RESOLVED - issue BATCH-560: StepExecutionResourceProxy can not be used with FlatFileItemWriter

This commit is contained in:
dsyer
2008-04-07 07:21:18 +00:00
parent 7dcda664c3
commit afb9508e4f
3 changed files with 28 additions and 6 deletions

View File

@@ -261,6 +261,22 @@ public class FlatFileItemWriterTests extends TestCase {
assertEquals(3, executionContext.getLong(ClassUtils.getShortName(FlatFileItemWriter.class) + ".written"));
}
public void testOpenWithNonexistentFile() throws Exception {
writer = new FlatFileItemWriter();
writer.setFieldSetCreator(new PassThroughFieldSetMapper());
FileSystemResource file = new FileSystemResource("no-such-file.foo");
file.getFile().setReadOnly();
writer.setResource(file);
writer.afterPropertiesSet();
try {
writer.open(executionContext);
fail("Expected IllegalStateException");
} catch (IllegalStateException e) {
String message = e.getMessage();
assertTrue("Message does not contain 'writable': "+message, message.indexOf("writable")>=0);
}
}
public void testAfterPropertiesSetChecksMandatory() throws Exception {
writer = new FlatFileItemWriter();