A class which provides the ability to interpret XTS service test commands. Each of the XTS service test classes imnplementing a specific test extends this class so that it can drive the test from a command script. Each of the XTS service test endpoints employs an instance of this class to process comands which are dispatched to it either from one of the test class instances or recursively via another intermediate service. The interpreter executes a list of Strings which represents one or more commands each with its own sequence of associated arguments. It returns a list of strings indicating the outcome of processing the commands. It throws an exception if command processing fails. A simple command comprises a list of Strings headed by one of a fixed set of command keywords followed by zero or more argument strings. Command arguments are either simple string literals or bound variable references. A variable reference is an alphanumeric variable name bracketed by '{' and '}' characters. The interpreter resolves this to a string value by looking up the variable in its binding list and uses this vale as the argument for th command. It is possible to seed the binding list with default values before processing a sequence of commands. Alternatively, bindings may be added during execution of block commands. A block commands comprises a list of Strings headed by the keyword "block" and terminated by the keyword "endblock". Intervening elements of the list comprise simple commands separated either by "next" keywords or by bind commands terminated with a "next" keyword. A bind commands is a list of strings headed by keyword "bind" and succeeded by a sequence of bind operations. A bind operation operates on the results returned from the last executed command and comes in one of three formats:
- set var idx
- check idx value/{var}"
- output idx
A set operation binds a variable to the nth result returned in the results list of the previously executed command. A check operation checks that the nth result returned in the results list of the previously executed command has a specific value, throwing an exception if not. An output operation appends the nth result returned in the results list of the previously executed command to the results list for the block command. The command syntax is defined as follows:
command ::= simple_command | block_command ==> resultList block_command ::= "block" command (block_trailing)* "endblock" block_trailing ::= (bindings_command)? "next" command bindings_command ::= "bindings" (binding_operation)+ "next" binding_operation ::= "bind" | "check" | "output" simple_command := "enlistDurable" (ATParticipantInstruuction)* ==> DurableId ; "enlistVolatile" (ATParticipantInstruuction)* ==> VolatileId ; "enlistCoordinatorCompletion" (BACoordinatorCompletionInstruuction)* ==> BACoordinatorCompletionId ; "enlistParticipantCompletion" (BAParticipantCompletionInstruuction)* ==> BAParticipantCompletionId ; "addCommands" ((DurableId | VolatileId) (ATParticipantInstruuction)* ==> "ok" | ((BAParticipantCompletionId | BACoordinatorCompletionId) BACoordinatorCompletionInstruuction)*) ==> "ok" ; "fail" (BAParticipantCompletionId | BACoordinatorCompletionId) ==> "ok" ; "exit" (BAParticipantCompletionId | BACoordinatorCompletionId) ==> "ok" ; "cannotComplete" BAParticipantCompletionId ==> "ok" ; "completed" BAParticipantCompletionId ==> "ok" ; "serve" URL command ==> resultsList "subtransaction" ==> subtransactionId ; "subactivity" ==> subactivityId ; "subtransactioncommands" subtransactionId serviceURL (command) ; "subactivitycommands" subactivityId serviceURL (command) ATParticipantInstruuction ::= "prepare" ; "prepareSystemException" ; "prepareWrongStateException" ; "commit" ; "commitSystemException" ; "commitWrongStateException" BAParticipantCompletionInstruuction ::= "close" ; "closeSystemException" ; "closeWrongStateException" ; "cancel" ; "cancelSystemException" ; "cancelWrongStateException" ; "cancelFaultedException" ; "compensate" ; "compensateSystemException" ; "compensateWrongStateException" ; "compensateFaultedException" BAParticipantCompletionInstruuction ::= "complete" ; "completeSystemException" ; "completeWrongStateException" ; DurableId ::= "org.jboss.jbossts.xts.servicetests.DurableTestParticipant." VolatileId ::= "org.jboss.jbossts.xts.servicetests.VolatileTestParticipant." BACoordinatorCompletionId ::= "org.jboss.jbossts.xts.servicetests.CoordinatorCompletionTestParticipant." BAParticipantCompletionId ::= "org.jboss.jbossts.xts.servicetests.ParticipantCompletionTestParticipant." subtransactionId is a String of the form "transaction.at." subactivityId is a String of the form "transaction.ba."
where
is a sequence of base 10 digits and is a sequence of alphanumeric characters serviceURL is a URL identifying an instance of the test service to which commands are to be recursively dispatched within the relevant subtransaction or subactivity