Class Waiter
java.lang.Object
org.netbeans.jemmy.Waiter
- All Implemented Interfaces:
Outputable, Timeoutable, Waitable
- Direct Known Subclasses:
WindowWaiter
Waits for something defined by Waitable interface to be happened.
Timeouts used:
Waiter.TimeDelta - time delta to check actionProduced result.
Waiter.WaitingTime - maximal waiting time
Waiter.AfterWaitingTime - time to sleep after waiting has been finished.
Timeouts used:
Waiter.TimeDelta - time delta to check actionProduced result.
Waiter.WaitingTime - maximal waiting time
Waiter.AfterWaitingTime - time to sleep after waiting has been finished.
- Author:
- Alexandre Iline (alexandre.iline@sun.com)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionactionProduced(Object obj) Checks if wait criteria have been met.protected StringgetActionProducedMessage(long timeSpent, Object result) Returns message to be printed when waiting has been successfully finished.Returns description.protected StringReturns message to be printed int golden output when waiting has been successfully finished.protected StringReturns message to be printed int golden output when waiting timeout has been expired.protected StringReturns message to be printed int golden output before waiting start.Returns print output streams or writers.protected StringgetTimeoutExpiredMessage(long timeSpent) Returns message to be printed when waiting timeout has been expired.Return current timeouts.protected StringReturns message to be printed before waiting start.voidDefines print output streams or writers.voidsetTimeouts(Timeouts timeouts) Defines current timeouts.protected longReturns time from waiting start.waitAction(Object waitableObject) Waits for not null result of actionProduced method of Waitable implementation passed into constructor.
-
Constructor Details
-
Waiter
-
Waiter
protected Waiter()Can be used from subclass.
-
-
Method Details
-
setTimeouts
Defines current timeouts.- Specified by:
setTimeoutsin interfaceTimeoutable- Parameters:
timeouts- A collection of timeout assignments.- See Also:
-
getTimeouts
Return current timeouts.- Specified by:
getTimeoutsin interfaceTimeoutable- Returns:
- the collection of current timeout assignments.
- See Also:
-
setOutput
Defines print output streams or writers.- Specified by:
setOutputin interfaceOutputable- Parameters:
out- Identify the streams or writers used for print output.- See Also:
-
getOutput
Returns print output streams or writers.- Specified by:
getOutputin interfaceOutputable- Returns:
- an object that contains references to objects for printing to output and err streams.
- See Also:
-
waitAction
Waits for not null result of actionProduced method of Waitable implementation passed into constructor.- Parameters:
waitableObject- Object to be passed into actionProduced method.- Returns:
- non null result of action.
- Throws:
TimeoutExpiredExceptionInterruptedException
-
actionProduced
Description copied from interface:WaitableChecks if wait criteria have been met.- Specified by:
actionProducedin interfaceWaitable- Parameters:
obj-- Returns:
- null is criteria have not been met.
- See Also:
-
getDescription
Description copied from interface:WaitableReturns description.- Specified by:
getDescriptionin interfaceWaitable- Returns:
- a description of the wait criteria.
- See Also:
-
getWaitingStartedMessage
Returns message to be printed before waiting start.- Returns:
- a message.
-
getTimeoutExpiredMessage
Returns message to be printed when waiting timeout has been expired.- Parameters:
timeSpent- time from waiting start (milliseconds)- Returns:
- a message.
-
getActionProducedMessage
-
getGoldenWaitingStartedMessage
Returns message to be printed int golden output before waiting start.- Returns:
- a message.
-
getGoldenTimeoutExpiredMessage
Returns message to be printed int golden output when waiting timeout has been expired.- Returns:
- a message.
-
getGoldenActionProducedMessage
Returns message to be printed int golden output when waiting has been successfully finished.- Returns:
- a message.
-
timeFromStart
protected long timeFromStart()Returns time from waiting start.- Returns:
- Time spent for waiting already.
-