You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by ga...@apache.org on 2012/10/16 01:24:04 UTC
svn commit: r1398575 - in /pig/branches/branch-0.11: CHANGES.txt
test/org/apache/pig/test/Util.java
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