Java Code Examples for org.springframework.batch.core.StepExecution#setId()
The following examples show how to use
org.springframework.batch.core.StepExecution#setId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JdbcSearchableStepExecutionDao.java From spring-cloud-dataflow with Apache License 2.0 | 6 votes |
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; }
Example 2
Source File: JobExecutionUtils.java From spring-cloud-dataflow with Apache License 2.0 | 6 votes |
private static void createSampleJob(JobRepository jobRepository, TaskBatchDao taskBatchDao, TaskExecutionDao taskExecutionDao, String jobName, int jobExecutionCount, BatchStatus status) { JobInstance instance = jobRepository.createJobInstance(jobName, new JobParameters()); TaskExecution taskExecution = taskExecutionDao.createTaskExecution(jobName, new Date(), new ArrayList<>(), null); JobExecution jobExecution; for (int i = 0; i < jobExecutionCount; i++) { jobExecution = jobRepository.createJobExecution(instance, new JobParameters(), null); StepExecution stepExecution = new StepExecution("foo", jobExecution, 1L); stepExecution.setId(null); jobRepository.add(stepExecution); taskBatchDao.saveRelationship(taskExecution, jobExecution); jobExecution.setStatus(status); jobExecution.setStartTime(new Date()); if (BatchStatus.STOPPED.equals(status)) { jobExecution.setEndTime(new Date()); } jobRepository.update(jobExecution); } }
Example 3
Source File: DefaultTaskJobServiceTests.java From spring-cloud-dataflow with Apache License 2.0 | 6 votes |
private void createSampleJob(JobRepository jobRepository, TaskBatchDao taskBatchDao, TaskExecutionDao taskExecutionDao, String jobName, int jobExecutionCount, BatchStatus status) { JobInstance instance = jobRepository.createJobInstance(jobName, new JobParameters()); TaskExecution taskExecution = taskExecutionDao.createTaskExecution(jobName, new Date(), new ArrayList<>(), null); JobExecution jobExecution; for (int i = 0; i < jobExecutionCount; i++) { jobExecution = jobRepository.createJobExecution(instance, this.jobParameters, null); StepExecution stepExecution = new StepExecution("foo", jobExecution, 1L); stepExecution.setId(null); jobRepository.add(stepExecution); taskBatchDao.saveRelationship(taskExecution, jobExecution); jobExecution.setStatus(status); jobExecution.setStartTime(new Date()); jobRepository.update(jobExecution); } }
Example 4
Source File: JobStepExecutionsDocumentation.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
private void createJobExecution(String name, BatchStatus status) { TaskExecution taskExecution = this.dao.createTaskExecution(name, new Date(), new ArrayList<>(), null); JobExecution jobExecution = this.jobRepository.createJobExecution(this.jobRepository.createJobInstance(name, new JobParameters()), new JobParameters(), null); StepExecution stepExecution = new StepExecution(name + "_STEP", jobExecution, jobExecution.getId()); stepExecution.setId(null); jobRepository.add(stepExecution); this.taskBatchDao.saveRelationship(taskExecution, jobExecution); jobExecution.setStatus(status); jobExecution.setStartTime(new Date()); this.jobRepository.update(jobExecution); }
Example 5
Source File: JobStepExecutionControllerTests.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
private void createStepExecution(String jobName, String... stepNames) { JobInstance instance = jobRepository.createJobInstance(jobName, new JobParameters()); JobExecution jobExecution = jobRepository.createJobExecution(instance, new JobParameters(), null); for (String stepName : stepNames) { StepExecution stepExecution = new StepExecution(stepName, jobExecution, 1L); stepExecution.setId(null); ExecutionContext context = new ExecutionContext(); context.put("stepval", stepName); stepExecution.setExecutionContext(context); jobRepository.add(stepExecution); } TaskExecution taskExecution = dao.createTaskExecution(jobName, new Date(), new ArrayList<String>(), null); taskBatchDao.saveRelationship(taskExecution, jobExecution); }
Example 6
Source File: StepExecutionEventTests.java From spring-cloud-task with Apache License 2.0 | 5 votes |
@Test public void testEquals() { StepExecution stepExecution = getBasicStepExecution(); stepExecution.setId(1L); StepExecutionEvent stepExecutionEvent = new StepExecutionEvent(stepExecution); assertThat(stepExecutionEvent.equals(getBasicStepExecution())).isFalse(); assertThat(stepExecutionEvent.equals(stepExecution)).isTrue(); }
Example 7
Source File: DeployerPartitionHandlerTests.java From spring-cloud-task with Apache License 2.0 | 5 votes |
private StepExecution getStepExecutionFinish(StepExecution stepExecutionStart, BatchStatus status) { StepExecution workerStepExecutionFinish = new StepExecution( stepExecutionStart.getStepName(), stepExecutionStart.getJobExecution()); workerStepExecutionFinish.setId(stepExecutionStart.getId()); workerStepExecutionFinish.setStatus(status); return workerStepExecutionFinish; }
Example 8
Source File: DeployerPartitionHandlerTests.java From spring-cloud-task with Apache License 2.0 | 4 votes |
private StepExecution getStepExecutionStart(JobExecution jobExecution, long id) { StepExecution workerStepExecutionStart = new StepExecution( "step1:partition" + (id - 3), jobExecution); workerStepExecutionStart.setId(id); return workerStepExecutionStart; }
Example 9
Source File: DeployerPartitionHandlerTests.java From spring-cloud-task with Apache License 2.0 | 3 votes |
private StepExecution createMasterStepExecution() { JobExecution jobExecution = new JobExecution(1L); jobExecution.setJobInstance(new JobInstance(2L, "partitionedJob")); StepExecution masterStepExecution = new StepExecution("masterStep", jobExecution); masterStepExecution.setId(3L); return masterStepExecution; }