use of org.camunda.bpm.engine.test.util.ExecutionTree in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationCancellationTest method testCreationAndCancellationInNestedOneTaskProcess.
@Deployment(resources = NESTED_PARALLEL_ONE_TASK_PROCESS)
public void testCreationAndCancellationInNestedOneTaskProcess() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("nestedOneTaskProcess");
String processInstanceId = processInstance.getId();
ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
runtimeService.createProcessInstanceModification(processInstance.getId()).startBeforeActivity("innerTask").cancelActivityInstance(getInstanceIdForActivity(tree, "innerTask")).execute();
assertProcessNotEnded(processInstanceId);
// assert activity instance
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertTrue(!getInstanceIdForActivity(tree, "innerTask").equals(getInstanceIdForActivity(updatedTree, "innerTask")));
assertThat(updatedTree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).activity("outerTask").beginScope("subProcess").activity("innerTask").done());
// assert executions
ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
assertThat(executionTree).matches(describeExecutionTree(null).scope().child("outerTask").concurrent().noScope().up().child(null).concurrent().noScope().child("innerTask").scope().done());
// assert successful completion of process
List<Task> tasks = taskService.createTaskQuery().list();
assertEquals(2, tasks.size());
for (Task task : tasks) {
taskService.complete(task.getId());
}
assertProcessEnded(processInstanceId);
}
use of org.camunda.bpm.engine.test.util.ExecutionTree in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationCancellationTest method testCancellationInNestedOneScopeTaskProcess.
@Deployment(resources = NESTED_PARALLEL_ONE_SCOPE_TASK_PROCESS)
public void testCancellationInNestedOneScopeTaskProcess() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("nestedOneScopeTaskProcess");
String processInstanceId = processInstance.getId();
ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
runtimeService.createProcessInstanceModification(processInstance.getId()).cancelActivityInstance(getInstanceIdForActivity(tree, "innerTask")).execute();
assertProcessNotEnded(processInstanceId);
// assert activity instance
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).activity("outerTask").done());
// assert executions
ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
assertThat(executionTree).matches(describeExecutionTree("outerTask").scope().done());
// assert successful completion of process
Task task = taskService.createTaskQuery().singleResult();
taskService.complete(task.getId());
assertProcessEnded(processInstanceId);
}
use of org.camunda.bpm.engine.test.util.ExecutionTree in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationCancellationTest method testCreationAndCancellationInNestedConcurrentScopeTasksProcess.
@Deployment(resources = NESTED_PARALLEL_CONCURRENT_SCOPE_TASKS_PROCESS)
public void testCreationAndCancellationInNestedConcurrentScopeTasksProcess() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("nestedParallelGatewayScopeTasks");
String processInstanceId = processInstance.getId();
ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
runtimeService.createProcessInstanceModification(processInstance.getId()).startBeforeActivity("innerTask1").cancelActivityInstance(getInstanceIdForActivity(tree, "innerTask1")).execute();
assertProcessNotEnded(processInstanceId);
// assert activity instance
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertTrue(!getInstanceIdForActivity(tree, "innerTask1").equals(getInstanceIdForActivity(updatedTree, "innerTask1")));
assertThat(updatedTree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).activity("outerTask").beginScope("subProcess").activity("innerTask1").activity("innerTask2").done());
// assert executions
ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
assertThat(executionTree).matches(describeExecutionTree(null).scope().child("outerTask").concurrent().noScope().up().child(null).noScope().concurrent().child(null).scope().child(null).concurrent().noScope().child("innerTask1").scope().up().up().child(null).concurrent().noScope().child("innerTask2").scope().done());
// assert successful completion of process
List<Task> tasks = taskService.createTaskQuery().list();
assertEquals(3, tasks.size());
for (Task task : tasks) {
taskService.complete(task.getId());
}
assertProcessEnded(processInstanceId);
}
use of org.camunda.bpm.engine.test.util.ExecutionTree in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationCancellationTest method testCancellationInNestedConcurrentScopeTasksProcess.
@Deployment(resources = NESTED_PARALLEL_CONCURRENT_SCOPE_TASKS_PROCESS)
public void testCancellationInNestedConcurrentScopeTasksProcess() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("nestedParallelGatewayScopeTasks");
String processInstanceId = processInstance.getId();
ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
runtimeService.createProcessInstanceModification(processInstance.getId()).cancelActivityInstance(getInstanceIdForActivity(tree, "innerTask1")).execute();
assertProcessNotEnded(processInstanceId);
// assert activity instance
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).activity("outerTask").beginScope("subProcess").activity("innerTask2").done());
// assert executions
ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
assertThat(executionTree).matches(describeExecutionTree(null).scope().child("outerTask").concurrent().noScope().up().child(null).concurrent().noScope().child(null).scope().child("innerTask2").scope().done());
// assert successful completion of process
List<Task> tasks = taskService.createTaskQuery().list();
assertEquals(2, tasks.size());
for (Task task : tasks) {
taskService.complete(task.getId());
}
assertProcessEnded(processInstanceId);
}
use of org.camunda.bpm.engine.test.util.ExecutionTree in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationCancellationTest method testCancellationInNestedConcurrentProcess.
@Deployment(resources = NESTED_PARALLEL_CONCURRENT_PROCESS)
public void testCancellationInNestedConcurrentProcess() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("nestedParallelGateway");
String processInstanceId = processInstance.getId();
ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
runtimeService.createProcessInstanceModification(processInstance.getId()).cancelActivityInstance(getInstanceIdForActivity(tree, "innerTask1")).execute();
assertProcessNotEnded(processInstanceId);
// assert activity instance
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).activity("outerTask").beginScope("subProcess").activity("innerTask2").done());
// assert executions
ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
assertThat(executionTree).matches(describeExecutionTree(null).scope().child("outerTask").concurrent().noScope().up().child(null).concurrent().noScope().child("innerTask2").scope().done());
// assert successful completion of process
List<Task> tasks = taskService.createTaskQuery().list();
assertEquals(2, tasks.size());
for (Task task : tasks) {
taskService.complete(task.getId());
}
assertProcessEnded(processInstanceId);
}
Aggregations