use of org.kie.dmn.model.v1_1.TItemDefinition in project drools by kiegroup.
the class ItemDefinitionDependenciesGeneratedTest method createAndAddDependency.
private static void createAndAddDependency(final ItemDefinition itemDefinition, final ItemDefinition dependency) {
final ItemDefinition newDependency = new TItemDefinition();
newDependency.setName("_" + itemDefinition.getName() + "-" + dependency.getName());
newDependency.setTypeRef(new QName(TEST_NS, dependency.getName()));
itemDefinition.getItemComponent().add(newDependency);
}
use of org.kie.dmn.model.v1_1.TItemDefinition in project drools by kiegroup.
the class ItemDefinitionDependenciesGeneratedTest method getBaseListOfItemDefinitions.
private static List<ItemDefinition> getBaseListOfItemDefinitions(final int nameIndexFrom) {
final List<ItemDefinition> itemDefinitions = new ArrayList<>();
for (int i = nameIndexFrom; i < NUMBER_OF_BASE_ITEM_DEFINITIONS + nameIndexFrom; i++) {
final ItemDefinition it = new TItemDefinition();
it.setName(ITEM_DEFINITION_NAME_BASE + i);
itemDefinitions.add(it);
}
return itemDefinitions;
}
use of org.kie.dmn.model.v1_1.TItemDefinition in project drools by kiegroup.
the class ItemDefinitionDependenciesTest method addComponent.
private void addComponent(ItemDefinition i, String componentName) {
final ItemDefinition c = new TItemDefinition();
c.setName("_" + i.getName() + "-" + componentName);
c.setTypeRef(new QName(TEST_NS, componentName));
i.getItemComponent().add(c);
}
use of org.kie.dmn.model.v1_1.TItemDefinition in project kie-wb-common by kiegroup.
the class DMNMarshallerImportsHelperStandaloneImplTest method testGetItemDefinitionsWithNamespace.
@Test
public void testGetItemDefinitionsWithNamespace() {
final Definitions definitions = mock(Definitions.class);
final Import anImport = mock(Import.class);
final ItemDefinition itemDefinition1 = new TItemDefinition();
final ItemDefinition itemDefinition2 = new TItemDefinition();
final ItemDefinition itemDefinition3 = new TItemDefinition();
final ItemDefinition itemDefinition4 = new TItemDefinition();
final ItemDefinition itemDefinition5 = new TItemDefinition();
final List<ItemDefinition> itemDefinitions = asList(itemDefinition1, itemDefinition2, itemDefinition3, itemDefinition4, itemDefinition5);
itemDefinition1.setName("tUUID");
itemDefinition2.setName("tPerson");
itemDefinition3.setName("id");
itemDefinition4.setName("name");
itemDefinition5.setName("age");
itemDefinition1.setTypeRef(new QName("string"));
itemDefinition2.setTypeRef(null);
itemDefinition3.setTypeRef(new QName("tUUID"));
itemDefinition4.setTypeRef(new QName("string"));
itemDefinition5.setTypeRef(new QName("number"));
when(anImport.getName()).thenReturn("model");
when(definitions.getItemDefinition()).thenReturn(itemDefinitions);
final List<ItemDefinition> actualItemDefinitions = helper.getItemDefinitionsWithNamespace(definitions, anImport);
assertEquals(5, actualItemDefinitions.size());
final ItemDefinition actualItemDefinition1 = actualItemDefinitions.get(0);
assertEquals("model.tUUID", actualItemDefinition1.getName());
assertEquals("string", actualItemDefinition1.getTypeRef().getLocalPart());
final ItemDefinition actualItemDefinition2 = actualItemDefinitions.get(1);
assertEquals("model.tPerson", actualItemDefinition2.getName());
assertNull(actualItemDefinition2.getTypeRef());
final ItemDefinition actualItemDefinition3 = actualItemDefinitions.get(2);
assertEquals("model.id", actualItemDefinition3.getName());
assertEquals("model.tUUID", actualItemDefinition3.getTypeRef().getLocalPart());
final ItemDefinition actualItemDefinition4 = actualItemDefinitions.get(3);
assertEquals("model.name", actualItemDefinition4.getName());
assertEquals("string", actualItemDefinition4.getTypeRef().getLocalPart());
final ItemDefinition actualItemDefinition5 = actualItemDefinitions.get(4);
assertEquals("model.age", actualItemDefinition5.getName());
assertEquals("number", actualItemDefinition5.getTypeRef().getLocalPart());
}
use of org.kie.dmn.model.v1_1.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