@Test public void testResolve_CustomCommands() throws Exception { List<CustomCommandDefinition> customCommands = new ArrayList<CustomCommandDefinition>(); CustomCommandDefinition cmd1 = new CustomCommandDefinition(); setPrivateField(cmd1, "name", "cmd1"); setPrivateField(cmd1, "background", false); CustomCommandDefinition cmd2 = new CustomCommandDefinition(); setPrivateField(cmd2, "name", "cmd2"); customCommands.add(cmd1); customCommands.add(cmd2); ServiceInfo info = new ServiceInfo(); ServiceInfo parentInfo = new ServiceInfo(); info.setCustomCommands(customCommands); ServiceModule service = resolveService(info, parentInfo); assertEquals(customCommands, service.getModuleInfo().getCustomCommands()); info.setCustomCommands(null); parentInfo.setCustomCommands(customCommands); service = resolveService(info, parentInfo); assertEquals(customCommands, service.getModuleInfo().getCustomCommands()); List<CustomCommandDefinition> parentCustomCommands = new ArrayList<CustomCommandDefinition>(); CustomCommandDefinition cmd3 = new CustomCommandDefinition(); setPrivateField(cmd3, "name", "cmd1"); setPrivateField(cmd3, "background", true); CustomCommandDefinition cmd4 = new CustomCommandDefinition(); setPrivateField(cmd4, "name", "cmd4"); parentCustomCommands.add(cmd3); parentCustomCommands.add(cmd4); info.setCustomCommands(customCommands); parentInfo.setCustomCommands(parentCustomCommands); service = resolveService(info, parentInfo); Collection<CustomCommandDefinition> mergedCommands = service.getModuleInfo().getCustomCommands(); assertEquals(3, mergedCommands.size()); assertTrue(mergedCommands.contains(cmd2)); assertTrue(mergedCommands.contains(cmd3)); assertTrue(mergedCommands.contains(cmd4)); info.setCustomCommands(null); parentInfo.setCustomCommands(null); service = resolveService(info, parentInfo); assertTrue(service.getModuleInfo().getCustomCommands().isEmpty()); }
@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();  }