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));
}
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));
}
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));
}
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();
}
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);
}
Aggregations