You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2012/08/02 02:50:03 UTC

svn commit: r1368330 - in /hive/trunk: common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java ql/src/test/org/apache/hadoop/hive/ql/exec/TestExecDriver.java ql/src/test/org/apache/hadoop/hive/ql/history/TestHiveHistory.java

Author: hashutosh
Date: Thu Aug  2 00:50:02 2012
New Revision: 1368330

URL: http://svn.apache.org/viewvc?rev=1368330&view=rev
Log:
HIVE-3319 : Fix the TestHiveHistory, TestHiveConf, TestExecDriver unit tests on Windows by fixing the path related issues. (Kanna Karanam via Ashutosh Chauhan)

Modified:
    hive/trunk/common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java
    hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/exec/TestExecDriver.java
    hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/history/TestHiveHistory.java

Modified: hive/trunk/common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java
URL: http://svn.apache.org/viewvc/hive/trunk/common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java?rev=1368330&r1=1368329&r2=1368330&view=diff
==============================================================================
--- hive/trunk/common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java (original)
+++ hive/trunk/common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java Thu Aug  2 00:50:02 2012
@@ -20,6 +20,7 @@ package org.apache.hadoop.hive.conf;
 import junit.framework.TestCase;
 
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
 
 
@@ -32,7 +33,8 @@ import org.apache.hadoop.hive.conf.HiveC
 public class TestHiveConf extends TestCase {
 
   public void testHiveSitePath() throws Exception {
-    String expectedPath = System.getProperty("test.build.resources") + "/hive-site.xml";
+    String expectedPath =
+        new Path(System.getProperty("test.build.resources") + "/hive-site.xml").toUri().getPath();
     assertEquals(expectedPath, new HiveConf().getHiveSitePath());
   }
 

Modified: hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/exec/TestExecDriver.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/exec/TestExecDriver.java?rev=1368330&r1=1368329&r2=1368330&view=diff
==============================================================================
--- hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/exec/TestExecDriver.java (original)
+++ hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/exec/TestExecDriver.java Thu Aug  2 00:50:02 2012
@@ -48,7 +48,6 @@ import org.apache.hadoop.hive.ql.plan.Pl
 import org.apache.hadoop.hive.ql.plan.ReduceSinkDesc;
 import org.apache.hadoop.hive.ql.plan.ScriptDesc;
 import org.apache.hadoop.hive.ql.plan.SelectDesc;
-import org.apache.hadoop.hive.ql.session.SessionState;
 import org.apache.hadoop.hive.serde.Constants;
 import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
 import org.apache.hadoop.mapred.TextInputFormat;
@@ -97,8 +96,7 @@ public class TestExecDriver extends Test
       int i = 0;
       Path[] hadoopDataFile = new Path[2];
       String[] testFiles = {"kv1.txt", "kv2.txt"};
-      String testFileDir = "file://"
-          + conf.get("test.data.files").replace('\\', '/').replace("c:", "");
+      String testFileDir = new Path(conf.get("test.data.files")).toUri().getPath();
       for (String oneFile : testFiles) {
         Path localDataFile = new Path(testFileDir, oneFile);
         hadoopDataFile[i] = new Path(tmppath, oneFile);
@@ -202,7 +200,7 @@ public class TestExecDriver extends Test
     Operator<FileSinkDesc> op3 = OperatorFactory.get(new FileSinkDesc(tmpdir
         + "mapplan2.out", Utilities.defaultTd, false));
 
-    Operator<ScriptDesc> op2 = OperatorFactory.get(new ScriptDesc("/bin/cat",
+    Operator<ScriptDesc> op2 = OperatorFactory.get(new ScriptDesc("cat",
         PlanUtils.getDefaultTableDesc("" + Utilities.tabCode, "key,value"),
         TextRecordWriter.class, PlanUtils.getDefaultTableDesc(""
         + Utilities.tabCode, "key,value"), TextRecordReader.class,
@@ -330,7 +328,7 @@ public class TestExecDriver extends Test
         Utilities.makeList(getStringColumn("tkey"),
         getStringColumn("tvalue")), outputColumns, false, -1, 1, -1));
 
-    Operator<ScriptDesc> op0 = OperatorFactory.get(new ScriptDesc("/bin/cat",
+    Operator<ScriptDesc> op0 = OperatorFactory.get(new ScriptDesc("cat",
         PlanUtils.getDefaultTableDesc("" + Utilities.tabCode, "key,value"),
         TextRecordWriter.class, PlanUtils.getDefaultTableDesc(""
         + Utilities.tabCode, "tkey,tvalue"), TextRecordReader.class,
@@ -406,7 +404,7 @@ public class TestExecDriver extends Test
         getStringColumn("tvalue")), outputColumns, false, -1, 1, -1));
 
     Operator<ScriptDesc> op0 = OperatorFactory.get(new ScriptDesc(
-        "\'/bin/cat\'", PlanUtils.getDefaultTableDesc("" + Utilities.tabCode,
+        "\'cat\'", PlanUtils.getDefaultTableDesc("" + Utilities.tabCode,
         "tkey,tvalue"), TextRecordWriter.class, PlanUtils
         .getDefaultTableDesc("" + Utilities.tabCode, "tkey,tvalue"),
         TextRecordReader.class,

Modified: hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/history/TestHiveHistory.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/history/TestHiveHistory.java?rev=1368330&r1=1368329&r2=1368330&view=diff
==============================================================================
--- hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/history/TestHiveHistory.java (original)
+++ hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/history/TestHiveHistory.java Thu Aug  2 00:50:02 2012
@@ -86,8 +86,7 @@ public class TestHiveHistory extends Tes
       int i = 0;
       Path[] hadoopDataFile = new Path[2];
       String[] testFiles = {"kv1.txt", "kv2.txt"};
-      String testFileDir = "file://"
-          + conf.get("test.data.files").replace('\\', '/').replace("c:", "");
+      String testFileDir = new Path(conf.get("test.data.files")).toUri().getPath();
       for (String oneFile : testFiles) {
         Path localDataFile = new Path(testFileDir, oneFile);
         hadoopDataFile[i] = new Path(tmppath, oneFile);