org.apache.jackrabbit.test.api.observation
Class EventResult

java.lang.Object
  extended by org.apache.jackrabbit.test.api.observation.EventResult
All Implemented Interfaces:
EventListener

public class EventResult
extends Object
implements EventListener

Utility class for Event retrieval with an EventListener.

The getEventIterator(long) and getEvents(long) methods will block until an event is delivered and then return the events. Note, that only one of the methods can be called for an expected event delivery. Calling the 'other' method will block until the next events are delivered.


Constructor Summary
EventResult(PrintWriter log)
          Creates a new EventResult.
 
Method Summary
 EventIterator getEventIterator(long wait)
          Gets the events from the EventListener.
 Event[] getEvents(long wait)
          Gets the events from the EventListener.
 void onEvent(EventIterator events)
          Called when events are delivered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventResult

public EventResult(PrintWriter log)
Creates a new EventResult.

Parameters:
log - log messages are written to this Logger.
Method Detail

getEvents

public Event[] getEvents(long wait)
Gets the events from the EventListener. Waits at most wait milliseconds for the events.

If the events are not delivered within wait time an empty array is returned and a log message is written.

Parameters:
wait - time in milliseconds to wait at most for Events.
Returns:
Events.

getEventIterator

public EventIterator getEventIterator(long wait)
Gets the events from the EventListener. Waits at most wait milliseconds for the events.

If the events are not delivered within wait time null is returned and a log message is written.

Parameters:
wait - time in milliseconds to wait at most for EventIterator.
Returns:
EventIterator.

onEvent

public void onEvent(EventIterator events)
Called when events are delivered.

Specified by:
onEvent in interface EventListener
Parameters:
events - the events.


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.