Search in sources :

Example 6 with CaseInstanceQuery

use of org.camunda.bpm.engine.runtime.CaseInstanceQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyCaseInstanceQueryTest method testQueryByTenantIds.

public void testQueryByTenantIds() {
    CaseInstanceQuery query = caseService.createCaseInstanceQuery().tenantIdIn(TENANT_ONE, TENANT_TWO);
    assertThat(query.count(), is(2L));
}
Also used : CaseInstanceQuery(org.camunda.bpm.engine.runtime.CaseInstanceQuery)

Example 7 with CaseInstanceQuery

use of org.camunda.bpm.engine.runtime.CaseInstanceQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyCaseInstanceQueryTest method testQueryAuthenticatedTenants.

public void testQueryAuthenticatedTenants() {
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO));
    CaseInstanceQuery query = caseService.createCaseInstanceQuery();
    assertThat(query.count(), is(3L));
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
    assertThat(query.tenantIdIn(TENANT_TWO).count(), is(1L));
    assertThat(query.withoutTenantId().count(), is(1L));
}
Also used : CaseInstanceQuery(org.camunda.bpm.engine.runtime.CaseInstanceQuery)

Example 8 with CaseInstanceQuery

use of org.camunda.bpm.engine.runtime.CaseInstanceQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyCaseInstanceQueryTest method testQueryAuthenticatedTenant.

public void testQueryAuthenticatedTenant() {
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
    CaseInstanceQuery query = caseService.createCaseInstanceQuery();
    assertThat(query.count(), is(2L));
    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 : CaseInstanceQuery(org.camunda.bpm.engine.runtime.CaseInstanceQuery)

Example 9 with CaseInstanceQuery

use of org.camunda.bpm.engine.runtime.CaseInstanceQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyCreateCaseInstanceTest method testCreateCaseInstanceByKeyWithTenantIdAuthenticatedTenant.

public void testCreateCaseInstanceByKeyWithTenantIdAuthenticatedTenant() {
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
    deploymentForTenant(TENANT_ONE, CMMN_FILE);
    deploymentForTenant(TENANT_TWO, CMMN_FILE);
    caseService.withCaseDefinitionByKey(CASE_DEFINITION_KEY).caseDefinitionTenantId(TENANT_ONE).create();
    CaseInstanceQuery query = caseService.createCaseInstanceQuery();
    assertThat(query.count(), is(1L));
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
}
Also used : CaseInstanceQuery(org.camunda.bpm.engine.runtime.CaseInstanceQuery)

Example 10 with CaseInstanceQuery

use of org.camunda.bpm.engine.runtime.CaseInstanceQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyCreateCaseInstanceTest method testCreateCaseInstanceByKeyWithoutTenantIdNoAuthenticatedTenants.

public void testCreateCaseInstanceByKeyWithoutTenantIdNoAuthenticatedTenants() {
    identityService.setAuthentication("user", null, null);
    deployment(CMMN_FILE);
    caseService.withCaseDefinitionByKey(CASE_DEFINITION_KEY).caseDefinitionWithoutTenantId().create();
    CaseInstanceQuery query = caseService.createCaseInstanceQuery();
    assertThat(query.count(), is(1L));
}
Also used : CaseInstanceQuery(org.camunda.bpm.engine.runtime.CaseInstanceQuery)

Aggregations

CaseInstanceQuery (org.camunda.bpm.engine.runtime.CaseInstanceQuery)123 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)21 Deployment (org.camunda.bpm.engine.test.Deployment)10 NotValidException (org.camunda.bpm.engine.exception.NotValidException)9 ArrayList (java.util.ArrayList)8 CaseInstance (org.camunda.bpm.engine.runtime.CaseInstance)8 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)7 Date (java.util.Date)6 CaseExecutionQuery (org.camunda.bpm.engine.runtime.CaseExecutionQuery)4 CaseDefinition (org.camunda.bpm.engine.repository.CaseDefinition)3 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)2 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 CaseInstanceDto (org.camunda.bpm.engine.rest.dto.runtime.CaseInstanceDto)1 CaseExecution (org.camunda.bpm.engine.runtime.CaseExecution)1