org.echarts.test
Class RegressionTestMonitor

java.lang.Object
  extended by org.echarts.test.RegressionTestMonitor
All Implemented Interfaces:
MachineMonitor

public class RegressionTestMonitor
extends java.lang.Object
implements MachineMonitor

Application of MachineMonitor to perform basic regression testing. Compares events received from a system under test to reference event sequence. An inconsistency results in the test being aborted. Doesn't handle non-determinism between reference run and actual run. See putEvent() for more detail.


Constructor Summary
RegressionTestMonitor(java.lang.Thread machineRunThread, long timeoutDurationSec, long jitterDurationMsec, java.lang.String referenceFilePath, java.lang.String actualFilePath)
           
RegressionTestMonitor(java.lang.Thread machineRunThread, long timeoutDurationSec, long jitterDurationMsec, java.lang.String referenceFilePath, java.lang.String actualFilePath, MachineMonitorEventFilter filter)
          Timeout represents max duration between event arrivals or, in case of first event, max duration waiting for first event.
 
Method Summary
 void dismiss()
          Stop any timer countdown in progress (because test is over).
 MachineMonitorEventFilter getEventFilter()
           
 void putEvent(MachineMonitorEvent actualEvent)
          When event arrives from system under test, stop the watchdog timer, log event (in string format) and compare event with next event from reference events.
 void setEventFilter(MachineMonitorEventFilter filter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegressionTestMonitor

public RegressionTestMonitor(java.lang.Thread machineRunThread,
                             long timeoutDurationSec,
                             long jitterDurationMsec,
                             java.lang.String referenceFilePath,
                             java.lang.String actualFilePath,
                             MachineMonitorEventFilter filter)
                      throws java.lang.Exception
Timeout represents max duration between event arrivals or, in case of first event, max duration waiting for first event. Jitter represents postive or negative variation between actual and reference event arrival times relative to their respective epochs. Reference input stream refers to file of reference events stored in 'raw' format (see MachineMonitorEvent class for details). Actual output stream refers to file where actual events will be logged (in string format) during the test run.

Throws:
java.lang.Exception

RegressionTestMonitor

public RegressionTestMonitor(java.lang.Thread machineRunThread,
                             long timeoutDurationSec,
                             long jitterDurationMsec,
                             java.lang.String referenceFilePath,
                             java.lang.String actualFilePath)
                      throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

putEvent

public void putEvent(MachineMonitorEvent actualEvent)
              throws java.lang.Exception
When event arrives from system under test, stop the watchdog timer, log event (in string format) and compare event with next event from reference events. If an inconsistency detected, then log it, write a message to standard error, and then throw a RegressionTestFailureException.

Specified by:
putEvent in interface MachineMonitor
Throws:
java.lang.Exception

dismiss

public void dismiss()
Stop any timer countdown in progress (because test is over).


setEventFilter

public void setEventFilter(MachineMonitorEventFilter filter)
Specified by:
setEventFilter in interface MachineMonitor

getEventFilter

public MachineMonitorEventFilter getEventFilter()
Specified by:
getEventFilter in interface MachineMonitor