use of org.camunda.bpm.dmn.engine.DmnDecisionRequirementsGraph in project camunda-engine-dmn by camunda.
the class ParseDecisionTest method shouldParseDrgFromModelInstance.
@Test
public void shouldParseDrgFromModelInstance() {
InputStream inputStream = IoUtil.fileAsStream(NO_INPUT_DMN);
DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream);
DmnDecisionRequirementsGraph drg = dmnEngine.parseDecisionRequirementsGraph(modelInstance);
assertDecisionRequirementsGraph(drg, "definitions");
}
use of org.camunda.bpm.dmn.engine.DmnDecisionRequirementsGraph in project camunda-engine-dmn by camunda.
the class DmnDecisionEvaluationTest method shouldEvaluateDecisionWithCollectHitPolicyReturningAList.
@Test
public void shouldEvaluateDecisionWithCollectHitPolicyReturningAList() {
DmnDecisionRequirementsGraph graph = dmnEngine.parseDecisionRequirementsGraph(IoUtil.fileAsStream(DRG_COLLECT_DMN));
initVariables();
variables.putValue("dayType", "WeekDay");
DmnDecisionResult result = dmnEngine.evaluateDecision(graph.getDecision("dish-decision"), variables);
assertThat(result.getSingleEntry()).isNotNull().isEqualTo("Steak");
}
use of org.camunda.bpm.dmn.engine.DmnDecisionRequirementsGraph in project camunda-engine-dmn by camunda.
the class DmnTransformTest method shouldTransformDecisionRequirementsGraph.
@Test
public void shouldTransformDecisionRequirementsGraph() {
InputStream inputStream = IoUtil.fileAsStream(REQUIRED_DECISIONS_DMN);
DmnDecisionRequirementsGraph drg = dmnEngine.parseDecisionRequirementsGraph(inputStream);
assertThat(drg).isNotNull();
assertThat(drg.getKey()).isEqualTo("buy-decision");
assertThat(drg.getName()).isEqualTo("Buy Decision");
assertThat(drg.getDecisionKeys()).hasSize(3).contains("buyProduct", "buyComputer", "buyElectronic");
Collection<DmnDecision> decisions = drg.getDecisions();
assertThat(decisions).hasSize(3).extracting("key").contains("buyProduct", "buyComputer", "buyElectronic");
}
use of org.camunda.bpm.dmn.engine.DmnDecisionRequirementsGraph in project camunda-engine-dmn by camunda.
the class DmnTransformListenerTest method shouldVerifyDmnDecisionRequirementsGraph.
@Test
public void shouldVerifyDmnDecisionRequirementsGraph() {
dmnEngine.parseDecisionRequirementsGraph(IoUtil.fileAsStream(DRG_EXAMPLE_DMN));
DmnDecisionRequirementsGraph dmnDecisionRequirementsGraph = listener.getDmnDecisionRequirementsGraph();
Definitions definitions = listener.getDefinitions();
assertThat(dmnDecisionRequirementsGraph.getKey()).isEqualTo(definitions.getId()).isEqualTo("dish");
assertThat(dmnDecisionRequirementsGraph.getName()).isEqualTo(definitions.getName()).isEqualTo("Dish");
assertThat(dmnDecisionRequirementsGraph.getDecisions().size()).isEqualTo(3);
assertThat(dmnDecisionRequirementsGraph.getDecision("dish-decision")).isNotNull();
assertThat(dmnDecisionRequirementsGraph.getDecision("season")).isNotNull();
assertThat(dmnDecisionRequirementsGraph.getDecision("guestCount")).isNotNull();
}
use of org.camunda.bpm.dmn.engine.DmnDecisionRequirementsGraph in project camunda-engine-dmn by camunda.
the class DmnEngineApiTest method shouldEvaluateDecisionOfDrg.
@Test
public void shouldEvaluateDecisionOfDrg() {
DmnDecisionRequirementsGraph drd = dmnEngine.parseDecisionRequirementsGraph(createInputStream());
decision = drd.getDecision("decision");
DmnDecisionTableResult results = dmnEngine.evaluateDecisionTable(decision, createVariables().putValue("input", INPUT_VALUE));
assertThat(results).hasSingleResult().hasSingleEntry(EXPECTED_OUTPUT_VALUE);
}
Aggregations