Search in sources :

Example 1 with ThrowErrorDelegate

use of org.camunda.bpm.engine.test.bpmn.event.error.ThrowErrorDelegate in project camunda-bpm-platform by camunda.

the class MultiInstanceTest method testCatchExceptionThrownBySignalOfParallelDelegateExpression.

@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/multiinstance/MultiInstanceTest.testCatchErrorThrownByParallelDelegateExpression.bpmn20.xml" })
public void testCatchExceptionThrownBySignalOfParallelDelegateExpression() {
    VariableMap variables = Variables.createVariables().putValue("myDelegate", new ThrowErrorDelegate());
    String pi = runtimeService.startProcessInstanceByKey("testProcess", variables).getId();
    assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
    assertNull(runtimeService.getVariable(pi, "signaled"));
    Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").list().get(3);
    assertNotNull(serviceTask);
    runtimeService.setVariables(pi, throwException());
    runtimeService.signal(serviceTask.getId());
    assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
    assertTrue((Boolean) runtimeService.getVariable(pi, "signaled"));
    Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult();
    assertNotNull(userTask);
    assertEquals("userTaskException", userTask.getTaskDefinitionKey());
    taskService.complete(userTask.getId());
}
Also used : ThrowErrorDelegate(org.camunda.bpm.engine.test.bpmn.event.error.ThrowErrorDelegate) Task(org.camunda.bpm.engine.task.Task) ThrowErrorDelegate.leaveExecution(org.camunda.bpm.engine.test.bpmn.event.error.ThrowErrorDelegate.leaveExecution) Execution(org.camunda.bpm.engine.runtime.Execution) VariableMap(org.camunda.bpm.engine.variable.VariableMap) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 2 with ThrowErrorDelegate

use of org.camunda.bpm.engine.test.bpmn.event.error.ThrowErrorDelegate in project camunda-bpm-platform by camunda.

the class MultiInstanceTest method testCatchExceptionThrownByExecuteOfSequentialDelegateExpression.

@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/multiinstance/MultiInstanceTest.testCatchErrorThrownBySequentialDelegateExpression.bpmn20.xml" })
public void testCatchExceptionThrownByExecuteOfSequentialDelegateExpression() {
    VariableMap variables = Variables.createVariables().putValue("myDelegate", new ThrowErrorDelegate());
    variables.putAll(throwException());
    String pi = runtimeService.startProcessInstanceByKey("testProcess", variables).getId();
    assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
    assertNull(runtimeService.getVariable(pi, "signaled"));
    Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult();
    assertNotNull(userTask);
    assertEquals("userTaskException", userTask.getTaskDefinitionKey());
    taskService.complete(userTask.getId());
}
Also used : ThrowErrorDelegate(org.camunda.bpm.engine.test.bpmn.event.error.ThrowErrorDelegate) Task(org.camunda.bpm.engine.task.Task) VariableMap(org.camunda.bpm.engine.variable.VariableMap) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 3 with ThrowErrorDelegate

use of org.camunda.bpm.engine.test.bpmn.event.error.ThrowErrorDelegate in project camunda-bpm-platform by camunda.

the class MultiInstanceTest method testCatchErrorThrownBySignalOfParallelDelegateExpression.

@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/multiinstance/MultiInstanceTest.testCatchErrorThrownByParallelDelegateExpression.bpmn20.xml" })
public void testCatchErrorThrownBySignalOfParallelDelegateExpression() {
    VariableMap variables = Variables.createVariables().putValue("myDelegate", new ThrowErrorDelegate());
    String pi = runtimeService.startProcessInstanceByKey("testProcess", variables).getId();
    assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
    assertNull(runtimeService.getVariable(pi, "signaled"));
    Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").list().get(3);
    assertNotNull(serviceTask);
    runtimeService.setVariables(pi, throwError());
    runtimeService.signal(serviceTask.getId());
    assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
    assertTrue((Boolean) runtimeService.getVariable(pi, "signaled"));
    Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult();
    assertNotNull(userTask);
    assertEquals("userTaskError", userTask.getTaskDefinitionKey());
    taskService.complete(userTask.getId());
}
Also used : ThrowErrorDelegate(org.camunda.bpm.engine.test.bpmn.event.error.ThrowErrorDelegate) Task(org.camunda.bpm.engine.task.Task) ThrowErrorDelegate.leaveExecution(org.camunda.bpm.engine.test.bpmn.event.error.ThrowErrorDelegate.leaveExecution) Execution(org.camunda.bpm.engine.runtime.Execution) VariableMap(org.camunda.bpm.engine.variable.VariableMap) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 4 with ThrowErrorDelegate

use of org.camunda.bpm.engine.test.bpmn.event.error.ThrowErrorDelegate in project camunda-bpm-platform by camunda.

the class MultiInstanceTest method testCatchExceptionThrownBySignalOfSequentialDelegateExpression.

@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/multiinstance/MultiInstanceTest.testCatchErrorThrownBySequentialDelegateExpression.bpmn20.xml" })
public void testCatchExceptionThrownBySignalOfSequentialDelegateExpression() {
    VariableMap variables = Variables.createVariables().putValue("myDelegate", new ThrowErrorDelegate());
    String pi = runtimeService.startProcessInstanceByKey("testProcess", variables).getId();
    assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
    assertNull(runtimeService.getVariable(pi, "signaled"));
    // signal 2 times to execute first sequential behaviors
    runtimeService.setVariables(pi, leaveExecution());
    runtimeService.signal(runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult().getId());
    runtimeService.setVariables(pi, leaveExecution());
    runtimeService.signal(runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult().getId());
    Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult();
    assertNotNull(serviceTask);
    runtimeService.setVariables(pi, throwException());
    runtimeService.signal(serviceTask.getId());
    assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
    assertTrue((Boolean) runtimeService.getVariable(pi, "signaled"));
    Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult();
    assertNotNull(userTask);
    assertEquals("userTaskException", userTask.getTaskDefinitionKey());
    taskService.complete(userTask.getId());
}
Also used : ThrowErrorDelegate(org.camunda.bpm.engine.test.bpmn.event.error.ThrowErrorDelegate) Task(org.camunda.bpm.engine.task.Task) ThrowErrorDelegate.leaveExecution(org.camunda.bpm.engine.test.bpmn.event.error.ThrowErrorDelegate.leaveExecution) Execution(org.camunda.bpm.engine.runtime.Execution) VariableMap(org.camunda.bpm.engine.variable.VariableMap) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 5 with ThrowErrorDelegate

use of org.camunda.bpm.engine.test.bpmn.event.error.ThrowErrorDelegate in project camunda-bpm-platform by camunda.

the class MultiInstanceTest method testCatchExceptionThrownByExecuteOfParallelDelegateExpression.

@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/multiinstance/MultiInstanceTest.testCatchErrorThrownByParallelDelegateExpression.bpmn20.xml" })
public void testCatchExceptionThrownByExecuteOfParallelDelegateExpression() {
    VariableMap variables = Variables.createVariables().putValue("myDelegate", new ThrowErrorDelegate());
    variables.putAll(throwException());
    String pi = runtimeService.startProcessInstanceByKey("testProcess", variables).getId();
    assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
    assertNull(runtimeService.getVariable(pi, "signaled"));
    Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult();
    assertNotNull(userTask);
    assertEquals("userTaskException", userTask.getTaskDefinitionKey());
    taskService.complete(userTask.getId());
}
Also used : ThrowErrorDelegate(org.camunda.bpm.engine.test.bpmn.event.error.ThrowErrorDelegate) Task(org.camunda.bpm.engine.task.Task) VariableMap(org.camunda.bpm.engine.variable.VariableMap) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

Task (org.camunda.bpm.engine.task.Task)8 Deployment (org.camunda.bpm.engine.test.Deployment)8 ThrowErrorDelegate (org.camunda.bpm.engine.test.bpmn.event.error.ThrowErrorDelegate)8 VariableMap (org.camunda.bpm.engine.variable.VariableMap)8 Execution (org.camunda.bpm.engine.runtime.Execution)4 ThrowErrorDelegate.leaveExecution (org.camunda.bpm.engine.test.bpmn.event.error.ThrowErrorDelegate.leaveExecution)4