Search in sources :

Example 31 with CaseDefinitionQuery

use of org.camunda.bpm.engine.repository.CaseDefinitionQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyCaseDefinitionQueryTest method testQueryByLatestNoTenantIdSet.

public void testQueryByLatestNoTenantIdSet() {
    // deploy a second version for tenant one
    deploymentForTenant(TENANT_ONE, CMMN);
    CaseDefinitionQuery query = repositoryService.createCaseDefinitionQuery().caseDefinitionKey(CASE_DEFINITION_KEY).latestVersion();
    // one definition for each tenant
    assertThat(query.count(), is(3L));
    Map<String, CaseDefinition> caseDefinitionsForTenant = getCaseDefinitionsForTenant(query.list());
    assertThat(caseDefinitionsForTenant.get(TENANT_ONE).getVersion(), is(2));
    assertThat(caseDefinitionsForTenant.get(TENANT_TWO).getVersion(), is(1));
    assertThat(caseDefinitionsForTenant.get(null).getVersion(), is(1));
}
Also used : CaseDefinition(org.camunda.bpm.engine.repository.CaseDefinition) CaseDefinitionQuery(org.camunda.bpm.engine.repository.CaseDefinitionQuery)

Example 32 with CaseDefinitionQuery

use of org.camunda.bpm.engine.repository.CaseDefinitionQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyCaseDefinitionQueryTest method testQueryByTenantId.

public void testQueryByTenantId() {
    CaseDefinitionQuery query = repositoryService.createCaseDefinitionQuery().tenantIdIn(TENANT_ONE);
    assertThat(query.count(), is(1L));
    query = repositoryService.createCaseDefinitionQuery().tenantIdIn(TENANT_TWO);
    assertThat(query.count(), is(1L));
}
Also used : CaseDefinitionQuery(org.camunda.bpm.engine.repository.CaseDefinitionQuery)

Example 33 with CaseDefinitionQuery

use of org.camunda.bpm.engine.repository.CaseDefinitionQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyCaseDefinitionQueryTest method testQueryByNonExistingTenantId.

public void testQueryByNonExistingTenantId() {
    CaseDefinitionQuery query = repositoryService.createCaseDefinitionQuery().tenantIdIn("nonExisting");
    assertThat(query.count(), is(0L));
}
Also used : CaseDefinitionQuery(org.camunda.bpm.engine.repository.CaseDefinitionQuery)

Example 34 with CaseDefinitionQuery

use of org.camunda.bpm.engine.repository.CaseDefinitionQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyCaseInstanceQueryTest method createCaseInstance.

protected void createCaseInstance(String tenantId) {
    String caseDefinitionId = null;
    CaseDefinitionQuery caseDefinitionQuery = repositoryService.createCaseDefinitionQuery().caseDefinitionKey("oneTaskCase");
    if (tenantId == null) {
        caseDefinitionId = caseDefinitionQuery.withoutTenantId().singleResult().getId();
    } else {
        caseDefinitionId = caseDefinitionQuery.tenantIdIn(tenantId).singleResult().getId();
    }
    caseService.withCaseDefinition(caseDefinitionId).create();
}
Also used : CaseDefinitionQuery(org.camunda.bpm.engine.repository.CaseDefinitionQuery)

Example 35 with CaseDefinitionQuery

use of org.camunda.bpm.engine.repository.CaseDefinitionQuery in project camunda-bpm-platform by camunda.

the class CaseDefinitionQueryTest method testQueryByKey.

public void testQueryByKey() {
    CaseDefinitionQuery query = repositoryService.createCaseDefinitionQuery();
    // case one
    query.caseDefinitionKey("one");
    verifyQueryResults(query, 2);
    // case two
    query.caseDefinitionKey("two");
    verifyQueryResults(query, 1);
}
Also used : CaseDefinitionQuery(org.camunda.bpm.engine.repository.CaseDefinitionQuery)

Aggregations

CaseDefinitionQuery (org.camunda.bpm.engine.repository.CaseDefinitionQuery)47 CaseDefinition (org.camunda.bpm.engine.repository.CaseDefinition)12 NotValidException (org.camunda.bpm.engine.exception.NotValidException)10 Response (com.jayway.restassured.response.Response)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)2 User (org.camunda.bpm.engine.identity.User)2 UserQuery (org.camunda.bpm.engine.identity.UserQuery)2 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)2 ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)2 CaseDefinitionQueryDto (org.camunda.bpm.engine.rest.dto.repository.CaseDefinitionQueryDto)2 Deployment (org.camunda.bpm.engine.test.Deployment)2 Test (org.junit.Test)2 Matchers.anyString (org.mockito.Matchers.anyString)2 InputStream (java.io.InputStream)1 LinkedHashMap (java.util.LinkedHashMap)1 ProcessApplicationService (org.camunda.bpm.ProcessApplicationService)1 ProcessApplicationInfo (org.camunda.bpm.application.ProcessApplicationInfo)1