@Test public void testResolve_Configuration__properties() throws Exception { ServiceInfo info = new ServiceInfo(); ServiceInfo parentInfo = new ServiceInfo(); Collection<PropertyInfo> childFooProperties = new ArrayList<PropertyInfo>(); PropertyInfo childProp1 = new PropertyInfo(); childProp1.setName("childName1"); childProp1.setValue("childVal1"); childFooProperties.add(childProp1); Collection<PropertyInfo> childBarProperties = new ArrayList<PropertyInfo>(); PropertyInfo childProp2 = new PropertyInfo(); childProp2.setName("childName2"); childProp2.setValue("childVal2"); childBarProperties.add(childProp2); Map<String, String> attributes = new HashMap<String, String>(); attributes.put(ConfigurationInfo.Supports.DO_NOT_EXTEND.getXmlAttributeName(), "true"); ConfigurationModule childConfigModule1 = createConfigurationModule("FOO", childFooProperties); ConfigurationModule childConfigModule2 = createConfigurationModule("BAR", childBarProperties, attributes); Collection<ConfigurationModule> childModules = new ArrayList<ConfigurationModule>(); childModules.add(childConfigModule1); childModules.add(childConfigModule2); Collection<PropertyInfo> parentFooProperties = new ArrayList<PropertyInfo>(); PropertyInfo parentProp1 = new PropertyInfo(); parentProp1.setName("parentName1"); parentProp1.setValue("parentVal1"); parentFooProperties.add(parentProp1); PropertyInfo parentProp12 = new PropertyInfo(); parentProp12.setName("childName1"); parentProp12.setValue("parentVal1"); parentFooProperties.add(parentProp12); Collection<PropertyInfo> parentBarProperties = new ArrayList<PropertyInfo>(); PropertyInfo parentProp2 = new PropertyInfo(); parentProp2.setName("parentName2"); parentProp2.setValue("parentVal2"); parentBarProperties.add(parentProp2); Collection<PropertyInfo> parentOtherProperties = new ArrayList<PropertyInfo>(); PropertyInfo parentProp3 = new PropertyInfo(); parentProp3.setName("parentName3"); parentProp3.setValue("parentVal3"); parentOtherProperties.add(parentProp3); ConfigurationModule parentConfigModule1 = createConfigurationModule("FOO", parentFooProperties); ConfigurationModule parentConfigModule2 = createConfigurationModule("BAR", parentBarProperties); ConfigurationModule parentConfigModule3 = createConfigurationModule("OTHER", parentOtherProperties); Collection<ConfigurationModule> parentModules = new ArrayList<ConfigurationModule>(); parentModules.add(parentConfigModule1); parentModules.add(parentConfigModule2); parentModules.add(parentConfigModule3); ServiceModule child = createServiceModule(info, childModules); ServiceModule parent = createServiceModule(parentInfo, parentModules); resolveService(child, parent); List<PropertyInfo> mergedProperties = child.getModuleInfo().getProperties(); assertEquals(4, mergedProperties.size()); Map<String, PropertyInfo> mergedPropertyMap = new HashMap<String, PropertyInfo>(); for (PropertyInfo prop : mergedProperties) { mergedPropertyMap.put(prop.getName(), prop); } assertEquals("childVal1", mergedPropertyMap.get("childName1").getValue()); assertEquals("childVal2", mergedPropertyMap.get("childName2").getValue()); assertEquals("parentVal1", mergedPropertyMap.get("parentName1").getValue()); assertEquals("parentVal3", mergedPropertyMap.get("parentName3").getValue()); Map<String, Map<String, Map<String, String>>> childAttributes = child.getModuleInfo().getConfigTypeAttributes(); Map<String, Map<String, Map<String, String>>> parentAttributes = parent.getModuleInfo().getConfigTypeAttributes(); assertEquals(3, childAttributes.size()); assertAttributes(childAttributes.get("FOO"), Collections.<String, String>emptyMap()); assertAttributes(childAttributes.get("BAR"), attributes); assertAttributes(childAttributes.get("OTHER"), Collections.<String, String>emptyMap()); assertEquals(3, parentAttributes.size()); assertAttributes(parentAttributes.get("FOO"), Collections.<String, String>emptyMap()); assertAttributes(parentAttributes.get("BAR"), Collections.<String, String>emptyMap()); assertAttributes(parentAttributes.get("OTHER"), Collections.<String, String>emptyMap()); }
@Override public ServiceInfo getModuleInfo() { return serviceInfo; }
ServiceModule extends BaseModule<ServiceModule, ServiceInfo> implements Validable { @Override public ServiceInfo getModuleInfo() { return serviceInfo; } }
ServiceModule extends BaseModule<ServiceModule, ServiceInfo> implements Validable { @Override public ServiceInfo getModuleInfo() { return serviceInfo; } ServiceModule(StackContext stackContext, ServiceInfo serviceInfo, ServiceDirectory serviceDirectory);  ServiceModule(
      StackContext stackContext, ServiceInfo serviceInfo, ServiceDirectory serviceDirectory, boolean isCommonService); }
ServiceModule extends BaseModule<ServiceModule, ServiceInfo> implements Validable { @Override public ServiceInfo getModuleInfo() { return serviceInfo; } ServiceModule(StackContext stackContext, ServiceInfo serviceInfo, ServiceDirectory serviceDirectory);  ServiceModule(
      StackContext stackContext, ServiceInfo serviceInfo, ServiceDirectory serviceDirectory, boolean isCommonService); @Override ServiceInfo getModuleInfo(); @Override void resolve(
      ServiceModule parentModule, Map<String, StackModule> allStacks, Map<String, ServiceModule> commonServices, Map<String, ExtensionModule> extensions); void resolveExplicit(
      ServiceModule parentModule, Map<String, StackModule> allStacks, Map<String, ServiceModule> commonServices, Map<String, ExtensionModule> extensions); void resolveInternal(
      ServiceModule parentModule, Map<String, StackModule> allStacks, Map<String, ServiceModule> commonServices,
      Map<String, ExtensionModule> extensions, boolean resolveExplicit); void resolveCommonService(Map<String, StackModule> allStacks, Map<String, ServiceModule> commonServices, Map<String, ExtensionModule> extensions); @Override boolean isDeleted(); @Override String getId(); @Override void finalizeModule(); @Override boolean isValid(); @Override void setValid(boolean valid); @Override void addError(String error); @Override Collection<String> getErrors(); ServiceDirectory getServiceDirectory(); @Override void addErrors(Collection<String> errors); @Override String toString(); }
ServiceModule extends BaseModule<ServiceModule, ServiceInfo> implements Validable { @Override public ServiceInfo getModuleInfo() { return serviceInfo; } ServiceModule(StackContext stackContext, ServiceInfo serviceInfo, ServiceDirectory serviceDirectory);  ServiceModule(
      StackContext stackContext, ServiceInfo serviceInfo, ServiceDirectory serviceDirectory, boolean isCommonService); @Override ServiceInfo getModuleInfo(); @Override void resolve(
      ServiceModule parentModule, Map<String, StackModule> allStacks, Map<String, ServiceModule> commonServices, Map<String, ExtensionModule> extensions); void resolveExplicit(
      ServiceModule parentModule, Map<String, StackModule> allStacks, Map<String, ServiceModule> commonServices, Map<String, ExtensionModule> extensions); void resolveInternal(
      ServiceModule parentModule, Map<String, StackModule> allStacks, Map<String, ServiceModule> commonServices,
      Map<String, ExtensionModule> extensions, boolean resolveExplicit); void resolveCommonService(Map<String, StackModule> allStacks, Map<String, ServiceModule> commonServices, Map<String, ExtensionModule> extensions); @Override boolean isDeleted(); @Override String getId(); @Override void finalizeModule(); @Override boolean isValid(); @Override void setValid(boolean valid); @Override void addError(String error); @Override Collection<String> getErrors(); ServiceDirectory getServiceDirectory(); @Override void addErrors(Collection<String> errors); @Override String toString();  }