use of org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL in project drools by kiegroup.
the class ValidatorBusinessKnowledgeModelTest method testBKM_MISSING_VAR_ReaderInput.
@Test
public void testBKM_MISSING_VAR_ReaderInput() throws IOException {
try (final Reader reader = getReader("businessknowledgemodel/BKM_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)));
}
}
use of org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL in project drools by kiegroup.
the class ValidatorBusinessKnowledgeModelTest method testBKM_MISMATCH_VAR_ReaderInput.
@Test
public void testBKM_MISMATCH_VAR_ReaderInput() throws IOException {
try (final Reader reader = getReader("businessknowledgemodel/BKM_MISMATCH_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.VARIABLE_NAME_MISMATCH)));
}
}
use of org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL in project drools by kiegroup.
the class ValidatorContextTest method testCONTEXT_ENTRY_MISSING_VARIABLE_FileInput.
@Test
public void testCONTEXT_ENTRY_MISSING_VARIABLE_FileInput() {
final List<DMNMessage> validate = validator.validate(getFile("context/CONTEXT_ENTRY_MISSING_VARIABLE.dmn"), 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)));
// check that it reports and error for the second context entry, but not for the last one
final ContextEntry ce = (ContextEntry) validate.get(0).getSourceReference();
assertThat(((Context) ce.getParent()).getContextEntry().indexOf(ce), is(1));
}
use of org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL in project drools by kiegroup.
the class ValidatorContextTest method testCONTEXT_ENTRY_NOTYPEREF_ReaderInput.
@Test
public void testCONTEXT_ENTRY_NOTYPEREF_ReaderInput() throws IOException {
try (final Reader reader = getReader("context/CONTEXT_ENTRY_NOTYPEREF.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_TYPE_REF)));
}
}
use of org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL in project drools by kiegroup.
the class ValidatorContextTest method testCONTEXT_DUP_ENTRY_ReaderInput.
@Test
public void testCONTEXT_DUP_ENTRY_ReaderInput() throws IOException {
try (final Reader reader = getReader("context/CONTEXT_DUP_ENTRY.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.DUPLICATE_NAME)));
}
}
Aggregations