use of org.camunda.bpm.engine.runtime.Execution 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.runtime.Execution in project camunda-bpm-platform by camunda.
the class MultiInstanceTest method testCatchExceptionThrownBySignalOfSequentialAbstractBpmnActivityBehavior.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/multiinstance/MultiInstanceTest.testCatchErrorThrownBySequentialAbstractBpmnActivityBehavior.bpmn20.xml" })
public void testCatchExceptionThrownBySignalOfSequentialAbstractBpmnActivityBehavior() {
String pi = runtimeService.startProcessInstanceByKey("testProcess").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.runtime.Execution in project camunda-bpm-platform by camunda.
the class MultiInstanceTest method testSequentialScriptTasksCompletionCondition.
@Deployment
public void testSequentialScriptTasksCompletionCondition() {
runtimeService.startProcessInstanceByKey("miSequentialScriptTaskCompletionCondition").getId();
Execution waitStateExecution = runtimeService.createExecutionQuery().singleResult();
int sum = (Integer) runtimeService.getVariable(waitStateExecution.getId(), "sum");
assertEquals(5, sum);
}
use of org.camunda.bpm.engine.runtime.Execution in project camunda-bpm-platform by camunda.
the class MultiInstanceTest method testParallelScriptTasks.
@Deployment
public void testParallelScriptTasks() {
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("sum", 0);
vars.put("nrOfLoops", 10);
runtimeService.startProcessInstanceByKey("miParallelScriptTask", vars);
Execution waitStateExecution = runtimeService.createExecutionQuery().singleResult();
int sum = (Integer) runtimeService.getVariable(waitStateExecution.getId(), "sum");
assertEquals(45, sum);
}
use of org.camunda.bpm.engine.runtime.Execution 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());
}
Aggregations