|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.confluence.it.rpc.EventWaitingLatch
public class EventWaitingLatch
Latch that allows acceptance testing code to wait for a specific Confluence event to be published on the server side before proceeding with assertions.
This is useful when assertions need to be made on the output of a long running process on the server that clearly indicates its completion using an event. Usage:
EventWaitingLatch latch = new EventWaitingLatch(MyEvent.class, 60000, rpc); try { latch.registerListener(); ... insert code that invokes long running process on server side ... latch.await(); ... insert test assertions ... } finally { latch.clearListener(); }It is important that the latch is instantiated before the start of the long running process. If constructed after, there is a small chance that the event being listened for is fired before latch is ready to receive it.
Constructor Summary | |
---|---|
EventWaitingLatch(java.lang.Class eventClass,
TimePeriod timeout,
ConfluenceRpc rpc)
Deprecated. since 5.2 use EventWaitingLatch(String, TimePeriod, ConfluenceRpc) instead, since
acceptance test code should not have a compile-time depency |
|
EventWaitingLatch(java.lang.String eventClassName,
TimePeriod timeout,
ConfluenceRpc rpc)
|
Method Summary | |
---|---|
static void |
clearAllLatches(ConfluenceRpc rpc)
It's advisable to clear all latches in a tearDown if multiple latches will be active concurrently. |
void |
registerListener()
|
void |
unregisterListener()
|
boolean |
waitForEvent()
Blocks until event is received. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EventWaitingLatch(java.lang.String eventClassName, TimePeriod timeout, ConfluenceRpc rpc)
@Deprecated public EventWaitingLatch(java.lang.Class eventClass, TimePeriod timeout, ConfluenceRpc rpc)
EventWaitingLatch(String, TimePeriod, ConfluenceRpc)
instead, since
acceptance test code should not have a compile-time depency
Method Detail |
---|
public boolean waitForEvent()
public static void clearAllLatches(ConfluenceRpc rpc)
public void registerListener()
public void unregisterListener()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |