@Test public void testStackServiceExtension() { StackInfo stack = stackManager.getStack("OTHER", "1.0"); assertNotNull(stack); assertEquals("OTHER", stack.getName()); assertEquals("1.0", stack.getVersion()); Collection<ServiceInfo> services = stack.getServices(); assertEquals(4, services.size()); assertEquals(6, stack.getService("HDFS").getComponents().size()); ServiceInfo sqoopService = stack.getService("SQOOP2"); assertNotNull(sqoopService); assertEquals("Extended SQOOP", sqoopService.getComment()); assertEquals("Extended Version", sqoopService.getVersion()); assertNull(sqoopService.getServicePackageFolder()); Collection<ComponentInfo> components = sqoopService.getComponents(); assertEquals(1, components.size()); ComponentInfo component = components.iterator().next(); assertEquals("SQOOP", component.getName()); StackInfo baseStack = stackManager.getStack("HDP", "2.1.1"); ServiceInfo baseSqoopService = baseStack.getService("SQOOP"); assertEquals(baseSqoopService.isDeleted(), sqoopService.isDeleted()); assertEquals(baseSqoopService.getAlertsFile(),sqoopService.getAlertsFile()); assertEquals(baseSqoopService.getClientComponent(), sqoopService.getClientComponent()); assertEquals(baseSqoopService.getCommandScript(), sqoopService.getCommandScript()); assertEquals(baseSqoopService.getConfigDependencies(), sqoopService.getConfigDependencies()); assertEquals(baseSqoopService.getConfigDir(), sqoopService.getConfigDir()); assertEquals(baseSqoopService.getConfigDependenciesWithComponents(), sqoopService.getConfigDependenciesWithComponents()); assertEquals(baseSqoopService.getConfigTypeAttributes(), sqoopService.getConfigTypeAttributes()); assertEquals(baseSqoopService.getCustomCommands(), sqoopService.getCustomCommands()); assertEquals(baseSqoopService.getExcludedConfigTypes(), sqoopService.getExcludedConfigTypes()); assertEquals(baseSqoopService.getProperties(), sqoopService.getProperties()); assertEquals(baseSqoopService.getMetrics(), sqoopService.getMetrics()); assertNull(baseSqoopService.getMetricsFile()); assertNull(sqoopService.getMetricsFile()); assertEquals(baseSqoopService.getOsSpecifics(), sqoopService.getOsSpecifics()); assertEquals(baseSqoopService.getRequiredServices(), sqoopService.getRequiredServices()); assertEquals(baseSqoopService.getSchemaVersion(), sqoopService.getSchemaVersion()); ServiceInfo stormService = stack.getService("STORM"); assertNotNull(stormService); assertEquals("STORM", stormService.getName()); ServiceInfo baseStormService = baseStack.getService("STORM"); assertEquals("Apache Hadoop Stream processing framework (Extended)", stormService.getComment()); assertEquals("New version", stormService.getVersion()); String packageDir = StringUtils.join( new String[]{"stacks", "OTHER", "1.0", "services", "STORM", "package"}, File.separator); assertEquals(packageDir, stormService.getServicePackageFolder()); List<ComponentInfo> stormServiceComponents = stormService.getComponents(); List<ComponentInfo> baseStormServiceComponents = baseStormService.getComponents(); assertEquals(new HashSet<ComponentInfo>(stormServiceComponents), new HashSet<ComponentInfo>(baseStormServiceComponents)); assertEquals(baseStormService.isDeleted(), stormService.isDeleted()); assertEquals(baseStormService.getAlertsFile(),stormService.getAlertsFile()); assertEquals(baseStormService.getClientComponent(), stormService.getClientComponent()); assertEquals(baseStormService.getCommandScript(), stormService.getCommandScript()); assertEquals(baseStormService.getConfigDependencies(), stormService.getConfigDependencies()); assertEquals(baseStormService.getConfigDir(), stormService.getConfigDir()); assertEquals(baseStormService.getConfigDependenciesWithComponents(), stormService.getConfigDependenciesWithComponents()); assertEquals(baseStormService.getConfigTypeAttributes(), stormService.getConfigTypeAttributes()); assertEquals(baseStormService.getCustomCommands(), stormService.getCustomCommands()); assertEquals(baseStormService.getExcludedConfigTypes(), stormService.getExcludedConfigTypes()); assertEquals(baseStormService.getProperties(), stormService.getProperties()); assertEquals(baseStormService.getMetrics(), stormService.getMetrics()); assertNotNull(baseStormService.getMetricsFile()); assertNotNull(stormService.getMetricsFile()); assertFalse(baseStormService.getMetricsFile().equals(stormService.getMetricsFile())); assertEquals(baseStormService.getOsSpecifics(), stormService.getOsSpecifics()); assertEquals(baseStormService.getRequiredServices(), stormService.getRequiredServices()); assertEquals(baseStormService.getSchemaVersion(), stormService.getSchemaVersion()); }
public StackInfo getStack(String name, String version) { return stackMap.get(name + StackManager.PATH_DELIMITER + version); }
StackManager { public StackInfo getStack(String name, String version) { return stackMap.get(name + StackManager.PATH_DELIMITER + version); } }
StackManager { public StackInfo getStack(String name, String version) { return stackMap.get(name + StackManager.PATH_DELIMITER + version); } @AssistedInject  StackManager(@Assisted("stackRoot") File stackRoot,
      @Assisted("commonServicesRoot") @Nullable File commonServicesRoot,
      @Assisted("extensionRoot") @Nullable File extensionRoot,
      @Assisted OsFamily osFamily, @Assisted boolean validate,
      MetainfoDAO metaInfoDAO, ActionMetadata actionMetadata, StackDAO stackDao,
      ExtensionDAO extensionDao, ExtensionLinkDAO linkDao); }
StackManager { public StackInfo getStack(String name, String version) { return stackMap.get(name + StackManager.PATH_DELIMITER + version); } @AssistedInject  StackManager(@Assisted("stackRoot") File stackRoot,
      @Assisted("commonServicesRoot") @Nullable File commonServicesRoot,
      @Assisted("extensionRoot") @Nullable File extensionRoot,
      @Assisted OsFamily osFamily, @Assisted boolean validate,
      MetainfoDAO metaInfoDAO, ActionMetadata actionMetadata, StackDAO stackDao,
      ExtensionDAO extensionDao, ExtensionLinkDAO linkDao); StackInfo getStack(String name, String version); Collection<StackInfo> getStacks(String name); Collection<StackInfo> getStacks(); ExtensionInfo getExtension(String name, String version); Collection<ExtensionInfo> getExtensions(String name); Collection<ExtensionInfo> getExtensions(); boolean haveAllRepoUrlsBeenResolved(); static Validator getPropertySchemaValidator(); static void validateAllPropertyXmlsInFolderRecursively(File stackRoot, Validator validator); void linkStackToExtension(StackInfo stack, ExtensionInfo extension); void unlinkStackAndExtension(StackInfo stack, ExtensionInfo extension); }
StackManager { public StackInfo getStack(String name, String version) { return stackMap.get(name + StackManager.PATH_DELIMITER + version); } @AssistedInject  StackManager(@Assisted("stackRoot") File stackRoot,
      @Assisted("commonServicesRoot") @Nullable File commonServicesRoot,
      @Assisted("extensionRoot") @Nullable File extensionRoot,
      @Assisted OsFamily osFamily, @Assisted boolean validate,
      MetainfoDAO metaInfoDAO, ActionMetadata actionMetadata, StackDAO stackDao,
      ExtensionDAO extensionDao, ExtensionLinkDAO linkDao); StackInfo getStack(String name, String version); Collection<StackInfo> getStacks(String name); Collection<StackInfo> getStacks(); ExtensionInfo getExtension(String name, String version); Collection<ExtensionInfo> getExtensions(String name); Collection<ExtensionInfo> getExtensions(); boolean haveAllRepoUrlsBeenResolved(); static Validator getPropertySchemaValidator(); static void validateAllPropertyXmlsInFolderRecursively(File stackRoot, Validator validator); void linkStackToExtension(StackInfo stack, ExtensionInfo extension); void unlinkStackAndExtension(StackInfo stack, ExtensionInfo extension); static final String PROPERTY_SCHEMA_PATH; static String PATH_DELIMITER; static final String COMMON_SERVICES; static final String EXTENSIONS; static final String METAINFO_FILE_NAME; }