Class EventResult
- java.lang.Object
-
- org.apache.jackrabbit.test.api.observation.EventResult
-
- All Implemented Interfaces:
EventListener
public class EventResult extends Object implements EventListener
Utility class forEvent
retrieval with anEventListener
.The
getEventIterator(long)
andgetEvents(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
Constructors Constructor Description EventResult(PrintWriter log)
Creates a newEventResult
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
Constructor Detail
-
EventResult
public EventResult(PrintWriter log)
Creates a newEventResult
.- Parameters:
log
- log messages are written to thisLogger
.
-
-
Method Detail
-
getEvents
public Event[] getEvents(long wait)
Gets the events from the EventListener. Waits at mostwait
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 forEvent
s.- Returns:
Event
s.
-
getEventIterator
public EventIterator getEventIterator(long wait)
Gets the events from the EventListener. Waits at mostwait
milliseconds for the events.If the events are not delivered within
wait
timenull
is returned and a log message is written.- Parameters:
wait
- time in milliseconds to wait at most forEventIterator
.- Returns:
EventIterator
.
-
onEvent
public void onEvent(EventIterator events)
Called when events are delivered.- Specified by:
onEvent
in interfaceEventListener
- Parameters:
events
- the events.
-
-