DRCL JavaSim API

drcl.comp.tool
Class EventTester

java.lang.Object
  |
  +--drcl.DrclObj
        |
        +--drcl.comp.tool.EventTester
All Implemented Interfaces:
java.lang.Cloneable, ObjectDuplicable, java.io.Serializable

public class EventTester
extends DrclObj

An event-based component testing engine. Must be embedded in a component (e.g., ComponentTester)

Author:
Hung-ying Tyan
See Also:
Serialized Form

Constructor Summary
EventTester()
           
EventTester(Component host_)
           
 
Method Summary
 boolean _isBatchRunning()
          Is a batch running?
 drcl.comp.tool.EventTester.Event addEvent(java.lang.String msg_)
          Adds a message event.
 drcl.comp.tool.EventTester.Event addEvent(java.lang.String evtType_, double time_)
          Adds a finish event.
 drcl.comp.tool.EventTester.Event addEvent(java.lang.String evtType_, double time_, java.lang.Object toSend_)
          Adds a "rr-reply" event, corresponding to last event.
 drcl.comp.tool.EventTester.Event addEvent(java.lang.String evtType_, double time_, java.lang.Object toSend_, Port p_)
          Adds a "send"/"rr-reply" event.
 drcl.comp.tool.EventTester.Event addEvent(java.lang.String evtType_, double time_, java.lang.Object toRcv_, java.lang.String classExpected_, Port p_)
          Adds a "receive"/"rr-request" event.
 drcl.comp.tool.EventTester.Event addEvent(java.lang.String evtType_, double time_, java.lang.Object toRcv_, java.lang.String classExpected_, java.lang.String portDescription_)
          Adds a "receive" event.
 drcl.comp.tool.EventTester.Event addEvent(java.lang.String evtType_, double time_, java.lang.String msg_)
          Adds a message event.
 void clear()
          Removes all the events in the batch.
 void duplicate(java.lang.Object source_)
          opies the content of the source_ object to this object.
 double getTimeDiffTolerance()
           
 java.lang.String info()
           
 drcl.comp.tool.EventTester.Event insertEvent(int index_, java.lang.String msg_)
          Inserts a message event.
 drcl.comp.tool.EventTester.Event insertEvent(int index_, java.lang.String evtType_, double time_)
          Inserts a finish event.
 drcl.comp.tool.EventTester.Event insertEvent(int index_, java.lang.String evtType_, double time_, java.lang.Object toSend_)
          Inserts a "rr-reply" event, corresponding to last event.
 drcl.comp.tool.EventTester.Event insertEvent(int index_, java.lang.String evtType_, double time_, java.lang.Object toSend_, Port p_)
          Inserts a "send"/"rr-reply" event
 drcl.comp.tool.EventTester.Event insertEvent(int index_, java.lang.String evtType_, double time_, java.lang.Object toRcv_, java.lang.String classExpected_, Port p_)
          Inserts a "receive" event
 drcl.comp.tool.EventTester.Event insertEvent(int index_, java.lang.String evtType_, double time_, java.lang.Object toRcv_, java.lang.String classExpected_, java.lang.String portDescription_)
          Inserts a "receive" event.
 drcl.comp.tool.EventTester.Event insertEvent(int index_, java.lang.String evtType_, double time_, java.lang.String msg_)
          Inserts a message event.
 void match(double time_, java.lang.Object data_, Port p_)
          Matches a receipt event.
 int progress()
           
 int rcvProgress()
           
 drcl.comp.tool.EventTester.Event removeEvent(int index_)
          Removes the index'th event in the batch.
 void reset()
          Reset the batch for a new start.
 int sendProgress()
          Returns the index of the next event which the send process is waiting to execute ("send" event) or match ("receive" event).
 void setTimeDiffTolerance(double d_)
           
 void start()
          Starts a batch run.
 void stop()
          Stops the running batch.
 boolean verify()
          Verifies rr-request and rr-reply pairs in the batch.
 java.lang.String view()
           
 
Methods inherited from class drcl.DrclObj
clone, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EventTester

public EventTester()

EventTester

public EventTester(Component host_)
Method Detail

_isBatchRunning

public boolean _isBatchRunning()
Is a batch running?

sendProgress

public int sendProgress()
Returns the index of the next event which the send process is waiting to execute ("send" event) or match ("receive" event).

rcvProgress

public int rcvProgress()

progress

public int progress()

clear

public void clear()
Removes all the events in the batch.

reset

public void reset()
Reset the batch for a new start. Use clear() to clear the batch.

stop

public void stop()
Stops the running batch. A stopped batched cannot be resumed. One must restart it.

view

public java.lang.String view()

info

public java.lang.String info()

verify

public boolean verify()
Verifies rr-request and rr-reply pairs in the batch.
Returns:
false if fails to find some pair.

start

public void start()
Starts a batch run. Do not call this method directly. Use run() instead, it will create an appropriate thread to start() the component.

match

public void match(double time_,
                  java.lang.Object data_,
                  Port p_)
Matches a receipt event.

addEvent

public drcl.comp.tool.EventTester.Event addEvent(java.lang.String evtType_,
                                                 double time_,
                                                 java.lang.Object toSend_,
                                                 Port p_)
Adds a "send"/"rr-reply" event. Must specify time, object to send and the port on which the object is to send. The time is relative to the time when the batch starts.

addEvent

public drcl.comp.tool.EventTester.Event addEvent(java.lang.String evtType_,
                                                 double time_,
                                                 java.lang.Object toSend_)
Adds a "rr-reply" event, corresponding to last event.

addEvent

public drcl.comp.tool.EventTester.Event addEvent(java.lang.String evtType_,
                                                 double time_,
                                                 java.lang.Object toRcv_,
                                                 java.lang.String classExpected_,
                                                 Port p_)
Adds a "receive"/"rr-request" event. When a data is received, time, data itself, class of data and port are matched with the event. In the event, if time is less than 0, time always matches. Similarly, data always matches if null is specified. Class always matches if null is specified. The time is relative to the time when the batch starts.

addEvent

public drcl.comp.tool.EventTester.Event addEvent(java.lang.String evtType_,
                                                 double time_,
                                                 java.lang.Object toRcv_,
                                                 java.lang.String classExpected_,
                                                 java.lang.String portDescription_)
Adds a "receive" event. Exactly the same as the other add-recv-event method except that port is specified in group id and port id. Group id always matches if null is specified. Port id always matches if null is specified.

addEvent

public drcl.comp.tool.EventTester.Event addEvent(java.lang.String evtType_,
                                                 double time_)
Adds a finish event. The event is to finish the batch run no matter whether there are still events behind.

addEvent

public drcl.comp.tool.EventTester.Event addEvent(java.lang.String evtType_,
                                                 double time_,
                                                 java.lang.String msg_)
Adds a message event. Executing the event results in the message being printed to the debug channels.

addEvent

public drcl.comp.tool.EventTester.Event addEvent(java.lang.String msg_)
Adds a message event. Executing the event results in the message being printed to the debug channels.

removeEvent

public drcl.comp.tool.EventTester.Event removeEvent(int index_)
Removes the index'th event in the batch.

insertEvent

public drcl.comp.tool.EventTester.Event insertEvent(int index_,
                                                    java.lang.String evtType_,
                                                    double time_,
                                                    java.lang.Object toSend_,
                                                    Port p_)
Inserts a "send"/"rr-reply" event
See Also:
addEvent(String, double, Object, Port)

insertEvent

public drcl.comp.tool.EventTester.Event insertEvent(int index_,
                                                    java.lang.String evtType_,
                                                    double time_,
                                                    java.lang.Object toSend_)
Inserts a "rr-reply" event, corresponding to last event.
See Also:
addEvent(String, double, Object)

insertEvent

public drcl.comp.tool.EventTester.Event insertEvent(int index_,
                                                    java.lang.String evtType_,
                                                    double time_,
                                                    java.lang.Object toRcv_,
                                                    java.lang.String classExpected_,
                                                    Port p_)
Inserts a "receive" event
See Also:
addEvent(String, double, Object, String, Port)

insertEvent

public drcl.comp.tool.EventTester.Event insertEvent(int index_,
                                                    java.lang.String evtType_,
                                                    double time_,
                                                    java.lang.Object toRcv_,
                                                    java.lang.String classExpected_,
                                                    java.lang.String portDescription_)
Inserts a "receive" event.
See Also:
addEvent(String, double, Object, String, String)

insertEvent

public drcl.comp.tool.EventTester.Event insertEvent(int index_,
                                                    java.lang.String evtType_,
                                                    double time_)
Inserts a finish event.
See Also:
addEvent(String, double)

insertEvent

public drcl.comp.tool.EventTester.Event insertEvent(int index_,
                                                    java.lang.String evtType_,
                                                    double time_,
                                                    java.lang.String msg_)
Inserts a message event.
See Also:
addEvent(String, double, String)

insertEvent

public drcl.comp.tool.EventTester.Event insertEvent(int index_,
                                                    java.lang.String msg_)
Inserts a message event.
See Also:
addEvent(String, double, String)

duplicate

public void duplicate(java.lang.Object source_)
Description copied from class: DrclObj
opies the content of the source_ object to this object. he subclass must implement this method to realize DrclObj.clone().
Overrides:
duplicate in class DrclObj

setTimeDiffTolerance

public void setTimeDiffTolerance(double d_)

getTimeDiffTolerance

public double getTimeDiffTolerance()

DRCL JavaSim API

Copyright © 2001 - DRCL, OSU     ~ Back to JavaSim Home ~