add additional test case that shows a bug in the current
StaxEventItemWriter.shouldDeleteIfEmpty: when the writer restarts from a previous execution where the output file was deleted, this fails because FileUtils.setUpOutputFile expects the file to be there on restart
This commit is contained in:
@@ -431,6 +431,24 @@ public class StaxEventItemWriterTests {
|
|||||||
writer.update(executionContext);
|
writer.update(executionContext);
|
||||||
writer.close();
|
writer.close();
|
||||||
|
|
||||||
|
writer = createItemWriter();
|
||||||
|
writer.setShouldDeleteIfEmpty(true);
|
||||||
|
writer.open(executionContext);
|
||||||
|
writer.close();
|
||||||
|
String content = getOutputFileContent();
|
||||||
|
assertTrue("Wrong content: " + content, content.contains(TEST_STRING));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that the writer can restart if the previous execution deleted empty file.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testDeleteIfEmptyRestart() throws Exception {
|
||||||
|
writer.setShouldDeleteIfEmpty(true);
|
||||||
|
writer.open(executionContext);
|
||||||
|
writer.update(executionContext);
|
||||||
|
writer.close();
|
||||||
|
assertFalse(resource.getFile().exists());
|
||||||
writer = createItemWriter();
|
writer = createItemWriter();
|
||||||
writer.setShouldDeleteIfEmpty(true);
|
writer.setShouldDeleteIfEmpty(true);
|
||||||
writer.open(executionContext);
|
writer.open(executionContext);
|
||||||
|
|||||||
Reference in New Issue
Block a user