@Test public void testGetHostComponents() throws Exception { ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider()); Set<String> hostComponents = clusterDefinition.getHostComponents("HDFS", "NAMENODE_MASTER.acme.com"); Assert.assertTrue(hostComponents.contains("NAMENODE")); hostComponents = clusterDefinition.getHostComponents("HDFS", "slave1.acme.com"); Assert.assertTrue(hostComponents.contains("DATANODE")); hostComponents = clusterDefinition.getHostComponents("HDFS", "slave2.acme.com"); Assert.assertTrue(hostComponents.contains("DATANODE")); clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider("clusterproperties_HDP2_HA.txt", "myCluster", "HDP-2.0.6"), new TestHostInfoProvider()); hostComponents = clusterDefinition.getHostComponents("HDFS", "WINHDP-1"); Assert.assertTrue(hostComponents.contains("NAMENODE")); Assert.assertTrue(hostComponents.contains("JOURNALNODE")); Assert.assertTrue(hostComponents.contains("ZKFC")); Assert.assertFalse(hostComponents.contains("DATANODE")); Assert.assertFalse(hostComponents.contains("SECONDARY_NAMENODE")); hostComponents = clusterDefinition.getHostComponents("HDFS", "WINHDP-2"); Assert.assertTrue(hostComponents.contains("NAMENODE")); Assert.assertTrue(hostComponents.contains("JOURNALNODE")); Assert.assertTrue(hostComponents.contains("ZKFC")); Assert.assertTrue(hostComponents.contains("DATANODE")); Assert.assertTrue(hostComponents.contains("SECONDARY_NAMENODE")); clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider("clusterproperties_HDP21_HA.txt", "myCluster", "HDP-2.1.2"), new TestHostInfoProvider()); hostComponents = clusterDefinition.getHostComponents("YARN", "WINHDP-1"); Assert.assertTrue(hostComponents.contains("RESOURCEMANAGER")); hostComponents = clusterDefinition.getHostComponents("HDFS", "WINHDP-1"); Assert.assertTrue(hostComponents.contains("NAMENODE")); Assert.assertTrue(hostComponents.contains("JOURNALNODE")); hostComponents = clusterDefinition.getHostComponents("YARN", "WINHDP-2"); Assert.assertTrue(hostComponents.contains("RESOURCEMANAGER")); hostComponents = clusterDefinition.getHostComponents("HDFS", "WINHDP-2"); Assert.assertTrue(hostComponents.contains("NAMENODE")); Assert.assertTrue(hostComponents.contains("JOURNALNODE")); }
public Set<String> getHostComponents(String service, String host) { Set<String> resultSet = null; Map<String, Set<String>> serviceHostComponents = hostComponents.get(service); if (serviceHostComponents != null) { resultSet = serviceHostComponents.get(host); } return resultSet == null ? Collections.<String>emptySet() : resultSet; }
ClusterDefinition { public Set<String> getHostComponents(String service, String host) { Set<String> resultSet = null; Map<String, Set<String>> serviceHostComponents = hostComponents.get(service); if (serviceHostComponents != null) { resultSet = serviceHostComponents.get(host); } return resultSet == null ? Collections.<String>emptySet() : resultSet; } }
ClusterDefinition { public Set<String> getHostComponents(String service, String host) { Set<String> resultSet = null; Map<String, Set<String>> serviceHostComponents = hostComponents.get(service); if (serviceHostComponents != null) { resultSet = serviceHostComponents.get(host); } return resultSet == null ? Collections.<String>emptySet() : resultSet; } ClusterDefinition(StateProvider stateProvider,
                           ClusterDefinitionProvider definitionProvider,
                           HostInfoProvider hostInfoProvider); }
ClusterDefinition { public Set<String> getHostComponents(String service, String host) { Set<String> resultSet = null; Map<String, Set<String>> serviceHostComponents = hostComponents.get(service); if (serviceHostComponents != null) { resultSet = serviceHostComponents.get(host); } return resultSet == null ? Collections.<String>emptySet() : resultSet; } ClusterDefinition(StateProvider stateProvider,
                           ClusterDefinitionProvider definitionProvider,
                           HostInfoProvider hostInfoProvider); Integer getMajorStackVersion(); Integer getMinorStackVersion(); String getClusterName(); String getVersionId(); Set<String> getServices(); Set<String> getHosts(); HostInfoProvider getHostInfoProvider(); Set<String> getComponents(String service); Set<String> getHostComponents(String service, String host); String getHostState(String hostName); String getServiceState(String serviceName); int setServiceState(String serviceName, String state); String getComponentState(String serviceName, String componentName); int setComponentState(String serviceName, String componentName, String state); String getHostComponentState(String hostName, String componentName); int setHostComponentState(String hostName, String componentName, String state); StateProvider.Process getProcess(Integer id); Set<Resource> getRequestResources(); Set<Resource> getTaskResources(); }
ClusterDefinition { public Set<String> getHostComponents(String service, String host) { Set<String> resultSet = null; Map<String, Set<String>> serviceHostComponents = hostComponents.get(service); if (serviceHostComponents != null) { resultSet = serviceHostComponents.get(host); } return resultSet == null ? Collections.<String>emptySet() : resultSet; } ClusterDefinition(StateProvider stateProvider,
                           ClusterDefinitionProvider definitionProvider,
                           HostInfoProvider hostInfoProvider); Integer getMajorStackVersion(); Integer getMinorStackVersion(); String getClusterName(); String getVersionId(); Set<String> getServices(); Set<String> getHosts(); HostInfoProvider getHostInfoProvider(); Set<String> getComponents(String service); Set<String> getHostComponents(String service, String host); String getHostState(String hostName); String getServiceState(String serviceName); int setServiceState(String serviceName, String state); String getComponentState(String serviceName, String componentName); int setComponentState(String serviceName, String componentName, String state); String getHostComponentState(String hostName, String componentName); int setHostComponentState(String hostName, String componentName, String state); StateProvider.Process getProcess(Integer id); Set<Resource> getRequestResources(); Set<Resource> getTaskResources();  }