Search in sources :

Example 51 with DecisionDefinition

use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.

the class DecisionDefinitionQueryTest method querySorting.

@Test
public void querySorting() {
    DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
    // asc
    query.orderByDecisionDefinitionId().asc();
    verifyQueryResults(query, 4);
    query = repositoryService.createDecisionDefinitionQuery();
    query.orderByDeploymentId().asc();
    verifyQueryResults(query, 4);
    query = repositoryService.createDecisionDefinitionQuery();
    query.orderByDecisionDefinitionKey().asc();
    verifyQueryResults(query, 4);
    query = repositoryService.createDecisionDefinitionQuery();
    query.orderByDecisionDefinitionVersion().asc();
    verifyQueryResults(query, 4);
    // desc
    query = repositoryService.createDecisionDefinitionQuery();
    query.orderByDecisionDefinitionId().desc();
    verifyQueryResults(query, 4);
    query = repositoryService.createDecisionDefinitionQuery();
    query.orderByDeploymentId().desc();
    verifyQueryResults(query, 4);
    query = repositoryService.createDecisionDefinitionQuery();
    query.orderByDecisionDefinitionKey().desc();
    verifyQueryResults(query, 4);
    query = repositoryService.createDecisionDefinitionQuery();
    query.orderByDecisionDefinitionVersion().desc();
    verifyQueryResults(query, 4);
    query = repositoryService.createDecisionDefinitionQuery();
    // Typical use decision
    query.orderByDecisionDefinitionKey().asc().orderByDecisionDefinitionVersion().desc();
    List<DecisionDefinition> decisionDefinitions = query.list();
    assertEquals(4, decisionDefinitions.size());
    assertEquals("one", decisionDefinitions.get(0).getKey());
    assertEquals(2, decisionDefinitions.get(0).getVersion());
    assertEquals("one", decisionDefinitions.get(1).getKey());
    assertEquals(1, decisionDefinitions.get(1).getVersion());
    assertEquals("two", decisionDefinitions.get(2).getKey());
    assertEquals(1, decisionDefinitions.get(2).getVersion());
}
Also used : DecisionDefinitionQuery(org.camunda.bpm.engine.repository.DecisionDefinitionQuery) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition) Test(org.junit.Test)

Example 52 with DecisionDefinition

use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.

the class MultiTenancyDecisionDefinitionCmdsTenantCheckTest method getDecisionDefinitionDisabledTenantCheck.

@Test
public void getDecisionDefinitionDisabledTenantCheck() {
    processEngineConfiguration.setTenantCheckEnabled(false);
    identityService.setAuthentication("user", null, null);
    DecisionDefinition definition = repositoryService.getDecisionDefinition(decisionDefinitionId);
    assertThat(definition.getTenantId(), is(TENANT_ONE));
}
Also used : DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition) Test(org.junit.Test)

Example 53 with DecisionDefinition

use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.

the class MultiTenancyDecisionDefinitionCmdsTenantCheckTest method getDecisionDefinitionWithAuthenticatedTenant.

@Test
public void getDecisionDefinitionWithAuthenticatedTenant() {
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
    DecisionDefinition definition = repositoryService.getDecisionDefinition(decisionDefinitionId);
    assertThat(definition.getTenantId(), is(TENANT_ONE));
}
Also used : DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition) Test(org.junit.Test)

Example 54 with DecisionDefinition

use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.

the class MultiTenancyDecisionDefinitionCmdsTenantCheckTest method updateHistoryTimeToLiveWithAuthenticatedTenant.

@Test
public void updateHistoryTimeToLiveWithAuthenticatedTenant() {
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
    repositoryService.updateDecisionDefinitionHistoryTimeToLive(decisionDefinitionId, 6);
    DecisionDefinition definition = repositoryService.getDecisionDefinition(decisionDefinitionId);
    assertThat(definition.getTenantId(), is(TENANT_ONE));
    assertThat(definition.getHistoryTimeToLive(), is(6));
}
Also used : DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition) Test(org.junit.Test)

Example 55 with DecisionDefinition

use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.

the class EvaluateDecisionTableCmd method execute.

@Override
public DmnDecisionTableResult execute(CommandContext commandContext) {
    ensureOnlyOneNotNull("either decision definition id or key must be set", decisionDefinitionId, decisionDefinitionKey);
    DecisionDefinition decisionDefinition = getDecisionDefinition(commandContext);
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
        checker.checkEvaluateDecision(decisionDefinition);
    }
    return doEvaluateDecision(decisionDefinition, variables);
}
Also used : CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition)

Aggregations

DecisionDefinition (org.camunda.bpm.engine.repository.DecisionDefinition)68 Test (org.junit.Test)21 Deployment (org.camunda.bpm.engine.test.Deployment)18 DecisionDefinitionQuery (org.camunda.bpm.engine.repository.DecisionDefinitionQuery)10 Date (java.util.Date)6 DmnDecisionTableResult (org.camunda.bpm.dmn.engine.DmnDecisionTableResult)5 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)5 InputStream (java.io.InputStream)4 ArrayList (java.util.ArrayList)4 DmnDecisionResult (org.camunda.bpm.dmn.engine.DmnDecisionResult)4 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)3 HistoricDecisionInstanceEntity (org.camunda.bpm.engine.impl.history.event.HistoricDecisionInstanceEntity)3 Response (com.jayway.restassured.response.Response)2 HistoricCaseInstance (org.camunda.bpm.engine.history.HistoricCaseInstance)2 HistoricDecisionInstanceQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery)2 HistoricDecisionOutputInstance (org.camunda.bpm.engine.history.HistoricDecisionOutputInstance)2 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)2 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)2 GetDeploymentResourceCmd (org.camunda.bpm.engine.impl.cmd.GetDeploymentResourceCmd)2 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)2