use of org.camunda.bpm.engine.test.cmmn.tasklistener.util.MyTaskListener in project camunda-bpm-platform by camunda.
the class TaskListenerTest method testAllListenerByExpressionExcludingCompletion.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/tasklistener/TaskListenerTest.testAllListenerByExpression.cmmn" })
public void testAllListenerByExpressionExcludingCompletion() {
// given
String caseInstanceId = caseService.withCaseDefinitionByKey("case").setVariable("myTaskListener", new MyTaskListener()).create().getId();
String humanTaskId = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult().getId();
// when
String taskId = taskService.createTaskQuery().caseExecutionId(humanTaskId).singleResult().getId();
taskService.setAssignee(taskId, "jonny");
terminate(humanTaskId);
// then
VariableInstanceQuery query = runtimeService.createVariableInstanceQuery().caseInstanceIdIn(caseInstanceId);
assertEquals(8, query.count());
assertTrue((Boolean) query.variableName("create").singleResult().getValue());
assertEquals(1, query.variableName("createEventCounter").singleResult().getValue());
assertTrue((Boolean) query.variableName("assignment").singleResult().getValue());
assertEquals(1, query.variableName("assignmentEventCounter").singleResult().getValue());
assertTrue((Boolean) query.variableName("delete").singleResult().getValue());
assertEquals(1, query.variableName("deleteEventCounter").singleResult().getValue());
assertEquals(3, query.variableName("eventCounter").singleResult().getValue());
}
use of org.camunda.bpm.engine.test.cmmn.tasklistener.util.MyTaskListener in project camunda-bpm-platform by camunda.
the class TaskListenerTest method testCompleteListenerByExpression.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/tasklistener/TaskListenerTest.testCompleteListenerByExpression.cmmn" })
public void testCompleteListenerByExpression() {
// given
String caseInstanceId = caseService.withCaseDefinitionByKey("case").setVariable("myTaskListener", new MyTaskListener()).create().getId();
String humanTaskId = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult().getId();
// when
caseService.withCaseExecution(humanTaskId).complete();
// then
VariableInstanceQuery query = runtimeService.createVariableInstanceQuery().caseInstanceIdIn(caseInstanceId);
assertEquals(4, query.count());
assertTrue((Boolean) query.variableName("complete").singleResult().getValue());
assertEquals(1, query.variableName("completeEventCounter").singleResult().getValue());
assertEquals(1, query.variableName("eventCounter").singleResult().getValue());
}
Aggregations