org.openeai.implementations.applications.testsuite
Class SyncVerificationCommand

java.lang.Object
  |
  +--org.openeai.OpenEaiObject
        |
        +--org.openeai.jms.consumer.commands.ConsumerCommand
              |
              +--org.openeai.jms.consumer.commands.SyncCommandImpl
                    |
                    +--org.openeai.implementations.applications.testsuite.SyncVerificationCommand
All Implemented Interfaces:
SyncCommand

public class SyncVerificationCommand
extends SyncCommandImpl
implements SyncCommand

This is an OpenEAI SyncCommand that consumes sync messages published by an authoritative source when that system creates, updates or deletes an object. It works in conjunction with the TestSuiteScheduledCommand to verify the appropriate sync messages are published. These two commands (this command and the TestSuiteScheduledCommand) make up the OpenEAI "TestSuite" Application.

Configuration Parameters:

These are the configuration parameters associated to this command.

Property Name Required Description
TestSuiteDocUri yes The URL for the actual TestSuite associated to this instance of the TeseSuiteApplication. This is the same value used by the TestSuiteScheduledCommand that points to the TestSuite document used by both commands to compare expected with actual results. The TestSuite document contains all the instructions that are to be carried out by the TestSuiteScheduledCommand as well as the expected sync messages that this command expects to consume.
TestSuiteSummaryDocPath yes This is the output path (directory name) where the TestSuite summary document should be written to. Both the TestSuiteScheculedCommand and this command need this parameter. They will both write the results of their processing to a file in this directory. The name of the summary document will be the actual file name of the test suite document with the word "-summary" appdended to it. For example, if the TestSuiteDocUri is: http://xml.openeai.org/xml/configs/messaging/environments/development/tests/1.0/TestSuite_BasicPerson_v1_0.xml then the summary document name would be TestSuite_BasicPerson_v1_0-summary.xml and it would be written to the directory specified in this property (e.g. "./").
maxConsumptionTime no (default=30000 or 30 seconds) This is the maximum time (specified in milliseconds) that this command will attempt to consume messages after the first message has been consumed AND processed. When the first message is processed, a timer is started and the command does not return. Instead, that instance of the command execution will wait until either the actual number of sync messages consumed equals the expected number of syncs or the 'maxConsumptionTime' has elapsed. If either trigger point is met, the command will return from the execution and the application will stop itself.

Author:
Tod Jackson
See Also:
TestSuiteScheduledCommand

Field Summary
static java.util.Date LAST_CLEANUP_TIME
           
static boolean PROCESS_MESSAGES
           
static boolean STARTED_VERIFICATION
           
 
Fields inherited from class org.openeai.jms.consumer.commands.ConsumerCommand
CREATE_ACTION, DELETE_ACTION, MESSAGE_ACTION, MESSAGE_CATEGORY, MESSAGE_OBJECT, MESSAGE_RELEASE, MESSAGE_TYPE, QUERY_ACTION, UPDATE_ACTION
 
Fields inherited from class org.openeai.OpenEaiObject
logger
 
Constructor Summary
SyncVerificationCommand(CommandConfig cConfig)
          This is the constructor used by the PubSubConsumer to instantiate this command.
 
Method Summary
 void execute(int messageNumber, javax.jms.Message aMessage)
          This execute implementation extracts the TestId Element from the ControlArea of the message consumed.
 
Methods inherited from class org.openeai.jms.consumer.commands.SyncCommandImpl
getSyncErrorPublisher, getSyncErrorSyncDoc, getSyncErrorSyncPrimedDocumentUri, publishSyncError, publishSyncError, setSyncErrorSyncDoc, setSyncErrorSyncPrimedDocumentUri
 
Methods inherited from class org.openeai.jms.consumer.commands.ConsumerCommand
addAppConfig, buildError, convertToString, generateRelease, getAppConfig, getAppConfigs, getControlArea, getInboundXmlValidation, getMessageAction, getMessageBody, getMessageCategory, getMessageDumpDirectory, getMessageObject, getMessageRelease, getMessageType, getMsgComponents, getOutboundXmlValidation, initializeInput, setAppConfig, setInboundXmlValidation, setMessageDumpDirectory, setMsgComponents, setOutboundXmlValidation, setWriteToFile, writeMessageToFile, writeToFile
 
Methods inherited from class org.openeai.OpenEaiObject
addLog4jProperty, getAppName, getDebug, getFromAddr, getLog4jProperties, getMailHost, getMailService, getProperties, getToAddr, initializeLog4j, initializeLog4j, initializeLog4j, setAppName, setDebug, setFromAddr, setMailHost, setMailService, setProperties, setToAddr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROCESS_MESSAGES

public static boolean PROCESS_MESSAGES

LAST_CLEANUP_TIME

public static java.util.Date LAST_CLEANUP_TIME

STARTED_VERIFICATION

public static boolean STARTED_VERIFICATION
Constructor Detail

SyncVerificationCommand

public SyncVerificationCommand(CommandConfig cConfig)
                        throws java.lang.InstantiationException
This is the constructor used by the PubSubConsumer to instantiate this command. The consumer will instantiate the command and then call its 'execute' method when it consumes a message that is supposed to be processed by this command.

Method Detail

execute

public void execute(int messageNumber,
                    javax.jms.Message aMessage)
             throws CommandException
This execute implementation extracts the TestId Element from the ControlArea of the message consumed. Then it proceeds to check the TestSuite document associated to the TestSuiteApplication for expected results. If it finds the TestId in the TestSuite document it will ensure that the message consumed matches the information specified in the TestSuite document as the expected result.

If the SyncVerification.PROCESS_MESSAGE variable is false, this command will ignore any messages it consumes. This is controlled by the TestSuiteScheduledCommand. The TestSuiteScheculedCommand must start the consumer associated to this command to ensure the durable subscription is established and to clean off any messages left over from previous runs or from any other sync message publication to this gateway's topic. Then, when it's ready, it will set the SyncVerification.PROCESS_MESSAGE flag to true which will allow this command to actually process the synchronization messages it consumes to verify they are correct according to the test suite document.

The first time this execute method gets invoked and the SyncVerificationCommand.PROCESS_MESSAGE flag is 'true', a timer will be started and control will not be returned from this particular execution of the command. The first execution of this command will stay alive until all sync messages have been consumed or until the 'maxConsumptionTime' has been reached. Once that period of time has elapsed, the method will return.

Specified by:
execute in interface SyncCommand
Returns:
void

Throws:
CommandException - if errors occur extracting information out of the JMS Message passed in. All other errors are handled by the command.
See Also:
PubSubConsumer, SyncCommand


Copyright © 2002, OpenEAI Software Foundation