step.setStepExecutionAggregator(aggregator);
@Test public void testStepAggregator() throws Exception { step.setStepExecutionAggregator(new DefaultStepExecutionAggregator() { @Override public void aggregate(StepExecution result, Collection<StepExecution> executions) { super.aggregate(result, executions); result.getExecutionContext().put("aggregated", true); } }); step.setStepExecutionSplitter(new SimpleStepExecutionSplitter(jobRepository, true, step.getName(), new SimplePartitioner())); step.setPartitionHandler(new PartitionHandler() { @Override public Collection<StepExecution> handle(StepExecutionSplitter stepSplitter, StepExecution stepExecution) throws Exception { return Arrays.asList(stepExecution); } }); step.afterPropertiesSet(); JobExecution jobExecution = jobRepository.createJobExecution("vanillaJob", new JobParameters()); StepExecution stepExecution = jobExecution.createStepExecution("foo"); jobRepository.add(stepExecution); step.execute(stepExecution); assertEquals(true, stepExecution.getExecutionContext().get("aggregated")); }
step.setStepExecutionAggregator(aggregator);