|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object i3.dragos.core.services.events.EventTracker
public class EventTracker
A more advanced and flexible version of EventDetector
. You supply a list of expected events. Each time an
actual event is received, the first entry from that list of expected events is taken and compared by event class and
event type. In case of a match, the entry is simply removed from the list. If the event did not match the
expectations, this automaton enters its rejecting state, from which there is no return. Once the list is empty, i.e.
all expected events have been received, and no other events were received during that phase, no further checking
takes place, and the automaton stays in its accepting state. An optional filter is applied before any
received events are compared, so it may be used to ignore certain events. This class is mainly used for testing, and
was included here instead of the testcases directory so that it can also be used by dragos-system-testsuite
.
Constructor Summary | |
---|---|
EventTracker(java.util.Collection<? extends DragosEvent> expectedEvents,
EventFilter filter)
Creates an EventTracker. |
Method Summary | |
---|---|
void |
check(DragosEvent event)
Checks the supplied event. |
java.lang.String |
getErrorMessage()
Returns the error message, null if none (yet). |
boolean |
hasDetected()
Returns true if all events where detected exactly as expected, false otherwise. |
boolean |
hasFinalResult()
Returns true if the result of hasDetected() is final, false otherwise. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EventTracker(java.util.Collection<? extends DragosEvent> expectedEvents, EventFilter filter)
expectedEvents
- The list of events to expect.filter
- An EventFilter that determines which events are actually checked (may be null
).Method Detail |
---|
public void check(DragosEvent event) throws DragosException
event
- The event to check.
DragosException
- in case of errors.public boolean hasDetected()
true
if all events where detected exactly as expected, false
otherwise.
true
if all events where detected exactly as expected, false
otherwise.public boolean hasFinalResult()
true
if the result of hasDetected()
is final, false
otherwise.
true
if the result of hasDetected()
is final, false
otherwise.public java.lang.String getErrorMessage()
null
if none (yet).
null
if none (yet).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |