Search in sources :

Example 1 with DmnDecisionRuleResult

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

the class DmnDecisionTableResultAssert method hasSingleResult.

public DmnDecisionRuleResultAssert hasSingleResult() {
    hasSize(1);
    DmnDecisionRuleResult singleResult = actual.getSingleResult();
    return new DmnDecisionRuleResultAssert(singleResult);
}
Also used : DmnDecisionRuleResult(org.camunda.bpm.dmn.engine.DmnDecisionRuleResult)

Example 2 with DmnDecisionRuleResult

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

the class DmnDecisionTableResultTest method testSingleOutputTypedValue.

@Test
@DecisionResource(resource = RESULT_TEST_WITH_TYPES_DMN)
public void testSingleOutputTypedValue() {
    DmnDecisionTableResult decisionResult = evaluateWithMatchingRules(SINGLE_OUTPUT_VALUE);
    assertThat(decisionResult).hasSize(1);
    DmnDecisionRuleResult ruleResult = decisionResult.getFirstResult();
    TypedValue typedValue = ruleResult.getEntryTyped("firstOutput");
    assertThat(typedValue).isEqualTo(Variables.stringValue("singleValue"));
    typedValue = ruleResult.getEntryTyped("secondOutput");
    assertThat(typedValue).isNull();
    typedValue = ruleResult.getFirstEntryTyped();
    assertThat(typedValue).isEqualTo(Variables.stringValue("singleValue"));
    typedValue = ruleResult.getSingleEntryTyped();
    assertThat(typedValue).isEqualTo(Variables.stringValue("singleValue"));
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) DmnDecisionRuleResult(org.camunda.bpm.dmn.engine.DmnDecisionRuleResult) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 3 with DmnDecisionRuleResult

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

the class DmnDecisionTableResultTest method testSingleOutputUntypedValue.

@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testSingleOutputUntypedValue() {
    DmnDecisionTableResult decisionResult = evaluateWithMatchingRules(SINGLE_OUTPUT_VALUE);
    assertThat(decisionResult).hasSize(1);
    DmnDecisionRuleResult ruleResult = decisionResult.getFirstResult();
    TypedValue typedEntry = ruleResult.getEntryTyped("firstOutput");
    assertThat(typedEntry).isEqualTo(Variables.untypedValue("singleValue"));
    typedEntry = ruleResult.getEntryTyped("secondOutput");
    assertThat(typedEntry).isNull();
    typedEntry = ruleResult.getFirstEntryTyped();
    assertThat(typedEntry).isEqualTo(Variables.untypedValue("singleValue"));
    typedEntry = ruleResult.getSingleEntryTyped();
    assertThat(typedEntry).isEqualTo(Variables.untypedValue("singleValue"));
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) DmnDecisionRuleResult(org.camunda.bpm.dmn.engine.DmnDecisionRuleResult) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 4 with DmnDecisionRuleResult

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

the class DmnDecisionTableResultTest method testValueMap.

@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testValueMap() {
    DmnDecisionTableResult decisionResult = evaluateWithMatchingRules(MULTIPLE_OUTPUT_VALUES);
    DmnDecisionRuleResult ruleResult = decisionResult.getSingleResult();
    assertThat(ruleResult).hasSize(2);
    Map<String, Object> entryMap = ruleResult.getEntryMap();
    assertThat(entryMap).hasSize(2);
    assertThat(entryMap).containsEntry("firstOutput", "multipleValues1");
    assertThat(entryMap).containsEntry("secondOutput", "multipleValues2");
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) DmnDecisionRuleResult(org.camunda.bpm.dmn.engine.DmnDecisionRuleResult) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 5 with DmnDecisionRuleResult

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

the class DmnDecisionTableResultImpl method getResultList.

@Override
public List<Map<String, Object>> getResultList() {
    List<Map<String, Object>> entryMapList = new ArrayList<Map<String, Object>>();
    for (DmnDecisionRuleResult ruleResult : ruleResults) {
        Map<String, Object> entryMap = ruleResult.getEntryMap();
        entryMapList.add(entryMap);
    }
    return entryMapList;
}
Also used : DmnDecisionRuleResult(org.camunda.bpm.dmn.engine.DmnDecisionRuleResult) ArrayList(java.util.ArrayList) Map(java.util.Map)

Aggregations

DmnDecisionRuleResult (org.camunda.bpm.dmn.engine.DmnDecisionRuleResult)9 DmnDecisionTableResult (org.camunda.bpm.dmn.engine.DmnDecisionTableResult)5 DecisionResource (org.camunda.bpm.dmn.engine.test.DecisionResource)4 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)4 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)3 TypedValue (org.camunda.bpm.engine.variable.value.TypedValue)2 Map (java.util.Map)1 DmnDecisionResultEntries (org.camunda.bpm.dmn.engine.DmnDecisionResultEntries)1 DmnDecisionResultException (org.camunda.bpm.dmn.engine.impl.DmnDecisionResultException)1 DecisionService (org.camunda.bpm.engine.DecisionService)1