@Test(expected = NoSuchDefinitionException.class) public void testResolveInheritanceNoParent() { Definition definition = new Definition("mydef", null, null); definition.setExtends("otherDef"); definitionDao.resolveInheritance(definition, new HashMap<String, Definition>(), Locale.ITALY, new HashSet<String>()); }
protected void resolveInheritance(Definition definition, Map<String, Definition> definitions, Locale locale, Set<String> alreadyResolvedDefinitions) { if (!definition.isExtending() || alreadyResolvedDefinitions.contains(definition.getName())) { return; } log.debug("Resolve definition for child name='{}' extends='{}.", definition.getName(), definition.getExtends()); alreadyResolvedDefinitions.add(definition.getName()); Definition parent = definitions.get(definition.getExtends()); if (parent == null) { String msg = "Error while resolving definition inheritance: child '" + definition.getName() + "' can't find its ancestor '" + definition.getExtends() + "'. Please check your description file."; throw new NoSuchDefinitionException(msg); } resolveInheritance(parent, definitions, locale, alreadyResolvedDefinitions); definition.inherit(parent); }
ResolvingLocaleUrlDefinitionDAO extends
        CachingLocaleUrlDefinitionDAO { protected void resolveInheritance(Definition definition, Map<String, Definition> definitions, Locale locale, Set<String> alreadyResolvedDefinitions) { if (!definition.isExtending() || alreadyResolvedDefinitions.contains(definition.getName())) { return; } log.debug("Resolve definition for child name='{}' extends='{}.", definition.getName(), definition.getExtends()); alreadyResolvedDefinitions.add(definition.getName()); Definition parent = definitions.get(definition.getExtends()); if (parent == null) { String msg = "Error while resolving definition inheritance: child '" + definition.getName() + "' can't find its ancestor '" + definition.getExtends() + "'. Please check your description file."; throw new NoSuchDefinitionException(msg); } resolveInheritance(parent, definitions, locale, alreadyResolvedDefinitions); definition.inherit(parent); } }
ResolvingLocaleUrlDefinitionDAO extends
        CachingLocaleUrlDefinitionDAO { protected void resolveInheritance(Definition definition, Map<String, Definition> definitions, Locale locale, Set<String> alreadyResolvedDefinitions) { if (!definition.isExtending() || alreadyResolvedDefinitions.contains(definition.getName())) { return; } log.debug("Resolve definition for child name='{}' extends='{}.", definition.getName(), definition.getExtends()); alreadyResolvedDefinitions.add(definition.getName()); Definition parent = definitions.get(definition.getExtends()); if (parent == null) { String msg = "Error while resolving definition inheritance: child '" + definition.getName() + "' can't find its ancestor '" + definition.getExtends() + "'. Please check your description file."; throw new NoSuchDefinitionException(msg); } resolveInheritance(parent, definitions, locale, alreadyResolvedDefinitions); definition.inherit(parent); } ResolvingLocaleUrlDefinitionDAO(ApplicationContext applicationContext); }
ResolvingLocaleUrlDefinitionDAO extends
        CachingLocaleUrlDefinitionDAO { protected void resolveInheritance(Definition definition, Map<String, Definition> definitions, Locale locale, Set<String> alreadyResolvedDefinitions) { if (!definition.isExtending() || alreadyResolvedDefinitions.contains(definition.getName())) { return; } log.debug("Resolve definition for child name='{}' extends='{}.", definition.getName(), definition.getExtends()); alreadyResolvedDefinitions.add(definition.getName()); Definition parent = definitions.get(definition.getExtends()); if (parent == null) { String msg = "Error while resolving definition inheritance: child '" + definition.getName() + "' can't find its ancestor '" + definition.getExtends() + "'. Please check your description file."; throw new NoSuchDefinitionException(msg); } resolveInheritance(parent, definitions, locale, alreadyResolvedDefinitions); definition.inherit(parent); } ResolvingLocaleUrlDefinitionDAO(ApplicationContext applicationContext);  }
ResolvingLocaleUrlDefinitionDAO extends
        CachingLocaleUrlDefinitionDAO { protected void resolveInheritance(Definition definition, Map<String, Definition> definitions, Locale locale, Set<String> alreadyResolvedDefinitions) { if (!definition.isExtending() || alreadyResolvedDefinitions.contains(definition.getName())) { return; } log.debug("Resolve definition for child name='{}' extends='{}.", definition.getName(), definition.getExtends()); alreadyResolvedDefinitions.add(definition.getName()); Definition parent = definitions.get(definition.getExtends()); if (parent == null) { String msg = "Error while resolving definition inheritance: child '" + definition.getName() + "' can't find its ancestor '" + definition.getExtends() + "'. Please check your description file."; throw new NoSuchDefinitionException(msg); } resolveInheritance(parent, definitions, locale, alreadyResolvedDefinitions); definition.inherit(parent); } ResolvingLocaleUrlDefinitionDAO(ApplicationContext applicationContext);   }