use of org.camunda.bpm.engine.runtime.ActivityInstance in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testActivityInstanceTreeForAsyncAfterTask.
@Deployment
@Test
public void testActivityInstanceTreeForAsyncAfterTask() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
Task task = taskService.createTaskQuery().singleResult();
taskService.complete(task.getId());
ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
assertThat(tree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).transition("theTask").done());
TransitionInstance asyncAfterTransitionInstance = tree.getChildTransitionInstances()[0];
assertEquals(processInstance.getId(), asyncAfterTransitionInstance.getExecutionId());
}
use of org.camunda.bpm.engine.runtime.ActivityInstance in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testActivityInstanceTreeForAsyncBeforeStartEvent.
@Deployment
@Test
public void testActivityInstanceTreeForAsyncBeforeStartEvent() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
assertThat(tree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).transition("theStart").done());
TransitionInstance asyncBeforeTransitionInstance = tree.getChildTransitionInstances()[0];
assertEquals(processInstance.getId(), asyncBeforeTransitionInstance.getExecutionId());
}
use of org.camunda.bpm.engine.runtime.ActivityInstance in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testGetTransitionInstancesForNonExistingActivity.
@Deployment(resources = "org/camunda/bpm/engine/test/api/runtime/RuntimeServiceTest.testGetTransitionInstancesForActivity.bpmn20.xml")
@Test
public void testGetTransitionInstancesForNonExistingActivity() {
ProcessInstance instance = runtimeService.startProcessInstanceByKey("miSubprocess");
ActivityInstance tree = runtimeService.getActivityInstance(instance.getId());
TransitionInstance[] instances = tree.getTransitionInstances("aNonExistingActivityId");
assertNotNull(instances);
assertEquals(0, instances.length);
}
use of org.camunda.bpm.engine.runtime.ActivityInstance in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testTransitionInstanceActivityTypePropertyBeforeStartEvent.
@Deployment(resources = "org/camunda/bpm/engine/test/api/runtime/RuntimeServiceTest.testTransitionInstanceActivityNamePropertyBeforeStartEvent.bpmn20.xml")
@Test
public void testTransitionInstanceActivityTypePropertyBeforeStartEvent() {
// 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.getActivityType());
assertEquals("startEvent", task.getActivityType());
}
use of org.camunda.bpm.engine.runtime.ActivityInstance in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testActivityInstanceTreeForNestedAsyncAfterTask.
@Deployment
@Test
public void testActivityInstanceTreeForNestedAsyncAfterTask() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
Task task = taskService.createTaskQuery().singleResult();
taskService.complete(task.getId());
ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
assertThat(tree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).beginScope("subProcess").transition("theTask").done());
TransitionInstance asyncAfterTransitionInstance = tree.getChildActivityInstances()[0].getChildTransitionInstances()[0];
String asyncExecutionId = managementService.createJobQuery().singleResult().getExecutionId();
assertEquals(asyncExecutionId, asyncAfterTransitionInstance.getExecutionId());
}
Aggregations