@Test public void testMultiListenerSimpleStep() throws Exception { bootstrap(MultiListenerTestConfiguration.class); JobExecution execution = jobLauncher.run(job, new JobParameters()); assertEquals(BatchStatus.FAILED, execution.getStatus()); assertEquals(1, callChecker.beforeStepCalled); assertEquals(1, callChecker.beforeChunkCalled); assertEquals(1, callChecker.beforeWriteCalled); assertEquals(0, callChecker.skipInWriteCalled); }
/** * The times the beforeChunkCalled occurs are: * - Before chunk 1 (item1, item2) * - Before the re-attempt of item1 (scanning) * - Before the re-attempt of item2 (scanning) * - Before the checking that scanning is complete * - Before chunk 2 (item3, item4) * - Before chunk 3 (null) * * @throws Exception */ @Test public void testMultiListenerFaultTolerantStep() throws Exception { bootstrap(MultiListenerFaultTolerantTestConfiguration.class); JobExecution execution = jobLauncher.run(job, new JobParameters()); assertEquals(BatchStatus.COMPLETED, execution.getStatus()); assertEquals(1, callChecker.beforeStepCalled); assertEquals(6, callChecker.beforeChunkCalled); assertEquals(2, callChecker.beforeWriteCalled); assertEquals(1, callChecker.skipInWriteCalled); }