Search in sources :

Example 26 with HistoricActivityInstanceQuery

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

the class HistoricActivityInstanceTest method testTransaction.

@Deployment(resources = "org/camunda/bpm/engine/test/history/HistoricActivityInstanceTest.testBoundaryCancelEvent.bpmn20.xml")
public void testTransaction() {
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("process");
    HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
    query.activityId("transaction");
    assertEquals(1, query.count());
    assertNotNull(query.singleResult().getEndTime());
    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)

Example 27 with HistoricActivityInstanceQuery

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

the class HistoricActivityInstanceTest method testHistoricActivityInstanceMessageEvent.

@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricActivityInstanceTest.testHistoricActivityInstanceTimerEvent.bpmn20.xml" })
public void testHistoricActivityInstanceMessageEvent() {
    runtimeService.startProcessInstanceByKey("catchSignal");
    JobQuery jobQuery = managementService.createJobQuery();
    assertEquals(1, jobQuery.count());
    EventSubscriptionQuery eventSubscriptionQuery = runtimeService.createEventSubscriptionQuery();
    assertEquals(1, eventSubscriptionQuery.count());
    runtimeService.correlateMessage("newInvoice");
    TaskQuery taskQuery = taskService.createTaskQuery();
    Task task = taskQuery.singleResult();
    assertEquals("afterMessage", task.getName());
    HistoricActivityInstanceQuery historicActivityInstanceQuery = historyService.createHistoricActivityInstanceQuery().activityId("gw1");
    assertEquals(1, historicActivityInstanceQuery.count());
    assertNotNull(historicActivityInstanceQuery.singleResult().getEndTime());
    historicActivityInstanceQuery = historyService.createHistoricActivityInstanceQuery().activityId("messageEvent");
    assertEquals(1, historicActivityInstanceQuery.count());
    assertNotNull(historicActivityInstanceQuery.singleResult().getEndTime());
    assertEquals("intermediateMessageCatch", historicActivityInstanceQuery.singleResult().getActivityType());
}
Also used : HistoricActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricActivityInstanceQuery) Task(org.camunda.bpm.engine.task.Task) TaskQuery(org.camunda.bpm.engine.task.TaskQuery) JobQuery(org.camunda.bpm.engine.runtime.JobQuery) EventSubscriptionQuery(org.camunda.bpm.engine.runtime.EventSubscriptionQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 28 with HistoricActivityInstanceQuery

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

the class HistoricActivityInstanceTest method testMultiInstanceScopeActivity.

@Deployment
public void testMultiInstanceScopeActivity() {
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("process");
    HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
    HistoricActivityInstance miBodyInstance = query.activityId("userTask#multiInstanceBody").singleResult();
    query.activityId("userTask");
    assertEquals(5, query.count());
    List<HistoricActivityInstance> result = query.list();
    for (HistoricActivityInstance instance : result) {
        assertEquals(miBodyInstance.getId(), instance.getParentActivityInstanceId());
    }
    List<Task> tasks = taskService.createTaskQuery().list();
    for (Task task : tasks) {
        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) HistoricActivityInstance(org.camunda.bpm.engine.history.HistoricActivityInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 29 with HistoricActivityInstanceQuery

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

the class HistoricActivityInstanceTest method testHistoricActivityInstanceTimerEvent.

@Deployment
public void testHistoricActivityInstanceTimerEvent() {
    runtimeService.startProcessInstanceByKey("catchSignal");
    assertEquals(1, runtimeService.createEventSubscriptionQuery().count());
    JobQuery jobQuery = managementService.createJobQuery();
    assertEquals(1, jobQuery.count());
    Job timer = jobQuery.singleResult();
    managementService.executeJob(timer.getId());
    TaskQuery taskQuery = taskService.createTaskQuery();
    Task task = taskQuery.singleResult();
    assertEquals("afterTimer", task.getName());
    HistoricActivityInstanceQuery historicActivityInstanceQuery = historyService.createHistoricActivityInstanceQuery().activityId("gw1");
    assertEquals(1, historicActivityInstanceQuery.count());
    assertNotNull(historicActivityInstanceQuery.singleResult().getEndTime());
    historicActivityInstanceQuery = historyService.createHistoricActivityInstanceQuery().activityId("timerEvent");
    assertEquals(1, historicActivityInstanceQuery.count());
    assertNotNull(historicActivityInstanceQuery.singleResult().getEndTime());
    assertEquals("intermediateTimer", historicActivityInstanceQuery.singleResult().getActivityType());
}
Also used : HistoricActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricActivityInstanceQuery) Task(org.camunda.bpm.engine.task.Task) TaskQuery(org.camunda.bpm.engine.task.TaskQuery) JobQuery(org.camunda.bpm.engine.runtime.JobQuery) Job(org.camunda.bpm.engine.runtime.Job) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 30 with HistoricActivityInstanceQuery

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

the class HistoricActivityInstanceTest method testBoundaryCompensateEvent.

@Deployment
public void testBoundaryCompensateEvent() {
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("process");
    HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
    // the compensation boundary event should not appear in history!
    query.activityId("compensate");
    assertEquals(0, query.count());
    assertProcessEnded(pi.getId());
}
Also used : HistoricActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricActivityInstanceQuery) 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