[Index]

check


Checks a value for certain criteria. This job is analogous to the Unix 'test' command.

This Job will COMPLETE if all checks pass. It will be INCOMPLETE if any fail.

The conditional values are converted into the type of the value before the checks are made. Thus in the example below if the row count property is an integer, the 1000 is converted into an integer for the comparison.

If the value property is not provided the job will be INCOMPLETE unless the null property is set to true.


Property Summary

eq The value must be equal to this.
ge The value must be greater than or equal to this.
gt The value must be greater than this.
le The value must be less than or equals to this.
lt The value must be less than this.
name The name of this job.
ne The value must be not equal to this.
null Must the value be null for the check to pass.
result The result of the check.
value The value to check.
z The value to check.

Example Summary

Example 1 Example text comparisons.
Example 2 Numeric checks.
Example 3 Check a Property Exists.

Property Detail

eq

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

The value must be equal to this.

ge

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

The value must be greater than or equal to this.

gt

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

The value must be greater than this.

le

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

The value must be less than or equals to this.

lt

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

The value must be less than this.

name

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

The name of this job. Can be any text.

ne

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

The value must be not equal to this.

null

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo, if this does exist the check value null will fail.

Must the value be null for the check to pass. True the value must be null. False it must not be null. If this property is true other checks will cause an exception because they require the value property has a value.

result

AccessREAD_ONLY

The result of the check.

value

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo, but the check value is not null will fail.

The value to check.

z

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo, but the check value is not null will fail.

The value to check.


Examples

Example 1

Example text comparisons. All these checks COMPLETE.

<oddjob>
  <job>
    <sequential>
      <jobs>
        <check value="apple" eq="apple"/>
        <check value="apple" ne="orange"/>
        <check value="apple" lt="orange"/>
        <check value="apple" le="apple"/>
        <check value="orange" gt="apple"/>
        <check value="orange" ge="orange"/>
        <check value="anything" null="false"/>
        <check value="${missing}" null="true"/>
        <check value="pear" z="false"/>
        <check value="" z="true"/>
      </jobs>
    </sequential>
  </job>
</oddjob>
Checks that are INCOMPLETE.
<oddjob>
  <job>
    <!-- needed to force predictable state transitions for the unit test, 
      so Oddjob goes to INCOMPLETE not ACTIVE first. -->
    <state:join xmlns:state="http://rgordon.co.uk/oddjob/state">
      <job>
        <parallel id="all-checks">
          <jobs>
            <check value="apple" eq="orange"/>
            <check value="apple" ne="apple"/>
            <check value="orange" lt="apple"/>
            <check value="orange" le="apple"/>
            <check value="apple" gt="orange"/>
            <check value="apple" ge="orange"/>
            <check value="anything" null="true"/>
            <check value="${missing}" null="false"/>
          </jobs>
        </parallel>
      </job>
    </state:join>
  </job>
</oddjob>

Example 2

Numeric checks. Note that the value must be the numeric value. The operand attributes values are converted to the type of the value before the comparison. If the value was "999" and the lt was "${sequence.current}" this check would not be COMPLETE because the text "999" is greater than "1000".

<oddjob>
  <job>
    <sequential>
      <jobs>
        <sequence id="sequence" from="1000"/>
        <check value="${sequence.current}" eq="1000"/>
        <check value="${sequence.current}" ne="999"/>
        <check value="${sequence.current}" lt="1001"/>
        <check value="${sequence.current}" le="1000"/>
        <check value="${sequence.current}" gt="999"/>
        <check value="${sequence.current}" ge="1000"/>
      </jobs>
    </sequential>
  </job>
</oddjob>

Example 3

Check a Property Exists. The second check will be INCOMPLETE because the property doesn't exist.

<oddjob>
  <job>
    <sequential>
      <jobs>
        <properties>
          <values>
            <value key="property.that.exists" value="some-value"/>
          </values>
        </properties>
        <check name="Check Something that Exists" value="${property.that.exists}" id="should-complete"/>
        <check name="Check Something that doesn't Exist" value="${property.doesnt.exist}" id="should-incomplete"/>
      </jobs>
    </sequential>
  </job>
</oddjob>


(c) Rob Gordon 2005 - 2014