private void testMultiFileFailedWriteHelper( EvenOddHDFSExactlyOnceWriter writer, ProcessingMode mode) { File meta = new File(testMeta.getDir()); writer.setFilePath(meta.getAbsolutePath()); writer.setup(new DummyContext(0, mode)); writer.beginWindow(0); writer.input.put(0); writer.input.put(1); writer.input.put(2); writer.input.put(3); writer.endWindow(); CheckPointWriter checkPointWriter = checkpoint(writer); writer.beginWindow(1); writer.input.put(4); writer.input.put(5); writer.endWindow(); writer.teardown(); restoreCheckPoint(checkPointWriter, writer); writer.setup(new DummyContext(0, mode)); writer.beginWindow(2); writer.input.put(6); writer.input.put(7); writer.input.put(8); writer.input.put(9); writer.endWindow(); }
private void testMultiRollingFileFailedWriteOverwriteHelper( EvenOddHDFSExactlyOnceWriter writer, ProcessingMode mode) { File meta = new File(testMeta.getDir()); writer.setFilePath(meta.getAbsolutePath()); writer.setMaxLength(4); writer.setup(new DummyContext(0, mode)); writer.beginWindow(0); writer.input.put(0); writer.input.put(1); writer.endWindow(); CheckPointWriter checkPointWriter = checkpoint(writer); writer.beginWindow(1); writer.input.put(2); writer.input.put(3); writer.teardown(); restoreCheckPoint(checkPointWriter, writer); writer.setup(new DummyContext(0, mode)); writer.beginWindow(1); writer.input.put(4); writer.input.put(5); writer.endWindow(); writer.beginWindow(2); writer.input.put(6); writer.input.put(7); writer.input.put(8); writer.input.put(9); writer.input.put(6); writer.input.put(7); writer.endWindow(); // Even file String evenFileName = testMeta.getDir() + File.separator + EVEN_FILE; String correctContents = "0\n" + "4\n" + "6\n"; checkOutput(0, evenFileName, correctContents); correctContents = "8\n" + "6\n"; checkOutput(1, evenFileName, correctContents); // Odd file String oddFileName = testMeta.getDir() + File.separator + ODD_FILE; correctContents = "1\n" + "5\n" + "7\n"; checkOutput(0, oddFileName, correctContents); correctContents = "9\n" + "7\n"; checkOutput(1, oddFileName, correctContents); }