use of org.camunda.bpm.model.dmn.DmnModelInstance in project camunda-bpm-platform by camunda.
the class DecisionDefinitionDeployerTest method testDeployDmnModelInstance.
@Test
public void testDeployDmnModelInstance() throws Exception {
// given
DmnModelInstance dmnModelInstance = createDmnModelInstance();
// when
testRule.deploy(repositoryService.createDeployment().addModelInstance("foo.dmn", dmnModelInstance));
// then
assertNotNull(repositoryService.createDecisionDefinitionQuery().decisionDefinitionResourceName("foo.dmn").singleResult());
}
use of org.camunda.bpm.model.dmn.DmnModelInstance in project camunda-engine-dmn by camunda.
the class DmnTransformTest method shouldNotDetectLoopInMultiLevelDecisionWithMultipleRequiredDecision.
@Test
public void shouldNotDetectLoopInMultiLevelDecisionWithMultipleRequiredDecision() {
InputStream inputStream = IoUtil.fileAsStream(MULTI_LEVEL_MULTIPLE_REQUIRED_DECISIONS_DMN);
DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream);
List<DmnDecision> decisions = dmnEngine.parseDecisions(modelInstance);
assertThat(decisions.size()).isEqualTo(8);
}
use of org.camunda.bpm.model.dmn.DmnModelInstance in project camunda-engine-dmn by camunda.
the class DmnTransformTest method shouldDetectLoopInParseDecisionWithRequiredDecision.
@Test
public void shouldDetectLoopInParseDecisionWithRequiredDecision() {
InputStream inputStream = IoUtil.fileAsStream(LOOP_REQUIRED_DECISIONS_DMN);
DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream);
try {
decision = dmnEngine.parseDecision("buyProduct", modelInstance);
failBecauseExceptionWasNotThrown(DmnTransformException.class);
} catch (DmnTransformException e) {
Assertions.assertThat(e).hasMessageStartingWith("DMN-02004").hasMessageContaining("DMN-02015").hasMessageContaining("has a loop");
}
}
use of org.camunda.bpm.model.dmn.DmnModelInstance in project camunda-engine-dmn by camunda.
the class DmnTransformTest method shouldParseDecisionWithMultipleRequiredDecisions.
@Test
public void shouldParseDecisionWithMultipleRequiredDecisions() {
InputStream inputStream = IoUtil.fileAsStream(MULTIPLE_REQUIRED_DECISIONS_DMN);
DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream);
DmnDecision decision = dmnEngine.parseDecision("car", modelInstance);
Collection<DmnDecision> requiredDecisions = decision.getRequiredDecisions();
assertThat(requiredDecisions.size()).isEqualTo(2);
DmnDecision carPriceDecision = getDecision(requiredDecisions, "carPrice");
assertThat(carPriceDecision).isNotNull();
DmnDecision carSpeedDecision = getDecision(requiredDecisions, "carSpeed");
assertThat(carSpeedDecision).isNotNull();
}
use of org.camunda.bpm.model.dmn.DmnModelInstance in project camunda-engine-dmn by camunda.
the class DmnTransformTest method shouldParseDecisionsWithRequiredDecisions.
@Test
public void shouldParseDecisionsWithRequiredDecisions() {
InputStream inputStream = IoUtil.fileAsStream(REQUIRED_DECISIONS_DMN);
DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream);
List<DmnDecision> decisions = dmnEngine.parseDecisions(modelInstance);
DmnDecision buyProductDecision = getDecision(decisions, "buyProduct");
assertThat(buyProductDecision).isNotNull();
Collection<DmnDecision> requiredProductDecisions = buyProductDecision.getRequiredDecisions();
assertThat(requiredProductDecisions.size()).isEqualTo(1);
DmnDecision requiredProductDecision = getDecision(requiredProductDecisions, "buyComputer");
assertThat(requiredProductDecision).isNotNull();
DmnDecision buyComputerDecision = getDecision(decisions, "buyComputer");
assertThat(buyComputerDecision).isNotNull();
Collection<DmnDecision> buyComputerRequiredDecisions = buyComputerDecision.getRequiredDecisions();
assertThat(buyComputerRequiredDecisions.size()).isEqualTo(1);
DmnDecision buyComputerRequiredDecision = getDecision(buyComputerRequiredDecisions, "buyElectronic");
assertThat(buyComputerRequiredDecision).isNotNull();
DmnDecision buyElectronicDecision = getDecision(decisions, "buyElectronic");
assertThat(buyElectronicDecision).isNotNull();
Collection<DmnDecision> buyElectronicRequiredDecisions = buyElectronicDecision.getRequiredDecisions();
assertThat(buyElectronicRequiredDecisions.size()).isEqualTo(0);
}
Aggregations