use of org.camunda.bpm.engine.runtime.TransitionInstance in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testTransitionInstanceActivityNamePropertyBeforeStartEvent.
@Deployment
@Test
public void testTransitionInstanceActivityNamePropertyBeforeStartEvent() {
// given
String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId();
// when
ActivityInstance tree = runtimeService.getActivityInstance(processInstanceId);
// then
TransitionInstance[] instances = tree.getTransitionInstances("start");
TransitionInstance task = instances[0];
assertNotNull(task);
assertNotNull(task.getActivityName());
assertEquals("The Start Event", task.getActivityName());
}
use of org.camunda.bpm.engine.runtime.TransitionInstance in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testGetTransitionInstancesForActivity.
@Deployment
@Test
public void testGetTransitionInstancesForActivity() {
// given
ProcessInstance instance = runtimeService.startProcessInstanceByKey("miSubprocess");
// complete one async task
Job job = managementService.createJobQuery().listPage(0, 1).get(0);
managementService.executeJob(job.getId());
Task task = taskService.createTaskQuery().singleResult();
taskService.complete(task.getId());
// when
ActivityInstance tree = runtimeService.getActivityInstance(instance.getId());
// then
assertEquals(0, tree.getTransitionInstances("subProcess").length);
TransitionInstance[] asyncBeforeInstances = tree.getTransitionInstances("innerTask");
assertEquals(2, asyncBeforeInstances.length);
assertEquals("innerTask", asyncBeforeInstances[0].getActivityId());
assertEquals("innerTask", asyncBeforeInstances[1].getActivityId());
assertFalse(asyncBeforeInstances[0].getId().equals(asyncBeforeInstances[1].getId()));
TransitionInstance[] asyncEndEventInstances = tree.getTransitionInstances("theSubProcessEnd");
assertEquals(1, asyncEndEventInstances.length);
assertEquals("theSubProcessEnd", asyncEndEventInstances[0].getActivityId());
}
use of org.camunda.bpm.engine.runtime.TransitionInstance in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testActivityInstanceTreeForConcurrentAsyncAfterTask.
@Deployment
@Test
public void testActivityInstanceTreeForConcurrentAsyncAfterTask() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("concurrentTasksProcess");
Task asyncTask = taskService.createTaskQuery().taskDefinitionKey("asyncTask").singleResult();
assertNotNull(asyncTask);
taskService.complete(asyncTask.getId());
ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
assertThat(tree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).activity("theTask").transition("asyncTask").done());
TransitionInstance asyncBeforeTransitionInstance = tree.getChildTransitionInstances()[0];
String asyncExecutionId = managementService.createJobQuery().singleResult().getExecutionId();
assertEquals(asyncExecutionId, asyncBeforeTransitionInstance.getExecutionId());
}
use of org.camunda.bpm.engine.runtime.TransitionInstance in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testActivityInstanceTreeForNestedAsyncAfterEndEvent.
@Deployment
@Test
public void testActivityInstanceTreeForNestedAsyncAfterEndEvent() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("asyncEndEventProcess");
ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
assertThat(tree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).beginScope("subProcess").transition("theSubProcessEnd").done());
TransitionInstance asyncAfterTransitionInstance = tree.getChildActivityInstances()[0].getChildTransitionInstances()[0];
String asyncExecutionId = managementService.createJobQuery().singleResult().getExecutionId();
assertEquals(asyncExecutionId, asyncAfterTransitionInstance.getExecutionId());
}
use of org.camunda.bpm.engine.runtime.TransitionInstance in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testTransitionInstanceActivityNamePropertyBeforeTask.
@Deployment
@Test
public void testTransitionInstanceActivityNamePropertyBeforeTask() {
// 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());
}
Aggregations