@Test public void testGetStack() { StackInfo stack = stackManager.getStack("HDP", "0.1"); assertNotNull(stack); assertEquals("HDP", stack.getName()); assertEquals("0.1", stack.getVersion()); Collection<ServiceInfo> services = stack.getServices(); assertEquals(3, services.size()); Map<String, ServiceInfo> serviceMap = new HashMap<String, ServiceInfo>(); for (ServiceInfo service : services) { serviceMap.put(service.getName(), service); } ServiceInfo hdfsService = serviceMap.get("HDFS"); assertNotNull(hdfsService); List<ComponentInfo> components = hdfsService.getComponents(); assertEquals(6, components.size()); List<PropertyInfo> properties = hdfsService.getProperties(); assertEquals(64, properties.size()); boolean hdfsPropFound = false; boolean hbasePropFound = false; for (PropertyInfo p : properties) { if (p.getName().equals("hbase.regionserver.msginterval")) { assertEquals("hbase-site.xml", p.getFilename()); hbasePropFound = true; } else if (p.getName().equals("dfs.name.dir")) { assertEquals("hdfs-site.xml", p.getFilename()); hdfsPropFound = true; } } assertTrue(hbasePropFound); assertTrue(hdfsPropFound); ServiceInfo mrService = serviceMap.get("MAPREDUCE"); assertNotNull(mrService); components = mrService.getComponents(); assertEquals(3, components.size()); ServiceInfo pigService = serviceMap.get("PIG"); assertNotNull(pigService); assertEquals("PIG", pigService.getName()); assertEquals("1.0", pigService.getVersion()); assertEquals("This is comment for PIG service", pigService.getComment()); components = pigService.getComponents(); assertEquals(1, components.size()); CommandScriptDefinition commandScript = pigService.getCommandScript(); assertEquals("scripts/service_check.py", commandScript.getScript()); assertEquals(CommandScriptDefinition.Type.PYTHON, commandScript.getScriptType()); assertEquals(300, commandScript.getTimeout()); List<String> configDependencies = pigService.getConfigDependencies(); assertEquals(1, configDependencies.size()); assertEquals("global", configDependencies.get(0)); assertEquals("global", pigService.getConfigDependenciesWithComponents().get(0)); ComponentInfo client = pigService.getClientComponent(); assertNotNull(client); assertEquals("PIG", client.getName()); assertEquals("0+", client.getCardinality()); assertEquals("CLIENT", client.getCategory()); assertEquals("configuration", pigService.getConfigDir()); assertEquals("2.0", pigService.getSchemaVersion()); Map<String, ServiceOsSpecific> osInfoMap = pigService.getOsSpecifics(); assertEquals(1, osInfoMap.size()); ServiceOsSpecific osSpecific = osInfoMap.get("centos6"); assertNotNull(osSpecific); assertEquals("centos6", osSpecific.getOsFamily()); assertNull(osSpecific.getRepo()); List<ServiceOsSpecific.Package> packages = osSpecific.getPackages(); assertEquals(1, packages.size()); ServiceOsSpecific.Package pkg = packages.get(0); assertEquals("pig", pkg.getName()); assertNull(pigService.getParent()); }
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; }