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 5746 - @Inject @BatchProperty should work for job level properties #32

Closed scottkurz closed 8 years ago

scottkurz commented 8 years ago

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

jvfullam commented 8 years ago

After reading through the discussion for Bug 5746 as well as the updated JSR 352 spec, it sounds like the conclusion that was made was that @​Inject @BatchProperty should not work for job level properties.


From the spec:

Example JSL:

   ...                             ... **Example Java (MyBatchlet from JSL above):** // WON’T WORK! - There is no property 'x' in scope for this injection @​Inject @BatchProperty(name="x"); // WILL WORK – Gets value 'xVal' @​Inject @BatchProperty(name="y"); --- If my understanding is correct, then this issue should really be asking that a test be added that makes sure job level properties are **not** in scope of @​Inject @BatchProperty
scottkurz commented 8 years ago

Exactly.

I copied and pasted the bug description as it was originally opened, but you're right, unless you understand that it's a historical description you'd reach the exact opposite conclusion. Sorry about the confusion.

jvfullam commented 8 years ago

To add to the confusion, the following test already exists:


/*


As we've determined, the parent properties should be out of scope (no need to be overridden). Does this test serve some other purpose? If not, it does not seem like good practice to keep it as part of the TCK.

Either way, a test still needs to be added to make sure that parent properties are in fact out of scope... working on this now.

scottkurz commented 8 years ago

@jvfullam - Good point regarding testPropertyInnerScopePrecedence, I agree. I think a way to salvage this flawed test would be to change the property def to:

<job id="job_properties2" ...>
    ...
        <batchlet ref="myBatchletWithPropertiesImpl">
            <properties>
                           ...
                <property name="batchletProp" value="#{jobProperties['batchletProp']}" />

and check that the step-level prop value of STEP_OVERRIDE is used rather than the job level.

I imagine that this was the intent at one time but it was implemented wrongly.

scottkurz commented 8 years ago

Looks good, we can close this now.