Search in sources :

Example 56 with ExecutionTree

use of org.camunda.bpm.engine.test.util.ExecutionTree in project camunda-bpm-platform by camunda.

the class ProcessInstanceModificationEventSubProcessTest method testStartBeforeTaskInsideNonInterruptingEventSubProcessAndCancelTaskOutsideEventSubProcess.

@Deployment(resources = NON_INTERRUPTING_EVENT_SUBPROCESS)
public void testStartBeforeTaskInsideNonInterruptingEventSubProcessAndCancelTaskOutsideEventSubProcess() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
    String processInstanceId = processInstance.getId();
    ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
    runtimeService.createProcessInstanceModification(processInstanceId).cancelActivityInstance(getInstanceIdForActivity(tree, "task1")).startBeforeActivity("eventSubProcessTask").execute();
    ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
    assertNotNull(updatedTree);
    assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
    assertThat(updatedTree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).beginScope("eventSubProcess").activity("eventSubProcessTask").endScope().done());
    ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
    assertThat(executionTree).matches(describeExecutionTree(null).scope().child("eventSubProcessTask").scope().done());
    completeTasksInOrder("eventSubProcessTask");
    assertProcessEnded(processInstanceId);
}
Also used : ExecutionAssert.describeExecutionTree(org.camunda.bpm.engine.test.util.ExecutionAssert.describeExecutionTree) ExecutionTree(org.camunda.bpm.engine.test.util.ExecutionTree) ActivityInstance(org.camunda.bpm.engine.runtime.ActivityInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 57 with ExecutionTree

use of org.camunda.bpm.engine.test.util.ExecutionTree in project camunda-bpm-platform by camunda.

the class ProcessInstanceModificationEventSubProcessTest method testStartBeforeTaskInsideEventSubProcess.

@Deployment(resources = INTERRUPTING_EVENT_SUBPROCESS)
public void testStartBeforeTaskInsideEventSubProcess() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
    String processInstanceId = processInstance.getId();
    runtimeService.createProcessInstanceModification(processInstanceId).startBeforeActivity("eventSubProcessTask").execute();
    ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
    assertNotNull(updatedTree);
    assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
    assertThat(updatedTree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).activity("task1").beginScope("eventSubProcess").activity("eventSubProcessTask").endScope().done());
    ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
    assertThat(executionTree).matches(describeExecutionTree(null).scope().child("task1").concurrent().noScope().up().child(null).concurrent().noScope().child("eventSubProcessTask").scope().done());
    completeTasksInOrder("task1", "task2", "eventSubProcessTask");
    assertProcessEnded(processInstanceId);
}
Also used : ExecutionAssert.describeExecutionTree(org.camunda.bpm.engine.test.util.ExecutionAssert.describeExecutionTree) ExecutionTree(org.camunda.bpm.engine.test.util.ExecutionTree) ActivityInstance(org.camunda.bpm.engine.runtime.ActivityInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 58 with ExecutionTree

use of org.camunda.bpm.engine.test.util.ExecutionTree in project camunda-bpm-platform by camunda.

the class ProcessInstanceModificationEventSubProcessTest method testStartBeforeStartEventInsideEventSubProcessInsideSubProcess.

@Deployment(resources = INTERRUPTING_EVENT_SUBPROCESS_INSIDE_SUBPROCESS)
public void testStartBeforeStartEventInsideEventSubProcessInsideSubProcess() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
    String processInstanceId = processInstance.getId();
    runtimeService.createProcessInstanceModification(processInstanceId).startBeforeActivity("eventProcessStart").execute();
    ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
    assertNotNull(updatedTree);
    assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
    assertThat(updatedTree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).activity("task1").beginScope("subProcess").beginScope("eventSubProcess").activity("eventSubProcessTask").done());
    ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
    assertThat(executionTree).matches(describeExecutionTree(null).scope().child("task1").concurrent().noScope().up().child(null).concurrent().noScope().child(null).scope().child("eventSubProcessTask").scope().done());
    completeTasksInOrder("eventSubProcessTask", "task1", "task2");
    assertProcessEnded(processInstanceId);
}
Also used : ExecutionAssert.describeExecutionTree(org.camunda.bpm.engine.test.util.ExecutionAssert.describeExecutionTree) ExecutionTree(org.camunda.bpm.engine.test.util.ExecutionTree) ActivityInstance(org.camunda.bpm.engine.runtime.ActivityInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 59 with ExecutionTree

use of org.camunda.bpm.engine.test.util.ExecutionTree in project camunda-bpm-platform by camunda.

the class ProcessInstanceModificationEventSubProcessTest method testStartBeforeStartEventInsideEventSubProcess.

@Deployment(resources = INTERRUPTING_EVENT_SUBPROCESS)
public void testStartBeforeStartEventInsideEventSubProcess() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
    String processInstanceId = processInstance.getId();
    runtimeService.createProcessInstanceModification(processInstanceId).startBeforeActivity("eventProcessStart").execute();
    ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
    assertNotNull(updatedTree);
    assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
    assertThat(updatedTree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).beginScope("eventSubProcess").activity("eventSubProcessTask").endScope().done());
    ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
    assertThat(executionTree).matches(describeExecutionTree(null).scope().child("eventSubProcessTask").scope().done());
    completeTasksInOrder("eventSubProcessTask");
    assertProcessEnded(processInstanceId);
}
Also used : ExecutionAssert.describeExecutionTree(org.camunda.bpm.engine.test.util.ExecutionAssert.describeExecutionTree) ExecutionTree(org.camunda.bpm.engine.test.util.ExecutionTree) ActivityInstance(org.camunda.bpm.engine.runtime.ActivityInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 60 with ExecutionTree

use of org.camunda.bpm.engine.test.util.ExecutionTree in project camunda-bpm-platform by camunda.

the class ProcessInstanceModificationEventSubProcessTest method testStartBeforeStartEventInsideEventSubProcessInsideSubProcessTask2ShouldBeCancelled.

@Deployment(resources = INTERRUPTING_EVENT_SUBPROCESS_INSIDE_SUBPROCESS)
public void testStartBeforeStartEventInsideEventSubProcessInsideSubProcessTask2ShouldBeCancelled() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
    String processInstanceId = processInstance.getId();
    String taskId = taskService.createTaskQuery().singleResult().getId();
    taskService.complete(taskId);
    runtimeService.createProcessInstanceModification(processInstanceId).startBeforeActivity("eventProcessStart").execute();
    ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
    assertNotNull(updatedTree);
    assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
    assertThat(updatedTree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).beginScope("subProcess").beginScope("eventSubProcess").activity("eventSubProcessTask").done());
    ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
    assertThat(executionTree).matches(describeExecutionTree(null).scope().child(null).scope().child("eventSubProcessTask").scope().done());
    completeTasksInOrder("eventSubProcessTask");
    assertProcessEnded(processInstanceId);
}
Also used : ExecutionAssert.describeExecutionTree(org.camunda.bpm.engine.test.util.ExecutionAssert.describeExecutionTree) ExecutionTree(org.camunda.bpm.engine.test.util.ExecutionTree) ActivityInstance(org.camunda.bpm.engine.runtime.ActivityInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

ExecutionTree (org.camunda.bpm.engine.test.util.ExecutionTree)155 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)149 Deployment (org.camunda.bpm.engine.test.Deployment)134 ExecutionAssert.describeExecutionTree (org.camunda.bpm.engine.test.util.ExecutionAssert.describeExecutionTree)134 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)130 Task (org.camunda.bpm.engine.task.Task)40 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)20 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)20 Test (org.junit.Test)20 VariableInstance (org.camunda.bpm.engine.runtime.VariableInstance)17 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)15 Execution (org.camunda.bpm.engine.runtime.Execution)9 Job (org.camunda.bpm.engine.runtime.Job)6 TransitionInstance (org.camunda.bpm.engine.runtime.TransitionInstance)5 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)4 RequiredHistoryLevel (org.camunda.bpm.engine.test.RequiredHistoryLevel)2 RecorderExecutionListener (org.camunda.bpm.engine.test.bpmn.executionlistener.RecorderExecutionListener)2 RecordedEvent (org.camunda.bpm.engine.test.bpmn.executionlistener.RecorderExecutionListener.RecordedEvent)2 ArrayList (java.util.ArrayList)1 HistoricActivityInstance (org.camunda.bpm.engine.history.HistoricActivityInstance)1