Browse Source

MAPREDUCE-7105. Fix TestNativeCollectorOnlyHandler.testOnCall on Windows because of the path format. Contributed by Giovanni Matteo Fumarola.

Inigo Goiri 7 years ago
parent
commit
dad1bb868f

+ 8 - 3
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/test/java/org/apache/hadoop/mapred/nativetask/handlers/TestNativeCollectorOnlyHandler.java

@@ -17,6 +17,7 @@
  */
 package org.apache.hadoop.mapred.nativetask.handlers;
 
+import java.io.File;
 import java.io.IOException;
 
 import org.apache.hadoop.conf.Configuration;
@@ -33,6 +34,7 @@ import org.apache.hadoop.mapred.nativetask.buffer.InputBuffer;
 import org.apache.hadoop.mapred.nativetask.testutil.TestConstants;
 import org.apache.hadoop.mapred.nativetask.util.OutputUtil;
 import org.apache.hadoop.mapred.nativetask.util.ReadWriteBuffer;
+import org.apache.hadoop.util.StringUtils;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -110,9 +112,12 @@ public class TestNativeCollectorOnlyHandler {
     }
     Assert.assertTrue("exception thrown", thrown);
 
-    final String expectedOutputPath = LOCAL_DIR + "/output/file.out";
-    final String expectedOutputIndexPath = LOCAL_DIR + "/output/file.out.index";
-    final String expectedSpillPath = LOCAL_DIR + "/output/spill0.out";
+    final String expectedOutputPath = StringUtils.join(File.separator,
+        new String[] {LOCAL_DIR, "output", "file.out"});
+    final String expectedOutputIndexPath = StringUtils.join(File.separator,
+        new String[] {LOCAL_DIR, "output", "file.out.index"});
+    final String expectedSpillPath = StringUtils.join(File.separator,
+        new String[] {LOCAL_DIR, "output", "spill0.out"});
 
     final String outputPath = handler.onCall(
       NativeCollectorOnlyHandler.GET_OUTPUT_PATH, null).readString();