com.atlassian.jira.webtest.framework.core.query
Interface TimedQuery<T>

Type Parameters:
T - type of the query result
All Superinterfaces:
PollingQuery
All Known Implementing Classes:
AbstractConditionBasedQuery, AbstractLocatorConditionQuery, AbstractSeleniumConditionBasedQuery, AbstractSeleniumTimedQuery, AbstractTimedQuery, AttributeQuery, GadgetTimedQuery, Queries.ConditionalQueryForQuery, Queries.ConditionalQueryForValue, ScriptExecutionQuery, StaticQuery, TextQuery, ValueQuery

@NotThreadSafe
public interface TimedQuery<T>
extends PollingQuery

Represents a repeatable query over the state of the test that results in an object instance of a particular type T. The query may be evaluated immediately (now(), within a default timeout (byDefaultTimeout(), or within a client-specified custom timeout (by(long). Usually there is a specific value of T expected by the query and it will not return until the underlying query evaluates to this expected value, or the timeout expires.

The specific semantics of how the polling is performed are up to implementations of this interface and should be documented appropriately. E.g. a particular implementation may be waiting for a specific value t of T, and returning the real value s, if the query does not return t within the given timeout. Other implementations may throw exceptions, or return null, if an expected query result value is not returned within timeout, etc.

Since:
v4.3

Method Summary
 T by(long timeoutInMillis)
          Evaluate this query by given timeout.
 T by(long timeout, TimeUnit unit)
          Evaluate this query by given timeout.
 T byDefaultTimeout()
          Evaluate this query by a timeout deemed default in the given test context.
 T now()
          Evaluate this query immediately.
 
Methods inherited from interface com.atlassian.jira.webtest.framework.core.PollingQuery
defaultTimeout, interval
 

Method Detail

by

T by(long timeoutInMillis)
Evaluate this query by given timeout. That is, return the expected T as soon as the query evaluates to the expected value, otherwise perform any appropriate operation when the timeout expires (e.g. return real value, null, or throw exception

Parameters:
timeoutInMillis - timeout in milliseconds (must be greater than 0)
Returns:
expected value of T, or any suitable value, if the expected value was not returned before timeout expired

by

T by(long timeout,
     TimeUnit unit)
Evaluate this query by given timeout. That is, return the expected T as soon as the query evaluates to the expected value, otherwise perform any appropriate operation when the timeout expires (e.g. return real value, null, or throw exception

Parameters:
timeout - timeout (must be greater than 0)
unit - the unit that the timeout is in
Returns:
expected value of T, or any suitable value, if the expected value was not returned before timeout expired

byDefaultTimeout

T byDefaultTimeout()
Evaluate this query by a timeout deemed default in the given test context.

Returns:
expected value of T, or any suitable value, if the expected value was not returned before the default timeout expired
See Also:
PollingQuery.defaultTimeout()

now

T now()
Evaluate this query immediately.

Returns:
current evaluation of the underlying query.


Copyright © 2002-2013 Atlassian. All Rights Reserved.