@Test
public void testBatchChunkOptionalProcessor() throws Exception {
JobOperator jobOperator = BatchRuntime.getJobOperator();
Long executionId = jobOperator.start("myJob", new Properties());
JobExecution jobExecution = jobOperator.getJobExecution(executionId);
jobExecution = BatchTestHelper.keepTestAlive(jobExecution);
List<StepExecution> stepExecutions = jobOperator.getStepExecutions(executionId);
for (StepExecution stepExecution : stepExecutions) {
if (stepExecution.getStepName().equals("myStep")) {
Map<Metric.MetricType, Long> metricsMap = BatchTestHelper.getMetricsMap(stepExecution.getMetrics());
(1)
assertEquals(10L, metricsMap.get(Metric.MetricType.READ_COUNT).longValue());
(2)
assertEquals(10L, metricsMap.get(Metric.MetricType.WRITE_COUNT).longValue());
(3)
assertEquals(10L / 3 + (10L % 3 > 0 ? 1 : 0),
metricsMap.get(Metric.MetricType.COMMIT_COUNT).longValue());
}
}
(4)
assertEquals(BatchStatus.COMPLETED, jobExecution.getBatchStatus());
}