Class DefaultWorkflowTestDriver
java.lang.Object
io.axoniq.framework.workflow.runtime.test.fixture.DefaultWorkflowTestDriver
- All Implemented Interfaces:
WorkflowTestDriver
Default implementation of
WorkflowTestDriver.- Since:
- 5.4.0
- Author:
- Simon Zambrovski
-
Method Summary
Modifier and TypeMethodDescriptionReturns the assertion failure handler.voidawaitEventually(String description, org.awaitility.core.ThrowingRunnable assertion) Waits until the given condition is met, using the defined assertion failure handler.voidexecuteStep(String stepName) Waits until the given step is executed calling original action defined in the workflow definition.voidexecuteStep(String stepName, PayloadProcessor payloadProcessor) Waits until the given step is executed calling the given payload processor.voidexecuteStepFailing(String stepName, StepFailedException exception) Waits until the given step is executed throwing the given exception.Waits until an active workflow execution exists.executionMatches(Predicate<WorkflowExecution> predicate) Waits until an active workflow execution matching the predicate exists.voidexecutionSatisfies(Consumer<WorkflowExecution> executionConsumer) Waits until an active workflow execution exists and applies the given consumer.Waits until a workflow history exists.historyMatches(Predicate<WorkflowHistory> predicate) Waits until a workflow history matching the predicate exists.voidhistorySatisfies(Consumer<WorkflowHistory> historyConsumer) Waits until a workflow history exists and applies the given consumer.voidWaits until no active workflow executions exist.voidAsserts that no workflow histories exist.voidpublishEvent(Object event) Publishes an event.voidshutdown()Shuts down the tester.booleanIndicates whether this driver runs in stepping mode.Returns the shared testing state.voidtimePasses(Duration duration) Advances time by the given duration.Returns services for testing workflow runtime.
-
Method Details
-
workflowTestServices
Description copied from interface:WorkflowTestDriverReturns services for testing workflow runtime.- Specified by:
workflowTestServicesin interfaceWorkflowTestDriver- Returns:
- services for testing workflow runtime
-
testingState
Description copied from interface:WorkflowTestDriverReturns the shared testing state.- Specified by:
testingStatein interfaceWorkflowTestDriver- Returns:
- shared testing state
-
assertionFailureHandler
Description copied from interface:WorkflowTestDriverReturns the assertion failure handler.- Specified by:
assertionFailureHandlerin interfaceWorkflowTestDriver- Returns:
- assertion failure handler
-
steppingMode
public boolean steppingMode()Description copied from interface:WorkflowTestDriverIndicates whether this driver runs in stepping mode.- Specified by:
steppingModein interfaceWorkflowTestDriver- Returns:
trueif this driver runs in stepping mode, otherwisefalse
-
executionExists
Description copied from interface:WorkflowTestDriverWaits until an active workflow execution exists.- Specified by:
executionExistsin interfaceWorkflowTestDriver- Returns:
- the selected execution
-
executionMatches
Description copied from interface:WorkflowTestDriverWaits until an active workflow execution matching the predicate exists.- Specified by:
executionMatchesin interfaceWorkflowTestDriver- Parameters:
predicate- predicate used to select matching executions- Returns:
- the selected execution
-
executionSatisfies
Description copied from interface:WorkflowTestDriverWaits until an active workflow execution exists and applies the given consumer.- Specified by:
executionSatisfiesin interfaceWorkflowTestDriver- Parameters:
executionConsumer- consumer applied to the selected execution
-
noExecution
public void noExecution()Description copied from interface:WorkflowTestDriverWaits until no active workflow executions exist.- Specified by:
noExecutionin interfaceWorkflowTestDriver
-
historyMatches
Description copied from interface:WorkflowTestDriverWaits until a workflow history matching the predicate exists.- Specified by:
historyMatchesin interfaceWorkflowTestDriver- Parameters:
predicate- predicate used to select matching histories- Returns:
- the selected history
-
historyExists
Description copied from interface:WorkflowTestDriverWaits until a workflow history exists.- Specified by:
historyExistsin interfaceWorkflowTestDriver- Returns:
- the selected history
-
historySatisfies
Description copied from interface:WorkflowTestDriverWaits until a workflow history exists and applies the given consumer.- Specified by:
historySatisfiesin interfaceWorkflowTestDriver- Parameters:
historyConsumer- consumer applied to the selected history
-
noHistory
public void noHistory()Description copied from interface:WorkflowTestDriverAsserts that no workflow histories exist.- Specified by:
noHistoryin interfaceWorkflowTestDriver
-
publishEvent
Description copied from interface:WorkflowTestDriverPublishes an event.- Specified by:
publishEventin interfaceWorkflowTestDriver- Parameters:
event- event message or event payload
-
timePasses
Description copied from interface:WorkflowTestDriverAdvances time by the given duration.- Specified by:
timePassesin interfaceWorkflowTestDriver- Parameters:
duration- duration to advance time by
-
executeStep
Description copied from interface:WorkflowTestDriverWaits until the given step is executed calling original action defined in the workflow definition.This works only in stepping mode.
- Specified by:
executeStepin interfaceWorkflowTestDriver- Parameters:
stepName- step name
-
executeStep
Description copied from interface:WorkflowTestDriverWaits until the given step is executed calling the given payload processor.This works only in stepping mode.
- Specified by:
executeStepin interfaceWorkflowTestDriver- Parameters:
stepName- step namepayloadProcessor- payload processor to use instead of the workflow-defined action
-
executeStepFailing
Description copied from interface:WorkflowTestDriverWaits until the given step is executed throwing the given exception.This works only in stepping mode.
- Specified by:
executeStepFailingin interfaceWorkflowTestDriver- Parameters:
stepName- name of the step to executeexception- exception to throw
-
shutdown
public void shutdown()Description copied from interface:WorkflowTestDriverShuts down the tester.- Specified by:
shutdownin interfaceWorkflowTestDriver
-
awaitEventually
Description copied from interface:WorkflowTestDriverWaits until the given condition is met, using the defined assertion failure handler.- Specified by:
awaitEventuallyin interfaceWorkflowTestDriver- Parameters:
description- description of the assertionassertion- assertion to execute
-