use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.
the class DMNRuntimeTest method testJavaFunctionContext_withErrors.
@Test
public void testJavaFunctionContext_withErrors() {
// DROOLS-1568
DMNRuntime runtime = DMNRuntimeUtil.createRuntime("java_function_context_with_errors.dmn", this.getClass());
DMNModel dmnModel = runtime.getModel("http://www.trisotech.com/dmn/definitions/_b42317c4-4f0c-474e-a0bf-2895b0b3c314", "Dessin 1");
assertThat(dmnModel, notNullValue());
assertThat(DMNRuntimeUtil.formatMessages(dmnModel.getMessages()), dmnModel.hasErrors(), is(true));
assertThat(dmnModel.getMessages().size(), is(2));
List<String> sourceIDs = dmnModel.getMessages().stream().map(m -> m.getSourceId()).collect(Collectors.toList());
assertTrue(sourceIDs.contains("_a72a7aff-48c3-4806-83ca-fc1f1fe34320"));
assertTrue(sourceIDs.contains("_a72a7aff-48c3-4806-83ca-fc1f1fe34321"));
}
use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.
the class DMNRuntimeTest method testUnionofLetters.
@Test
public void testUnionofLetters() {
DMNRuntime runtime = DMNRuntimeUtil.createRuntime("Union_of_letters.dmn", this.getClass());
DMNModel dmnModel = runtime.getModel("http://www.trisotech.com/definitions/_76362694-41e8-400c-8dea-e5f033d4f405", "Union of letters");
assertThat(dmnModel, notNullValue());
assertThat(DMNRuntimeUtil.formatMessages(dmnModel.getMessages()), dmnModel.hasErrors(), is(false));
DMNContext ctx1 = runtime.newContext();
ctx1.set("A1", Arrays.asList(new String[] { "a", "b" }));
ctx1.set("A2", Arrays.asList(new String[] { "b", "c" }));
DMNResult dmnResult1 = runtime.evaluateAll(dmnModel, ctx1);
assertThat(DMNRuntimeUtil.formatMessages(dmnResult1.getMessages()), dmnResult1.hasErrors(), is(false));
assertThat((List<?>) dmnResult1.getContext().get("D1"), contains("a", "b", "c"));
DMNContext ctx2 = runtime.newContext();
ctx2.set("A1", Arrays.asList(new String[] { "a", "b" }));
ctx2.set("A2", Arrays.asList(new String[] { "b", "x" }));
DMNResult dmnResult2 = runtime.evaluateAll(dmnModel, ctx2);
assertThat(DMNRuntimeUtil.formatMessages(dmnResult2.getMessages()), dmnResult2.hasErrors(), is(true));
assertThat(dmnResult2.getMessages().stream().anyMatch(m -> m.getMessageType().equals(DMNMessageType.ERROR_EVAL_NODE)), is(true));
}
use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.
the class ImportDMNResolverUtilTest method testNSnoModelNameDefaultWithAliasButUnexistent.
@Test
public void testNSnoModelNameDefaultWithAliasButUnexistent() {
Import i = makeImport("ns1", "boh", null);
List<QName> available = Arrays.asList(new QName("ns1", "m1"), new QName("ns2", "m2"), new QName("ns3", "m3"));
Either<String, QName> result = ImportDMNResolverUtil.resolveImportDMN(i, available, Function.identity());
assertTrue(result.isLeft());
}
use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.
the class ImportDMNResolverUtilTest method testLocateInNSunexistent.
@Test
public void testLocateInNSunexistent() {
Import i = makeImport("nsA", null, "boh");
List<QName> available = Arrays.asList(new QName("nsA", "m1"), new QName("nsA", "m2"), new QName("nsB", "m3"));
Either<String, QName> result = ImportDMNResolverUtil.resolveImportDMN(i, available, Function.identity());
assertTrue(result.isLeft());
}
use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.
the class ImportDMNResolverUtilTest method testNSandModelName.
@Test
public void testNSandModelName() {
Import i = makeImport("ns1", null, "m1");
List<QName> available = Arrays.asList(new QName("ns1", "m1"), new QName("ns2", "m2"), new QName("ns3", "m3"));
Either<String, QName> result = ImportDMNResolverUtil.resolveImportDMN(i, available, Function.identity());
assertTrue(result.isRight());
assertEquals(new QName("ns1", "m1"), result.getOrElse(null));
}
Aggregations