Search in sources :

Example 11 with DmnDecisionTableResult

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

the class DmnEngineApiTest method shouldEvaluateDecisionTableWithVariableMap.

@Test
@DecisionResource(resource = ONE_RULE_DMN)
public void shouldEvaluateDecisionTableWithVariableMap() {
    DmnDecisionTableResult results = dmnEngine.evaluateDecisionTable(decision, createVariables().putValue("input", INPUT_VALUE));
    assertThat(results).hasSingleResult().hasSingleEntry(EXPECTED_OUTPUT_VALUE);
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 12 with DmnDecisionTableResult

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

the class DmnDecisionEvaluationTest method shouldEvaluateDecisionsWithNoMatchingRuleAndDefaultRuleInParent.

@Test
public void shouldEvaluateDecisionsWithNoMatchingRuleAndDefaultRuleInParent() {
    DmnDecisionTableResult results = dmnEngine.evaluateDecisionTable(parseDecisionFromFile("A", DMN_DECISIONS_WITH_DIFFERENT_INPUT_OUTPUT_TYPES), createVariables().putValue("dd", "7").putValue("ee", 2147483650L).asVariableContext());
    assertThat(results).hasSingleResult().containsEntry("aa", 7.2);
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest)

Example 13 with DmnDecisionTableResult

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

the class DmnDecisionEvaluationTest method shouldEvaluateDecisionsWithDefaultRuleInChildDecision.

@Test
public void shouldEvaluateDecisionsWithDefaultRuleInChildDecision() {
    DmnDecisionTableResult results = dmnEngine.evaluateDecisionTable(parseDecisionFromFile("A", DMN_DECISIONS_WITH_DEFAULT_RULE_IN_CHILD), createVariables().putValue("dd", // There is no rule in the table matching the input 7
    "7").asVariableContext());
    assertThat(results).hasSingleResult().containsEntry("aa", 7.0);
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest)

Example 14 with DmnDecisionTableResult

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

the class DmnDecisionEvaluationTest method shouldEvaluateDrdDishDecisionExample.

@Test
public void shouldEvaluateDrdDishDecisionExample() {
    DmnDecisionTableResult results = dmnEngine.evaluateDecisionTable(parseDecisionFromFile("Dish", DMN_DECISIONS_WITH_DISH_DECISON_EXAMPLE), createVariables().putValue("temperature", 20).putValue("dayType", "Weekend"));
    assertThat(results).hasSingleResult().containsEntry("desiredDish", "Steak");
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest)

Example 15 with DmnDecisionTableResult

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

the class DmnDecisionEvaluationTest method shouldEvaluateDecisionsWithDifferentInputAndOutputTypes.

@Test
public void shouldEvaluateDecisionsWithDifferentInputAndOutputTypes() {
    DmnDecisionTableResult results = dmnEngine.evaluateDecisionTable(parseDecisionFromFile("A", DMN_DECISIONS_WITH_DIFFERENT_INPUT_OUTPUT_TYPES), createVariables().putValue("dd", "5").putValue("ee", 21).asVariableContext());
    assertThat(results.get(0)).containsEntry("aa", 7.1);
    results = dmnEngine.evaluateDecisionTable(parseDecisionFromFile("A", DMN_DECISIONS_WITH_DIFFERENT_INPUT_OUTPUT_TYPES), createVariables().putValue("dd", "5").putValue("ee", 2147483650L).asVariableContext());
    assertThat(results.get(0)).containsEntry("aa", 7.0);
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest)

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