public class Waiter extends Object implements Waitable, Timeoutable, Outputable
| Modifier | Constructor and Description |
|---|---|
protected |
Waiter()
Can be used from subclass.
|
|
Waiter(Waitable w)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
actionProduced(Object obj)
Checks if wait criteria have been met.
|
protected String |
getActionProducedMessage(long timeSpent,
Object result)
Returns message to be printed when waiting has been successfully finished.
|
String |
getDescription()
Returns description.
|
protected String |
getGoldenActionProducedMessage()
Returns message to be printed int golden output when waiting has been successfully finished.
|
protected String |
getGoldenTimeoutExpiredMessage()
Returns message to be printed int golden output when waiting timeout has been expired.
|
protected String |
getGoldenWaitingStartedMessage()
Returns message to be printed int golden output before waiting start.
|
TestOut |
getOutput()
Returns print output streams or writers.
|
protected String |
getTimeoutExpiredMessage(long timeSpent)
Returns message to be printed when waiting timeout has been expired.
|
Timeouts |
getTimeouts()
Return current timeouts.
|
protected String |
getWaitingStartedMessage()
Returns message to be printed before waiting start.
|
void |
setOutput(TestOut out)
Defines print output streams or writers.
|
void |
setTimeouts(Timeouts timeouts)
Defines current timeouts.
|
Timeouts |
setTimeoutsToCloneOf(Timeouts timeouts,
String useAsWaitingTime)
Like
setTimeouts(Timeouts), but clones the timeouts first, then
sets "Waiter.WaitingTime" to the timeout whose name is passed in. |
void |
setWaitingTimeOrigin(String origin)
Sets the origin of the current "Waiter.WaitingTime" to be shown in timeout
error messages
|
protected long |
timeFromStart()
Returns time from waiting start.
|
Object |
waitAction(Object waitableObject)
Waits for not null result of actionProduced method of Waitable implementation passed into constructor.
|
public Waiter(Waitable w)
w - Waitable object defining waiting criteria.protected Waiter()
public void setTimeouts(Timeouts timeouts)
setTimeouts in interface Timeoutabletimeouts - A collection of timeout assignments.Timeoutable,
Timeouts,
getTimeouts()public Timeouts setTimeoutsToCloneOf(Timeouts timeouts, String useAsWaitingTime)
setTimeouts(Timeouts), but clones the timeouts first, then
sets "Waiter.WaitingTime" to the timeout whose name is passed in. This
name is remembered for display in timeout error messages so people know
what to adjust.timeouts - to be cloned and in which to look up "useAsWaitingTime".useAsWaitingTime - the name of the timeout to apply to "Waiter.WaitingTime".public void setWaitingTimeOrigin(String origin)
origin - is the name of the origin.public Timeouts getTimeouts()
getTimeouts in interface TimeoutableTimeoutable,
Timeouts,
setTimeouts(org.netbeans.jemmy.Timeouts)public void setOutput(TestOut out)
setOutput in interface Outputableout - Identify the streams or writers used for print output.Outputable,
TestOut,
getOutput()public TestOut getOutput()
getOutput in interface OutputableOutputable,
TestOut,
setOutput(org.netbeans.jemmy.TestOut)public Object waitAction(Object waitableObject) throws InterruptedException
waitableObject - Object to be passed into actionProduced method.TimeoutExpiredExceptionInterruptedExceptionpublic Object actionProduced(Object obj)
WaitableactionProduced in interface Waitableobj - Waitablepublic String getDescription()
WaitablegetDescription in interface WaitableWaitableprotected String getWaitingStartedMessage()
protected String getTimeoutExpiredMessage(long timeSpent)
timeSpent - time from waiting start (milliseconds)protected String getActionProducedMessage(long timeSpent, Object result)
timeSpent - time from waiting start (milliseconds)result - result of Waitable.actionproduced method.protected String getGoldenWaitingStartedMessage()
protected String getGoldenTimeoutExpiredMessage()
protected String getGoldenActionProducedMessage()
protected long timeFromStart()