Search in sources :

Example 46 with DmnDecisionTableResult

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

the class DmnDecisionEvaluationTest method shouldEvaluateDecisionsWithRequiredDecisionAndMultipleMatchingRulesMultipleOutputs.

@Test
public void shouldEvaluateDecisionsWithRequiredDecisionAndMultipleMatchingRulesMultipleOutputs() {
    DmnDecisionTableResult results = dmnEngine.evaluateDecisionTable(parseDecisionFromFile("A", DMN_DECISIONS_WITH_MULTIPLE_MATCHING_RULES_MULTIPLE_OUTPUTS), createVariables().putValue("dd", "dd").putValue("ee", "ee").asVariableContext());
    List<Map<String, Object>> resultList = results.getResultList();
    assertThat(resultList.get(0)).containsEntry("aa", "aa");
    assertThat(resultList.get(1)).containsEntry("aa", "aaa");
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) Map(java.util.Map) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest)

Example 47 with DmnDecisionTableResult

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

the class HitPolicyTest method testCollectHitPolicyCompoundOutputSingleMatchingRule.

@Test
@DecisionResource(resource = COLLECT_COMPOUND)
public void testCollectHitPolicyCompoundOutputSingleMatchingRule() {
    DmnDecisionTableResult results = evaluateDecisionTable(true, false, false, "a", "b", "c");
    assertThat(results).hasSingleResult().containsOnly(entry("out1", "a"), entry("out2", "a"), entry("out3", "a"));
    results = evaluateDecisionTable(false, true, false, "a", "b", "c");
    assertThat(results).hasSingleResult().containsOnly(entry("out1", "b"), entry("out2", "b"), entry("out3", "b"));
    results = evaluateDecisionTable(false, false, true, "a", "b", "c");
    assertThat(results).hasSingleResult().containsOnly(entry("out1", "c"), entry("out2", "c"), entry("out3", "c"));
}
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 48 with DmnDecisionTableResult

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

the class HitPolicyTest method testCollectHitPolicySingleOutputMultipleMatchingRules.

@Test
@DecisionResource(resource = COLLECT_SINGLE)
public void testCollectHitPolicySingleOutputMultipleMatchingRules() {
    DmnDecisionTableResult results = evaluateDecisionTable(true, true, false, "a", "b", "c");
    assertThat(results).hasSize(2);
    assertThat(collectSingleOutputEntries(results)).containsOnlyOnce("a", "b");
    results = evaluateDecisionTable(true, false, true, "a", "b", "c");
    assertThat(results).hasSize(2);
    assertThat(collectSingleOutputEntries(results)).containsOnlyOnce("a", "c");
    results = evaluateDecisionTable(false, true, true, "a", "b", "c");
    assertThat(results).hasSize(2);
    assertThat(collectSingleOutputEntries(results)).containsOnlyOnce("b", "c");
    results = evaluateDecisionTable(true, true, true, "a", "b", "c");
    assertThat(results).hasSize(3);
    assertThat(collectSingleOutputEntries(results)).containsOnlyOnce("a", "b", "c");
}
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 49 with DmnDecisionTableResult

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

the class HitPolicyTest method testRuleOrderHitPolicySingleOutputMultipleMatchingRules.

@Test
@DecisionResource(resource = RULE_ORDER_SINGLE)
public void testRuleOrderHitPolicySingleOutputMultipleMatchingRules() {
    DmnDecisionTableResult results = evaluateDecisionTable(true, true, false, "a", "b", "c");
    assertThat(results).hasSize(2);
    assertThat(collectSingleOutputEntries(results)).containsExactly("a", "b");
    results = evaluateDecisionTable(true, true, false, "c", "b", "a");
    assertThat(results).hasSize(2);
    assertThat(collectSingleOutputEntries(results)).containsExactly("c", "b");
    results = evaluateDecisionTable(true, false, true, "a", "b", "c");
    assertThat(results).hasSize(2);
    assertThat(collectSingleOutputEntries(results)).containsExactly("a", "c");
    results = evaluateDecisionTable(true, false, true, "c", "b", "a");
    assertThat(results).hasSize(2);
    assertThat(collectSingleOutputEntries(results)).containsExactly("c", "a");
    results = evaluateDecisionTable(false, true, true, "a", "b", "c");
    assertThat(results).hasSize(2);
    assertThat(collectSingleOutputEntries(results)).containsExactly("b", "c");
    results = evaluateDecisionTable(false, true, true, "c", "b", "a");
    assertThat(results).hasSize(2);
    assertThat(collectSingleOutputEntries(results)).containsExactly("b", "a");
    results = evaluateDecisionTable(true, true, true, "a", "b", "c");
    assertThat(results).hasSize(3);
    assertThat(collectSingleOutputEntries(results)).containsExactly("a", "b", "c");
    results = evaluateDecisionTable(true, true, true, "c", "b", "a");
    assertThat(results).hasSize(3);
    assertThat(collectSingleOutputEntries(results)).containsExactly("c", "b", "a");
}
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 50 with DmnDecisionTableResult

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

the class HitPolicyTest method testRuleOrderHitPolicyCompoundOutputMultipleMatchingRules.

@Test
@DecisionResource(resource = RULE_ORDER_COMPOUND)
public void testRuleOrderHitPolicyCompoundOutputMultipleMatchingRules() {
    DmnDecisionTableResult results = evaluateDecisionTable(true, true, false, "a", "b", "c");
    assertThat(results).hasSize(2);
    assertThat(results.get(0)).containsOnly(entry("out1", "a"), entry("out2", "a"), entry("out3", "a"));
    assertThat(results.get(1)).containsOnly(entry("out1", "b"), entry("out2", "b"), entry("out3", "b"));
    results = evaluateDecisionTable(true, true, false, "c", "b", "a");
    assertThat(results).hasSize(2);
    assertThat(results.get(0)).containsOnly(entry("out1", "c"), entry("out2", "c"), entry("out3", "c"));
    assertThat(results.get(1)).containsOnly(entry("out1", "b"), entry("out2", "b"), entry("out3", "b"));
    results = evaluateDecisionTable(true, false, true, "a", "b", "c");
    assertThat(results).hasSize(2);
    assertThat(results.get(0)).containsOnly(entry("out1", "a"), entry("out2", "a"), entry("out3", "a"));
    assertThat(results.get(1)).containsOnly(entry("out1", "c"), entry("out2", "c"), entry("out3", "c"));
    results = evaluateDecisionTable(true, false, true, "c", "b", "a");
    assertThat(results).hasSize(2);
    assertThat(results.get(0)).containsOnly(entry("out1", "c"), entry("out2", "c"), entry("out3", "c"));
    assertThat(results.get(1)).containsOnly(entry("out1", "a"), entry("out2", "a"), entry("out3", "a"));
    results = evaluateDecisionTable(false, true, true, "a", "b", "c");
    assertThat(results).hasSize(2);
    assertThat(results.get(0)).containsOnly(entry("out1", "b"), entry("out2", "b"), entry("out3", "b"));
    assertThat(results.get(1)).containsOnly(entry("out1", "c"), entry("out2", "c"), entry("out3", "c"));
    results = evaluateDecisionTable(false, true, true, "c", "b", "a");
    assertThat(results).hasSize(2);
    assertThat(results.get(0)).containsOnly(entry("out1", "b"), entry("out2", "b"), entry("out3", "b"));
    assertThat(results.get(1)).containsOnly(entry("out1", "a"), entry("out2", "a"), entry("out3", "a"));
    results = evaluateDecisionTable(true, true, true, "a", "b", "c");
    assertThat(results).hasSize(3);
    assertThat(results.get(0)).containsOnly(entry("out1", "a"), entry("out2", "a"), entry("out3", "a"));
    assertThat(results.get(1)).containsOnly(entry("out1", "b"), entry("out2", "b"), entry("out3", "b"));
    assertThat(results.get(2)).containsOnly(entry("out1", "c"), entry("out2", "c"), entry("out3", "c"));
    results = evaluateDecisionTable(true, true, true, "c", "b", "a");
    assertThat(results).hasSize(3);
    assertThat(results.get(0)).containsOnly(entry("out1", "c"), entry("out2", "c"), entry("out3", "c"));
    assertThat(results.get(1)).containsOnly(entry("out1", "b"), entry("out2", "b"), entry("out3", "b"));
    assertThat(results.get(2)).containsOnly(entry("out1", "a"), entry("out2", "a"), entry("out3", "a"));
}
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)

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