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
1 changed files with 13 additions and 10 deletions

View File

@ -91,6 +91,8 @@ public class TestJavaSerialization {
wr.write("b a\n");
wr.close();
}
@SuppressWarnings("deprecation")
@Test
public void testMapReduceJob() throws Exception {
@ -131,16 +133,17 @@ public class TestJavaSerialization {
FileUtil.stat2Paths(fs.listStatus(OUTPUT_DIR,
new Utils.OutputFileUtils.OutputFilesFilter()));
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[] lines = reduceOutput.split(System.getProperty("line.separator"));
String[] lines = reduceOutput.split("\n");
assertEquals("Unexpected output; received output '" + reduceOutput + "'",
"a\t1", lines[0]);
assertEquals("Unexpected output; received output '" + reduceOutput + "'",
"b\t1", lines[1]);
assertEquals("Reduce output has extra lines; output is '" + reduceOutput
+ "'", 2, lines.length);
is.close();
assertEquals(
"Reduce output has extra lines; output is '" + reduceOutput + "'", 2,
lines.length);
}
}
/**