OPEN - issue BATCH-771: Refactor Listeners for chunk changes

Move write listener into step handler
This commit is contained in:
dsyer
2008-08-26 11:35:59 +00:00
parent 207e882e37
commit a0ea47ce63
6 changed files with 72 additions and 163 deletions

View File

@@ -56,7 +56,7 @@ import org.springframework.core.task.SimpleAsyncTaskExecutor;
*/
public class SimpleStepFactoryBeanTests {
private List<Exception> recovered = new ArrayList<Exception>();
private List<Exception> listened = new ArrayList<Exception>();
private SimpleJobRepository repository = new SimpleJobRepository(new MapJobInstanceDao(), new MapJobExecutionDao(),
new MapStepExecutionDao(), new MapExecutionContextDao());
@@ -136,11 +136,11 @@ public class SimpleStepFactoryBeanTests {
});
factory.setListeners(new StepListener[] { new ItemListenerSupport() {
public void onReadError(Exception ex) {
recovered.add(ex);
listened.add(ex);
}
public void onWriteError(Exception ex, Object item) {
recovered.add(ex);
listened.add(ex);
}
} });
@@ -161,7 +161,7 @@ public class SimpleStepFactoryBeanTests {
assertEquals(0, written.size());
// provider should be at second item
assertEquals("bar", reader.read());
assertEquals(1, recovered.size());
assertEquals(1, listened.size());
}
@Test

View File

@@ -314,11 +314,10 @@ public class StatefulRetryStepFactoryBeanTests {
assertEquals(2, stepExecution.getSkipCount());
assertEquals(2, stepExecution.getWriteSkipCount());
System.err.println(processed);
// [a, b, c, d, e, f, null]
assertEquals(7, provided.size());
// [a, b, a, b, b, b, b, b, b, c, a, c, d, d, d, d, d, e, f, e, f]
assertEquals(21, processed.size());
// [a, b, c, a, b, c, b, b, b, b, b, c, a, c, d, e, f, d, d, d, d, e, f, e, f]
assertEquals(25, processed.size());
// [b, d]
assertEquals(2, recovered.size());
}
@@ -511,11 +510,10 @@ public class StatefulRetryStepFactoryBeanTests {
// We added a bogus cache so no items are actually skipped
// because they aren't recognised as eligible
assertEquals(0, stepExecution.getSkipCount());
// only one item processed but three (the commit interval) were provided
// [0, 1, 2]
assertEquals(3, provided.size());
// [0]
assertEquals(1, processed.size());
// [0, 1, 2]
assertEquals(3, processed.size());
// []
assertEquals(0, recovered.size());
}