pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1398576 - in /pig/branches/branch-0.10: CHANGES.txt test/org/apache/pig/test/Util.java
Date Mon, 15 Oct 2012 23:24:44 GMT
Author: gates
Date: Mon Oct 15 23:24:44 2012
New Revision: 1398576

URL: http://svn.apache.org/viewvc?rev=1398576&view=rev
Log:
PIG-2794 Pig test: add utils to simplify testing on Windows

Modified:
    pig/branches/branch-0.10/CHANGES.txt
    pig/branches/branch-0.10/test/org/apache/pig/test/Util.java

Modified: pig/branches/branch-0.10/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.10/CHANGES.txt?rev=1398576&r1=1398575&r2=1398576&view=diff
==============================================================================
--- pig/branches/branch-0.10/CHANGES.txt (original)
+++ pig/branches/branch-0.10/CHANGES.txt Mon Oct 15 23:24:44 2012
@@ -24,6 +24,8 @@ INCOMPATIBLE CHANGES
 
 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-2852: Update documentation regarding parallel local mode execution (cheolsoo via jcoveney)

Modified: pig/branches/branch-0.10/test/org/apache/pig/test/Util.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.10/test/org/apache/pig/test/Util.java?rev=1398576&r1=1398575&r2=1398576&view=diff
==============================================================================
--- pig/branches/branch-0.10/test/org/apache/pig/test/Util.java (original)
+++ pig/branches/branch-0.10/test/org/apache/pig/test/Util.java Mon Oct 15 23:24:44 2012
@@ -117,8 +117,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]));
@@ -263,6 +269,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



Mime
View raw message