use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.
the class ValidatorContextTest method testCONTEXT_MISSING_ENTRIES_ReaderInput.
@Test
public void testCONTEXT_MISSING_ENTRIES_ReaderInput() throws IOException {
try (final Reader reader = getReader("context/CONTEXT_MISSING_ENTRIES.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_EXPRESSION)));
}
}
use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.
the class ValidatorTest method testINVOCATION_MISSING_TARGETRbis.
@Ignore("known current limitation")
@Test
public void testINVOCATION_MISSING_TARGETRbis() {
Definitions definitions = utilDefinitions("INVOCATION_MISSING_TARGETbis.dmn", "INVOCATION_MISSING_TARGETbis");
List<DMNMessage> validate = validator.validate(definitions);
// assertTrue( validate.stream().anyMatch( p -> p.getMessageType().equals( DMNMessageType.INVOCATION_MISSING_TARGET ) ) );
}
use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.
the class ValidatorTest method utilDefinitions.
private Definitions utilDefinitions(String filename, String modelName) {
// List<DMNMessage> validateXML;
// try {
// validateXML = validator.validate( new File(this.getClass().getResource(filename).toURI()), DMNValidator.Validation.VALIDATE_SCHEMA );
// assertThat( "using unit test method utilDefinitions must received a XML valid DMN file", validateXML, IsEmptyCollection.empty() );
// } catch (URISyntaxException e) {
// e.printStackTrace();
// fail("Unable for the test suite to locate the file for XML validation.");
// }
DMNMarshaller marshaller = DMNMarshallerFactory.newDefaultMarshaller();
try (InputStreamReader isr = new InputStreamReader(getClass().getResourceAsStream(filename))) {
Definitions definitions = marshaller.unmarshal(isr);
assertThat(definitions, notNullValue());
return definitions;
} catch (IOException e) {
e.printStackTrace();
fail("Unable for the test suite to locate the file for validation.");
}
return null;
}
use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.
the class ValidatorTest method testMACDInputDefinitions.
@Test
public void testMACDInputDefinitions() {
DMNRuntime runtime = DMNRuntimeUtil.createRuntime("MACD-enhanced_iteration.dmn", DMNInputRuntimeTest.class);
DMNModel dmnModel = runtime.getModel("http://www.trisotech.com/definitions/_6cfe7d88-6741-45d1-968c-b61a597d0964", "MACD-enhanced iteration");
assertThat(dmnModel, notNullValue());
Definitions definitions = dmnModel.getDefinitions();
assertThat(definitions, notNullValue());
List<DMNMessage> messages = DMNValidatorFactory.newValidator().validate(definitions, VALIDATE_MODEL, VALIDATE_COMPILATION);
assertThat(messages.toString(), messages.size(), is(0));
}
use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.
the class DMNRuntimeTest method testList_of_Vowels.
@Test
public void testList_of_Vowels() {
// DROOLS-2357
DMNRuntime runtime = DMNRuntimeUtil.createRuntime("List_of_Vowels.dmn", this.getClass());
DMNModel dmnModel = runtime.getModel("http://www.trisotech.com/dmn/definitions/_c5f007ce-4d45-4aac-8729-991d4abc7826", "List of Vowels");
assertThat(dmnModel, notNullValue());
assertThat(DMNRuntimeUtil.formatMessages(dmnModel.getMessages()), dmnModel.hasErrors(), is(false));
DMNContext emptyContext = DMNFactory.newContext();
DMNResult dmnResult = runtime.evaluateAll(dmnModel, emptyContext);
assertThat(DMNRuntimeUtil.formatMessages(dmnResult.getMessages()), dmnResult.hasErrors(), is(true));
assertThat(dmnResult.getMessages().stream().filter(m -> m.getMessageType() == DMNMessageType.ERROR_EVAL_NODE).anyMatch(m -> m.getSourceId().equals("_b2205027-d06c-41b5-8419-e14b501e14a6")), is(true));
DMNContext result = dmnResult.getContext();
assertThat(result.get("Decide Vowel a"), is("a"));
assertThat(result.get("Decide BAD"), nullValue());
}
Aggregations