Search in sources :

Example 21 with DmnDecisionResultEntries

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

the class DmnDecisionResultListenerTest method testEmptyMap.

@Deployment(resources = { TEST_PROCESS, TEST_DECISION })
public void testEmptyMap() {
    startTestProcess("empty map");
    assertEquals(2, results.size());
    for (DmnDecisionResultEntries output : results) {
        assertTrue("The decision output should be empty", output.isEmpty());
    }
}
Also used : DmnDecisionResultEntries(org.camunda.bpm.dmn.engine.DmnDecisionResultEntries) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 22 with DmnDecisionResultEntries

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

the class DmnDecisionResultTest method testSingleOutputTypedValue.

@Test
@DecisionResource(resource = RESULT_TEST_WITH_TYPES_DMN)
public void testSingleOutputTypedValue() {
    DmnDecisionResult decisionResult = evaluateWithMatchingRules(SINGLE_OUTPUT_VALUE);
    assertThat(decisionResult).hasSize(1);
    DmnDecisionResultEntries 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 : DmnDecisionResultEntries(org.camunda.bpm.dmn.engine.DmnDecisionResultEntries) DmnDecisionResult(org.camunda.bpm.dmn.engine.DmnDecisionResult) 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 23 with DmnDecisionResultEntries

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

the class DmnDecisionResultTest method testValueMap.

@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testValueMap() {
    DmnDecisionResult decisionResult = evaluateWithMatchingRules(MULTIPLE_OUTPUT_VALUES);
    DmnDecisionResultEntries 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 : DmnDecisionResultEntries(org.camunda.bpm.dmn.engine.DmnDecisionResultEntries) DmnDecisionResult(org.camunda.bpm.dmn.engine.DmnDecisionResult) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 24 with DmnDecisionResultEntries

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

the class DmnDecisionResultImpl method collectEntries.

@SuppressWarnings("unchecked")
public <T> List<T> collectEntries(String outputName) {
    List<T> outputValues = new ArrayList<T>();
    for (DmnDecisionResultEntries ruleResult : ruleResults) {
        if (ruleResult.containsKey(outputName)) {
            Object value = ruleResult.get(outputName);
            outputValues.add((T) value);
        }
    }
    return outputValues;
}
Also used : DmnDecisionResultEntries(org.camunda.bpm.dmn.engine.DmnDecisionResultEntries) ArrayList(java.util.ArrayList)

Example 25 with DmnDecisionResultEntries

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

the class DmnDecisionResultImpl method getResultList.

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

Aggregations

DmnDecisionResultEntries (org.camunda.bpm.dmn.engine.DmnDecisionResultEntries)27 Deployment (org.camunda.bpm.engine.test.Deployment)18 ArrayList (java.util.ArrayList)5 DmnDecisionResult (org.camunda.bpm.dmn.engine.DmnDecisionResult)4 DecisionResource (org.camunda.bpm.dmn.engine.test.DecisionResource)4 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)4 Test (org.junit.Test)4 Map (java.util.Map)2 TypedValue (org.camunda.bpm.engine.variable.value.TypedValue)2 DmnDecisionRuleResult (org.camunda.bpm.dmn.engine.DmnDecisionRuleResult)1 DmnDecisionTableEvaluationEvent (org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationEvent)1 DmnEvaluatedDecisionRule (org.camunda.bpm.dmn.engine.delegate.DmnEvaluatedDecisionRule)1 DmnEvaluatedOutput (org.camunda.bpm.dmn.engine.delegate.DmnEvaluatedOutput)1 DmnDecisionResultEntriesImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionResultEntriesImpl)1 DmnDecisionResultException (org.camunda.bpm.dmn.engine.impl.DmnDecisionResultException)1 DmnDecisionResultImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionResultImpl)1 VariableValueDto (org.camunda.bpm.engine.rest.dto.VariableValueDto)1 VariableMap (org.camunda.bpm.engine.variable.VariableMap)1