Search in sources :

Example 6 with TItemDefinition

use of org.kie.dmn.model.v1_2.TItemDefinition in project drools by kiegroup.

the class ItemDefinitionDependenciesTest method build.

private ItemDefinition build(final String name, final ItemDefinition... components) {
    final ItemDefinition res = new TItemDefinition();
    res.setName(name);
    for (final ItemDefinition ic : components) {
        addComponent(res, ic.getName());
    }
    return res;
}
Also used : TItemDefinition(org.kie.dmn.model.v1_1.TItemDefinition) ItemDefinition(org.kie.dmn.model.api.ItemDefinition) TItemDefinition(org.kie.dmn.model.v1_1.TItemDefinition)

Example 7 with TItemDefinition

use of org.kie.dmn.model.v1_2.TItemDefinition in project kie-wb-common by kiegroup.

the class ImportedItemDefinitionConverterTest method testWbFromDMN.

@Test
public void testWbFromDMN() {
    final org.kie.dmn.model.api.ItemDefinition itemDefinition = new TItemDefinition();
    final org.kie.dmn.model.api.ItemDefinition itemComponent1 = new TItemDefinition();
    final org.kie.dmn.model.api.ItemDefinition itemComponent2 = new TItemDefinition();
    final org.kie.dmn.model.api.ItemDefinition itemComponent3 = new TItemDefinition();
    itemDefinition.setName("tPerson");
    itemDefinition.setTypeRef(null);
    itemDefinition.getItemComponent().addAll(asList(itemComponent1, itemComponent2, itemComponent3));
    itemComponent1.setName("id");
    itemComponent1.setTypeRef(new QName("tUUID"));
    itemComponent2.setName("name");
    itemComponent2.setTypeRef(new QName("string"));
    itemComponent3.setName("age");
    itemComponent3.setTypeRef(new QName("number"));
    final ItemDefinition actualItemDefinition = ImportedItemDefinitionConverter.wbFromDMN(itemDefinition, "model");
    assertEquals("model.tPerson", actualItemDefinition.getName().getValue());
    assertNull(actualItemDefinition.getTypeRef());
    assertTrue(actualItemDefinition.isAllowOnlyVisualChange());
    assertEquals(3, actualItemDefinition.getItemComponent().size());
    final ItemDefinition actualItemDefinition1 = actualItemDefinition.getItemComponent().get(0);
    assertEquals("model.id", actualItemDefinition1.getName().getValue());
    assertEquals("model.tUUID", actualItemDefinition1.getTypeRef().getLocalPart());
    assertTrue(actualItemDefinition1.isAllowOnlyVisualChange());
    final ItemDefinition actualItemDefinition2 = actualItemDefinition.getItemComponent().get(1);
    assertEquals("model.name", actualItemDefinition2.getName().getValue());
    assertEquals("string", actualItemDefinition2.getTypeRef().getLocalPart());
    assertTrue(actualItemDefinition2.isAllowOnlyVisualChange());
    final ItemDefinition actualItemDefinition3 = actualItemDefinition.getItemComponent().get(2);
    assertEquals("model.age", actualItemDefinition3.getName().getValue());
    assertEquals("number", actualItemDefinition3.getTypeRef().getLocalPart());
    assertTrue(actualItemDefinition3.isAllowOnlyVisualChange());
}
Also used : QName(javax.xml.namespace.QName) TItemDefinition(org.kie.dmn.model.v1_2.TItemDefinition) TItemDefinition(org.kie.dmn.model.v1_2.TItemDefinition) ItemDefinition(org.kie.workbench.common.dmn.api.definition.model.ItemDefinition) Test(org.junit.Test)

Aggregations

ItemDefinition (org.kie.dmn.model.api.ItemDefinition)6 QName (javax.xml.namespace.QName)5 TItemDefinition (org.kie.dmn.model.v1_1.TItemDefinition)5 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 TItemDefinition (org.kie.dmn.model.v1_2.TItemDefinition)2 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Assert.assertTrue (org.junit.Assert.assertTrue)1 RunWith (org.junit.runner.RunWith)1 Parameterized (org.junit.runners.Parameterized)1 Definitions (org.kie.dmn.model.api.Definitions)1 Import (org.kie.dmn.model.api.Import)1 ItemDefinition (org.kie.workbench.common.dmn.api.definition.model.ItemDefinition)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1