Return-Path: X-Original-To: apmail-pig-commits-archive@www.apache.org Delivered-To: apmail-pig-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DCD36DE04 for ; Mon, 15 Oct 2012 23:24:48 +0000 (UTC) Received: (qmail 10063 invoked by uid 500); 15 Oct 2012 23:24:48 -0000 Delivered-To: apmail-pig-commits-archive@pig.apache.org Received: (qmail 10038 invoked by uid 500); 15 Oct 2012 23:24:48 -0000 Mailing-List: contact commits-help@pig.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pig.apache.org Delivered-To: mailing list commits@pig.apache.org Received: (qmail 10030 invoked by uid 99); 15 Oct 2012 23:24:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Oct 2012 23:24:48 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Oct 2012 23:24:47 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 74A7523889B8 for ; Mon, 15 Oct 2012 23:24:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1398575 - in /pig/branches/branch-0.11: CHANGES.txt test/org/apache/pig/test/Util.java Date: Mon, 15 Oct 2012 23:24:04 -0000 To: commits@pig.apache.org From: gates@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121015232404.74A7523889B8@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gates Date: Mon Oct 15 23:24:03 2012 New Revision: 1398575 URL: http://svn.apache.org/viewvc?rev=1398575&view=rev Log: PIG-2794 Pig test: add utils to simplify testing on Windows Modified: pig/branches/branch-0.11/CHANGES.txt pig/branches/branch-0.11/test/org/apache/pig/test/Util.java Modified: pig/branches/branch-0.11/CHANGES.txt URL: http://svn.apache.org/viewvc/pig/branches/branch-0.11/CHANGES.txt?rev=1398575&r1=1398574&r2=1398575&view=diff ============================================================================== --- pig/branches/branch-0.11/CHANGES.txt (original) +++ pig/branches/branch-0.11/CHANGES.txt Mon Oct 15 23:24:03 2012 @@ -25,6 +25,8 @@ PIG-1891 Enable StoreFunc to make intell IMPROVEMENTS +PIG-2794: Pig test: add utils to simplify testing on Windows (jgordon via gates) + PIG-2908: Fix unit tests to work with jdk7 (rohini via dvryaboy) PIG-2965: RANDOM should allow seed initialization for ease of testing (jcoveney) Modified: pig/branches/branch-0.11/test/org/apache/pig/test/Util.java URL: http://svn.apache.org/viewvc/pig/branches/branch-0.11/test/org/apache/pig/test/Util.java?rev=1398575&r1=1398574&r2=1398575&view=diff ============================================================================== --- pig/branches/branch-0.11/test/org/apache/pig/test/Util.java (original) +++ pig/branches/branch-0.11/test/org/apache/pig/test/Util.java Mon Oct 15 23:24:03 2012 @@ -112,8 +112,14 @@ public class Util { private static BagFactory mBagFactory = BagFactory.getInstance(); private static TupleFactory mTupleFactory = TupleFactory.getInstance(); + // Commonly-checked system state + // ================= + public static final boolean WINDOWS /* borrowed from Path.WINDOWS, Shell.WINDOWS */ + = System.getProperty("os.name").startsWith("Windows"); + // Helper Functions // ================= + static public Tuple loadFlatTuple(Tuple t, int[] input) throws ExecException { for (int i = 0; i < input.length; i++) { t.set(i, new Integer(input[i])); @@ -258,6 +264,19 @@ public class Util { } /** + * Helper to remove colons (if any exist) from paths to sanitize them for + * consumption by hdfs. + * + * @param origPath original path name + * @return String sanitized path with anything prior to : removed + * @throws IOException + */ + static public String removeColon(String origPath) + { + return origPath.replaceAll(":", ""); + } + + /** * Helper to create a temporary file with given input data for use in test cases. * * @param tmpFilenamePrefix file-name prefix