BATCH-1881: added forceSync flag to file writers
This commit is contained in:
@@ -202,6 +202,17 @@ public class FlatFileItemWriterTests {
|
||||
assertEquals(TEST_STRING, lineFromFile);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testForcedWriteString() throws Exception {
|
||||
writer.setForceSync(true);
|
||||
writer.open(executionContext);
|
||||
writer.write(Collections.singletonList(TEST_STRING));
|
||||
writer.close();
|
||||
String lineFromFile = readLine();
|
||||
|
||||
assertEquals(TEST_STRING, lineFromFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Regular usage of <code>write(String)</code> method
|
||||
*
|
||||
|
||||
@@ -90,6 +90,16 @@ public class StaxEventItemWriterTests {
|
||||
assertTrue("Wrong content: " + content, content.contains(TEST_STRING));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteAndForceFlush() throws Exception {
|
||||
writer.setForceSync(true);
|
||||
writer.open(executionContext);
|
||||
writer.write(items);
|
||||
writer.close();
|
||||
String content = getOutputFileContent();
|
||||
assertTrue("Wrong content: " + content, content.contains(TEST_STRING));
|
||||
}
|
||||
|
||||
/**
|
||||
* Restart scenario - content is appended to the output file after restart.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user