This commit is contained in:
dsyer
2009-11-26 18:06:16 +00:00
parent f5e515242a
commit 4b2f90158d
3 changed files with 44 additions and 12 deletions

View File

@@ -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<Throwable> listenerCalls = new ArrayList<Throwable>();
factory.setListeners(new StepListener[] { new SkipListenerSupport<String, String>() {
@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<T, S> implements ItemProcessListener<T, S> {
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() {

View File

@@ -5,10 +5,6 @@
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@@ -47,6 +47,16 @@
</repository>
</repositories>
</profile>
<profile>
<id>central</id>
<distributionManagement>
<repository>
<id>spring-sourceforge</id>
<name>Spring Sourceforge Repository</name>
<url>https://springframework.svn.sourceforge.net/svnroot/springframework/repos/repo</url>
</repository>
</distributionManagement>
</profile>
<profile>
<id>staging</id>
<distributionManagement>