@Test public void test_GetHostAssigmentForComponents() throws Exception { TestTopologyRequest request = new TestTopologyRequest(TopologyRequest.Type.PROVISION); TopologyValidator validator = createStrictMock(TopologyValidator.class); topologyValidators.add(validator); validator.validate((ClusterTopology) notNull()); replayAll(); replay(validator); new ClusterTopologyImpl(null, request).getHostAssignmentsForComponent("component1"); }
@Override public Collection<String> getHostAssignmentsForComponent(String component) { Collection<String> hosts = new ArrayList<String>(); Collection<String> hostGroups = getHostGroupsForComponent(component); for (String group : hostGroups) { HostGroupInfo hostGroupInfo = getHostGroupInfo().get(group); if (hostGroupInfo != null) { hosts.addAll(hostGroupInfo.getHostNames()); } else { LOG.warn("HostGroup {} not found, when checking for hosts for component {}", group, component); } } return hosts; }
ClusterTopologyImpl implements ClusterTopology { @Override public Collection<String> getHostAssignmentsForComponent(String component) { Collection<String> hosts = new ArrayList<String>(); Collection<String> hostGroups = getHostGroupsForComponent(component); for (String group : hostGroups) { HostGroupInfo hostGroupInfo = getHostGroupInfo().get(group); if (hostGroupInfo != null) { hosts.addAll(hostGroupInfo.getHostNames()); } else { LOG.warn("HostGroup {} not found, when checking for hosts for component {}", group, component); } } return hosts; } }
ClusterTopologyImpl implements ClusterTopology { @Override public Collection<String> getHostAssignmentsForComponent(String component) { Collection<String> hosts = new ArrayList<String>(); Collection<String> hostGroups = getHostGroupsForComponent(component); for (String group : hostGroups) { HostGroupInfo hostGroupInfo = getHostGroupInfo().get(group); if (hostGroupInfo != null) { hosts.addAll(hostGroupInfo.getHostNames()); } else { LOG.warn("HostGroup {} not found, when checking for hosts for component {}", group, component); } } return hosts; } ClusterTopologyImpl(AmbariContext ambariContext, TopologyRequest topologyRequest);  ClusterTopologyImpl(AmbariContext ambariContext,
                             Long clusterId,
                             Blueprint blueprint,
                             Configuration configuration,
                             Map<String, HostGroupInfo> hostGroupInfo); }
ClusterTopologyImpl implements ClusterTopology { @Override public Collection<String> getHostAssignmentsForComponent(String component) { Collection<String> hosts = new ArrayList<String>(); Collection<String> hostGroups = getHostGroupsForComponent(component); for (String group : hostGroups) { HostGroupInfo hostGroupInfo = getHostGroupInfo().get(group); if (hostGroupInfo != null) { hosts.addAll(hostGroupInfo.getHostNames()); } else { LOG.warn("HostGroup {} not found, when checking for hosts for component {}", group, component); } } return hosts; } ClusterTopologyImpl(AmbariContext ambariContext, TopologyRequest topologyRequest);  ClusterTopologyImpl(AmbariContext ambariContext,
                             Long clusterId,
                             Blueprint blueprint,
                             Configuration configuration,
                             Map<String, HostGroupInfo> hostGroupInfo); @Override void update(TopologyRequest topologyRequest); @Override Long getClusterId(); @Override void setClusterId(Long clusterId); @Override Blueprint getBlueprint(); @Override Configuration getConfiguration(); @Override Map<String, HostGroupInfo> getHostGroupInfo(); @Override Collection<String> getHostGroupsForComponent(String component); @Override String getHostGroupForHost(String hostname); @Override void addHostToTopology(String hostGroupName, String host); @Override Collection<String> getHostAssignmentsForComponent(String component); @Override boolean isNameNodeHAEnabled(); static boolean isNameNodeHAEnabled(Map<String, Map<String, String>> configurationProperties); @Override boolean isYarnResourceManagerHAEnabled(); @Override boolean isClusterKerberosEnabled(); @Override RequestStatusResponse installHost(String hostName, boolean skipInstallTaskCreate, boolean skipFailure); @Override RequestStatusResponse startHost(String hostName, boolean skipFailure); @Override void setConfigRecommendationStrategy(ConfigRecommendationStrategy strategy); @Override ConfigRecommendationStrategy getConfigRecommendationStrategy(); @Override ProvisionAction getProvisionAction(); @Override void setProvisionAction(ProvisionAction provisionAction); @Override Map<String, AdvisedConfiguration> getAdvisedConfigurations(); @Override AmbariContext getAmbariContext(); @Override void removeHost(String hostname); }
ClusterTopologyImpl implements ClusterTopology { @Override public Collection<String> getHostAssignmentsForComponent(String component) { Collection<String> hosts = new ArrayList<String>(); Collection<String> hostGroups = getHostGroupsForComponent(component); for (String group : hostGroups) { HostGroupInfo hostGroupInfo = getHostGroupInfo().get(group); if (hostGroupInfo != null) { hosts.addAll(hostGroupInfo.getHostNames()); } else { LOG.warn("HostGroup {} not found, when checking for hosts for component {}", group, component); } } return hosts; } ClusterTopologyImpl(AmbariContext ambariContext, TopologyRequest topologyRequest);  ClusterTopologyImpl(AmbariContext ambariContext,
                             Long clusterId,
                             Blueprint blueprint,
                             Configuration configuration,
                             Map<String, HostGroupInfo> hostGroupInfo); @Override void update(TopologyRequest topologyRequest); @Override Long getClusterId(); @Override void setClusterId(Long clusterId); @Override Blueprint getBlueprint(); @Override Configuration getConfiguration(); @Override Map<String, HostGroupInfo> getHostGroupInfo(); @Override Collection<String> getHostGroupsForComponent(String component); @Override String getHostGroupForHost(String hostname); @Override void addHostToTopology(String hostGroupName, String host); @Override Collection<String> getHostAssignmentsForComponent(String component); @Override boolean isNameNodeHAEnabled(); static boolean isNameNodeHAEnabled(Map<String, Map<String, String>> configurationProperties); @Override boolean isYarnResourceManagerHAEnabled(); @Override boolean isClusterKerberosEnabled(); @Override RequestStatusResponse installHost(String hostName, boolean skipInstallTaskCreate, boolean skipFailure); @Override RequestStatusResponse startHost(String hostName, boolean skipFailure); @Override void setConfigRecommendationStrategy(ConfigRecommendationStrategy strategy); @Override ConfigRecommendationStrategy getConfigRecommendationStrategy(); @Override ProvisionAction getProvisionAction(); @Override void setProvisionAction(ProvisionAction provisionAction); @Override Map<String, AdvisedConfiguration> getAdvisedConfigurations(); @Override AmbariContext getAmbariContext(); @Override void removeHost(String hostname);  }