use of org.kie.dmn.api.core.DMNMessage in project drools by kiegroup.
the class ValidatorAuthorityRequirementTest method testAUTH_REQ_MISSING_DEPENDENCY_REQ_INPUT_ReaderInput.
@Test
public void testAUTH_REQ_MISSING_DEPENDENCY_REQ_INPUT_ReaderInput() throws IOException {
try (final Reader reader = getReader("authorityrequirement/AUTHREQ_MISSING_DEPENDENCY_REQ_INPUT.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)));
}
}
use of org.kie.dmn.api.core.DMNMessage in project drools by kiegroup.
the class ValidatorAuthorityRequirementTest method testAUTHREQ_DEP_REQ_DEC_NOT_DECISION_ReaderInput.
@Test
public void testAUTHREQ_DEP_REQ_DEC_NOT_DECISION_ReaderInput() throws IOException {
try (final Reader reader = getReader("authorityrequirement/AUTHREQ_DEP_REQ_DEC_NOT_DECISION.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)));
}
}
use of org.kie.dmn.api.core.DMNMessage in project drools by kiegroup.
the class ValidatorAuthorityRequirementTest method testAUTHREQ_DEP_REQ_INPUT_NOT_INPUT_ReaderInput.
@Test
public void testAUTHREQ_DEP_REQ_INPUT_NOT_INPUT_ReaderInput() throws IOException {
try (final Reader reader = getReader("authorityrequirement/AUTHREQ_DEP_REQ_INPUT_NOT_INPUT.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)));
}
}
use of org.kie.dmn.api.core.DMNMessage in project drools by kiegroup.
the class ValidatorAuthorityRequirementTest method testAUTH_REQ_MISSING_DEPENDENCY_REQ_DEC_ReaderInput.
@Test
public void testAUTH_REQ_MISSING_DEPENDENCY_REQ_DEC_ReaderInput() throws IOException {
try (final Reader reader = getReader("authorityrequirement/AUTHREQ_MISSING_DEPENDENCY_REQ_DEC.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)));
}
}
use of org.kie.dmn.api.core.DMNMessage in project drools by kiegroup.
the class DMNCompilerTest method testImport.
@Test
public void testImport() {
System.out.println(null instanceof Definitions);
DMNRuntime runtime = DMNRuntimeUtil.createRuntimeWithAdditionalResources("Importing_Model.dmn", this.getClass(), "Imported_Model.dmn");
DMNModel importedModel = runtime.getModel("http://www.trisotech.com/dmn/definitions/_f27bb64b-6fc7-4e1f-9848-11ba35e0df36", "Imported Model");
assertThat(importedModel, notNullValue());
for (DMNMessage message : importedModel.getMessages()) {
LOG.debug("{}", message);
}
DMNModel dmnModel = runtime.getModel("http://www.trisotech.com/dmn/definitions/_f79aa7a4-f9a3-410a-ac95-bea496edab52", "Importing Model");
assertThat(dmnModel, notNullValue());
for (DMNMessage message : dmnModel.getMessages()) {
LOG.debug("{}", message);
}
DMNContext context = runtime.newContext();
context.set("A Person", mapOf(entry("name", "John"), entry("age", 47)));
DMNResult evaluateAll = runtime.evaluateAll(dmnModel, context);
for (DMNMessage message : evaluateAll.getMessages()) {
LOG.debug("{}", message);
}
LOG.debug("{}", evaluateAll);
assertThat(evaluateAll.getDecisionResultByName("Greeting").getResult(), is("Hello John!"));
}
Aggregations