示例#1
0
 @Before
 public void setUp() throws Exception {
   step.setName("step");
   MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();
   jobRepository = factory.getObject();
   step.setJobRepository(jobRepository);
   JobExecution jobExecution = jobRepository.createJobExecution("job", new JobParameters());
   stepExecution = jobExecution.createStepExecution("step");
   jobRepository.add(stepExecution);
   SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
   jobLauncher.setJobRepository(jobRepository);
   jobLauncher.afterPropertiesSet();
   step.setJobLauncher(jobLauncher);
 }
 @Override
 protected ExecutionContextDao createExecutionContextDao() throws Exception {
   return repositoryFactory.getExecutionContextDao();
 }
 @Override
 protected StepExecutionDao createStepExecutionDao() throws Exception {
   return repositoryFactory.getStepExecutionDao();
 }
 @Override
 protected JobInstanceDao createJobInstanceDao() throws Exception {
   return repositoryFactory.getJobInstanceDao();
 }
 @Override
 protected JobExecutionDao createJobExecutionDao() throws Exception {
   return repositoryFactory.getJobExecutionDao();
 }
 /**
  * @throws Exception
  * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
  */
 @Override
 public void afterPropertiesSet() throws Exception {
   Assert.state(repositoryFactory != null, "A MapJobRepositoryFactoryBean must be provided");
   repositoryFactory.afterPropertiesSet();
 }