RESOLVED - issue BATCH-1421: Add method to get all job names to JobExplorer

This commit is contained in:
dsyer
2009-11-04 12:21:04 +00:00
parent 15fbb6f9ac
commit f2e96f4f71
4 changed files with 29 additions and 0 deletions

View File

@@ -80,4 +80,12 @@ public interface JobExplorer {
*/
Set<JobExecution> findRunningJobExecutions(String jobName);
/**
* Query the repository for all unique {@link JobInstance} names (sorted
* alphabetically).
*
* @return the set of job names that have been executed
*/
List<String> getJobNames();
}

View File

@@ -159,6 +159,13 @@ public class SimpleJobExplorer implements JobExplorer {
int count) {
return jobInstanceDao.getJobInstances(jobName, start, count);
}
/* (non-Javadoc)
* @see org.springframework.batch.core.explore.JobExplorer#getJobNames()
*/
public List<String> getJobNames() {
return jobInstanceDao.getJobNames();
}
/*
* Find all dependencies for a JobExecution, including JobInstance (which

View File

@@ -174,4 +174,14 @@ public class SimpleJobExplorerTests extends TestCase {
verify(jobExecutionDao, jobInstanceDao, stepExecutionDao);
}
@Test
public void testGetJobNames() throws Exception {
jobInstanceDao.getJobNames();
EasyMock.expectLastCall().andReturn(
Collections.singletonList("foo"));
replay(jobExecutionDao, jobInstanceDao, stepExecutionDao);
jobExplorer.getJobNames();
verify(jobExecutionDao, jobInstanceDao, stepExecutionDao);
}
}

View File

@@ -298,6 +298,10 @@ public class CommandLineJobRunnerTests {
public StepExecution getStepExecution(Long jobExecutionId, Long stepExecutionId) {
throw new UnsupportedOperationException();
}
public List<String> getJobNames() {
throw new UnsupportedOperationException();
}
}