BatchStartAndRecoveryServiceImpl implements BatchStartAndRecoveryService, JobExplorer { @Override public JobExecution refresh(JobExecution jobExecution) throws NoSuchJobExecutionException { Assert.notNull(jobExecution); return findExecutionById(jobExecution.getId()); } BatchStartAndRecoveryServiceImpl(JobInstanceDao jobInstanceDao,
                                            JobExecutionDao jobExecutionDao,
                                            StepExecutionDao stepExecutionDao,
                                            ExecutionContextDao executionContextDao
    ); @Override List<JobExecution> stopAllRunningJobs(); @Override List<JobExecution> markInconsistentJobsAsFailed(); Set<Long> getRunningExecutions(String jobName); @Override List<JobExecution> restartAllFailedJobs(); @Override List<JobExecution> restartAllStoppedJobs(); List<JobExecution> restartJobs(String jobName, BatchStatus status); @Override BatchStatus getStatus(Long jobInstanceId); List<JobInstance> getJobInstances(String jobName, int start, int count); @Override JobExecution start(String jobName, JobParameters jobParameters); JobExecution start(String jobName, JobParameters jobParameters, boolean newInstance); @Override JobExecution restart(Long jobInstanceId); JobExecution restart(String jobName, JobParameters parameters); JobExecution findExecutionById(Long jobExecutionId); @Override JobExecution startNewInstance(String jobName, JobParameters jobParameters); @Override JobExecution stop(Long jobExecutionId); @Override List<String> getJobNames(); @Override List<JobInstance> findJobInstancesByJobName(String jobName, int start, int count); @Override int getJobInstanceCount(String jobName); @Override JobExecution refresh(JobExecution jobExecution); @Override JobExecution abandon(Long jobExecutionId); @Override JobExecution getJobExecution(Long executionId); @Override StepExecution getStepExecution(Long jobExecutionId, Long stepExecutionId); @Override JobInstance getJobInstance(Long instanceId); @Override List<JobExecution> getJobExecutions(JobInstance jobInstance); @Override Set<JobExecution> findRunningJobExecutions(String jobName); void updateJobExecution(JobExecution jobExecution); void updateStepExecution(StepExecution stepExecution); void setJobRegistry(JobRegistry jobRegistry); void setJobLauncher(JobLauncher jobLauncher); void setJobInstanceDao(JobInstanceDao jobInstanceDao); void setJobExecutionDao(JobExecutionDao jobExecutionDao); void setStepExecutionDao(StepExecutionDao stepExecutionDao); void setExecutionContextDao(ExecutionContextDao executionContextDao);  }
@Test public void testRefresh() throws Exception { expectFindExecutionById(); replayAll(); JobExecution jobExecution = service.refresh(MetaDataInstanceFactory.createJobExecution(EXECUTION_ID)); Assert.assertEquals(this.jobExecution, jobExecution); }
@Test(expected = NoSuchJobExecutionException.class) public void testRefreshNoSuchJobExecutionException() throws Exception { service.refresh(jobExecution); }