public class ExternalTaskHandler extends Object
| Constructor and Description |
|---|
ExternalTaskHandler(org.camunda.bpm.engine.ProcessEngine processEngine,
String activityId,
String topicName) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
apply(org.camunda.bpm.engine.runtime.ProcessInstance pi) |
void |
complete()
Completes the external task with an action that fetches/locks the task and calls
complete. |
protected void |
complete(String topicName) |
ExternalTaskHandler |
customize(Consumer<ExternalTaskHandler> customizer)
Customizes the handler, using the given
Consumer function. |
void |
execute(Consumer<String> action)
Executes a custom action that handles the external task.
|
protected void |
handleBpmnError(String topicName) |
void |
handleBpmnError(String errorCode,
String errorMessage)
Continues the execution with an action that calls
handleBpmnError using the given error
code and message. |
boolean |
isWaitingForBoundaryEvent()
Determines if the external task is waiting for a boundary message, signal or timer event.
|
ExternalTaskHandler |
verify(BiConsumer<org.camunda.bpm.engine.test.assertions.bpmn.ProcessInstanceAssert,String> verifier)
Verifies the external task's waiting state.
|
void |
waitForBoundaryEvent()
Applies no action at the external task's wait state.
|
ExternalTaskHandler |
withErrorMessage(String errorMessage)
Sets the error message, which is used when the next activity is an error boundary event - in this
case the handler's default action is
handleBpmnError. |
ExternalTaskHandler |
withLocalVariable(String name,
Object value)
Sets a local variable, which is passed to the execution when the default action is used.
|
ExternalTaskHandler |
withLocalVariableTyped(String name,
org.camunda.bpm.engine.variable.value.TypedValue value)
Sets a typed local variable, which is passed to the execution when the default action is used.
|
ExternalTaskHandler |
withVariable(String name,
Object value)
Sets a variable, which is passed to the execution when the default action is used.
|
ExternalTaskHandler |
withVariableTyped(String name,
org.camunda.bpm.engine.variable.value.TypedValue value)
Sets a typed variable, which is passed to the execution when the default action is used.
|
protected void apply(org.camunda.bpm.engine.runtime.ProcessInstance pi)
public void complete()
complete.ExternalTaskService.complete(String, String, java.util.Map, java.util.Map)protected void complete(String topicName)
public ExternalTaskHandler customize(Consumer<ExternalTaskHandler> customizer)
Consumer function. This method can be used to
apply a common customization needed for different test cases.
tc.handleExternalTask().customize(this::prepareExternalTask);
customizer - A function that accepts a ExternalTaskHandler.public void execute(Consumer<String> action)
action - A specific action that accepts the related topic name (String).public void handleBpmnError(String errorCode, String errorMessage)
handleBpmnError using the given error
code and message.errorCode - The error code of the attached boundary error event.errorMessage - An error message or null.ExternalTaskService.handleBpmnError(String, String, String, String, java.util.Map)protected void handleBpmnError(String topicName)
public boolean isWaitingForBoundaryEvent()
true, if it is waiting for a boundary event. false, if not.public ExternalTaskHandler verify(BiConsumer<org.camunda.bpm.engine.test.assertions.bpmn.ProcessInstanceAssert,String> verifier)
verifier - Verifier that accepts an ProcessInstanceAssert instance and the related
topic name (String).public void waitForBoundaryEvent()
public ExternalTaskHandler withErrorMessage(String errorMessage)
handleBpmnError.errorMessage - An error message or null.public ExternalTaskHandler withLocalVariable(String name, Object value)
name - The name of the local variable.value - The local variable's value.public ExternalTaskHandler withLocalVariableTyped(String name, org.camunda.bpm.engine.variable.value.TypedValue value)
name - The name of the local variable.value - The local variable's typed value.public ExternalTaskHandler withVariable(String name, Object value)
name - The name of the variable.value - The variable's value.public ExternalTaskHandler withVariableTyped(String name, org.camunda.bpm.engine.variable.value.TypedValue value)
name - The name of the variable.value - The variable's typed value.Copyright © 2023 Camunda Services GmbH. All rights reserved.