Add failed transition if none exists when next attribute is used.

Fixes TCK test testStartLimitVariation1
This commit is contained in:
Chris Schaefer
2014-01-12 13:45:15 -05:00
parent b0c9af5e8e
commit ea7a704299
4 changed files with 82 additions and 0 deletions

View File

@@ -64,6 +64,32 @@ public class FlowParserTests {
assertTrue("step1".equals(failedStep.getStepName()));
}
@Test
public void testStepGetsFailedTransitionWhenNextAttributePresent() throws Exception {
JobExecution jobExecution = runJob("FlowParserTestsStepGetsFailedTransitionWhenNextAttributePresent", new Properties(), 10000l);
assertEquals(ExitStatus.FAILED.getExitCode(), jobExecution.getExitStatus());
JobOperator jobOperator = BatchRuntime.getJobOperator();
List<StepExecution> stepExecutions = jobOperator.getStepExecutions(jobExecution.getExecutionId());
assertEquals(1, stepExecutions.size());
StepExecution failedStep = stepExecutions.get(0);
assertTrue("failedExitStatusStep".equals(failedStep.getStepName()));
assertTrue("FAILED".equals(failedStep.getExitStatus()));
}
@Test
public void testStepNoOverrideWhenNextAndFailedTransitionElementExists() throws Exception {
JobExecution jobExecution = runJob("FlowParserTestsStepNoOverrideWhenNextAndFailedTransitionElementExists", new Properties(), 10000l);
assertEquals(ExitStatus.FAILED.getExitCode(), jobExecution.getExitStatus());
JobOperator jobOperator = BatchRuntime.getJobOperator();
List<StepExecution> stepExecutions = jobOperator.getStepExecutions(jobExecution.getExecutionId());
assertEquals(1, stepExecutions.size());
StepExecution failedStep = stepExecutions.get(0);
assertTrue("failedExitStatusStepDontOverride".equals(failedStep.getStepName()));
assertTrue("CUSTOM_FAIL".equals(failedStep.getExitStatus()));
}
public static class TestBatchlet extends AbstractBatchlet {
private static int CNT;
@@ -79,6 +105,14 @@ public class FlowParserTests {
CNT++;
}
if("failedExitStatusStep".equals(stepContext.getStepName())) {
exitCode = "FAILED";
}
if("failedExitStatusStepDontOverride".equals(stepContext.getStepName())) {
exitCode = "CUSTOM_FAIL";
}
return exitCode;
}
}