use of org.kie.dmn.model.v1_3.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;
}
use of org.kie.dmn.model.v1_3.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());
}
Aggregations