RESOLVED - issue BATCH-570: Job.getSteps() does not need to be exposed in the interface
Added getStepNames() to StepLocator.
This commit is contained in:
@@ -15,8 +15,14 @@
|
||||
*/
|
||||
package org.springframework.batch.core.job;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
|
||||
import org.junit.Test;
|
||||
@@ -174,6 +180,11 @@ public class AbstractJobTests {
|
||||
public Step getStep(String stepName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getStepNames() {
|
||||
return Collections.<String> emptySet();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -147,6 +147,14 @@ public class SimpleJobTests {
|
||||
assertEquals(1, jobExecution.getStepExecutions().size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link SimpleJob#setSteps(java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testGetSteps() {
|
||||
assertEquals(2, job.getStepNames().size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link SimpleJob#addStep(org.springframework.batch.core.Step)}.
|
||||
|
||||
@@ -67,6 +67,20 @@ public class FlowJobTests {
|
||||
jobExecution = jobRepository.createJobExecution("job", new JobParameters());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSteps() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "step2"));
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step2")), "end0"));
|
||||
transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.COMPLETED, "end0")));
|
||||
flow.setStateTransitions(transitions);
|
||||
flow.afterPropertiesSet();
|
||||
job.setFlow(flow);
|
||||
job.afterPropertiesSet();
|
||||
assertEquals(2, job.getStepNames().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTwoSteps() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
|
||||
Reference in New Issue
Block a user