com.amazonaws.services.simpleworkflow.flow.junit
Class WorkflowTestBase

java.lang.Object
  extended by 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


Field Summary
protected  DecisionContext decisionContext
           
protected  String defaultActivitiesTaskListToPoll
           
protected  TestWorkflowClock workflowClock
           
protected  TestWorkflowContext workflowContext
           
 
Constructor Summary
WorkflowTestBase(DecisionContext decisionContext)
           
 
Method Summary
protected  void afterEvaluate()
           
 org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runners.model.FrameworkMethod method, Object target)
           
protected  void beforeEvaluate(DecisionContext decisionContext)
           
 void clockAdvanceSeconds(long seconds)
           
 void clockAdvanceSeconds(long seconds, Promise<?>... waitFor)
           
 double getClockAcceleration()
           
 DecisionContext getDecisionContext()
           
 String getDefaultActivitiesTaskListToPoll()
           
 WorkflowExecution getWorkflowExecution()
           
 WorkflowType getWorkflowType()
           
 boolean isDisableOutstandingTasksCheck()
           
 void setClockAccelerationCoefficient(double clockAcceleration)
          Accelerate workflow clock according the coefficient.
 void setClockCurrentTimeMillis(long timeMillis)
           
 void setDefaultActivitiesTaskListToPoll(String defaultActivitiesTaskListToPoll)
           
 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.
 void setExpectedException(Class<? extends Throwable> expectedException)
           
 void setFlowTestRunner(boolean flowTestRunner)
           
 void setTestTimeoutActualTimeMilliseconds(long timeout)
          Test timeout time.
 void setWorkflowExecution(WorkflowExecution workflowExecution)
           
 void setWorkflowType(WorkflowType workflowType)
           
 Promise<Void> waitBlocked(Promise<?>... waitFor)
          Here blocked means that there are no any tasks that are ready to be executed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultActivitiesTaskListToPoll

protected String defaultActivitiesTaskListToPoll

decisionContext

protected DecisionContext decisionContext

workflowContext

protected TestWorkflowContext workflowContext

workflowClock

protected TestWorkflowClock workflowClock
Constructor Detail

WorkflowTestBase

public WorkflowTestBase(DecisionContext decisionContext)
Method Detail

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.