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());
}
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());
}
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());
}
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());
}
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());
}
Aggregations