use of org.camunda.bpm.engine.runtime.TransitionInstance in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testTransitionInstanceActivityNamePropertyAfterTask.
@Deployment
@Test
public void testTransitionInstanceActivityNamePropertyAfterTask() {
// given
String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId();
// when
ActivityInstance tree = runtimeService.getActivityInstance(processInstanceId);
// then
TransitionInstance[] instances = tree.getTransitionInstances("firstServiceTask");
TransitionInstance task = instances[0];
assertNotNull(task);
assertNotNull(task.getActivityName());
assertEquals("First Service Task", task.getActivityName());
instances = tree.getTransitionInstances("secondServiceTask");
task = instances[0];
assertNotNull(task);
assertNotNull(task.getActivityName());
assertEquals("Second Service Task", task.getActivityName());
}
use of org.camunda.bpm.engine.runtime.TransitionInstance in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testTransitionInstanceActivityTypePropertyBeforeTask.
@Deployment(resources = "org/camunda/bpm/engine/test/api/runtime/RuntimeServiceTest.testTransitionInstanceActivityNamePropertyBeforeTask.bpmn20.xml")
@Test
public void testTransitionInstanceActivityTypePropertyBeforeTask() {
// given
String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId();
// when
ActivityInstance tree = runtimeService.getActivityInstance(processInstanceId);
// then
TransitionInstance[] instances = tree.getTransitionInstances("firstServiceTask");
TransitionInstance task = instances[0];
assertNotNull(task);
assertNotNull(task.getActivityType());
assertEquals("serviceTask", task.getActivityType());
instances = tree.getTransitionInstances("secondServiceTask");
task = instances[0];
assertNotNull(task);
assertNotNull(task.getActivityType());
assertEquals("serviceTask", task.getActivityType());
}
use of org.camunda.bpm.engine.runtime.TransitionInstance in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationAsyncTest method testCancelStartCancelInScope.
/**
* CAM-4090
*/
@Deployment(resources = NESTED_PARALLEL_ASYNC_BEFORE_SCOPE_TASK_PROCESS)
public void testCancelStartCancelInScope() {
// given there are two transition instances in an inner scope
// and an active activity instance in an outer scope
ProcessInstance instance = runtimeService.createProcessInstanceByKey("nestedConcurrentTasksProcess").startBeforeActivity("innerTask1").startBeforeActivity("innerTask1").startBeforeActivity("outerTask").execute();
ActivityInstance tree = runtimeService.getActivityInstance(instance.getId());
// when i cancel both transition instances
TransitionInstance[] transitionInstances = tree.getTransitionInstances("innerTask1");
runtimeService.createProcessInstanceModification(instance.getId()).cancelTransitionInstance(// triggers tree compaction
transitionInstances[0].getId()).startBeforeActivity(// triggers tree expansion
"innerTask2").cancelTransitionInstance(transitionInstances[1].getId()).execute();
// then the outer activity instance is the only one remaining
tree = runtimeService.getActivityInstance(instance.getId());
assertThat(tree).hasStructure(describeActivityInstanceTree(instance.getProcessDefinitionId()).activity("outerTask").beginScope("subProcess").transition("innerTask2").done());
// assert executions
ExecutionTree executionTree = ExecutionTree.forExecution(instance.getId(), processEngine);
assertThat(executionTree).matches(describeExecutionTree(null).scope().child("outerTask").concurrent().noScope().up().child(null).concurrent().noScope().child("innerTask2").scope().done());
}
use of org.camunda.bpm.engine.runtime.TransitionInstance in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationAsyncTest method testRepeatedCancellationAndStartForTransitionInstance.
/**
* CAM-4090
*/
@Deployment(resources = NESTED_PARALLEL_ASYNC_BEFORE_SCOPE_TASK_PROCESS)
public void testRepeatedCancellationAndStartForTransitionInstance() {
// given there is one transition instance in a scope
ProcessInstance instance = runtimeService.createProcessInstanceByKey("nestedConcurrentTasksProcess").startBeforeActivity("innerTask1").startBeforeActivity("innerTask1").execute();
ActivityInstance tree = runtimeService.getActivityInstance(instance.getId());
TransitionInstance[] transitionInstances = tree.getTransitionInstances("innerTask1");
// when I start an activity in the same scope
// and cancel the first transition instance
runtimeService.createProcessInstanceModification(instance.getId()).cancelTransitionInstance(// compact tree
transitionInstances[0].getId()).startBeforeActivity(// expand tree
"innerTask2").cancelAllForActivity(// compact tree
"innerTask2").startBeforeActivity(// expand tree
"innerTask2").cancelAllForActivity(// compact tree
"innerTask2").startBeforeActivity(// expand tree
"innerTask2").cancelTransitionInstance(transitionInstances[1].getId()).execute();
// then there is only an activity instance for innerTask2
tree = runtimeService.getActivityInstance(instance.getId());
assertThat(tree).hasStructure(describeActivityInstanceTree(instance.getProcessDefinitionId()).beginScope("subProcess").transition("innerTask2").done());
// assert executions
ExecutionTree executionTree = ExecutionTree.forExecution(instance.getId(), processEngine);
assertThat(executionTree).matches(describeExecutionTree(null).scope().child("innerTask2").scope().done());
}
Aggregations