Search in sources :

Example 6 with BpmnError

use of org.camunda.bpm.engine.delegate.BpmnError in project camunda-bpm-platform by camunda.

the class InputOutputTest method FAILING_testBpmnErrorInScriptOutputMapping.

@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/iomapping/InputOutputTest.testThrowErrorInScriptInputOutputMapping.bpmn")
public void FAILING_testBpmnErrorInScriptOutputMapping() {
    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"));
}
Also used : Task(org.camunda.bpm.engine.task.Task) HashMap(java.util.HashMap) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) BpmnError(org.camunda.bpm.engine.delegate.BpmnError) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 7 with BpmnError

use of org.camunda.bpm.engine.delegate.BpmnError in project camunda-bpm-platform by camunda.

the class ConnectProcessEnginePluginTest method testConnectorBpmnErrorThrownInScriptResourceNoAsyncAfterJobIsCreated.

@Deployment(resources = "org/camunda/connect/plugin/ConnectProcessEnginePluginTest.testConnectorBpmnErrorThrownInScriptResourceNoAsyncAfterJobIsCreated.bpmn")
public void testConnectorBpmnErrorThrownInScriptResourceNoAsyncAfterJobIsCreated() {
    // given
    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("throwInMapping", "in");
    variables.put("exception", new BpmnError("error"));
    // when
    runtimeService.startProcessInstanceByKey("testProcess", variables);
    // then
    // 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"));
    // no job is created
    assertThat(Long.valueOf(managementService.createJobQuery().count()), is(0l));
}
Also used : Task(org.camunda.bpm.engine.task.Task) HashMap(java.util.HashMap) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) BpmnError(org.camunda.bpm.engine.delegate.BpmnError) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 8 with BpmnError

use of org.camunda.bpm.engine.delegate.BpmnError in project camunda-bpm-platform by camunda.

the class ConnectProcessEnginePluginTest method testConnectorBpmnErrorThrownInScriptOutputMappingIsHandledByBoundaryEvent.

@Deployment(resources = "org/camunda/connect/plugin/ConnectProcessEnginePluginTest.testConnectorWithThrownExceptionInScriptInputOutputMapping.bpmn")
public void testConnectorBpmnErrorThrownInScriptOutputMappingIsHandledByBoundaryEvent() {
    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"));
}
Also used : Task(org.camunda.bpm.engine.task.Task) HashMap(java.util.HashMap) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) BpmnError(org.camunda.bpm.engine.delegate.BpmnError) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 9 with BpmnError

use of org.camunda.bpm.engine.delegate.BpmnError in project camunda-bpm-platform by camunda.

the class BoundaryErrorEventTest method testUncaughtError.

@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/event/error/BoundaryErrorEventTest.subprocess.bpmn20.xml" })
public void testUncaughtError() {
    runtimeService.startProcessInstanceByKey("simpleSubProcess");
    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());
    }
}
Also used : Task(org.camunda.bpm.engine.task.Task) BpmnError(org.camunda.bpm.engine.delegate.BpmnError) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 10 with BpmnError

use of org.camunda.bpm.engine.delegate.BpmnError in project camunda-bpm-platform by camunda.

the class InputOutputTest method FAILING_testBpmnErrorInScriptInputMapping.

@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/iomapping/InputOutputTest.testThrowErrorInScriptInputOutputMapping.bpmn")
public void FAILING_testBpmnErrorInScriptInputMapping() {
    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"));
}
Also used : Task(org.camunda.bpm.engine.task.Task) HashMap(java.util.HashMap) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) BpmnError(org.camunda.bpm.engine.delegate.BpmnError) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

BpmnError (org.camunda.bpm.engine.delegate.BpmnError)10 Task (org.camunda.bpm.engine.task.Task)9 Deployment (org.camunda.bpm.engine.test.Deployment)9 HashMap (java.util.HashMap)7 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)7 ExternalTaskActivityBehavior (org.camunda.bpm.engine.impl.bpmn.behavior.ExternalTaskActivityBehavior)1 ActivityExecution (org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution)1