Search in sources :

Example 31 with ActivityInstance

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

the class RuntimeServiceTest method testGetInvalidTransitionInstancesForActivity.

@Deployment(resources = "org/camunda/bpm/engine/test/api/runtime/RuntimeServiceTest.testGetTransitionInstancesForActivity.bpmn20.xml")
@Test
public void testGetInvalidTransitionInstancesForActivity() {
    ProcessInstance instance = runtimeService.startProcessInstanceByKey("miSubprocess");
    ActivityInstance tree = runtimeService.getActivityInstance(instance.getId());
    try {
        tree.getTransitionInstances(null);
        fail("exception expected");
    } catch (NullValueException e) {
    // happy path
    }
}
Also used : ActivityInstance(org.camunda.bpm.engine.runtime.ActivityInstance) HistoricActivityInstance(org.camunda.bpm.engine.history.HistoricActivityInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) NullValueException(org.camunda.bpm.engine.exception.NullValueException) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 32 with ActivityInstance

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

the class RuntimeServiceTest method testTransitionInstanceActivityTypePropertyAfterStartEvent.

@Deployment(resources = "org/camunda/bpm/engine/test/api/runtime/RuntimeServiceTest.testTransitionInstanceActivityNamePropertyAfterStartEvent.bpmn20.xml")
@Test
public void testTransitionInstanceActivityTypePropertyAfterStartEvent() {
    // 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 33 with ActivityInstance

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

the class RuntimeServiceTest method testActivityInstanceTreeForNestedAsyncBeforeTask.

@Deployment
@Test
public void testActivityInstanceTreeForNestedAsyncBeforeTask() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
    ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
    assertThat(tree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).beginScope("subProcess").transition("theTask").done());
    TransitionInstance asyncBeforeTransitionInstance = tree.getChildActivityInstances()[0].getChildTransitionInstances()[0];
    String asyncExecutionId = managementService.createJobQuery().singleResult().getExecutionId();
    assertEquals(asyncExecutionId, 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) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 34 with ActivityInstance

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

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

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