Search in sources :

Example 6 with DecisionDefinitionQuery

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));
}
Also used : DecisionDefinitionQuery(org.camunda.bpm.engine.repository.DecisionDefinitionQuery) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition)

Example 7 with DecisionDefinitionQuery

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));
}
Also used : DecisionDefinitionQuery(org.camunda.bpm.engine.repository.DecisionDefinitionQuery) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition)

Example 8 with DecisionDefinitionQuery

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));
}
Also used : DecisionDefinitionQuery(org.camunda.bpm.engine.repository.DecisionDefinitionQuery)

Example 9 with DecisionDefinitionQuery

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));
}
Also used : DecisionDefinitionQuery(org.camunda.bpm.engine.repository.DecisionDefinitionQuery)

Example 10 with DecisionDefinitionQuery

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());
}
Also used : DecisionDefinitionQuery(org.camunda.bpm.engine.repository.DecisionDefinitionQuery) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition)

Aggregations

DecisionDefinitionQuery (org.camunda.bpm.engine.repository.DecisionDefinitionQuery)49 Test (org.junit.Test)23 NotValidException (org.camunda.bpm.engine.exception.NotValidException)10 DecisionDefinition (org.camunda.bpm.engine.repository.DecisionDefinition)10 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)2 DecisionDefinitionQueryDto (org.camunda.bpm.engine.rest.dto.repository.DecisionDefinitionQueryDto)2 Deployment (org.camunda.bpm.engine.test.Deployment)2 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 DecisionRequirementsDefinition (org.camunda.bpm.engine.repository.DecisionRequirementsDefinition)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 DecisionDefinitionDto (org.camunda.bpm.engine.rest.dto.repository.DecisionDefinitionDto)1