use of org.camunda.bpm.engine.repository.DecisionDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionDefinitionQueryTest method testQueryAuthenticatedTenant.
public void testQueryAuthenticatedTenant() {
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
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).includeDecisionDefinitionsWithoutTenantId().count(), is(2L));
}
use of org.camunda.bpm.engine.repository.DecisionDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionDefinitionQueryTest method testQueryAuthenticatedTenants.
public void testQueryAuthenticatedTenants() {
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO));
DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
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.DecisionDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionDefinitionQueryTest method testQueryByLatestWithTenantId.
public void testQueryByLatestWithTenantId() {
// deploy a second version for tenant one
deploymentForTenant(TENANT_ONE, DMN);
DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).latestVersion().tenantIdIn(TENANT_ONE);
assertThat(query.count(), is(1L));
DecisionDefinition decisionDefinition = query.singleResult();
assertThat(decisionDefinition.getTenantId(), is(TENANT_ONE));
assertThat(decisionDefinition.getVersion(), is(2));
query = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).latestVersion().tenantIdIn(TENANT_TWO);
assertThat(query.count(), is(1L));
decisionDefinition = query.singleResult();
assertThat(decisionDefinition.getTenantId(), is(TENANT_TWO));
assertThat(decisionDefinition.getVersion(), is(1));
}
use of org.camunda.bpm.engine.repository.DecisionDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionDefinitionQueryTest method testQueryByLatestWithoutTenantId.
public void testQueryByLatestWithoutTenantId() {
// deploy a second version without tenant id
deployment(DMN);
DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).latestVersion().withoutTenantId();
assertThat(query.count(), is(1L));
DecisionDefinition decisionDefinition = query.singleResult();
assertThat(decisionDefinition.getTenantId(), is(nullValue()));
assertThat(decisionDefinition.getVersion(), is(2));
}
use of org.camunda.bpm.engine.repository.DecisionDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionDefinitionQueryTest method testQueryByNonExistingTenantId.
public void testQueryByNonExistingTenantId() {
DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery().tenantIdIn("nonExisting");
assertThat(query.count(), is(0L));
}
Aggregations