org.jboss.test.selenium.waiting
Class Wait.Waiting

java.lang.Object
  extended by org.jboss.test.selenium.waiting.Wait.Waiting
Enclosing class:
Wait

public static class Wait.Waiting
extends java.lang.Object

Class intented to construct by factories in Wait class. Implementation of waiting for satisfaction of condition.


Nested Class Summary
protected static class Wait.Waiting.WaitTimeoutException
           
 
Field Summary
 boolean isDelayed
          Indicates when the first test for the condition should be delayed after waiting starts.
 
Method Summary
 Wait.Waiting dontFail()
          Sets no failure after waiting timeout.
 Wait.Waiting failWith(java.lang.CharSequence failureMessage, java.lang.Object... args)
          Returns preset instance of waiting (@see Waiting) with given failure message parametrized by given objects If failure is set to null, timeout will not result to failure!
 Wait.Waiting failWith(java.lang.Object failureSubject)
          Returns Waiting object initialized with given subject of failure.
 Wait.Waiting interval(long interval)
          Sets condition testing interval to this instance and return it.
 Wait.Waiting noDelay()
          Sets no delay by interval between start waiting and first test for conditions.
protected  java.lang.RuntimeException processFailure()
          Prepares a exception for failing the waiting
 Wait.Waiting timeout(long timeout)
          Sets waiting timeout to this instance and return it.
 void until(Condition condition)
          Stars loop waiting to satisfy condition.
<T> void
waitForChange(T oldValue, Retrieve<T> retrieve)
          Waits until Retrieve's implementation doesn't retrieve value other than oldValue.
<T> T
waitForChangeAndReturn(T oldValue, Retrieve<T> retrieve)
          Waits until Retrieve's implementation doesn't retrieve value other than oldValue and this new value returns.
 void waitForTimeout()
          Waits for predefined amount of time.
 Wait.Waiting withDelay(boolean isDelayed)
          Set if testing condition should be delayed of one interval after the start of waiting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isDelayed

public boolean isDelayed
Indicates when the first test for the condition should be delayed after waiting starts.

Method Detail

interval

public Wait.Waiting interval(long interval)
Sets condition testing interval to this instance and return it.

Parameters:
interval - in miliseconds that will be preset to Waiting
Returns:
Waiting instance initialized with given interval

timeout

public Wait.Waiting timeout(long timeout)
Sets waiting timeout to this instance and return it.

Parameters:
timeout - in miliseconds that will be preset to Waiting
Returns:
Waiting instance configured with given timeout

failWith

public Wait.Waiting failWith(java.lang.Object failureSubject)
Returns Waiting object initialized with given subject of failure. It can be a Throwable (in that case it will be used as cause) or it can be any other object (it will be converted to String and used as exception message).

Parameters:
failureSubject - Throwable (used in cause) or any other object (will be converted to expection message by its string value)
Returns:
Waiting instance initialized with given failure subject

failWith

public Wait.Waiting failWith(java.lang.CharSequence failureMessage,
                             java.lang.Object... args)
Returns preset instance of waiting (@see Waiting) with given failure message parametrized by given objects If failure is set to null, timeout will not result to failure!

Parameters:
failureMessage - character sequence that will be used as message of exception thrown in case of waiting timeout or null if waiting timeout shouldn't result to failure
args - arguments to failureMessage which will be use to parametrization of failureMessage
Returns:
Waiting instance initialized with given failureMessage and arguments

processFailure

protected java.lang.RuntimeException processFailure()
Prepares a exception for failing the waiting

Returns:
runtime exception

dontFail

public Wait.Waiting dontFail()
Sets no failure after waiting timeout. Waiting timeout with this preset dont result to failure!

Returns:
Waiting instance initialized with no failure

noDelay

public Wait.Waiting noDelay()
Sets no delay by interval between start waiting and first test for conditions.

Returns:
Waiting instance initialized with no delay

withDelay

public Wait.Waiting withDelay(boolean isDelayed)
Set if testing condition should be delayed of one interval after the start of waiting.

Parameters:
isDelayed - true if condition testing should be delayed; false otherwise
Returns:
Waiting instance initialized with delay if isDelayed is set to true; with no delay otherwise

until

public void until(Condition condition)
Stars loop waiting to satisfy condition.

Parameters:
condition - what wait for to be satisfied

waitForTimeout

public void waitForTimeout()
Waits for predefined amount of time.


waitForChange

public <T> void waitForChange(T oldValue,
                              Retrieve<T> retrieve)
Waits until Retrieve's implementation doesn't retrieve value other than oldValue.

Type Parameters:
T - type of value what we are waiting for change
Parameters:
oldValue - value that we are waiting for change
retrieve - implementation of retrieving actual value

waitForChangeAndReturn

public <T> T waitForChangeAndReturn(T oldValue,
                                    Retrieve<T> retrieve)
Waits until Retrieve's implementation doesn't retrieve value other than oldValue and this new value returns.

Type Parameters:
T - type of value what we are waiting for change
Parameters:
oldValue - value that we are waiting for change
retrieve - implementation of retrieving actual value
Returns:
new retrieved value


Copyright © 2010. All Rights Reserved.