RESOLVED - issue BATCH-945: Add support for step and job name in late binding

Also added some null checks in SimpleJobExplorer
This commit is contained in:
dsyer
2008-12-10 12:03:09 +00:00
parent f2f14a90e6
commit fe5828d3e5
13 changed files with 122 additions and 6 deletions

View File

@@ -72,6 +72,14 @@ public class SimpleJobExplorerTests extends TestCase {
verify(jobExecutionDao, jobInstanceDao, stepExecutionDao);
}
@Test
public void testMissingGetJobExecution() throws Exception {
expect(jobExecutionDao.getJobExecution(123L)).andReturn(null);
replay(jobExecutionDao);
assertNull(jobExplorer.getJobExecution(123L));
verify(jobExecutionDao);
}
@Test
public void testGetStepExecution() throws Exception {
expect(jobExecutionDao.getJobExecution(123L)).andReturn(jobExecution);

View File

@@ -41,7 +41,7 @@ public class StepContextTests {
private List<String> list = new ArrayList<String>();
private StepExecution stepExecution = new StepExecution("step", new JobExecution(0L), 1L);
private StepExecution stepExecution = new StepExecution("step", new JobExecution(new JobInstance(2L, null, "job"), 0L), 1L);
private StepContext context = new StepContext(stepExecution);
@@ -133,6 +133,16 @@ public class StepContextTests {
assertTrue(list.contains("spam"));
}
@Test
public void testStepName() throws Exception {
assertEquals("step", context.getStepName());
}
@Test
public void testJobName() throws Exception {
assertEquals("job", context.getJobName());
}
@Test
public void testStepExecutionContext() throws Exception {
ExecutionContext executionContext = stepExecution.getExecutionContext();
@@ -140,6 +150,12 @@ public class StepContextTests {
assertEquals("bar", context.getStepExecutionContext().get("foo"));
}
@Test
public void testSystemProperties() throws Exception {
System.setProperty("foo", "bar");
assertEquals("bar", context.getSystemProperties().getProperty("foo"));
}
@Test
public void testJobExecutionContext() throws Exception {
ExecutionContext executionContext = stepExecution.getJobExecution().getExecutionContext();