/** * Public setter for the {@link JobRepository} that is needed to manage the * state of the batch meta domain (jobs, steps, executions) during the life * of a job. * * @param jobRepository repository to use during the job execution */ public void setJobRepository(JobRepository jobRepository) { this.jobRepository = jobRepository; stepHandler = new SimpleStepHandler(jobRepository); }
/** * Test method for {@link SimpleStepHandler#afterPropertiesSet()}. */ @Test(expected = IllegalStateException.class) public void testAfterPropertiesSet() throws Exception { SimpleStepHandler stepHandler = new SimpleStepHandler(); stepHandler.afterPropertiesSet(); }
if (stepExecutionPartOfExistingJobExecution(execution, lastStepExecution)) { if (shouldStart(lastStepExecution, execution, step)) {
@Override public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); Assert.state(jobExplorer != null, "A JobExplorer must be provided"); }
/** * Test method for * {@link SimpleStepHandler#handleStep(org.springframework.batch.core.Step, org.springframework.batch.core.JobExecution)} * . */ @Test public void testHandleStep() throws Exception { StepExecution stepExecution = stepHandler.handleStep(new StubStep("step"), jobExecution); assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); }
if (stepExecutionPartOfExistingJobExecution(execution, lastStepExecution)) { if (shouldStart(lastStepExecution, jobInstance, step)) {
@Override public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); Assert.state(jobExplorer != null, "A JobExplorer must be provided"); }
/** * @see AbstractJob#doExecute(JobExecution) */ @Override protected void doExecute(final JobExecution execution) throws JobExecutionException { try { JobFlowExecutor executor = new JobFlowExecutor(getJobRepository(), new SimpleStepHandler(getJobRepository()), execution); executor.updateJobExecutionStatus(flow.start(executor).getStatus()); } catch (FlowExecutionException e) { if (e.getCause() instanceof JobExecutionException) { throw (JobExecutionException) e.getCause(); } throw new JobExecutionException("Flow execution ended unexpectedly", e); } }
if (stepExecutionPartOfExistingJobExecution(execution, lastStepExecution)) { if (shouldStart(lastStepExecution, execution, step)) {
@Before public void setUp() throws Exception { MapJobRepositoryFactoryBean jobRepositoryFactoryBean = new MapJobRepositoryFactoryBean(); jobRepository = jobRepositoryFactoryBean.getObject(); jobExecution = jobRepository.createJobExecution("job", new JobParameters()); stepHandler = new SimpleStepHandler(jobRepository); stepHandler.afterPropertiesSet(); }
@Override public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); Assert.state(jobExplorer != null, "A JobExplorer must be provided"); }
@Test public void test() throws Exception { FlowBuilder<Flow> builder = new FlowBuilder<>("flow"); JobRepository jobRepository = new MapJobRepositoryFactoryBean().getObject(); JobExecution execution = jobRepository.createJobExecution("foo", new JobParameters()); builder.start(new StepSupport("step") { @Override public void execute(StepExecution stepExecution) throws JobInterruptedException, UnexpectedJobExecutionException { } }).end().start(new JobFlowExecutor(jobRepository, new SimpleStepHandler(jobRepository), execution)); }
if (stepExecutionPartOfExistingJobExecution(execution, lastStepExecution)) { if (shouldStart(lastStepExecution, execution, step)) {
@Override public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); Assert.state(jobExplorer != null, "A JobExplorer must be provided"); }
/** * Delegate to the flow provided for the execution of the step. * * @see AbstractStep#doExecute(StepExecution) */ @Override protected void doExecute(StepExecution stepExecution) throws Exception { try { stepExecution.getExecutionContext().put(STEP_TYPE_KEY, this.getClass().getName()); StepHandler stepHandler = new SimpleStepHandler(getJobRepository(), stepExecution.getExecutionContext()); FlowExecutor executor = new JobFlowExecutor(getJobRepository(), stepHandler, stepExecution.getJobExecution()); executor.updateJobExecutionStatus(flow.start(executor).getStatus()); stepExecution.upgradeStatus(executor.getJobExecution().getStatus()); stepExecution.setExitStatus(executor.getJobExecution().getExitStatus()); } catch (FlowExecutionException e) { if (e.getCause() instanceof JobExecutionException) { throw (JobExecutionException) e.getCause(); } throw new JobExecutionException("Flow execution ended unexpectedly", e); } }
if (stepExecutionPartOfExistingJobExecution(execution, lastStepExecution)) { if (shouldStart(lastStepExecution, execution, step)) {
/** * Public setter for the {@link JobRepository} that is needed to manage the * state of the batch meta domain (jobs, steps, executions) during the life * of a job. * * @param jobRepository repository to use during the job execution */ public void setJobRepository(JobRepository jobRepository) { this.jobRepository = jobRepository; stepHandler = new SimpleStepHandler(jobRepository); }
/** * Public setter for the {@link JobRepository} that is needed to manage the * state of the batch meta domain (jobs, steps, executions) during the life * of a job. * * @param jobRepository */ public void setJobRepository(JobRepository jobRepository) { this.jobRepository = jobRepository; stepHandler = new SimpleStepHandler(jobRepository); }
/** * Public setter for the {@link JobRepository} that is needed to manage the * state of the batch meta domain (jobs, steps, executions) during the life * of a job. * * @param jobRepository */ public void setJobRepository(JobRepository jobRepository) { this.jobRepository = jobRepository; stepHandler = new SimpleStepHandler(jobRepository); }
/** * Public setter for the {@link JobRepository} that is needed to manage the * state of the batch meta domain (jobs, steps, executions) during the life * of a job. * * @param jobRepository repository to use during the job execution */ public void setJobRepository(JobRepository jobRepository) { this.jobRepository = jobRepository; stepHandler = new SimpleStepHandler(jobRepository); }