Search in sources :

Example 71 with List

use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.

the class ImportDMNResolverUtilTest method testNSonly.

@Test
public void testNSonly() {
    Import i = makeImport("ns1", null, 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.isRight());
    assertEquals(new QName("ns1", "m1"), result.getOrElse(null));
}
Also used : Import(org.kie.dmn.model.v1_1.Import) QName(javax.xml.namespace.QName) Test(org.junit.Test)

Example 72 with List

use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.

the class ImportDMNResolverUtilTest method testNSandModelNameWithAlias.

@Test
public void testNSandModelNameWithAlias() {
    Import i = makeImport("ns1", "aliased", "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));
}
Also used : Import(org.kie.dmn.model.v1_1.Import) QName(javax.xml.namespace.QName) Test(org.junit.Test)

Example 73 with List

use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.

the class ImportDMNResolverUtilTest method testLocateInNSdefaultWithAliasunexistent.

@Test
public void testLocateInNSdefaultWithAliasunexistent() {
    Import i = makeImport("nsA", "boh", null);
    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());
}
Also used : Import(org.kie.dmn.model.v1_1.Import) QName(javax.xml.namespace.QName) Test(org.junit.Test)

Example 74 with List

use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.

the class ImportDMNResolverUtilTest method testNSandUnexistentModelName.

@Test
public void testNSandUnexistentModelName() {
    Import i = makeImport("ns1", null, "boh");
    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());
}
Also used : Import(org.kie.dmn.model.v1_1.Import) QName(javax.xml.namespace.QName) Test(org.junit.Test)

Example 75 with List

use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.

the class ItemDefinitionDependenciesGeneratedTest method addDepsToItemDefinition.

private static void addDepsToItemDefinition(final ItemDefinition itemDefinition, final List<ItemDefinition> dependencies, final int numberOfDeps, final Set<String> usedNames) {
    int addedDepsCount = 0;
    for (ItemDefinition dependency : dependencies) {
        if (!usedNames.contains(dependency.getName())) {
            createAndAddDependency(itemDefinition, dependency);
            usedNames.add(dependency.getName());
            addedDepsCount++;
            if (addedDepsCount == numberOfDeps) {
                return;
            }
        }
    }
}
Also used : ItemDefinition(org.kie.dmn.model.v1_1.ItemDefinition)

Aggregations

Test (org.junit.Test)54 List (org.kie.workbench.common.dmn.api.definition.v1_1.List)26 ItemDefinition (org.kie.dmn.model.v1_1.ItemDefinition)21 QName (javax.xml.namespace.QName)17 ArrayList (java.util.ArrayList)15 List (java.util.List)14 DMNMessage (org.kie.dmn.api.core.DMNMessage)14 Import (org.kie.dmn.model.v1_1.Import)13 LiteralExpression (org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression)13 CoreMatchers.is (org.hamcrest.CoreMatchers.is)11 DMNMessageType (org.kie.dmn.api.core.DMNMessageType)11 DMNGridRow (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow)11 GraphCommandExecutionContext (org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext)10 RuleViolation (org.kie.workbench.common.stunner.core.rule.RuleViolation)10 Definitions (org.kie.dmn.model.v1_1.Definitions)9 IOException (java.io.IOException)8 Collectors (java.util.stream.Collectors)8 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)8 CanvasViolation (org.kie.workbench.common.stunner.core.client.command.CanvasViolation)8 Reader (java.io.Reader)7