use of org.camunda.bpm.engine.repository.DecisionDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionDefinitionQueryTest method testQueryByLatestNoTenantIdSet.
public void testQueryByLatestNoTenantIdSet() {
// deploy a second version for tenant one
deploymentForTenant(TENANT_ONE, DMN);
DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).latestVersion();
// one definition for each tenant
assertThat(query.count(), is(3L));
Map<String, DecisionDefinition> decisionDefinitionsForTenant = getDecisionDefinitionsForTenant(query.list());
assertThat(decisionDefinitionsForTenant.get(TENANT_ONE).getVersion(), is(2));
assertThat(decisionDefinitionsForTenant.get(TENANT_TWO).getVersion(), is(1));
assertThat(decisionDefinitionsForTenant.get(null).getVersion(), is(1));
}
use of org.camunda.bpm.engine.repository.DecisionDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionDefinitionQueryTest method testQueryByLatestWithTenantIds.
public void testQueryByLatestWithTenantIds() {
// deploy a second version for tenant one
deploymentForTenant(TENANT_ONE, DMN);
DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).latestVersion().tenantIdIn(TENANT_ONE, TENANT_TWO).orderByTenantId().asc();
// one definition for each tenant
assertThat(query.count(), is(2L));
Map<String, DecisionDefinition> decisionDefinitionsForTenant = getDecisionDefinitionsForTenant(query.list());
assertThat(decisionDefinitionsForTenant.get(TENANT_ONE).getVersion(), is(2));
assertThat(decisionDefinitionsForTenant.get(TENANT_TWO).getVersion(), is(1));
}
use of org.camunda.bpm.engine.repository.DecisionDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionDefinitionQueryTest method testQueryDisabledTenantCheck.
public void testQueryDisabledTenantCheck() {
processEngineConfiguration.setTenantCheckEnabled(false);
identityService.setAuthentication("user", null, null);
DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
assertThat(query.count(), is(3L));
}
use of org.camunda.bpm.engine.repository.DecisionDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionDefinitionQueryTest method testQueryByKey.
public void testQueryByKey() {
DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY);
// one definition for each tenant
assertThat(query.count(), is(3L));
query = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).withoutTenantId();
// one definition without tenant id
assertThat(query.count(), is(1L));
query = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).tenantIdIn(TENANT_ONE);
// one definition for tenant one
assertThat(query.count(), is(1L));
}
use of org.camunda.bpm.engine.repository.DecisionDefinitionQuery in project camunda-bpm-platform by camunda.
the class DecisionDefinitionAuthorizationTest method testQueryWithReadPermissionOnOneDecisionDefinition.
public void testQueryWithReadPermissionOnOneDecisionDefinition() {
// given user gets read permission on the decision definition
createGrantAuthorization(DECISION_DEFINITION, DECISION_DEFINITION_KEY, userId, READ);
// when
DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
// then
verifyQueryResults(query, 1);
DecisionDefinition definition = query.singleResult();
assertNotNull(definition);
assertEquals(DECISION_DEFINITION_KEY, definition.getKey());
}
Aggregations