Class ReceiveTaskHandler

java.lang.Object
org.camunda.community.bpmndt.api.ReceiveTaskHandler

public class ReceiveTaskHandler extends Object
Fluent API to handle receive tasks.
  • Constructor Details

    • ReceiveTaskHandler

      public ReceiveTaskHandler(org.camunda.bpm.engine.ProcessEngine processEngine, String activityId, String eventName)
  • Method Details

    • apply

      protected void apply(org.camunda.bpm.engine.runtime.ProcessInstance pi)
    • customize

      public ReceiveTaskHandler customize(Consumer<ReceiveTaskHandler> customizer)
      Customizes the handler, using the given Consumer function. 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 a ReceiveTaskHandler.
      Returns:
      The handler.
    • execute

      public void execute(Consumer<org.camunda.bpm.engine.runtime.EventSubscription> action)
      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 an EventSubscription.
      Throws:
      IllegalArgumentException - if action is null.
    • eventReceived

      public void eventReceived()
      Continues the waiting execution with an action that calls messageEventReceived. Please note: this is the default behavior.
      See Also:
      • RuntimeService.messageEventReceived(String, String, Map)
    • 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 an ProcessInstanceAssert instance and an EventSubscription.
      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

      public ReceiveTaskHandler withVariable(String name, Object value)
      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

      public ReceiveTaskHandler withVariables(Map<String,Object> variables)
      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.