Search in sources :

Example 16 with HistoricActivityInstanceQuery

use of org.camunda.bpm.engine.history.HistoricActivityInstanceQuery in project camunda-bpm-platform by camunda.

the class HistoricActivityInstanceSequenceCounterTest method testParallelMultiInstance.

@Deployment(resources = { "org/camunda/bpm/engine/test/standalone/entity/ExecutionSequenceCounterTest.testParallelMultiInstance.bpmn20.xml" })
public void testParallelMultiInstance() {
    // given
    HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery().orderPartiallyByOccurrence().asc();
    // when
    String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId();
    // then
    query.executionId(processInstanceId);
    verifyOrder(query, "theStart", "theService1", "theService3", "theEnd");
    List<HistoricActivityInstance> taskActivityInstances = historyService.createHistoricActivityInstanceQuery().activityId("theService2").list();
    for (HistoricActivityInstance activityInstance : taskActivityInstances) {
        query.executionId(activityInstance.getExecutionId());
        verifyOrder(query, "theService2");
    }
    query = historyService.createHistoricActivityInstanceQuery().orderPartiallyByOccurrence().asc();
    verifyOrder(query, "theStart", "theService1", "theService2#multiInstanceBody", "theService2", "theService2", "theService3", "theEnd");
}
Also used : HistoricActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricActivityInstanceQuery) HistoricActivityInstance(org.camunda.bpm.engine.history.HistoricActivityInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 17 with HistoricActivityInstanceQuery

use of org.camunda.bpm.engine.history.HistoricActivityInstanceQuery in project camunda-bpm-platform by camunda.

the class HistoricActivityInstanceTest method testHistoricActivityInstanceQueryByCanceled.

@Deployment(resources = "org/camunda/bpm/engine/test/history/HistoricActivityInstanceTest.testHistoricActivityInstanceQueryByCompleteScope.bpmn")
public void testHistoricActivityInstanceQueryByCanceled() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
    runtimeService.deleteProcessInstance(processInstance.getId(), "test");
    HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery().canceled();
    assertEquals(3, query.count());
    List<HistoricActivityInstance> instances = query.list();
    for (HistoricActivityInstance instance : instances) {
        if (!instance.getActivityId().equals("subprocess") && !instance.getActivityId().equals("userTask1") && !instance.getActivityId().equals("userTask2")) {
            fail("Unexpected instance with activity id " + instance.getActivityId() + " found.");
        }
    }
    assertProcessEnded(processInstance.getId());
}
Also used : HistoricActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricActivityInstanceQuery) HistoricProcessInstance(org.camunda.bpm.engine.history.HistoricProcessInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) HistoricActivityInstance(org.camunda.bpm.engine.history.HistoricActivityInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 18 with HistoricActivityInstanceQuery

use of org.camunda.bpm.engine.history.HistoricActivityInstanceQuery in project camunda-bpm-platform by camunda.

the class HistoricActivityInstanceTest method testInterruptingBoundarySignalEvent.

@Deployment
public void testInterruptingBoundarySignalEvent() {
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("process");
    Execution execution = runtimeService.createExecutionQuery().signalEventSubscriptionName("newSignal").singleResult();
    runtimeService.signalEventReceived("newSignal", execution.getId());
    HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
    query.activityId("signal");
    assertEquals(1, query.count());
    assertNotNull(query.singleResult().getEndTime());
    assertEquals("boundarySignal", query.singleResult().getActivityType());
    Task task = taskService.createTaskQuery().singleResult();
    taskService.complete(task.getId());
    assertProcessEnded(pi.getId());
}
Also used : HistoricActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricActivityInstanceQuery) Task(org.camunda.bpm.engine.task.Task) Execution(org.camunda.bpm.engine.runtime.Execution) HistoricProcessInstance(org.camunda.bpm.engine.history.HistoricProcessInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 19 with HistoricActivityInstanceQuery

use of org.camunda.bpm.engine.history.HistoricActivityInstanceQuery in project camunda-bpm-platform by camunda.

the class HistoricActivityInstanceTest method testInterruptingBoundaryTimerEvent.

@Deployment
public void testInterruptingBoundaryTimerEvent() {
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("process");
    Job job = managementService.createJobQuery().singleResult();
    assertNotNull(job);
    managementService.executeJob(job.getId());
    HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
    query.activityId("timer");
    assertEquals(1, query.count());
    assertNotNull(query.singleResult().getEndTime());
    assertEquals("boundaryTimer", query.singleResult().getActivityType());
    Task task = taskService.createTaskQuery().singleResult();
    taskService.complete(task.getId());
    assertProcessEnded(pi.getId());
}
Also used : HistoricActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricActivityInstanceQuery) Task(org.camunda.bpm.engine.task.Task) HistoricProcessInstance(org.camunda.bpm.engine.history.HistoricProcessInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Job(org.camunda.bpm.engine.runtime.Job) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 20 with HistoricActivityInstanceQuery

use of org.camunda.bpm.engine.history.HistoricActivityInstanceQuery in project camunda-bpm-platform by camunda.

the class HistoricActivityInstanceTest method testBoundaryCancelEvent.

@Deployment
public void testBoundaryCancelEvent() {
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("process");
    HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
    query.activityId("catchCancel");
    assertEquals(1, query.count());
    assertNotNull(query.singleResult().getEndTime());
    assertEquals("cancelBoundaryCatch", query.singleResult().getActivityType());
    Task task = taskService.createTaskQuery().singleResult();
    taskService.complete(task.getId());
    assertProcessEnded(pi.getId());
}
Also used : HistoricActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricActivityInstanceQuery) Task(org.camunda.bpm.engine.task.Task) HistoricProcessInstance(org.camunda.bpm.engine.history.HistoricProcessInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

HistoricActivityInstanceQuery (org.camunda.bpm.engine.history.HistoricActivityInstanceQuery)59 Deployment (org.camunda.bpm.engine.test.Deployment)35 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)18 Task (org.camunda.bpm.engine.task.Task)18 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)17 HistoricActivityInstance (org.camunda.bpm.engine.history.HistoricActivityInstance)13 Execution (org.camunda.bpm.engine.runtime.Execution)4 Test (org.junit.Test)4 Job (org.camunda.bpm.engine.runtime.Job)3 JobQuery (org.camunda.bpm.engine.runtime.JobQuery)3 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)3 Response (com.jayway.restassured.response.Response)2 ArrayList (java.util.ArrayList)2 AbstractRestServiceTest (org.camunda.bpm.engine.rest.AbstractRestServiceTest)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2 InOrder (org.mockito.InOrder)2 HashMap (java.util.HashMap)1 HistoricDetail (org.camunda.bpm.engine.history.HistoricDetail)1 HistoricVariableInstance (org.camunda.bpm.engine.history.HistoricVariableInstance)1 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)1