WASdev / standards.jsr352.tck

Home of the TCK for the Java Batch standard (JSR 352, Batch Applications for the Java Platform). #JavaEE7
Apache License 2.0
1 stars 9 forks source link

Add test for Bug 5780 - Spec should clarify StepExecution values passed to Decider on a restart #33

Closed scottkurz closed 8 years ago

scottkurz commented 8 years ago

https://java.net/bugzilla/show_bug.cgi?id=5780

jvfullam commented 8 years ago

This issue is really asking that we check for complete TCK coverage of section 10.8.4 of the spec.

jvfullam commented 8 years ago

For reference, section 10.8.4 defines the following behavior for executing a restarted job (in my own words):

1) Perform Job XML Substitution 2) Set the job restart position to the correct execution element*:   a) If the previous execution was terminated by a element with a specified “restart” attribute,    use the step indicated by “restart”   b) Otherwise use the initial execution element 3) Execute (or don’t execute) the current execution element and transition to the next execution element:   a) If the current execution element has a BatchStatus of COMPLETED and    “allow-restart-if-complete” = false, then transition without re-executing   b) If the current execution element has a BatchStatus of COMPLETED and    “allow-restart-if-complete” = true, then re-execute and transition   c) If the current execution element has a BatchStatus of STOPPED or FAILED,    then re-execute and transition   d) If the current execution element is a Decider, then re-execute and transition   e) If the current execution element is a flow, then transition to the first element of the flow   f) If the current execution element is a split, then proceed in parallel for each flow in the split.

*execution element = a step, flow, split, or decider

jvfullam commented 8 years ago

To do this somewhat systematically, I'll address each of the different behaviors specified above in a series of comments.

jvfullam commented 8 years ago

1) This behavior is implicitly tested in almost every test where a job gets restarted, so there is no need to write a test for this specifically.

EDIT: A more thorough test for this is performed in BatchletRestartStateMachineTests.testTransitionElementOnAttrValuesWithRestartJobParamOverrides()

jvfullam commented 8 years ago

2a), 2b), 3a), and 3b) are all tested by BatchletRestartStateMachineTests.testAllowStartIfCompleteRestartExecution()

jvfullam commented 8 years ago

3c) is implicitly tested in JobAttributeRestartTests.testJobAttributeRestartableTrue(). A job with one step fails on first execution due to an exception being thrown in the step. This results in a Batch Status of FAILED for both the step and the job on the first execution. On second execution, the step that previously failed is re-executed, and the job proceeds to COMPLETE due to the new (COMPLETED) Batch Status of the re-executed step.

scottkurz commented 8 years ago

So I think what's left that's interesting to test is that the specific StepExecution passed to a Decider is the correct one, either the earlier execution's or the current's...depending on whether that step executed on THIS job execution.

scottkurz commented 8 years ago

We'll consider this resolved with commit 8a44e6c06f7f60c244ea63529c4fa99cb614c991