com.atlassian.jira.webtest.framework.core.query
Class AbstractConditionBasedQuery<T>

java.lang.Object
  extended by com.atlassian.jira.webtest.framework.core.AbstractPollingQuery
      extended by com.atlassian.jira.webtest.framework.core.query.AbstractTimedQuery<T>
          extended by com.atlassian.jira.webtest.framework.core.query.AbstractConditionBasedQuery<T>
Type Parameters:
T - type of the query result
All Implemented Interfaces:
ClockAware, PollingQuery, TimedQuery<T>
Direct Known Subclasses:
AbstractSeleniumConditionBasedQuery, Queries.ConditionalQueryForQuery, Queries.ConditionalQueryForValue

@NotThreadSafe
public abstract class AbstractConditionBasedQuery<T>
extends AbstractTimedQuery<T>

A TimedQuery that will only return if a given TimedCondition is met.

Since:
v4.3

Field Summary
 
Fields inherited from class com.atlassian.jira.webtest.framework.core.AbstractPollingQuery
defaultTimeout, interval
 
Constructor Summary
protected AbstractConditionBasedQuery(TimedCondition condition)
          By default, this query will return null, if the underlying condition is not met before timeout.
protected AbstractConditionBasedQuery(TimedCondition condition, ExpirationHandler expirationHandler)
          Use timeout configuration from the underlying condition.
protected AbstractConditionBasedQuery(TimedCondition condition, long defTimeout, long interval, ExpirationHandler expirationHandler)
           
 
Method Summary
 TimedCondition condition()
           
protected  T currentValue()
          Current evaluation of the query.
protected abstract  T evaluateNow()
          Hook for subclasses, semantics are basically the same as currentValue().
protected  boolean shouldReturn(T currentEval)
          If the current evaluated query value should be returned.
protected  T substituteValue()
           A 'null' value for given context that will be returned by currentValue() in case the underlying condition evaluates to false.
 
Methods inherited from class com.atlassian.jira.webtest.framework.core.query.AbstractTimedQuery
by, by, byDefaultTimeout, clock, expirationHandler, now, resetLastRun, toString
 
Methods inherited from class com.atlassian.jira.webtest.framework.core.AbstractPollingQuery
defaultTimeout, interval
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.atlassian.jira.webtest.framework.core.PollingQuery
defaultTimeout, interval
 

Constructor Detail

AbstractConditionBasedQuery

protected AbstractConditionBasedQuery(TimedCondition condition,
                                      long defTimeout,
                                      long interval,
                                      ExpirationHandler expirationHandler)

AbstractConditionBasedQuery

protected AbstractConditionBasedQuery(TimedCondition condition,
                                      ExpirationHandler expirationHandler)
Use timeout configuration from the underlying condition. User custom expirationHandler.

Parameters:
condition - underlying condition
expirationHandler - expiration handler

AbstractConditionBasedQuery

protected AbstractConditionBasedQuery(TimedCondition condition)
By default, this query will return null, if the underlying condition is not met before timeout.

Parameters:
condition - underlying conditon
Method Detail

shouldReturn

protected final boolean shouldReturn(T currentEval)
Description copied from class: AbstractTimedQuery
If the current evaluated query value should be returned.

Specified by:
shouldReturn in class AbstractTimedQuery<T>
Parameters:
currentEval - current query evaluation expires
Returns:
true, if the current query evaluation should be returned as a result of this timed query

currentValue

protected final T currentValue()
Description copied from class: AbstractTimedQuery
Current evaluation of the query.

Specified by:
currentValue in class AbstractTimedQuery<T>
Returns:
current evaluation of the query

evaluateNow

protected abstract T evaluateNow()
Hook for subclasses, semantics are basically the same as currentValue().

Returns:
current evaluation of this query
See Also:
AbstractTimedQuery.currentValue()

substituteValue

protected T substituteValue()

A 'null' value for given context that will be returned by currentValue() in case the underlying condition evaluates to false.

Subclasses may override this method to provide non-null empty values, depending on the query context

Returns:
'null' substitution of the query result

condition

public final TimedCondition condition()


Copyright © 2002-2013 Atlassian. All Rights Reserved.