use of org.camunda.bpm.engine.test.util.ExecutionTree in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationTest method testStartTransitionCase2.
@Deployment(resources = EXCLUSIVE_GATEWAY_PROCESS)
public void testStartTransitionCase2() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("exclusiveGateway");
String processInstanceId = processInstance.getId();
runtimeService.createProcessInstanceModification(processInstance.getId()).startTransition("flow2").execute();
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).activity("task1").activity("task1").done());
ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
assertThat(executionTree).matches(describeExecutionTree(null).scope().child("task1").concurrent().noScope().up().child("task1").concurrent().noScope().done());
assertEquals(2, taskService.createTaskQuery().count());
// complete the process
completeTasksInOrder("task1", "task1");
assertProcessEnded(processInstanceId);
}
use of org.camunda.bpm.engine.test.util.ExecutionTree in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationTest method testCancellationAndStartBefore.
@Deployment(resources = EXCLUSIVE_GATEWAY_PROCESS)
public void testCancellationAndStartBefore() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("exclusiveGateway");
String processInstanceId = processInstance.getId();
ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
runtimeService.createProcessInstanceModification(processInstance.getId()).cancelActivityInstance(getInstanceIdForActivity(tree, "task1")).startBeforeActivity("task2").execute();
ActivityInstance activityInstanceTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(activityInstanceTree);
assertEquals(processInstanceId, activityInstanceTree.getProcessInstanceId());
assertThat(activityInstanceTree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).activity("task2").done());
ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
assertThat(executionTree).matches(describeExecutionTree("task2").scope().done());
completeTasksInOrder("task2");
assertProcessEnded(processInstanceId);
}
use of org.camunda.bpm.engine.test.util.ExecutionTree in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationTest method testCancellation.
@Deployment(resources = PARALLEL_GATEWAY_PROCESS)
public void testCancellation() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("parallelGateway");
String processInstanceId = processInstance.getId();
ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
runtimeService.createProcessInstanceModification(processInstance.getId()).cancelActivityInstance(getInstanceIdForActivity(tree, "task1")).execute();
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).activity("task2").done());
ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
assertThat(executionTree).matches(describeExecutionTree("task2").scope().done());
// complete the process
completeTasksInOrder("task2");
assertProcessEnded(processInstanceId);
}
use of org.camunda.bpm.engine.test.util.ExecutionTree in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationTest method testStartAfter.
@Deployment(resources = EXCLUSIVE_GATEWAY_PROCESS)
public void testStartAfter() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("exclusiveGateway");
String processInstanceId = processInstance.getId();
runtimeService.createProcessInstanceModification(processInstance.getId()).startAfterActivity("theStart").execute();
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).activity("task1").activity("task1").done());
ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
assertThat(executionTree).matches(describeExecutionTree(null).scope().child("task1").concurrent().noScope().up().child("task1").concurrent().noScope().done());
assertEquals(2, taskService.createTaskQuery().count());
// complete the process
completeTasksInOrder("task1", "task1");
assertProcessEnded(processInstanceId);
}
use of org.camunda.bpm.engine.test.util.ExecutionTree in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationTest method testStartTransitionWithAncestorInstanceId.
@Deployment(resources = EXCLUSIVE_GATEWAY_PROCESS)
public void testStartTransitionWithAncestorInstanceId() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("exclusiveGateway");
String processInstanceId = processInstance.getId();
ActivityInstance tree = runtimeService.getActivityInstance(processInstanceId);
runtimeService.createProcessInstanceModification(processInstance.getId()).startTransition("flow4", tree.getId()).execute();
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).activity("task1").activity("task2").done());
ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
assertThat(executionTree).matches(describeExecutionTree(null).scope().child("task1").concurrent().noScope().up().child("task2").concurrent().noScope().done());
assertEquals(2, taskService.createTaskQuery().count());
// complete the process
completeTasksInOrder("task1", "task2");
assertProcessEnded(processInstanceId);
}
Aggregations