@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());
  // test a couple of the properties for filename
  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());
}