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());
}
}
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"));
}
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");
}
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;
}
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;
}
Aggregations