Search in sources :

Example 11 with VALIDATE_MODEL

use of org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL in project drools by kiegroup.

the class ValidatorInformationRequirementTest method testINFOREQ_MISSING_INPUT_ReaderInput.

@Test
public void testINFOREQ_MISSING_INPUT_ReaderInput() throws IOException {
    try (final Reader reader = getReader("informationrequirement/INFOREQ_MISSING_INPUT.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.MISSING_EXPRESSION)));
        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 12 with VALIDATE_MODEL

use of org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL in project drools by kiegroup.

the class ValidatorKnowledgeRequirementTest method testKNOWREQ_REQ_DECISION_NOT_BKM_ReaderInput.

@Test
public void testKNOWREQ_REQ_DECISION_NOT_BKM_ReaderInput() throws IOException {
    try (final Reader reader = getReader("knowledgerequirement/KNOWREQ_REQ_DECISION_NOT_BKM.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.MISSING_EXPRESSION)));
        assertTrue(validate.stream().anyMatch(p -> p.getMessageType().equals(DMNMessageType.REQ_NOT_FOUND)));
    }
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) List(java.util.List) VALIDATE_SCHEMA(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_SCHEMA) DMNMessage(org.kie.dmn.api.core.DMNMessage) VALIDATE_COMPILATION(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_COMPILATION) DMNMessageType(org.kie.dmn.api.core.DMNMessageType) IOException(java.io.IOException) Test(org.junit.Test) Reader(java.io.Reader) Assert(org.junit.Assert) 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 13 with VALIDATE_MODEL

use of org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL in project drools by kiegroup.

the class ValidatorKnowledgeSourceTest method testKNOW_SOURCE_OWNER_NOT_ORG_UNIT_ReaderInput.

@Test
public void testKNOW_SOURCE_OWNER_NOT_ORG_UNIT_ReaderInput() throws IOException {
    try (final Reader reader = getReader("knowledgesource/KNOW_SOURCE_OWNER_NOT_ORG_UNIT.dmn")) {
        final List<DMNMessage> validate = validator.validate(reader, VALIDATE_SCHEMA, VALIDATE_MODEL, VALIDATE_COMPILATION);
        assertThat(ValidatorUtil.formatMessages(validate), validate.size(), is(3));
        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 14 with VALIDATE_MODEL

use of org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL in project drools by kiegroup.

the class ValidatorKnowledgeSourceTest method testKNOW_SOURCE_MISSING_OWNER_ReaderInput.

@Test
public void testKNOW_SOURCE_MISSING_OWNER_ReaderInput() throws IOException {
    try (final Reader reader = getReader("knowledgesource/KNOW_SOURCE_MISSING_OWNER.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.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 15 with VALIDATE_MODEL

use of org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL in project drools by kiegroup.

the class ValidatorTypeRefTest method testTYPEREF_NOT_FEEL_NOT_DEF_ReaderInput.

@Test
public void testTYPEREF_NOT_FEEL_NOT_DEF_ReaderInput() throws IOException {
    try (final Reader reader = getReader("typeref/TYPEREF_NOT_FEEL_NOT_DEF.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.INVALID_NAME)));
        assertTrue(validate.stream().anyMatch(p -> p.getMessageType().equals(DMNMessageType.TYPE_DEF_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)

Aggregations

IOException (java.io.IOException)46 Reader (java.io.Reader)46 List (java.util.List)46 CoreMatchers.is (org.hamcrest.CoreMatchers.is)46 Test (org.junit.Test)46 DMNMessage (org.kie.dmn.api.core.DMNMessage)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