use of org.kie.dmn.model.api.Definitions in project drools by kiegroup.
the class ValidatorTest method testRelationwithemptycell.
@Test
public void testRelationwithemptycell() {
// DROOLS-2439
DMNRuntime runtime = DMNRuntimeUtil.createRuntime("relation_with_empty_cell.dmn", DMNRuntimeTest.class);
DMNModel dmnModel = runtime.getModel("http://www.trisotech.com/dmn/definitions/_99a00903-2943-47df-bab1-a32f276617ea", "Relation with empty cell");
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.api.Definitions in project drools by kiegroup.
the class ValidatorTest method testDryRun.
@Test
public void testDryRun() {
DMNRuntime runtime = DMNRuntimeUtil.createRuntime("0001-input-data-string.dmn", DMNInputRuntimeTest.class);
DMNModel dmnModel = runtime.getModel("https://github.com/kiegroup/drools/kie-dmn", "_0001-input-data-string");
assertThat(dmnModel, notNullValue());
Definitions definitions = dmnModel.getDefinitions();
assertThat(definitions, notNullValue());
DMNValidatorFactory.newValidator().validate(definitions);
}
use of org.kie.dmn.model.api.Definitions in project drools by kiegroup.
the class ValidatorTest method testINVOCATION_MISSING_TARGET.
@Test
@Ignore("Needs to be improved as invocations can be used to invoke functions node defined in BKMs. E.g., FEEL built in functions, etc.")
public void testINVOCATION_MISSING_TARGET() {
Definitions definitions = utilDefinitions("INVOCATION_MISSING_TARGET.dmn", "INVOCATION_MISSING_TARGET");
List<DMNMessage> validate = validator.validate(definitions);
// assertTrue( validate.stream().anyMatch( p -> p.getMessageType().equals( DMNMessageType.INVOCATION_MISSING_TARGET ) ) );
}
use of org.kie.dmn.model.api.Definitions in project drools by kiegroup.
the class ValidatorDecisionServiceTest method testDS1ofEach.
@Test
public void testDS1ofEach() {
DMNRuntime runtime = DMNRuntimeUtil.createRuntime("decisionservice/DS1ofEach_OK.dmn", this.getClass());
DMNModel dmnModel = runtime.getModel("https://kiegroup.org/dmn/_40B3D02F-868C-4925-A1F2-5710DFEEF51E", "DS1ofEach");
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));
DMNContext dmnContext = runtime.newContext();
dmnContext.set("InputData-1", "id1");
dmnContext.set("Decision-1", "od1");
DMNResult evaluateDS1 = runtime.evaluateDecisionService(dmnModel, dmnContext, "DecisionService-1");
LOG.debug("{}", evaluateDS1);
assertThat(evaluateDS1.getDecisionResultByName("Decision-2"), nullValue());
assertThat(evaluateDS1.getDecisionResultByName("Decision-3").getResult(), is("d3:d2:id1od1"));
}
use of org.kie.dmn.model.api.Definitions in project drools by kiegroup.
the class ValidatorDecisionServiceTest method testOKDS.
@Test
public void testOKDS() {
DMNRuntime runtime = DMNRuntimeUtil.createRuntime("decisionservice/HelloDS_OK.dmn", this.getClass());
DMNModel dmnModel = runtime.getModel("https://kiegroup.org/dmn/_7C3C7416-2F33-4718-AE35-F3843C5250DB", "HelloDS");
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));
DMNResult evaluateAll = runtime.evaluateAll(dmnModel, runtime.newContext());
LOG.debug("{}", evaluateAll);
assertThat(evaluateAll.getDecisionResultByName("Decision-1").getResult(), is("Hello World"));
}
Aggregations