DMNTypeServiceImpl extends AbstractKieContainerService implements DMNTypeService { protected void checkTypeSupport(DMNType type, ErrorHolder errorHolder, String fullPropertyPath) { internalCheckTypeSupport(type, false, errorHolder, fullPropertyPath, new HashSet<>()); }  @Override FactModelTuple retrieveFactModelTuple(Path path, String dmnPath); @Override void initializeNameAndNamespace(Settings settings, Path path, String dmnPath); DMNModel getDMNModel(Path path, String dmnPath); DMNRuntime getDMNRuntime(Path path);  }
@Test public void checkTypeSimpleTopLevelCollection() { SimpleTypeImpl topLevelCollection = getSimpleCollection(); DMNTypeServiceImpl.ErrorHolder errorHolder = new DMNTypeServiceImpl.ErrorHolder(); dmnTypeServiceImpl.checkTypeSupport(topLevelCollection, errorHolder, "fieldName"); assertEquals(0, errorHolder.getMultipleNestedObject().size()); assertEquals(0, errorHolder.getMultipleNestedCollection().size()); }
@Test public void checkTypeSingleCompositeWithNestedCompositeCollection() { CompositeTypeImpl singleCompositeWithComplexCollection = getSingleCompositeWithNestedCollection(); DMNTypeServiceImpl.ErrorHolder errorHolder = new DMNTypeServiceImpl.ErrorHolder(); dmnTypeServiceImpl.checkTypeSupport(singleCompositeWithComplexCollection, errorHolder, "fieldName"); assertEquals(0, errorHolder.getMultipleNestedObject().size()); assertEquals(1, errorHolder.getMultipleNestedCollection().size()); assertTrue(errorHolder.getMultipleNestedCollection().contains("fieldName.phoneNumbers.numbers")); }
@Test public void checkTypeSingleCompositeWithCollection() { CompositeTypeImpl person = new CompositeTypeImpl(); CompositeTypeImpl complexNumbers = new CompositeTypeImpl(null, "tPhoneNumber", null, false); CompositeTypeImpl phoneNumberCompositeCollection = new CompositeTypeImpl(null, "tPhoneNumber", null, true); phoneNumberCompositeCollection.addField("complexNumbers", complexNumbers); person.addField(EXPANDABLE_PROPERTY_PHONENUMBERS, phoneNumberCompositeCollection); DMNTypeServiceImpl.ErrorHolder errorHolder = new DMNTypeServiceImpl.ErrorHolder(); dmnTypeServiceImpl.checkTypeSupport(person, errorHolder, "fieldName"); assertEquals(1, errorHolder.getMultipleNestedObject().size()); assertEquals(0, errorHolder.getMultipleNestedCollection().size()); assertTrue(errorHolder.getMultipleNestedObject().contains("fieldName.phoneNumbers.complexNumbers")); }
@Test public void checkTypeRecursive() { DMNTypeServiceImpl.ErrorHolder errorHolder = new DMNTypeServiceImpl.ErrorHolder(); dmnTypeServiceImpl.checkTypeSupport(getRecursivePersonComposite(false), errorHolder, ""); assertEquals(1, errorHolder.getMultipleNestedCollection().size()); assertEquals(2, errorHolder.getMultipleNestedObject().size()); errorHolder = new DMNTypeServiceImpl.ErrorHolder(); dmnTypeServiceImpl.checkTypeSupport(getRecursivePersonComposite(true), errorHolder, ""); assertEquals(2, errorHolder.getMultipleNestedCollection().size()); assertEquals(2, errorHolder.getMultipleNestedObject().size()); }