RESOLVED - BATCH-638: ItemSkipPolicyItemHandler does not count items

moved item counting in SimpleItemHandler from write(..) into handle(..) method so that it isn't overriden in subclasses + tests
This commit is contained in:
robokaso
2008-06-10 08:11:57 +00:00
parent 8b79582be2
commit c5992c9833
3 changed files with 10 additions and 1 deletions

View File

@@ -109,6 +109,8 @@ public class ItemSkipPolicyItemHandlerTests extends TestCase {
catch (SkippableException e) {
// expected
}
assertEquals(3, contribution.getItemCount());
assertEquals(2, contribution.getSkipCount());
// No "4" because it was skipped on write
assertEquals(new Holder("5"), handler.read(contribution));
@@ -131,6 +133,7 @@ public class ItemSkipPolicyItemHandlerTests extends TestCase {
// was previously skipped
handler.handle(contribution);
assertEquals(null, handler.read(contribution));
assertEquals(3, contribution.getItemCount());
assertEquals(2, contribution.getSkipCount());
assertEquals(1, TransactionSynchronizationManager.getResourceMap().size());
@@ -182,6 +185,7 @@ public class ItemSkipPolicyItemHandlerTests extends TestCase {
catch (SkippableException e) {
// expected
}
assertEquals(3, contribution.getItemCount());
assertEquals(2, contribution.getSkipCount());
// No "4" because it was skipped on write, even though it is mutating
// its key
@@ -229,6 +233,7 @@ public class ItemSkipPolicyItemHandlerTests extends TestCase {
// re-thrown
handler.handle(contribution);
assertEquals(3, contribution.getItemCount());
assertEquals(2, contribution.getSkipCount());
// No "4" because it was skipped on write, even though it is mutating
// its key

View File

@@ -90,6 +90,8 @@ public class SkipLimitStepFactoryBeanTests extends TestCase {
List expectedOutput = Arrays.asList(StringUtils.commaDelimitedListToStringArray("1,3,5"));
assertEquals(expectedOutput, writer.written);
assertEquals(4, stepExecution.getItemCount().intValue());
}
@@ -110,6 +112,8 @@ public class SkipLimitStepFactoryBeanTests extends TestCase {
// no rollbacks
assertEquals(0, stepExecution.getRollbackCount().intValue());
assertEquals(4, stepExecution.getItemCount().intValue());
}