Search in sources :

Example 36 with DMNMessage

use of org.kie.dmn.api.core.DMNMessage in project drools by kiegroup.

the class ValidatorDecisionTableTest method testDTABLE_PRIORITY_MISSING_OUTVALS_ReaderInput.

@Test
public void testDTABLE_PRIORITY_MISSING_OUTVALS_ReaderInput() throws IOException {
    try (final Reader reader = getReader("DTABLE_PRIORITY_MISSING_OUTVALS.dmn")) {
        List<DMNMessage> validate = validator.validate(reader, VALIDATE_SCHEMA, VALIDATE_MODEL, VALIDATE_COMPILATION);
        assertThat(ValidatorUtil.formatMessages(validate), validate.isEmpty(), is(false));
        assertTrue(validate.stream().anyMatch(p -> p.getMessageType().equals(DMNMessageType.MISSING_OUTPUT_VALUES)));
    }
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) Assert.assertThat(org.junit.Assert.assertThat) List(java.util.List) DMNMessage(org.kie.dmn.api.core.DMNMessage) VALIDATE_SCHEMA(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_SCHEMA) DMNMessageType(org.kie.dmn.api.core.DMNMessageType) VALIDATE_COMPILATION(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_COMPILATION) Assert.assertTrue(org.junit.Assert.assertTrue) IOException(java.io.IOException) Test(org.junit.Test) Reader(java.io.Reader) VALIDATE_MODEL(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL) DMNMessage(org.kie.dmn.api.core.DMNMessage) Reader(java.io.Reader) Test(org.junit.Test)

Example 37 with DMNMessage

use of org.kie.dmn.api.core.DMNMessage in project drools by kiegroup.

the class ValidatorDecisionTableTest method testDTABLE_SINGLEOUT_NONAME_ReaderInput.

@Test
public void testDTABLE_SINGLEOUT_NONAME_ReaderInput() throws IOException {
    try (final Reader reader = getReader("DTABLE_SINGLEOUTPUT_WRONG_OUTPUT.dmn")) {
        List<DMNMessage> validate = validator.validate(reader, VALIDATE_SCHEMA, VALIDATE_MODEL, VALIDATE_COMPILATION);
        assertThat(ValidatorUtil.formatMessages(validate), validate.size(), is(2));
        assertTrue(validate.stream().anyMatch(p -> p.getMessageType().equals(DMNMessageType.ILLEGAL_USE_OF_NAME)));
        assertTrue(validate.stream().anyMatch(p -> p.getMessageType().equals(DMNMessageType.ILLEGAL_USE_OF_TYPEREF)));
    }
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) Assert.assertThat(org.junit.Assert.assertThat) List(java.util.List) DMNMessage(org.kie.dmn.api.core.DMNMessage) VALIDATE_SCHEMA(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_SCHEMA) DMNMessageType(org.kie.dmn.api.core.DMNMessageType) VALIDATE_COMPILATION(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_COMPILATION) Assert.assertTrue(org.junit.Assert.assertTrue) IOException(java.io.IOException) Test(org.junit.Test) Reader(java.io.Reader) VALIDATE_MODEL(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL) DMNMessage(org.kie.dmn.api.core.DMNMessage) Reader(java.io.Reader) Test(org.junit.Test)

Example 38 with DMNMessage

use of org.kie.dmn.api.core.DMNMessage in project drools by kiegroup.

the class ValidatorDecisionTest method testDECISION_CYCLIC_DEPENDENCY_ReaderInput.

@Test
public void testDECISION_CYCLIC_DEPENDENCY_ReaderInput() throws IOException {
    try (final Reader reader = getReader("decision/DECISION_CYCLIC_DEPENDENCY.dmn")) {
        final List<DMNMessage> validate = validator.validate(reader, VALIDATE_SCHEMA, VALIDATE_MODEL, VALIDATE_COMPILATION);
        assertThat(ValidatorUtil.formatMessages(validate), validate.size(), is(2));
        assertTrue(validate.stream().anyMatch(p -> p.getMessageType().equals(DMNMessageType.REQ_NOT_FOUND)));
    }
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) Assert.assertThat(org.junit.Assert.assertThat) List(java.util.List) DMNMessage(org.kie.dmn.api.core.DMNMessage) VALIDATE_SCHEMA(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_SCHEMA) DMNMessageType(org.kie.dmn.api.core.DMNMessageType) VALIDATE_COMPILATION(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_COMPILATION) Assert.assertTrue(org.junit.Assert.assertTrue) IOException(java.io.IOException) Test(org.junit.Test) Reader(java.io.Reader) VALIDATE_MODEL(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL) DMNMessage(org.kie.dmn.api.core.DMNMessage) Reader(java.io.Reader) Test(org.junit.Test)

Example 39 with DMNMessage

use of org.kie.dmn.api.core.DMNMessage in project drools by kiegroup.

the class ValidatorDecisionTest method testDECISION_DEADLY_DIAMOND_ReaderInput.

@Test
public void testDECISION_DEADLY_DIAMOND_ReaderInput() throws IOException {
    try (final Reader reader = getReader("decision/DECISION_DEADLY_DIAMOND.dmn")) {
        final List<DMNMessage> validate = validator.validate(reader, VALIDATE_SCHEMA, VALIDATE_MODEL, VALIDATE_COMPILATION);
        assertThat(ValidatorUtil.formatMessages(validate), validate.size(), is(0));
    }
}
Also used : DMNMessage(org.kie.dmn.api.core.DMNMessage) Reader(java.io.Reader) Test(org.junit.Test)

Example 40 with DMNMessage

use of org.kie.dmn.api.core.DMNMessage in project drools by kiegroup.

the class ValidatorDecisionTest method testDECISION_MISSING_VAR_ReaderInput.

@Test
public void testDECISION_MISSING_VAR_ReaderInput() throws IOException {
    try (final Reader reader = getReader("decision/DECISION_MISSING_VAR.dmn")) {
        final List<DMNMessage> validate = validator.validate(reader, VALIDATE_SCHEMA, VALIDATE_MODEL, VALIDATE_COMPILATION);
        assertThat(ValidatorUtil.formatMessages(validate), validate.size(), is(1));
        assertTrue(validate.stream().anyMatch(p -> p.getMessageType().equals(DMNMessageType.MISSING_VARIABLE)));
    }
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) Assert.assertThat(org.junit.Assert.assertThat) List(java.util.List) DMNMessage(org.kie.dmn.api.core.DMNMessage) VALIDATE_SCHEMA(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_SCHEMA) DMNMessageType(org.kie.dmn.api.core.DMNMessageType) VALIDATE_COMPILATION(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_COMPILATION) Assert.assertTrue(org.junit.Assert.assertTrue) IOException(java.io.IOException) Test(org.junit.Test) Reader(java.io.Reader) VALIDATE_MODEL(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL) DMNMessage(org.kie.dmn.api.core.DMNMessage) Reader(java.io.Reader) Test(org.junit.Test)

Aggregations

DMNMessage (org.kie.dmn.api.core.DMNMessage)59 Test (org.junit.Test)58 Reader (java.io.Reader)52 IOException (java.io.IOException)46 List (java.util.List)46 CoreMatchers.is (org.hamcrest.CoreMatchers.is)46 DMNMessageType (org.kie.dmn.api.core.DMNMessageType)46 VALIDATE_COMPILATION (org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_COMPILATION)46 VALIDATE_MODEL (org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL)46 VALIDATE_SCHEMA (org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_SCHEMA)46 Assert.assertThat (org.junit.Assert.assertThat)33 Assert.assertTrue (org.junit.Assert.assertTrue)33 Assert (org.junit.Assert)13 Context (org.kie.dmn.model.v1_1.Context)7 ContextEntry (org.kie.dmn.model.v1_1.ContextEntry)7 DMNInputRuntimeTest (org.kie.dmn.core.DMNInputRuntimeTest)5 Definitions (org.kie.dmn.model.v1_1.Definitions)4 DMNModel (org.kie.dmn.api.core.DMNModel)3 DMNRuntime (org.kie.dmn.api.core.DMNRuntime)3 Ignore (org.junit.Ignore)2