diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanTests.java index 861aa4f7b..b23892084 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanTests.java @@ -363,6 +363,39 @@ public class FaultTolerantStepFactoryBeanTests { .getName())); } + /** + * Check items causing errors are skipped as expected. + */ + @Test + public void testSkipOverLimitOnReadWithListener() throws Exception { + reader.setFailures("1", "3", "5"); + writer.setFailures(); + + final List listenerCalls = new ArrayList(); + + factory.setListeners(new StepListener[] { new SkipListenerSupport() { + @Override + public void onSkipInRead(Throwable t) { + listenerCalls.add(t); + } + } }); + factory.setCommitInterval(2); + factory.setSkipLimit(2); + + Step step = (Step) factory.getObject(); + + step.execute(stepExecution); + + // 1,3 skipped inside a committed chunk. 5 tripped the skip + // limit but it was skipped in a chunk that rolled back, so + // it will re-appear on a restart and the listener is not called. + assertEquals(2, listenerCalls.size()); + assertEquals(2, stepExecution.getReadSkipCount()); + + assertEquals(BatchStatus.FAILED, stepExecution.getStatus()); + + } + /** * Check items causing errors are skipped as expected. */ @@ -767,8 +800,6 @@ public class FaultTolerantStepFactoryBeanTests { private static class ItemProcessListenerStub implements ItemProcessListener { - private boolean errorEncountered = false; - private boolean filterEncountered = false; public void afterProcess(T item, S result) { @@ -782,11 +813,6 @@ public class FaultTolerantStepFactoryBeanTests { } public void onProcessError(T item, Exception e) { - errorEncountered = true; - } - - public boolean isErrorEncountered() { - return errorEncountered; } public boolean isFilterEncountered() { diff --git a/spring-batch-infrastructure/.classpath b/spring-batch-infrastructure/.classpath index 617809812..96489ff1c 100644 --- a/spring-batch-infrastructure/.classpath +++ b/spring-batch-infrastructure/.classpath @@ -5,10 +5,6 @@ - - - - - + diff --git a/spring-batch-parent/pom.xml b/spring-batch-parent/pom.xml index e2e6001ae..2cf00c4f1 100644 --- a/spring-batch-parent/pom.xml +++ b/spring-batch-parent/pom.xml @@ -47,6 +47,16 @@ + + central + + + spring-sourceforge + Spring Sourceforge Repository + https://springframework.svn.sourceforge.net/svnroot/springframework/repos/repo + + + staging