i3.dragos.core.services.events
Class EventTracker

java.lang.Object
  extended by i3.dragos.core.services.events.EventTracker

public class EventTracker
extends java.lang.Object

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.

Author:
Thorsten Hermes <thermes@i3.informatik.rwth-aachen.de>

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

EventTracker

public EventTracker(java.util.Collection<? extends DragosEvent> expectedEvents,
                    EventFilter filter)
Creates an EventTracker.

Parameters:
expectedEvents - The list of events to expect.
filter - An EventFilter that determines which events are actually checked (may be null).
Method Detail

check

public void check(DragosEvent event)
           throws DragosException
Checks the supplied event. See class description for details.

Parameters:
event - The event to check.
Throws:
DragosException - in case of errors.

hasDetected

public boolean hasDetected()
Returns true if all events where detected exactly as expected, false otherwise.

Returns:
true if all events where detected exactly as expected, false otherwise.

hasFinalResult

public boolean hasFinalResult()
Returns true if the result of hasDetected() is final, false otherwise.

Returns:
true if the result of hasDetected() is final, false otherwise.

getErrorMessage

public java.lang.String getErrorMessage()
Returns the error message, null if none (yet).

Returns:
the error message, null if none (yet).


Copyright © 2002-2008 RWTH Aachen, Department of Computer Science 3 (Software Engineering). All Rights Reserved.