RESOLVED - issue BATCH-516: default to commitInterval=1 in SimpleStepFactoryBean

http://jira.springframework.org/browse/BATCH-516
This commit is contained in:
robokaso
2008-03-26 13:58:04 +00:00
parent 6becaa5939
commit ca2db2c31a
2 changed files with 40 additions and 9 deletions

View File

@@ -225,5 +225,34 @@ public class SimpleStepFactoryBeanTests extends TestCase {
assertEquals(expectedListenerCallCount, chunkListener.afterCount);
assertEquals(expectedListenerCallCount, chunkListener.beforeCount);
}
/**
* Commit interval specified is not allowed to be zero or negative.
* @throws Exception
*/
public void testCommitIntervalMustBeGreaterThanZero() throws Exception {
SimpleStepFactoryBean factory = getStepFactory("foo");
// nothing wrong here
factory.getObject();
// but exception excpected after setting commit interval to value <= 0
factory.setCommitInterval(0);
try {
factory.getObject();
fail();
}
catch (IllegalArgumentException e) {
// expected
}
factory.setCommitInterval(-1);
try {
factory.getObject();
fail();
}
catch (IllegalArgumentException e) {
// expected
}
}
}