use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.
the class ImportDMNResolverUtilTest method testLocateInNSdefaultwithAlias.
@Test
public void testLocateInNSdefaultwithAlias() {
Import i = makeImport("nsA", "m1", 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.isRight());
assertEquals(new QName("nsA", "m1"), result.getOrElse(null));
}
use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.
the class ItemDefinitionDependenciesGeneratedTest method assertOrdering.
private void assertOrdering(final ItemDefinition itemDefinition, final List<ItemDefinition> orderedList) {
for (ItemDefinition dependency : itemDefinition.getItemComponent()) {
final String dependencyName = dependency.getTypeRef().getLocalPart();
final int indexOfDependency = indexOfItemDefinitionByName(dependencyName, orderedList);
assertTrue("Cannot find dependency " + dependencyName + " in the ordered list!", indexOfDependency > -1);
assertTrue("Index of " + itemDefinition.getName() + " < " + dependency.getTypeRef().getLocalPart(), orderedList.indexOf(itemDefinition) > indexOfDependency);
if (dependency.getItemComponent() != null && !dependency.getItemComponent().isEmpty()) {
assertOrdering(dependency, orderedList);
}
}
}
use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.
the class ItemDefinitionDependenciesGeneratedTest method getPermutations.
private static void getPermutations(final List<ItemDefinition> itemDefinitions, final List<ItemDefinition> head, final Collection<List<ItemDefinition>> result) {
if (itemDefinitions.size() == 1) {
final List<ItemDefinition> resultList = new ArrayList<>(head);
resultList.addAll(itemDefinitions);
result.add(resultList);
} else {
for (ItemDefinition itemDefinition : itemDefinitions) {
final List<ItemDefinition> newHead = new ArrayList<>(head);
newHead.add(itemDefinition);
final List<ItemDefinition> possibleDependencies = itemDefinitions.stream().filter(item -> !newHead.contains(item)).collect(Collectors.toList());
getPermutations(possibleDependencies, newHead, result);
}
}
}
use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.
the class ItemDefinitionDependenciesGeneratedTest method testOrdering.
@Test
public void testOrdering() {
logger.debug("Item definitions:");
itemDefinitions.forEach(itemDefinition -> {
logger.debug(itemDefinition.getName());
itemDefinition.getItemComponent().forEach(dependency -> logger.debug(dependency.getName()));
});
List<ItemDefinition> orderedList = orderingStrategy(itemDefinitions);
for (ItemDefinition itemDefinition : itemDefinitions) {
assertOrdering(itemDefinition, orderedList);
}
}
use of org.kie.dmn.model.v1_1.List 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 ItemDefinition();
it.setName(ITEM_DEFINITION_NAME_BASE + i);
itemDefinitions.add(it);
}
return itemDefinitions;
}
Aggregations