writeFile(expected, infilename);
Pipeline memPipeline = MemPipeline.getInstance();
PCollection<String> memPColl = memPipeline.readTextFile(infilename);
Target memTarget = new TextFileTarget(memOutFilename);
memPipeline.write(memPColl, memTarget, WriteMode.OVERWRITE);
memPipeline.run();
File outDir = new File(memOutFilename);
File actualMemOut = null;
for (File f : outDir.listFiles()) {
String name = f.getName();
if (name.contains("out") && name.endsWith(".txt")) {
actualMemOut = f;
break;
}
}
String actualMemText = Files.readFirstLine(actualMemOut, Charsets.UTF_8);
Pipeline mrPipeline = new MRPipeline(getClass());
PCollection<String> mrPColl = mrPipeline.readTextFile(infilename);
Target mrTarget = new TextFileTarget(mrOutFilename);
mrPipeline.write(mrPColl, mrTarget, WriteMode.OVERWRITE);
mrPipeline.run();
String actualMrText = Files.readFirstLine(new File(mrOutFilename + "/part-m-00000"), Charsets.UTF_8);
Assert.assertEquals("MR file mismatch", expected, actualMrText);