use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.
the class BoundaryConditionalEventTest method testNonInterruptingSetVariableInCallActivity.
@Test
public void testNonInterruptingSetVariableInCallActivity() {
engine.manageDeployment(repositoryService.createDeployment().addModelInstance(CONDITIONAL_MODEL, DELEGATED_PROCESS).deploy());
final BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().userTask(TASK_BEFORE_CONDITION_ID).name(TASK_BEFORE_CONDITION).callActivity(TASK_WITH_CONDITION_ID).calledElement(DELEGATED_PROCESS_KEY).userTask().name(TASK_AFTER_SERVICE_TASK).endEvent().done();
deployConditionalBoundaryEventProcess(modelInstance, TASK_WITH_CONDITION_ID, false);
// given
ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY);
TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.getId());
Task task = taskQuery.singleResult();
assertNotNull(task);
assertEquals(TASK_BEFORE_CONDITION, task.getName());
// when task is completed
taskService.complete(task.getId());
// then service task in call activity sets variable
// conditional event is not triggered
tasksAfterVariableIsSet = taskQuery.list();
assertEquals(TASK_AFTER_SERVICE_TASK, tasksAfterVariableIsSet.get(0).getName());
}
use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.
the class BoundaryConditionalEventTest method testCleanUpConditionalEventSubscriptions.
@Test
@Deployment
public void testCleanUpConditionalEventSubscriptions() {
// given process with boundary conditional event
ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY);
TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.getId());
Task task = taskQuery.singleResult();
assertEquals(1, conditionEventSubscriptionQuery.list().size());
// when task is completed
taskService.complete(task.getId());
// then conditional subscription should be deleted
tasksAfterVariableIsSet = taskQuery.list();
assertEquals(1, tasksAfterVariableIsSet.size());
assertEquals(0, conditionEventSubscriptionQuery.list().size());
}
use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.
the class BoundaryConditionalEventTest method testParallelVariableCondition.
@Test
@Deployment
public void testParallelVariableCondition() {
// given process with parallel user tasks and boundary conditional event
ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY);
TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.getId());
List<Task> tasks = taskQuery.list();
assertEquals(2, tasks.size());
assertEquals(2, conditionEventSubscriptionQuery.list().size());
Task task = tasks.get(0);
// when local variable is set on task
taskService.setVariableLocal(task.getId(), VARIABLE_NAME, 1);
// then nothing happens
tasks = taskQuery.list();
assertEquals(2, tasks.size());
// when local variable is set on task execution
runtimeService.setVariableLocal(task.getExecutionId(), VARIABLE_NAME, 1);
// then boundary event is triggered of this task and task ends (subscription is deleted)
// other execution stays in other task
tasksAfterVariableIsSet = taskQuery.list();
assertEquals(1, tasksAfterVariableIsSet.size());
assertEquals(1, conditionEventSubscriptionQuery.list().size());
}
use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.
the class BoundaryConditionalEventTest method testNonInterruptingSubProcessVariableCondition.
@Test
@Deployment
public void testNonInterruptingSubProcessVariableCondition() {
// given process with boundary conditional event on sub process
ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY);
TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.getId());
Task task = taskQuery.singleResult();
assertNotNull(task);
assertEquals(TASK_IN_SUB_PROCESS, task.getName());
// when variable is set on task with condition
taskService.setVariable(task.getId(), VARIABLE_NAME, 1);
// then execution stays on user task and at task after condition
tasksAfterVariableIsSet = taskQuery.list();
assertEquals(2, tasksAfterVariableIsSet.size());
}
use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.
the class BoundaryConditionalEventTest method testNonInterruptingSetVariableInInputMapping.
@Test
public void testNonInterruptingSetVariableInInputMapping() {
final BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().userTask().name(TASK_BEFORE_CONDITION).serviceTask(TASK_WITH_CONDITION_ID).camundaInputParameter(VARIABLE_NAME, "1").camundaExpression(TRUE_CONDITION).userTask().name(TASK_AFTER_SERVICE_TASK).endEvent().done();
deployConditionalBoundaryEventProcess(modelInstance, TASK_WITH_CONDITION_ID, false);
// given
ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY);
TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.getId());
Task task = taskQuery.singleResult();
assertNotNull(task);
assertEquals(TASK_BEFORE_CONDITION, task.getName());
// when task before service task is completed
taskService.complete(task.getId());
// then the variable is set in an input mapping
// -> non interrupting conditional event is not triggered
tasksAfterVariableIsSet = taskQuery.list();
assertEquals(TASK_AFTER_SERVICE_TASK, tasksAfterVariableIsSet.get(0).getName());
}
Aggregations