use of org.kie.dmn.model.api.ItemDefinition in project drools by kiegroup.
the class ItemDefinitionDependenciesGeneratedTest method testOrdering.
@Test
public void testOrdering() {
logger.trace("Item definitions:");
itemDefinitions.forEach(itemDefinition -> {
logger.trace(itemDefinition.getName());
itemDefinition.getItemComponent().forEach(dependency -> logger.trace(dependency.getName()));
});
final List<ItemDefinition> orderedList = orderingStrategy(itemDefinitions);
for (final ItemDefinition itemDefinition : itemDefinitions) {
assertOrdering(itemDefinition, orderedList);
}
}
use of org.kie.dmn.model.api.ItemDefinition 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.api.ItemDefinition 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.api.ItemDefinition in project drools by kiegroup.
the class ItemDefinitionDependenciesTest method testGeneric2.
@Test
public void testGeneric2() {
final ItemDefinition z = build("z");
final ItemDefinition b = build("b");
final ItemDefinition a = build("a", z);
final List<ItemDefinition> originalList = Arrays.asList(z, b, a);
final List<ItemDefinition> orderedList = orderingStrategy(originalList);
assertTrue("Index of z < a", orderedList.indexOf(z) < orderedList.indexOf(a));
}
use of org.kie.dmn.model.api.ItemDefinition in project drools by kiegroup.
the class ItemDefinitionDependenciesTest method testCircular3.
@Test
public void testCircular3() {
final ItemDefinition fhirAge = build("fhirAge");
addComponent(fhirAge, "fhirExtension");
final ItemDefinition fhirExtension = build("fhirExtension", fhirAge);
final ItemDefinition fhirT1 = build("fhirT1", fhirAge);
final List<ItemDefinition> originalList = Arrays.asList(fhirT1, fhirAge, fhirExtension);
final List<ItemDefinition> orderedList = orderingStrategy(originalList);
assertThat(orderedList.subList(0, 2), containsInAnyOrder(fhirAge, fhirExtension));
assertThat(orderedList.subList(2, 3), contains(fhirT1));
}
Aggregations