Search in sources :

Example 41 with HistoricActivityInstanceQuery

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

the class MultiTenancyHistoricActivityInstanceQueryTest method testQueryByTenantIds.

public void testQueryByTenantIds() {
    HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery().tenantIdIn(TENANT_ONE, TENANT_TWO);
    assertThat(query.count(), is(4L));
}
Also used : HistoricActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricActivityInstanceQuery)

Example 42 with HistoricActivityInstanceQuery

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

the class MultiTenancyHistoricActivityInstanceQueryTest method testQueryAuthenticatedTenant.

public void testQueryAuthenticatedTenant() {
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
    HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
    assertThat(query.count(), is(2L));
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(2L));
    assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L));
    assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count(), is(2L));
}
Also used : HistoricActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricActivityInstanceQuery)

Example 43 with HistoricActivityInstanceQuery

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

the class CompleteProcessWithParallelGatewayAndServiceTaskTest method testCompleteProcessWithParallelGateway.

@Test
@ScenarioUnderTest("init.none.1")
public void testCompleteProcessWithParallelGateway() {
    // given an already started process instance with one user task
    ProcessInstance oldInstance = rule.processInstance();
    Assert.assertNotNull(oldInstance);
    Task task = rule.taskQuery().singleResult();
    Assert.assertNotNull(task);
    // and completed service task
    HistoricActivityInstanceQuery historicActQuery = rule.getHistoryService().createHistoricActivityInstanceQuery().activityType("serviceTask").processInstanceId(oldInstance.getId()).finished();
    Assert.assertEquals(1, historicActQuery.count());
    // when completing the user task
    rule.getTaskService().complete(task.getId());
    // then there exists no more tasks
    // and the process instance is also completed
    Assert.assertEquals(0, rule.taskQuery().count());
    rule.assertScenarioEnded();
}
Also used : HistoricActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricActivityInstanceQuery) Task(org.camunda.bpm.engine.task.Task) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Test(org.junit.Test) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest)

Example 44 with HistoricActivityInstanceQuery

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

the class HistoricActivityInstanceTest method testNonInterruptingBoundaryTimerEvent.

@Deployment
public void testNonInterruptingBoundaryTimerEvent() {
    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());
    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) Job(org.camunda.bpm.engine.runtime.Job) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 45 with HistoricActivityInstanceQuery

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

the class HistoricActivityInstanceTest method testEndEventTypes.

@Deployment(resources = "org/camunda/bpm/engine/test/history/HistoricActivityInstanceTest.testEvents.bpmn")
public void testEndEventTypes() {
    HistoricActivityInstanceQuery query = startEventTestProcess("");
    query.activityId("cancellationEndEvent");
    assertEquals(1, query.count());
    assertEquals("cancelEndEvent", query.singleResult().getActivityType());
    query.activityId("messageEndEvent");
    assertEquals(1, query.count());
    assertEquals("messageEndEvent", query.singleResult().getActivityType());
    query.activityId("errorEndEvent");
    assertEquals(1, query.count());
    assertEquals("errorEndEvent", query.singleResult().getActivityType());
    query.activityId("signalEndEvent");
    assertEquals(1, query.count());
    assertEquals("signalEndEvent", query.singleResult().getActivityType());
    query.activityId("terminationEndEvent");
    assertEquals(1, query.count());
    assertEquals("terminateEndEvent", query.singleResult().getActivityType());
    query.activityId("noneEndEvent");
    assertEquals(1, query.count());
    assertEquals("noneEndEvent", query.singleResult().getActivityType());
}
Also used : HistoricActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricActivityInstanceQuery) 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