RESOLVED - issue BATCH-1256: Processor is called (and committed) many times for the same items if Writer skips
http://jira.springframework.org/browse/BATCH-1256
This commit is contained in:
@@ -317,6 +317,7 @@ public class FaultTolerantStepFactoryBeanRetryTests {
|
||||
// [a, b, c, d, e, f, null]
|
||||
assertEquals(7, provided.size());
|
||||
// [a, b, b, b, b, b, c, d, d, d, d, d, e, f]
|
||||
System.err.println(processed);
|
||||
assertEquals(14, processed.size());
|
||||
// [b, d]
|
||||
assertEquals(2, recovered.size());
|
||||
|
||||
@@ -313,11 +313,11 @@ public class FaultTolerantStepFactoryBeanRollbackTests {
|
||||
step.execute(stepExecution);
|
||||
assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus());
|
||||
|
||||
// TODO: Fix this with BATCH-1259?
|
||||
assertEquals("[1, 2, 1, 3, 4, 1, 3, 5]", processor.getProcessed().toString());
|
||||
assertEquals("[1, 3, 5]", processor.getCommitted().toString());
|
||||
assertEquals("[1, 3, 5]", writer.getWritten().toString());
|
||||
assertEquals("[1, 3, 5]", writer.getCommitted().toString());
|
||||
// TODO: Fix this with BATCH-1259?
|
||||
assertEquals("[1, 2, 1, 3, 4, 1, 3, 5]", processor.getProcessed().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -347,12 +347,12 @@ public class FaultTolerantStepFactoryBeanRollbackTests {
|
||||
step.execute(stepExecution);
|
||||
assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus());
|
||||
|
||||
// TODO: Fix this with BATCH-1256
|
||||
assertEquals("[1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 2, 3, 4, 5, 3, 4, 5, 4, 5, 5]", processor.getProcessed()
|
||||
.toString());
|
||||
assertEquals("[1, 2, 3, 4, 5, 2, 3, 4, 5, 3, 4, 5, 5]", processor.getCommitted().toString());
|
||||
assertEquals("[1, 2, 3, 4, 1, 2, 3, 4, 5]", writer.getWritten().toString());
|
||||
assertEquals("[1, 2, 3, 5]", processor.getCommitted().toString());
|
||||
assertEquals("[1, 2, 3, 5]", writer.getCommitted().toString());
|
||||
assertEquals("[1, 2, 3, 4, 1, 2, 3, 4, 5]", writer.getWritten().toString());
|
||||
// TODO: Fix this with BATCH-1259?
|
||||
assertEquals("[1, 2, 3, 4, 5, 1, 2, 3, 4, 5]", processor.getProcessed()
|
||||
.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -365,12 +365,12 @@ public class FaultTolerantStepFactoryBeanRollbackTests {
|
||||
step.execute(stepExecution);
|
||||
assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus());
|
||||
|
||||
// TODO: Fix this with BATCH-1256
|
||||
assertEquals("[1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 2, 3, 4, 5, 3, 4, 5, 4, 5, 5]", processor.getProcessed()
|
||||
.toString());
|
||||
assertEquals("[1, 2, 3, 4, 5, 3, 4, 5, 5]", processor.getCommitted().toString());
|
||||
assertEquals("[1, 2, 1, 2, 3, 4, 5]", writer.getWritten().toString());
|
||||
assertEquals("[1, 3, 5]", writer.getCommitted().toString());
|
||||
assertEquals("[1, 2, 1, 2, 3, 4, 5]", writer.getWritten().toString());
|
||||
assertEquals("[1, 3, 5]", processor.getCommitted().toString());
|
||||
// TODO: Fix this with BATCH-1259?
|
||||
assertEquals("[1, 2, 3, 4, 5, 1, 2, 3, 4, 5]", processor.getProcessed()
|
||||
.toString());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -540,10 +540,9 @@ public class FaultTolerantStepFactoryBeanTests {
|
||||
assertEquals(1, stepExecution.getSkipCount());
|
||||
assertEquals(2, stepExecution.getRollbackCount());
|
||||
|
||||
// 1,2,3,4,3,4,4 - two re-processing attempts until the item is
|
||||
// identified and finally skipped on the third attempt
|
||||
assertEquals(7, processor.getProcessed().size());
|
||||
assertEquals("[1, 2, 3, 4, 3, 4, 4]", processor.getProcessed().toString());
|
||||
// 1,2,3,4,3,4 - two re-processing attempts until the item is
|
||||
// identified and finally skipped on the second attempt
|
||||
assertEquals("[1, 2, 3, 4, 3, 4]", processor.getProcessed().toString());
|
||||
assertStepExecutionsAreEqual(stepExecution, repository.getLastStepExecution(jobExecution.getJobInstance(), step
|
||||
.getName()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user