Skip to content

Commit

Permalink
Fixes jakartaee#49
Browse files Browse the repository at this point in the history
Signed-off-by: Scott Kurz <skurz@us.ibm.com>
  • Loading branch information
scottkurz committed Jun 2, 2022
1 parent 7d21205 commit 019a6d7
Showing 1 changed file with 19 additions and 5 deletions.
Expand Up @@ -36,12 +36,18 @@
@Named("CDIDependentScopedBatchletContexts")
public class DependentScopedBatchletContexts implements Batchlet {

//
// As mentioned in issue: https://github.com/eclipse-ee4j/batch-tck/issues/49
// the fields getting set via constructor/method parameter injection should not
// themselves be annotated with "@Inject".
//
@Inject JobContext jf;
@Inject JobContext jc;
@Inject JobContext jm;
JobContext jc;
JobContext jm;

@Inject StepContext sf;
@Inject StepContext sc;
@Inject StepContext sm;
StepContext sc;
StepContext sm;

@Inject
DependentScopedBatchletContexts(JobContext jc, StepContext sc) {
Expand All @@ -61,13 +67,21 @@ public void setMethod2(StepContext sm) {

@Override
public String process() throws Exception {

updateJobExitStatus(jf);
updateJobExitStatus(jc);
updateJobExitStatus(jm);
updateStepExitStatus(sf);
updateStepExitStatus(sc);
updateStepExitStatus(sm);
return "OK";

//
// Spec doesn't clearly specify precedence between exit status set into StepContext vs. exit status returned by Batchlet process().
// To avoid ambiguity, ensure the same value is used by both mechanisms.
//
// See: https://github.com/eclipse-ee4j/batch-tck/issues/49
//
return stepCtx.getExitStatus();
}

private void updateJobExitStatus(JobContext jobCtx) {
Expand Down

0 comments on commit 019a6d7

Please sign in to comment.