Search in sources :

Example 1 with DmnTransformException

use of org.camunda.bpm.dmn.engine.impl.transform.DmnTransformException in project camunda-engine-dmn by camunda.

the class ParseDecisionTest method shouldFailIfDecisionDrgIdIsMissing.

@Test
public void shouldFailIfDecisionDrgIdIsMissing() {
    try {
        InputStream inputStream = IoUtil.fileAsStream(MISSING_DECISION_REQUIREMENT_DIAGRAM_ID_DMN);
        dmnEngine.parseDecisionRequirementsGraph(inputStream);
        failBecauseExceptionWasNotThrown(DmnTransformException.class);
    } catch (DmnTransformException e) {
        assertThat(e).hasCauseExactlyInstanceOf(DmnTransformException.class).hasMessageStartingWith("DMN-02016").hasMessageContaining("DMN-02017").hasMessageContaining("DRD with Missing Id");
    }
}
Also used : DmnTransformException(org.camunda.bpm.dmn.engine.impl.transform.DmnTransformException) InputStream(java.io.InputStream) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest)

Example 2 with DmnTransformException

use of org.camunda.bpm.dmn.engine.impl.transform.DmnTransformException 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");
    }
}
Also used : DmnTransformException(org.camunda.bpm.dmn.engine.impl.transform.DmnTransformException) InputStream(java.io.InputStream) DmnModelInstance(org.camunda.bpm.model.dmn.DmnModelInstance) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest)

Example 3 with DmnTransformException

use of org.camunda.bpm.dmn.engine.impl.transform.DmnTransformException 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");
    }
}
Also used : DmnTransformException(org.camunda.bpm.dmn.engine.impl.transform.DmnTransformException) InputStream(java.io.InputStream) DmnModelInstance(org.camunda.bpm.model.dmn.DmnModelInstance) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest)

Example 4 with DmnTransformException

use of org.camunda.bpm.dmn.engine.impl.transform.DmnTransformException in project camunda-engine-dmn by camunda.

the class DmnTransformTest method shouldDetectLoopInParseDecisionWithSelfRequiredDecision.

@Test
public void shouldDetectLoopInParseDecisionWithSelfRequiredDecision() {
    InputStream inputStream = IoUtil.fileAsStream(SELF_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");
    }
}
Also used : DmnTransformException(org.camunda.bpm.dmn.engine.impl.transform.DmnTransformException) InputStream(java.io.InputStream) DmnModelInstance(org.camunda.bpm.model.dmn.DmnModelInstance) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest)

Aggregations

InputStream (java.io.InputStream)4 DmnTransformException (org.camunda.bpm.dmn.engine.impl.transform.DmnTransformException)4 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)4 Test (org.junit.Test)4 DmnModelInstance (org.camunda.bpm.model.dmn.DmnModelInstance)3