@OperationDefault annotation

This annotation exists primarily to make test code more readable.  It can be attached to a class or method, and any attributes specified will be used in matching operations as default values - I.E., if the attributes are not defined in the operation.

Usage

The sole purpose of @OperationDefault is to assist the processor in determining the arguments to apply to an operation.  Given the following declaration:

@OperationDefault(
    operation: 'stage',
    defaultValue: {
      a: 'e'
    }
)
class test
{}

Every stage operation would have a: 'e' implicitly added to it's arguments.  This can be verified in the log.

Given this test declaration within the class above:

@OperationDefault(
    operation: 'stage',
     defaultValue: {
      a: 'b'
     }
)
@OperationDefault(
    operation: 'stage',
     defaultValue: {
       b: 'c'
     }
)@Test
testSome()
{
	stage();
	stage(b: 'd');
}
 
@Test
testOther()
{
	stage();
}

The first stage operation in testSome would have arguments {a:'b', b: 'c'}, whereas the second would have {a: 'b', b: 'd'}.  The stage operation in testOther would simply have {a: 'e'} - inherited from the class.

Matching

There are two additional, rather confusing attributes named matchWhen and doNotMatchWhen.  These are both arrays of strings, both may be supplied.  For matchWhen, in the context of the above example, you could supply ['c'] as the match list, and the default would only be applied to an operation named 'stage', but also containing an attribute 'c'.  doNotMatchWhen works the opposite of matchWhen - it excludes what it matches.  The purpose of matching is to select only of a set of polymorphic operations.  E.G., you want to match file assertions (matchWhen: ['source-file']) but not database assertions (doNotMatchWhen: 'source-table']).

Some examples have been documented in the etlunit_samples.  See stage_operation_default.etlunit in database_samples.