Search in sources :

Example 36 with ActivityInstance

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());
}
Also used : TransitionInstance(org.camunda.bpm.engine.runtime.TransitionInstance) Task(org.camunda.bpm.engine.task.Task) ActivityInstance(org.camunda.bpm.engine.runtime.ActivityInstance) HistoricActivityInstance(org.camunda.bpm.engine.history.HistoricActivityInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 37 with ActivityInstance

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());
}
Also used : TransitionInstance(org.camunda.bpm.engine.runtime.TransitionInstance) ActivityInstance(org.camunda.bpm.engine.runtime.ActivityInstance) HistoricActivityInstance(org.camunda.bpm.engine.history.HistoricActivityInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 38 with ActivityInstance

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);
}
Also used : TransitionInstance(org.camunda.bpm.engine.runtime.TransitionInstance) ActivityInstance(org.camunda.bpm.engine.runtime.ActivityInstance) HistoricActivityInstance(org.camunda.bpm.engine.history.HistoricActivityInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 39 with ActivityInstance

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());
}
Also used : TransitionInstance(org.camunda.bpm.engine.runtime.TransitionInstance) ActivityInstance(org.camunda.bpm.engine.runtime.ActivityInstance) HistoricActivityInstance(org.camunda.bpm.engine.history.HistoricActivityInstance) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 40 with ActivityInstance

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());
}
Also used : TransitionInstance(org.camunda.bpm.engine.runtime.TransitionInstance) Task(org.camunda.bpm.engine.task.Task) ActivityInstance(org.camunda.bpm.engine.runtime.ActivityInstance) HistoricActivityInstance(org.camunda.bpm.engine.history.HistoricActivityInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)427 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)372 Deployment (org.camunda.bpm.engine.test.Deployment)277 Test (org.junit.Test)159 ExecutionTree (org.camunda.bpm.engine.test.util.ExecutionTree)130 ExecutionAssert.describeExecutionTree (org.camunda.bpm.engine.test.util.ExecutionAssert.describeExecutionTree)129 Task (org.camunda.bpm.engine.task.Task)108 ScenarioUnderTest (org.camunda.bpm.qa.upgrade.ScenarioUnderTest)80 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)56 HistoricActivityInstance (org.camunda.bpm.engine.history.HistoricActivityInstance)54 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)47 TransitionInstance (org.camunda.bpm.engine.runtime.TransitionInstance)31 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)22 Job (org.camunda.bpm.engine.runtime.Job)21 Batch (org.camunda.bpm.engine.batch.Batch)15 DeploymentWithDefinitions (org.camunda.bpm.engine.repository.DeploymentWithDefinitions)12 Execution (org.camunda.bpm.engine.runtime.Execution)12 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)10 VariableInstance (org.camunda.bpm.engine.runtime.VariableInstance)10 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)9