use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessDefinitionQueryTest method testQueryByNonExistingTenantId.
public void testQueryByNonExistingTenantId() {
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().tenantIdIn("nonExisting");
assertThat(query.count(), is(0L));
}
use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessDefinitionQueryTest method testQueryAuthenticatedTenants.
public void testQueryAuthenticatedTenants() {
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO));
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
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));
}
use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessDefinitionQueryTest method testQueryByKey.
public void testQueryByKey() {
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY);
// one definition for each tenant
assertThat(query.count(), is(3L));
query = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).withoutTenantId();
// one definition without tenant id
assertThat(query.count(), is(1L));
query = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).tenantIdIn(TENANT_ONE);
// one definition for tenant one
assertThat(query.count(), is(1L));
}
use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessDefinitionQueryTest method testQueryByLatestWithTenantId.
public void testQueryByLatestWithTenantId() {
// deploy a second version for tenant one
deploymentForTenant(TENANT_ONE, emptyProcess);
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).latestVersion().tenantIdIn(TENANT_ONE);
assertThat(query.count(), is(1L));
ProcessDefinition processDefinition = query.singleResult();
assertThat(processDefinition.getTenantId(), is(TENANT_ONE));
assertThat(processDefinition.getVersion(), is(2));
query = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).latestVersion().tenantIdIn(TENANT_TWO);
assertThat(query.count(), is(1L));
processDefinition = query.singleResult();
assertThat(processDefinition.getTenantId(), is(TENANT_TWO));
assertThat(processDefinition.getVersion(), is(1));
}
use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessDefinitionQueryTest method testQueryByLatestWithoutTenantId.
public void testQueryByLatestWithoutTenantId() {
// deploy a second version without tenant id
deployment(emptyProcess);
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).latestVersion().withoutTenantId();
assertThat(query.count(), is(1L));
ProcessDefinition processDefinition = query.singleResult();
assertThat(processDefinition.getTenantId(), is(nullValue()));
assertThat(processDefinition.getVersion(), is(2));
}
Aggregations