Expose additional method in JobExplorer and ensure that StepExecution is hydrated correctly from database

This commit is contained in:
dsyer
2008-10-28 16:21:53 +00:00
parent bad8491fa4
commit 97719a9514
6 changed files with 41 additions and 5 deletions

View File

@@ -72,6 +72,15 @@ public class SimpleJobExplorerTests extends TestCase {
verify(jobExecutionDao, jobInstanceDao, stepExecutionDao);
}
@Test
public void testGetStepExecution() throws Exception {
expect(jobExecutionDao.getJobExecution(123L)).andReturn(jobExecution);
expect(stepExecutionDao.getStepExecution(jobExecution, "foo")).andReturn(null);
replay(jobExecutionDao, stepExecutionDao);
jobExplorer.getStepExecution(123L,"foo");
verify(jobExecutionDao, stepExecutionDao);
}
@Test
public void testFindRunningJobExecutions() throws Exception {
expect(jobExecutionDao.findRunningJobExecutions("job")).andReturn(Collections.singleton(jobExecution));

View File

@@ -88,7 +88,7 @@ public abstract class AbstractStepExecutionDaoTests extends AbstractTransactiona
}
@Transactional @Test
public void testSaveAndFindExecution() {
public void testSaveAndGetExecution() {
stepExecution.setStatus(BatchStatus.STARTED);
stepExecution.setReadSkipCount(7);
@@ -104,12 +104,13 @@ public abstract class AbstractStepExecutionDaoTests extends AbstractTransactiona
StepExecution retrieved = dao.getStepExecution(jobExecution, step.getName());
assertStepExecutionsAreEqual(stepExecution, retrieved);
assertNotNull(retrieved.getVersion());
assertNull(dao.getStepExecution(jobExecution, "not-existing step"));
}
@Transactional @Test
public void testSaveAndGetExecution() {
public void testSaveAndFindExecution() {
stepExecution.setStatus(BatchStatus.STARTED);
stepExecution.setReadSkipCount(7);