Search in sources :

Example 6 with HistoricCaseActivityInstanceQuery

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

the class MultiTenancyHistoricCaseActivityInstanceQueryTest method testQueryAuthenticatedTenant.

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

Example 7 with HistoricCaseActivityInstanceQuery

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

the class MultiTenancyHistoricCaseActivityInstanceQueryTest method testQueryNoAuthenticatedTenants.

public void testQueryNoAuthenticatedTenants() {
    identityService.setAuthentication("user", null, null);
    HistoricCaseActivityInstanceQuery query = historyService.createHistoricCaseActivityInstanceQuery();
    assertThat(query.count(), is(0L));
}
Also used : HistoricCaseActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricCaseActivityInstanceQuery)

Example 8 with HistoricCaseActivityInstanceQuery

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

the class MultiTenancyHistoricCaseActivityInstanceQueryTest method testQueryByTenantIds.

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

Example 9 with HistoricCaseActivityInstanceQuery

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

the class MultiTenancyHistoricCaseActivityInstanceQueryTest method testQueryByNonExistingTenantId.

public void testQueryByNonExistingTenantId() {
    HistoricCaseActivityInstanceQuery query = historyService.createHistoricCaseActivityInstanceQuery().tenantIdIn("nonExisting");
    assertThat(query.count(), is(0L));
}
Also used : HistoricCaseActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricCaseActivityInstanceQuery)

Example 10 with HistoricCaseActivityInstanceQuery

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

the class HistoricCaseActivityInstanceTest method testQueryByCaseInstanceIds.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testQueryByCaseInstanceIds() {
    // given
    CaseInstance instance1 = createCaseInstance();
    CaseInstance instance2 = createCaseInstance();
    String taskInstanceId1 = caseService.createCaseExecutionQuery().caseInstanceId(instance1.getId()).activityId("PI_HumanTask_1").singleResult().getId();
    String taskInstanceId2 = caseService.createCaseExecutionQuery().caseInstanceId(instance2.getId()).activityId("PI_HumanTask_1").singleResult().getId();
    // when
    HistoricCaseActivityInstanceQuery query = historicQuery().caseActivityInstanceIdIn(taskInstanceId1, taskInstanceId2);
    // then
    assertCount(2, query);
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance) HistoricCaseInstance(org.camunda.bpm.engine.history.HistoricCaseInstance) HistoricCaseActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricCaseActivityInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

HistoricCaseActivityInstanceQuery (org.camunda.bpm.engine.history.HistoricCaseActivityInstanceQuery)25 Deployment (org.camunda.bpm.engine.test.Deployment)11 HistoricCaseActivityInstance (org.camunda.bpm.engine.history.HistoricCaseActivityInstance)5 NotValidException (org.camunda.bpm.engine.exception.NotValidException)2 HistoricCaseInstance (org.camunda.bpm.engine.history.HistoricCaseInstance)2 Response (com.jayway.restassured.response.Response)1 ArrayList (java.util.ArrayList)1 AbstractRestServiceTest (org.camunda.bpm.engine.rest.AbstractRestServiceTest)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 HistoricCaseActivityInstanceDto (org.camunda.bpm.engine.rest.dto.history.HistoricCaseActivityInstanceDto)1 CaseExecution (org.camunda.bpm.engine.runtime.CaseExecution)1 CaseInstance (org.camunda.bpm.engine.runtime.CaseInstance)1 Task (org.camunda.bpm.engine.task.Task)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 Test (org.junit.Test)1 InOrder (org.mockito.InOrder)1