Package org.camunda.community.bpmndt.api
Class ReceiveTaskHandler
java.lang.Object
org.camunda.community.bpmndt.api.ReceiveTaskHandler
Fluent API to handle receive tasks.
-
Constructor Summary
ConstructorsConstructorDescriptionReceiveTaskHandler(org.camunda.bpm.engine.ProcessEngine processEngine, String activityId, String eventName) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapply(org.camunda.bpm.engine.runtime.ProcessInstance pi) customize(Consumer<ReceiveTaskHandler> customizer) Customizes the handler, using the givenConsumerfunction.voidContinues the waiting execution with an action that callsmessageEventReceived.protected voideventReceived(org.camunda.bpm.engine.runtime.EventSubscription eventSubscription) voidExecutes a custom action that handles the receive task, when the process instance is waiting at the corresponding activity.booleanDetermines if the receive task is waiting for a boundary message, signal or timer event.verify(BiConsumer<org.camunda.bpm.engine.test.assertions.bpmn.ProcessInstanceAssert, org.camunda.bpm.engine.runtime.EventSubscription> verifier) Verifies the receive task's waiting state.voidApplies no action at the receive task's wait state.withVariable(String name, Object value) Sets a variable, which is passed to the execution when the default behavior is used.withVariables(Map<String, Object> variables) Sets variables, which are passed to the execution when the default behavior is used.withVariableTyped(String name, org.camunda.bpm.engine.variable.value.TypedValue value) Sets a typed variable, which is passed to the execution when the default behavior is used.
-
Constructor Details
-
ReceiveTaskHandler
-
-
Method Details
-
apply
protected void apply(org.camunda.bpm.engine.runtime.ProcessInstance pi) -
customize
Customizes the handler, using the givenConsumerfunction. This method can be used to apply a common customization needed for different test cases.tc.handleReceiveTask().customize(this::prepareEvent);
- Parameters:
customizer- A function that accepts aReceiveTaskHandler.- Returns:
- The handler.
-
execute
Executes a custom action that handles the receive task, when the process instance is waiting at the corresponding activity.- Parameters:
action- A specific action that accepts anEventSubscription.- Throws:
IllegalArgumentException- if action isnull.
-
eventReceived
public void eventReceived()Continues the waiting execution with an action that callsmessageEventReceived. Please note: this is the default behavior.- See Also:
-
eventReceived
protected void eventReceived(org.camunda.bpm.engine.runtime.EventSubscription eventSubscription) -
isWaitingForBoundaryEvent
public boolean isWaitingForBoundaryEvent()Determines if the receive task is waiting for a boundary message, signal or timer event.- Returns:
true, if it is waiting for a boundary event.false, if not.
-
verify
public ReceiveTaskHandler verify(BiConsumer<org.camunda.bpm.engine.test.assertions.bpmn.ProcessInstanceAssert, org.camunda.bpm.engine.runtime.EventSubscription> verifier) Verifies the receive task's waiting state.- Parameters:
verifier- Verifier that accepts anProcessInstanceAssertinstance and anEventSubscription.- Returns:
- The handler.
-
waitForBoundaryEvent
public void waitForBoundaryEvent()Applies no action at the receive task's wait state. This is required to wait for events ( message, signal or timer events) that are attached as boundary events on the activity itself or on the surrounding scope (e.g. embedded subprocess). -
withVariable
Sets a variable, which is passed to the execution when the default behavior is used.- Parameters:
name- The name of the variable.value- The variable's value.- Returns:
- The handler.
-
withVariables
Sets variables, which are passed to the execution when the default behavior is used.- Parameters:
variables- A map of variables to set.- Returns:
- The handler.
-
withVariableTyped
public ReceiveTaskHandler withVariableTyped(String name, org.camunda.bpm.engine.variable.value.TypedValue value) Sets a typed variable, which is passed to the execution when the default behavior is used.- Parameters:
name- The name of the variable.value- The variable's typed value.- Returns:
- The handler.
-