com.amazonaws.services.simpleworkflow.flow.junit
Class WorkflowTestBase
java.lang.Object
com.amazonaws.services.simpleworkflow.flow.junit.WorkflowTestBase
- All Implemented Interfaces:
- org.junit.rules.MethodRule
- Direct Known Subclasses:
- GenericWorkflowTest, SpringWorkflowTest, WorkflowTest
public abstract class WorkflowTestBase
- extends Object
- implements org.junit.rules.MethodRule
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
defaultActivitiesTaskListToPoll
protected String defaultActivitiesTaskListToPoll
decisionContext
protected DecisionContext decisionContext
workflowContext
protected TestWorkflowContext workflowContext
workflowClock
protected TestWorkflowClock workflowClock
WorkflowTestBase
public WorkflowTestBase(DecisionContext decisionContext)
isDisableOutstandingTasksCheck
public boolean isDisableOutstandingTasksCheck()
setDisableOutstandingTasksCheck
public void setDisableOutstandingTasksCheck(boolean disableOutstandingTasksCheck)
- When set to
true
it is considered a test failure to have
outstanding tasks that are blocked on non external events or timers. Such
blockage is usually indicates a bug that can lead to a workflow
"getting stuck". Default is true
.
getDecisionContext
public DecisionContext getDecisionContext()
setWorkflowExecution
public void setWorkflowExecution(WorkflowExecution workflowExecution)
setWorkflowType
public void setWorkflowType(WorkflowType workflowType)
getWorkflowExecution
public WorkflowExecution getWorkflowExecution()
getWorkflowType
public WorkflowType getWorkflowType()
getDefaultActivitiesTaskListToPoll
public String getDefaultActivitiesTaskListToPoll()
setDefaultActivitiesTaskListToPoll
public void setDefaultActivitiesTaskListToPoll(String defaultActivitiesTaskListToPoll)
getClockAcceleration
public double getClockAcceleration()
setClockAccelerationCoefficient
public void setClockAccelerationCoefficient(double clockAcceleration)
- Accelerate workflow clock according the coefficient. Note that the clock
acceleration affects time returned by
WorkflowClock
and timers
firing only. The default is 1.0 (no acceleration).
- Parameters:
clockAcceleration
- value that is larger then 1.0
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runners.model.FrameworkMethod method,
Object target)
- Specified by:
apply
in interface org.junit.rules.MethodRule
waitBlocked
public Promise<Void> waitBlocked(Promise<?>... waitFor)
- Here blocked means that there are no any tasks that are ready to be
executed. Usually these tasks wait for timers or some other external
events.
- Returns:
- Promise that becomes ready when there are not tasks to execute
setClockCurrentTimeMillis
public void setClockCurrentTimeMillis(long timeMillis)
clockAdvanceSeconds
public void clockAdvanceSeconds(long seconds)
clockAdvanceSeconds
public void clockAdvanceSeconds(long seconds,
Promise<?>... waitFor)
beforeEvaluate
protected void beforeEvaluate(DecisionContext decisionContext)
afterEvaluate
protected void afterEvaluate()
setTestTimeoutActualTimeMilliseconds
public void setTestTimeoutActualTimeMilliseconds(long timeout)
- Test timeout time. Uses real clock that ignores acceleration (see
setClockAccelerationCoefficient(double)
). Instead of calling
this method consider using FlowBlockJUnit4ClassRunner
or
FlowSpringJUnit4ClassRunner
and timeout parameter of @Test
annotation.
- Parameters:
timeout
- time in milliseconds.
setExpectedException
public void setExpectedException(Class<? extends Throwable> expectedException)
setFlowTestRunner
public void setFlowTestRunner(boolean flowTestRunner)
Copyright © 2016. All rights reserved.