Search in sources :

Example 6 with TransitionInstance

use of org.camunda.bpm.engine.runtime.TransitionInstance in project camunda-bpm-platform by camunda.

the class RuntimeServiceTest method testActivityInstanceTreeForAsyncAfterEndEvent.

@Deployment
@Test
public void testActivityInstanceTreeForAsyncAfterEndEvent() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("asyncEndEventProcess");
    ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
    assertThat(tree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).transition("theEnd").done());
    TransitionInstance asyncAfterTransitionInstance = tree.getChildTransitionInstances()[0];
    assertEquals(processInstance.getId(), asyncAfterTransitionInstance.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 7 with TransitionInstance

use of org.camunda.bpm.engine.runtime.TransitionInstance in project camunda-bpm-platform by camunda.

the class RuntimeServiceTest method testActivityInstanceTreeForAsyncBeforeTask.

@Deployment
@Test
public void testActivityInstanceTreeForAsyncBeforeTask() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
    ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
    assertThat(tree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).transition("theTask").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 8 with TransitionInstance

use of org.camunda.bpm.engine.runtime.TransitionInstance 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 9 with TransitionInstance

use of org.camunda.bpm.engine.runtime.TransitionInstance 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 10 with TransitionInstance

use of org.camunda.bpm.engine.runtime.TransitionInstance 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)

Aggregations

TransitionInstance (org.camunda.bpm.engine.runtime.TransitionInstance)34 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)31 Deployment (org.camunda.bpm.engine.test.Deployment)27 Test (org.junit.Test)21 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)20 HistoricActivityInstance (org.camunda.bpm.engine.history.HistoricActivityInstance)19 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)13 ExecutionAssert.describeExecutionTree (org.camunda.bpm.engine.test.util.ExecutionAssert.describeExecutionTree)5 ExecutionTree (org.camunda.bpm.engine.test.util.ExecutionTree)5 Task (org.camunda.bpm.engine.task.Task)4 NotValidException (org.camunda.bpm.engine.exception.NotValidException)3 Job (org.camunda.bpm.engine.runtime.Job)3 ArrayList (java.util.ArrayList)2 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)2 ProcessDefinitionImpl (org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl)1 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)1 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)1 AbstractFoxPlatformIntegrationTest (org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)1