@Override public StepExecution mapRow(ResultSet rs, int rowNum) throws SQLException { StepExecution stepExecution = new StepExecution(rs.getString(2), jobExecution, rs.getLong(1)); stepExecution.setStartTime(rs.getTimestamp(3)); stepExecution.setEndTime(rs.getTimestamp(4)); stepExecution.setStatus(BatchStatus.valueOf(rs.getString(5))); stepExecution.setCommitCount(rs.getInt(6)); stepExecution.setReadCount(rs.getInt(7)); stepExecution.setFilterCount(rs.getInt(8)); stepExecution.setWriteCount(rs.getInt(9)); stepExecution.setExitStatus(new ExitStatus(rs.getString(10), rs.getString(11))); stepExecution.setReadSkipCount(rs.getInt(12)); stepExecution.setWriteSkipCount(rs.getInt(13)); stepExecution.setProcessSkipCount(rs.getInt(14)); stepExecution.setRollbackCount(rs.getInt(15)); stepExecution.setLastUpdated(rs.getTimestamp(16)); stepExecution.setVersion(rs.getInt(17)); return stepExecution; }
/** * Test method for * {@link org.springframework.batch.core.StepExecution#getCommitCount()}. */ @Test public void testGetCommitCount() { execution.setCommitCount(123); assertEquals(123, execution.getCommitCount()); }
private void copy(final StepExecution source, final StepExecution target) { target.setVersion(source.getVersion()); target.setWriteCount(source.getWriteCount()); target.setFilterCount(source.getFilterCount()); target.setCommitCount(source.getCommitCount()); target.setExecutionContext(new ExecutionContext(source.getExecutionContext())); }
@Override public void aggregate(StepExecution result, Collection<StepExecution> executions) { Assert.notNull(result, "To aggregate into a result it must be non-null."); if (executions == null) { return; } for (StepExecution stepExecution : executions) { BatchStatus status = stepExecution.getStatus(); result.setStatus(BatchStatus.max(result.getStatus(), status)); result.setCommitCount(result.getCommitCount() + stepExecution.getCommitCount()); result.setRollbackCount(result.getRollbackCount() + stepExecution.getRollbackCount()); result.setReadCount(result.getReadCount() + stepExecution.getReadCount()); result.setReadSkipCount(result.getReadSkipCount() + stepExecution.getReadSkipCount()); result.setWriteCount(result.getWriteCount() + stepExecution.getWriteCount()); result.setWriteSkipCount(result.getWriteSkipCount() + stepExecution.getWriteSkipCount()); } } }
result.setFilterCount(result.getFilterCount() + stepExecution.getFilterCount()); result.setProcessSkipCount(result.getProcessSkipCount() + stepExecution.getProcessSkipCount()); result.setCommitCount(result.getCommitCount() + stepExecution.getCommitCount()); result.setRollbackCount(result.getRollbackCount() + stepExecution.getRollbackCount()); result.setReadCount(result.getReadCount() + stepExecution.getReadCount());
@Before public void setUp() throws Exception { JobExecution jobExecution = new JobExecution(1L, new JobParametersBuilder().addString("key", "value").toJobParameters()); stepExecution = new StepExecution("testStep", jobExecution); stepExecution.setId(5L); stepExecution.setStatus(BatchStatus.STARTED); stepExecution.setExitStatus(new ExitStatus("customExitStatus")); stepExecution.setCommitCount(1); stepExecution.setFilterCount(2); stepExecution.setProcessSkipCount(3); stepExecution.setReadCount(4); stepExecution.setReadSkipCount(5); stepExecution.setRollbackCount(6); stepExecution.setWriteCount(7); stepExecution.setWriteSkipCount(8); executionContext = new ExecutionContext(); stepExecution.setExecutionContext(executionContext); Properties properties = new Properties(); properties.put("key", "value"); stepContext = new JsrStepContext(stepExecution, properties); stepContext.setTransientUserData("This is my transient data"); }
@Before public void setUp() throws Exception { JobExecution jobExecution = new JobExecution(1L, new JobParametersBuilder().addString("key", "value").toJobParameters()); stepExecution = new StepExecution("testStep", jobExecution); stepExecution.setId(5L); stepExecution.setStatus(BatchStatus.STARTED); stepExecution.setExitStatus(new ExitStatus("customExitStatus")); stepExecution.setCommitCount(1); stepExecution.setFilterCount(2); stepExecution.setProcessSkipCount(3); stepExecution.setReadCount(4); stepExecution.setReadSkipCount(5); stepExecution.setRollbackCount(6); stepExecution.setWriteCount(7); stepExecution.setWriteSkipCount(8); stepExecution.setStartTime(new Date(0)); stepExecution.setEndTime(new Date(10000000)); stepExecution.getExecutionContext().put(executionContextUserSupport.getKey("batch_jsr_persistentUserData"), "persisted data"); jsrStepExecution = new JsrStepExecution(stepExecution); }
@Test public void testAggregateCountsSunnyDay() { stepExecution1.setCommitCount(1); stepExecution1.setFilterCount(2); stepExecution1.setProcessSkipCount(3); stepExecution1.setReadCount(4); stepExecution1.setReadSkipCount(5); stepExecution1.setRollbackCount(6); stepExecution1.setWriteCount(7); stepExecution1.setWriteSkipCount(8); stepExecution2.setCommitCount(11); stepExecution2.setFilterCount(12); stepExecution2.setProcessSkipCount(13); stepExecution2.setReadCount(14); stepExecution2.setReadSkipCount(15); stepExecution2.setRollbackCount(16); stepExecution2.setWriteCount(17); stepExecution2.setWriteSkipCount(18); aggregator.aggregate(result, Arrays.<StepExecution> asList(stepExecution1, stepExecution2)); assertEquals(12, result.getCommitCount()); assertEquals(14, result.getFilterCount()); assertEquals(16, result.getProcessSkipCount()); assertEquals(18, result.getReadCount()); assertEquals(20, result.getReadSkipCount()); assertEquals(22, result.getRollbackCount()); assertEquals(24, result.getWriteCount()); assertEquals(26, result.getWriteSkipCount()); } }
public StepExecution mapRow(ResultSet rs, int rowNum) throws SQLException { StepExecution stepExecution = new StepExecution(rs.getString(2), null); stepExecution.setId(rs.getLong(1)); stepExecution.setStartTime(rs.getTimestamp(3)); stepExecution.setEndTime(rs.getTimestamp(4)); stepExecution.setStatus(BatchStatus.valueOf(rs.getString(5))); stepExecution.setCommitCount(rs.getInt(6)); stepExecution.setReadCount(rs.getInt(7)); stepExecution.setFilterCount(rs.getInt(8)); stepExecution.setWriteCount(rs.getInt(9)); stepExecution.setExitStatus(new ExitStatus(rs.getString(10), rs.getString(11))); stepExecution.setReadSkipCount(rs.getInt(12)); stepExecution.setWriteSkipCount(rs.getInt(13)); stepExecution.setProcessSkipCount(rs.getInt(14)); stepExecution.setRollbackCount(rs.getInt(15)); stepExecution.setLastUpdated(rs.getTimestamp(16)); stepExecution.setVersion(rs.getInt(17)); return stepExecution; }
@Override public StepExecution mapRow(ResultSet rs, int rowNum) throws SQLException { StepExecution stepExecution = new StepExecution(rs.getString(2), jobExecution, rs.getLong(1)); stepExecution.setStartTime(rs.getTimestamp(3)); stepExecution.setEndTime(rs.getTimestamp(4)); stepExecution.setStatus(BatchStatus.valueOf(rs.getString(5))); stepExecution.setCommitCount(rs.getInt(6)); stepExecution.setReadCount(rs.getInt(7)); stepExecution.setFilterCount(rs.getInt(8)); stepExecution.setWriteCount(rs.getInt(9)); stepExecution.setExitStatus(new ExitStatus(rs.getString(10), rs.getString(11))); stepExecution.setReadSkipCount(rs.getInt(12)); stepExecution.setWriteSkipCount(rs.getInt(13)); stepExecution.setProcessSkipCount(rs.getInt(14)); stepExecution.setRollbackCount(rs.getInt(15)); stepExecution.setLastUpdated(rs.getTimestamp(16)); stepExecution.setVersion(rs.getInt(17)); return stepExecution; }
@Override public StepExecution mapRow(ResultSet rs, int rowNum) throws SQLException { StepExecution stepExecution = new StepExecution(rs.getString(2), jobExecution, rs.getLong(1)); stepExecution.setStartTime(rs.getTimestamp(3)); stepExecution.setEndTime(rs.getTimestamp(4)); stepExecution.setStatus(BatchStatus.valueOf(rs.getString(5))); stepExecution.setCommitCount(rs.getInt(6)); stepExecution.setReadCount(rs.getInt(7)); stepExecution.setFilterCount(rs.getInt(8)); stepExecution.setWriteCount(rs.getInt(9)); stepExecution.setExitStatus(new ExitStatus(rs.getString(10), rs.getString(11))); stepExecution.setReadSkipCount(rs.getInt(12)); stepExecution.setWriteSkipCount(rs.getInt(13)); stepExecution.setProcessSkipCount(rs.getInt(14)); stepExecution.setRollbackCount(rs.getInt(15)); stepExecution.setLastUpdated(rs.getTimestamp(16)); stepExecution.setVersion(rs.getInt(17)); return stepExecution; }
public StepExecution mapRow(ResultSet rs, int rowNum) throws SQLException { StepExecution stepExecution = new StepExecution(rs.getString(2), jobExecution, rs.getLong(1)); stepExecution.setStartTime(rs.getTimestamp(3)); stepExecution.setEndTime(rs.getTimestamp(4)); stepExecution.setStatus(BatchStatus.valueOf(rs.getString(5))); stepExecution.setCommitCount(rs.getInt(6)); stepExecution.setReadCount(rs.getInt(7)); stepExecution.setFilterCount(rs.getInt(8)); stepExecution.setWriteCount(rs.getInt(9)); stepExecution.setExitStatus(new ExitStatus(rs.getString(10), rs.getString(11))); stepExecution.setReadSkipCount(rs.getInt(12)); stepExecution.setWriteSkipCount(rs.getInt(13)); stepExecution.setProcessSkipCount(rs.getInt(14)); stepExecution.setRollbackCount(rs.getInt(15)); stepExecution.setLastUpdated(rs.getTimestamp(16)); stepExecution.setVersion(rs.getInt(17)); return stepExecution; }
@Override public StepExecution mapRow(ResultSet rs, int rowNum) throws SQLException { StepExecution stepExecution = new StepExecution(rs.getString(2), jobExecution, rs.getLong(1)); stepExecution.setStartTime(rs.getTimestamp(3)); stepExecution.setEndTime(rs.getTimestamp(4)); stepExecution.setStatus(BatchStatus.valueOf(rs.getString(5))); stepExecution.setCommitCount(rs.getInt(6)); stepExecution.setReadCount(rs.getInt(7)); stepExecution.setFilterCount(rs.getInt(8)); stepExecution.setWriteCount(rs.getInt(9)); stepExecution.setExitStatus(new ExitStatus(rs.getString(10), rs.getString(11))); stepExecution.setReadSkipCount(rs.getInt(12)); stepExecution.setWriteSkipCount(rs.getInt(13)); stepExecution.setProcessSkipCount(rs.getInt(14)); stepExecution.setRollbackCount(rs.getInt(15)); stepExecution.setLastUpdated(rs.getTimestamp(16)); stepExecution.setVersion(rs.getInt(17)); return stepExecution; }
@Override public StepExecution mapRow(ResultSet rs, int rowNum) throws SQLException { StepExecution stepExecution = new StepExecution(rs.getString(2), jobExecution, rs.getLong(1)); stepExecution.setStartTime(rs.getTimestamp(3)); stepExecution.setEndTime(rs.getTimestamp(4)); stepExecution.setStatus(BatchStatus.valueOf(rs.getString(5))); stepExecution.setCommitCount(rs.getInt(6)); stepExecution.setReadCount(rs.getInt(7)); stepExecution.setFilterCount(rs.getInt(8)); stepExecution.setWriteCount(rs.getInt(9)); stepExecution.setExitStatus(new ExitStatus(rs.getString(10), rs.getString(11))); stepExecution.setReadSkipCount(rs.getInt(12)); stepExecution.setWriteSkipCount(rs.getInt(13)); stepExecution.setProcessSkipCount(rs.getInt(14)); stepExecution.setRollbackCount(rs.getInt(15)); stepExecution.setLastUpdated(rs.getTimestamp(16)); stepExecution.setVersion(rs.getInt(17)); return stepExecution; }
public StepExecution mapRow(ResultSet rs, int rowNum) throws SQLException { StepExecution stepExecution = new StepExecution(rs.getString(2), null); stepExecution.setId(rs.getLong(1)); stepExecution.setStartTime(rs.getTimestamp(3)); stepExecution.setEndTime(rs.getTimestamp(4)); stepExecution.setStatus(BatchStatus.valueOf(rs.getString(5))); stepExecution.setCommitCount(rs.getInt(6)); stepExecution.setReadCount(rs.getInt(7)); stepExecution.setFilterCount(rs.getInt(8)); stepExecution.setWriteCount(rs.getInt(9)); stepExecution.setExitStatus(new ExitStatus(rs.getString(10), rs.getString(11))); stepExecution.setReadSkipCount(rs.getInt(12)); stepExecution.setWriteSkipCount(rs.getInt(13)); stepExecution.setProcessSkipCount(rs.getInt(14)); stepExecution.setRollbackCount(rs.getInt(15)); stepExecution.setLastUpdated(rs.getTimestamp(16)); stepExecution.setVersion(rs.getInt(17)); return stepExecution; }
private void copy(final StepExecution source, final StepExecution target) { target.setVersion(source.getVersion()); target.setWriteCount(source.getWriteCount()); target.setFilterCount(source.getFilterCount()); target.setCommitCount(source.getCommitCount()); target.setExecutionContext(new ExecutionContext(source.getExecutionContext())); }
private void copy(final StepExecution source, final StepExecution target) { target.setVersion(source.getVersion()); target.setWriteCount(source.getWriteCount()); target.setFilterCount(source.getFilterCount()); target.setCommitCount(source.getCommitCount()); target.setExecutionContext(new ExecutionContext(source.getExecutionContext())); }
private void copy(final StepExecution source, final StepExecution target) { target.setVersion(source.getVersion()); target.setWriteCount(source.getWriteCount()); target.setFilterCount(source.getFilterCount()); target.setCommitCount(source.getCommitCount()); target.setExecutionContext(new ExecutionContext(source.getExecutionContext())); }
@Override public void aggregate(StepExecution result, Collection<StepExecution> executions) { Assert.notNull(result, "To aggregate into a result it must be non-null."); if (executions == null) { return; } for (StepExecution stepExecution : executions) { BatchStatus status = stepExecution.getStatus(); result.setStatus(BatchStatus.max(result.getStatus(), status)); result.setCommitCount(result.getCommitCount() + stepExecution.getCommitCount()); result.setRollbackCount(result.getRollbackCount() + stepExecution.getRollbackCount()); result.setReadCount(result.getReadCount() + stepExecution.getReadCount()); result.setReadSkipCount(result.getReadSkipCount() + stepExecution.getReadSkipCount()); result.setWriteCount(result.getWriteCount() + stepExecution.getWriteCount()); result.setWriteSkipCount(result.getWriteSkipCount() + stepExecution.getWriteSkipCount()); } } }
@Override public void aggregate(StepExecution result, Collection<StepExecution> executions) { Assert.notNull(result, "To aggregate into a result it must be non-null."); if (executions == null) { return; } for (StepExecution stepExecution : executions) { BatchStatus status = stepExecution.getStatus(); result.setStatus(BatchStatus.max(result.getStatus(), status)); result.setCommitCount(result.getCommitCount() + stepExecution.getCommitCount()); result.setRollbackCount(result.getRollbackCount() + stepExecution.getRollbackCount()); result.setReadCount(result.getReadCount() + stepExecution.getReadCount()); result.setReadSkipCount(result.getReadSkipCount() + stepExecution.getReadSkipCount()); result.setWriteCount(result.getWriteCount() + stepExecution.getWriteCount()); result.setWriteSkipCount(result.getWriteSkipCount() + stepExecution.getWriteSkipCount()); } } }