use of org.camunda.bpm.model.dmn.DmnModelInstance in project camunda-engine-dmn by camunda.
the class ParseDecisionTest method shouldParseDecisionFromModelInstance.
@Test
public void shouldParseDecisionFromModelInstance() {
InputStream inputStream = IoUtil.fileAsStream(NO_INPUT_DMN);
DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream);
decision = dmnEngine.parseDecision("decision", modelInstance);
assertDecision(decision, "decision");
}
use of org.camunda.bpm.model.dmn.DmnModelInstance 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.model.dmn.DmnModelInstance in project camunda-engine-dmn by camunda.
the class DmnTransformListenerTest method shouldVerifyTransformedDmnDecision.
@Test
public void shouldVerifyTransformedDmnDecision() {
InputStream inputStream = IoUtil.fileAsStream(DECISION_TRANSFORM_DMN);
DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream);
dmnEngine.parseDecisionRequirementsGraph(modelInstance);
DmnDecision dmnDecision = listener.getDmnDecision();
Decision decision = listener.getDecision();
assertThat(dmnDecision.getKey()).isEqualTo(decision.getId()).isEqualTo("decision1");
assertThat(dmnDecision.getName()).isEqualTo(decision.getName()).isEqualTo("camunda");
}
use of org.camunda.bpm.model.dmn.DmnModelInstance in project camunda-engine-dmn by camunda.
the class DmnTransformTest method shouldParseDecisionWithRequiredDecisions.
@Test
public void shouldParseDecisionWithRequiredDecisions() {
InputStream inputStream = IoUtil.fileAsStream(REQUIRED_DECISIONS_DMN);
DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream);
DmnDecision buyProductDecision = dmnEngine.parseDecision("buyProduct", modelInstance);
assertDecision(buyProductDecision, "buyProduct");
Collection<DmnDecision> buyProductrequiredDecisions = buyProductDecision.getRequiredDecisions();
assertThat(buyProductrequiredDecisions.size()).isEqualTo(1);
DmnDecision buyComputerDecision = getDecision(buyProductrequiredDecisions, "buyComputer");
assertThat(buyComputerDecision).isNotNull();
Collection<DmnDecision> buyComputerRequiredDecision = buyComputerDecision.getRequiredDecisions();
assertThat(buyComputerRequiredDecision.size()).isEqualTo(1);
DmnDecision buyElectronicDecision = getDecision(buyComputerRequiredDecision, "buyElectronic");
assertThat(buyElectronicDecision).isNotNull();
assertThat(buyElectronicDecision.getRequiredDecisions().size()).isEqualTo(0);
}
use of org.camunda.bpm.model.dmn.DmnModelInstance in project camunda-engine-dmn by camunda.
the class DmnTransformTest method shouldDetectLoopInParseDecisionWithRequiredDecisionOfDifferentOrder.
@Test
public void shouldDetectLoopInParseDecisionWithRequiredDecisionOfDifferentOrder() {
InputStream inputStream = IoUtil.fileAsStream(LOOP_REQUIRED_DECISIONS_DIFFERENT_ORDER_DMN);
DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream);
try {
dmnEngine.parseDecisions(modelInstance);
failBecauseExceptionWasNotThrown(DmnTransformException.class);
} catch (DmnTransformException e) {
Assertions.assertThat(e).hasMessageStartingWith("DMN-02004").hasMessageContaining("DMN-02015").hasMessageContaining("has a loop");
}
}
Aggregations