step.setJobParametersExtractor(jobParametersExtractor);
ExecutionContext executionContext = stepExecution.getExecutionContext(); executionContext.put("foo", "bar"); step.setJobParametersExtractor(jobParametersExtractor);
@Test public void testStoppedChild() throws Exception { DefaultJobParametersExtractor jobParametersExtractor = new DefaultJobParametersExtractor(); jobParametersExtractor.setKeys(new String[] {"foo"}); ExecutionContext executionContext = stepExecution.getExecutionContext(); executionContext.put("foo", "bar"); step.setJobParametersExtractor(jobParametersExtractor); step.setJob(new JobSupport("child") { @Override public void execute(JobExecution execution) { assertEquals(1, execution.getJobParameters().getParameters().size()); execution.setStatus(BatchStatus.STOPPED); execution.setEndTime(new Date()); jobRepository.update(execution); } @Override public boolean isRestartable() { return true; } }); step.afterPropertiesSet(); step.execute(stepExecution); JobExecution jobExecution = stepExecution.getJobExecution(); jobExecution.setEndTime(new Date()); jobRepository.update(jobExecution); assertEquals(BatchStatus.STOPPED, stepExecution.getStatus()); }
@SuppressWarnings("serial") private void configureJobStep(JobStep ts) throws Exception { configureAbstractStep(ts); if (job != null) { ts.setJob(job); } if (jobParametersExtractor != null) { ts.setJobParametersExtractor(jobParametersExtractor); } if (jobLauncher == null) { SimpleJobLauncher jobLauncher = new SimpleJobLauncher(); jobLauncher.setJobRepository(jobRepository); jobLauncher.afterPropertiesSet(); this.jobLauncher = jobLauncher; } ts.setJobLauncher(jobLauncher); }
step.setJobParametersExtractor(jobParametersExtractor);
step.setJobParametersExtractor(jobParametersExtractor);
step.setJobParametersExtractor(jobParametersExtractor);