IN PROGRESS - issue BATCH-476: samples cleanup

http://jira.springframework.org/browse/BATCH-476

infinite loop replaced with finite but long enough (so that the loop doesn't run forever when test fails)
This commit is contained in:
robokaso
2008-03-18 14:07:39 +00:00
parent 1c6aa3570b
commit 94b5615245
3 changed files with 4 additions and 39 deletions

View File

@@ -1,38 +0,0 @@
package org.springframework.batch.sample.item.reader;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.MarkFailedException;
import org.springframework.batch.item.ResetFailedException;
/**
* Creates items infinitely - useful for testing job interruption by user.
*/
public class InfiniteItemReader implements ItemReader {
private static final Log logger = LogFactory.getLog(InfiniteItemReader.class);
private long counter = 0;
public Object read() throws Exception {
Object item = "item" + counter;
Thread.sleep(10);
logger.info("read item: " + item);
return item;
}
public void mark() throws MarkFailedException {
// no-op
}
public void reset() throws ResetFailedException {
// no-op
}
}

View File

@@ -25,7 +25,9 @@
</bean-->
<bean id="infiniteStep" parent="simpleStep">
<property name="itemReader">
<bean id="reader" class="org.springframework.batch.sample.item.reader.InfiniteItemReader" />
<bean id="reader" class="org.springframework.batch.sample.item.reader.GeneratingItemReader">
<property name="limit" value="1000000" />
</bean>
</property>
<property name="itemWriter">
<bean id="writer" class="org.springframework.batch.sample.item.writer.DummyItemWriter" />

View File

@@ -50,6 +50,7 @@ public class GracefulShutdownFunctionalTests extends AbstractBatchLauncherTests
}
assertFalse("Timed out waiting for job to end.", jobExecution.isRunning());
assertEquals(BatchStatus.STOPPED, jobExecution.getStatus());
}