use of org.camunda.bpm.engine.delegate.BpmnError in project camunda-bpm-platform by camunda.
the class ConnectProcessEnginePluginTest method testConnectorBpmnErrorThrownInScriptResourceInputMappingIsHandledByBoundaryEvent.
@Deployment(resources = "org/camunda/connect/plugin/ConnectProcessEnginePluginTest.testConnectorWithThrownExceptionInScriptResourceInputOutputMapping.bpmn")
public void testConnectorBpmnErrorThrownInScriptResourceInputMappingIsHandledByBoundaryEvent() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("throwInMapping", "in");
variables.put("exception", new BpmnError("error"));
runtimeService.startProcessInstanceByKey("testProcess", variables);
// we will only reach the user task if the BPMNError from the script was handled by the boundary event
Task task = taskService.createTaskQuery().singleResult();
assertThat(task.getName(), is("User Task"));
}
use of org.camunda.bpm.engine.delegate.BpmnError in project camunda-bpm-platform by camunda.
the class ConnectProcessEnginePluginTest method testConnectorBpmnErrorThrownInScriptInputMappingIsHandledByBoundaryEvent.
@Deployment(resources = "org/camunda/connect/plugin/ConnectProcessEnginePluginTest.testConnectorWithThrownExceptionInScriptInputOutputMapping.bpmn")
public void testConnectorBpmnErrorThrownInScriptInputMappingIsHandledByBoundaryEvent() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("throwInMapping", "in");
variables.put("exception", new BpmnError("error"));
runtimeService.startProcessInstanceByKey("testProcess", variables);
// we will only reach the user task if the BPMNError from the script was handled by the boundary event
Task task = taskService.createTaskQuery().singleResult();
assertThat(task.getName(), is("User Task"));
}
use of org.camunda.bpm.engine.delegate.BpmnError in project camunda-bpm-platform by camunda.
the class ConnectProcessEnginePluginTest method testConnectorBpmnErrorThrownInScriptResourceOutputMappingIsHandledByBoundaryEvent.
@Deployment(resources = "org/camunda/connect/plugin/ConnectProcessEnginePluginTest.testConnectorWithThrownExceptionInScriptResourceInputOutputMapping.bpmn")
public void testConnectorBpmnErrorThrownInScriptResourceOutputMappingIsHandledByBoundaryEvent() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("throwInMapping", "out");
variables.put("exception", new BpmnError("error"));
runtimeService.startProcessInstanceByKey("testProcess", variables);
// we will only reach the user task if the BPMNError from the script was handled by the boundary event
Task task = taskService.createTaskQuery().singleResult();
assertThat(task.getName(), is("User Task"));
}
use of org.camunda.bpm.engine.delegate.BpmnError in project camunda-bpm-platform by camunda.
the class ExternalTaskEntity method bpmnError.
public void bpmnError(String errorCode) {
ensureActive();
ActivityExecution activityExecution = getExecution();
BpmnError bpmnError = new BpmnError(errorCode);
try {
ExternalTaskActivityBehavior behavior = ((ExternalTaskActivityBehavior) activityExecution.getActivity().getActivityBehavior());
behavior.propagateBpmnError(bpmnError, activityExecution);
} catch (Exception ex) {
throw ProcessEngineLogger.CMD_LOGGER.exceptionBpmnErrorPropagationFailed(errorCode, ex);
}
}
use of org.camunda.bpm.engine.delegate.BpmnError in project camunda-bpm-platform by camunda.
the class BoundaryErrorEventTest method testUncaughtErrorOnCallActivity.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/event/error/BoundaryErrorEventTest.testUncaughtErrorOnCallActivity-parent.bpmn20.xml", "org/camunda/bpm/engine/test/bpmn/event/error/BoundaryErrorEventTest.subprocess.bpmn20.xml" })
public void testUncaughtErrorOnCallActivity() {
runtimeService.startProcessInstanceByKey("uncaughtErrorOnCallActivity");
Task task = taskService.createTaskQuery().singleResult();
assertEquals("Task in subprocess", task.getName());
try {
// Completing the task will reach the end error event,
// which is never caught in the process
taskService.complete(task.getId());
} catch (BpmnError e) {
assertTextPresent("No catching boundary event found for error with errorCode 'myError', neither in same process nor in parent process", e.getMessage());
}
}
Aggregations