MAPREDUCE-7102. Fix TestJavaSerialization for Windows due a mismatch line separator. Contributed by Giovanni Matteo Fumarola.

This commit is contained in:
Inigo Goiri 2018-06-02 20:25:42 -07:00
parent 8f83b9abf9
commit a804b7c9d2

View File

@ -91,6 +91,8 @@ private void cleanAndCreateInput(FileSystem fs) throws IOException {
wr.write("b a\n"); wr.write("b a\n");
wr.close(); wr.close();
} }
@SuppressWarnings("deprecation")
@Test @Test
public void testMapReduceJob() throws Exception { public void testMapReduceJob() throws Exception {
@ -131,16 +133,17 @@ public void testMapReduceJob() throws Exception {
FileUtil.stat2Paths(fs.listStatus(OUTPUT_DIR, FileUtil.stat2Paths(fs.listStatus(OUTPUT_DIR,
new Utils.OutputFileUtils.OutputFilesFilter())); new Utils.OutputFileUtils.OutputFilesFilter()));
assertEquals(1, outputFiles.length); assertEquals(1, outputFiles.length);
InputStream is = fs.open(outputFiles[0]); try (InputStream is = fs.open(outputFiles[0])) {
String reduceOutput = org.apache.commons.io.IOUtils.toString(is); String reduceOutput = org.apache.commons.io.IOUtils.toString(is);
String[] lines = reduceOutput.split(System.getProperty("line.separator")); String[] lines = reduceOutput.split("\n");
assertEquals("Unexpected output; received output '" + reduceOutput + "'", assertEquals("Unexpected output; received output '" + reduceOutput + "'",
"a\t1", lines[0]); "a\t1", lines[0]);
assertEquals("Unexpected output; received output '" + reduceOutput + "'", assertEquals("Unexpected output; received output '" + reduceOutput + "'",
"b\t1", lines[1]); "b\t1", lines[1]);
assertEquals("Reduce output has extra lines; output is '" + reduceOutput assertEquals(
+ "'", 2, lines.length); "Reduce output has extra lines; output is '" + reduceOutput + "'", 2,
is.close(); lines.length);
}
} }
/** /**