Search in sources :

Example 31 with DmnDecisionTableResult

use of org.camunda.bpm.dmn.engine.DmnDecisionTableResult in project camunda-bpm-platform by camunda.

the class DecisionContextSwitchTest method shouldSwitchContextWhenUsingDecisionServiceAfterRedeployment.

@Test
@OperateOnDeployment("clientDeployment")
public void shouldSwitchContextWhenUsingDecisionServiceAfterRedeployment() {
    // given
    List<org.camunda.bpm.engine.repository.Deployment> deployments = repositoryService.createDeploymentQuery().list();
    // find dmn deployment
    org.camunda.bpm.engine.repository.Deployment dmnDeployment = null;
    for (org.camunda.bpm.engine.repository.Deployment deployment : deployments) {
        List<String> resourceNames = repositoryService.getDeploymentResourceNames(deployment.getId());
        if (resourceNames.contains(DMN_RESOURCE_NAME)) {
            dmnDeployment = deployment;
        }
    }
    if (dmnDeployment == null) {
        Assert.fail("Expected to find DMN deployment");
    }
    org.camunda.bpm.engine.repository.Deployment deployment2 = repositoryService.createDeployment().nameFromDeployment(dmnDeployment.getId()).addDeploymentResources(dmnDeployment.getId()).deploy();
    try {
        // when then
        DmnDecisionTableResult decisionResult = decisionService.evaluateDecisionTableByKey("decision", Variables.createVariables());
        assertEquals("ok", decisionResult.getFirstResult().getFirstEntry());
    } finally {
        repositoryService.deleteDeployment(deployment2.getId(), true);
    }
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Deployment(org.jboss.arquillian.container.test.api.Deployment) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test) AbstractFoxPlatformIntegrationTest(org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)

Example 32 with DmnDecisionTableResult

use of org.camunda.bpm.dmn.engine.DmnDecisionTableResult in project camunda-bpm-platform by camunda.

the class MultiTenancyDecisionTableEvaluationTest method testEvaluateDecisionByKeyWithoutTenantId.

public void testEvaluateDecisionByKeyWithoutTenantId() {
    deployment(DMN_FILE);
    DmnDecisionTableResult decisionResult = decisionService.evaluateDecisionTableByKey(DECISION_DEFINITION_KEY).variables(createVariables()).decisionDefinitionWithoutTenantId().evaluate();
    assertThatDecisionHasResult(decisionResult, RESULT_OF_FIRST_VERSION);
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult)

Example 33 with DmnDecisionTableResult

use of org.camunda.bpm.dmn.engine.DmnDecisionTableResult in project camunda-bpm-platform by camunda.

the class MultiTenancyDecisionTableEvaluationTest method testEvaluateDecisionByKeyAndTenantId.

public void testEvaluateDecisionByKeyAndTenantId() {
    deploymentForTenant(TENANT_ONE, DMN_FILE);
    deploymentForTenant(TENANT_TWO, DMN_FILE_SECOND_VERSION);
    DmnDecisionTableResult decisionResult = decisionService.evaluateDecisionTableByKey(DECISION_DEFINITION_KEY).variables(createVariables()).decisionDefinitionTenantId(TENANT_ONE).evaluate();
    assertThatDecisionHasResult(decisionResult, RESULT_OF_FIRST_VERSION);
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult)

Example 34 with DmnDecisionTableResult

use of org.camunda.bpm.dmn.engine.DmnDecisionTableResult in project camunda-bpm-platform by camunda.

the class MultiTenancyDecisionTableEvaluationTest method testEvaluateDecisionByKeyLatestVersionAndTenantId.

public void testEvaluateDecisionByKeyLatestVersionAndTenantId() {
    deploymentForTenant(TENANT_ONE, DMN_FILE);
    deploymentForTenant(TENANT_ONE, DMN_FILE_SECOND_VERSION);
    DmnDecisionTableResult decisionResult = decisionService.evaluateDecisionTableByKey(DECISION_DEFINITION_KEY).variables(createVariables()).decisionDefinitionTenantId(TENANT_ONE).evaluate();
    assertThatDecisionHasResult(decisionResult, RESULT_OF_SECOND_VERSION);
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult)

Example 35 with DmnDecisionTableResult

use of org.camunda.bpm.dmn.engine.DmnDecisionTableResult in project camunda-bpm-platform by camunda.

the class MultiTenancyDecisionTableEvaluationTest method testEvaluateDecisionByKeyVersionAndTenantId.

public void testEvaluateDecisionByKeyVersionAndTenantId() {
    deploymentForTenant(TENANT_ONE, DMN_FILE);
    deploymentForTenant(TENANT_TWO, DMN_FILE);
    deploymentForTenant(TENANT_TWO, DMN_FILE_SECOND_VERSION);
    DmnDecisionTableResult decisionResult = decisionService.evaluateDecisionTableByKey(DECISION_DEFINITION_KEY).variables(createVariables()).version(1).decisionDefinitionTenantId(TENANT_TWO).evaluate();
    assertThatDecisionHasResult(decisionResult, RESULT_OF_FIRST_VERSION);
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult)

Aggregations

DmnDecisionTableResult (org.camunda.bpm.dmn.engine.DmnDecisionTableResult)56 Test (org.junit.Test)44 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)33 DecisionResource (org.camunda.bpm.dmn.engine.test.DecisionResource)20 Deployment (org.camunda.bpm.engine.test.Deployment)9 DmnDecisionRuleResult (org.camunda.bpm.dmn.engine.DmnDecisionRuleResult)5 DecisionDefinition (org.camunda.bpm.engine.repository.DecisionDefinition)5 Map (java.util.Map)4 TypedValue (org.camunda.bpm.engine.variable.value.TypedValue)4 DmnDecisionResultException (org.camunda.bpm.dmn.engine.impl.DmnDecisionResultException)2 AbstractFoxPlatformIntegrationTest (org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)2 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)2 DmnDecisionRequirementsGraph (org.camunda.bpm.dmn.engine.DmnDecisionRequirementsGraph)1 DecisionService (org.camunda.bpm.engine.DecisionService)1 VariableMap (org.camunda.bpm.engine.variable.VariableMap)1 Deployment (org.jboss.arquillian.container.test.api.Deployment)1