BATCH-1053: Moved getStep() logic from AbstractJobTests to Job implementations. Added getStep(String) to AbstractJob. Added getState(String) to Flow.
This commit is contained in:
@@ -25,6 +25,7 @@ import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobExecutionException;
|
||||
import org.springframework.batch.core.JobInterruptedException;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
@@ -170,6 +171,11 @@ public class AbstractJobTests {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Step getStep(String stepName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package org.springframework.batch.core.job.flow.support;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
@@ -203,6 +204,24 @@ public class SimpleFlowTests {
|
||||
assertEquals(FlowExecution.COMPLETED, execution.getStatus());
|
||||
assertEquals("step3", execution.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetStateExists() throws Exception {
|
||||
flow.setStateTransitions(Collections.singletonList(StateTransition.createEndStateTransition(new StubState(
|
||||
"step1"))));
|
||||
flow.afterPropertiesSet();
|
||||
State state = flow.getState("step1");
|
||||
assertNotNull(state);
|
||||
assertEquals("step1", state.getName());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testGetStateDoesNotExist() throws Exception {
|
||||
flow.setStateTransitions(Collections.singletonList(StateTransition.createEndStateTransition(new StubState(
|
||||
"step1"))));
|
||||
flow.afterPropertiesSet();
|
||||
flow.getState("bar");
|
||||
}
|
||||
|
||||
private List<StateTransition> collect(StateTransition s1, StateTransition s2) {
|
||||
List<StateTransition> list = new ArrayList<StateTransition>();
|
||||
|
||||
Reference in New Issue
Block a user