@Test void testGetComponentLocation() { HostGroup master1 = new HostGroup(); master1.setName(MASTER_1); InstanceGroup ig1 = new InstanceGroup(); InstanceMetaData imd1 = new InstanceMetaData(); imd1.setInstanceStatus(InstanceStatus.SERVICES_HEALTHY); imd1.setDiscoveryFQDN(MASTER1_FQDN); ig1.setInstanceMetaData(Set.of(imd1)); master1.setInstanceGroup(ig1); HostGroup master2 = new HostGroup(); master2.setName(MASTER_2); InstanceGroup ig2 = new InstanceGroup(); InstanceMetaData imd2 = new InstanceMetaData(); imd2.setInstanceStatus(InstanceStatus.SERVICES_HEALTHY); imd2.setDiscoveryFQDN(MASTER2_FQDN); ig2.setInstanceMetaData(Set.of(imd2)); master2.setInstanceGroup(ig2); HostGroup master3 = new HostGroup(); master3.setName(MASTER_3); InstanceGroup ig3 = new InstanceGroup(); InstanceMetaData imd3 = new InstanceMetaData(); imd3.setInstanceStatus(InstanceStatus.SERVICES_HEALTHY); imd3.setDiscoveryFQDN(MASTER3_FQDN); ig3.setInstanceMetaData(Set.of(imd3)); master3.setInstanceGroup(ig3); HostGroup executor = new HostGroup(); executor.setName(EXECUTOR); InstanceGroup ig4 = new InstanceGroup(); Set<InstanceMetaData> imd4 = EXECUTOR_FQDNS.stream().map(fqdn -> { InstanceMetaData imd = new InstanceMetaData(); imd.setInstanceStatus(InstanceStatus.SERVICES_HEALTHY); imd.setDiscoveryFQDN(fqdn); return imd; }).collect(Collectors.toSet()); ig4.setInstanceMetaData(imd4); executor.setInstanceGroup(ig4); HostGroup coordinator = new HostGroup(); coordinator.setName(COORDINATOR); InstanceGroup ig5 = new InstanceGroup(); Set<InstanceMetaData> imd5 = COORDINATOR_FQDNS.stream().map(fqdn -> { InstanceMetaData imd = new InstanceMetaData(); imd.setInstanceStatus(InstanceStatus.SERVICES_HEALTHY); imd.setDiscoveryFQDN(fqdn); return imd; }).collect(Collectors.toSet()); ig5.setInstanceMetaData(imd5); coordinator.setInstanceGroup(ig5); Set<HostGroup> hostGroups = new LinkedHashSet<>(List.of(master1, master2, master3, executor, coordinator)); when(blueprintTextProcessor.getComponentsInHostGroup(MASTER_1)).thenReturn(MASTER1_COMPONENTS); when(blueprintTextProcessor.getComponentsInHostGroup(MASTER_2)).thenReturn(MASTER2_COMPONENTS); when(blueprintTextProcessor.getComponentsInHostGroup(MASTER_3)).thenReturn(MASTER3_COMPONENTS); when(blueprintTextProcessor.getComponentsInHostGroup(EXECUTOR)).thenReturn(EXECUTOR_COMPONENTS); when(blueprintTextProcessor.getComponentsInHostGroup(COORDINATOR)).thenReturn(COORDINATOR_COMPONENTS); when(hostGroupService.getByCluster(CLUSTER_ID)).thenReturn(hostGroups); Map<String, List<String>> result = underTest.getComponentLocation(CLUSTER_ID, blueprintTextProcessor, COMPONENT_NAMES); assertEquals(1, result.get(NAMENODE).size()); assertEquals(MASTER1_FQDN, result.get(NAMENODE).get(0)); assertEquals(3, result.get(KUDU_MASTER).size()); assertEquals(1, result.get(SPARK_YARN_HISTORY_SERVER).size()); assertEquals(6, result.size()); }
public Map<String, List<String>> getComponentLocation(Cluster cluster, Collection<String> componentNames) { return getFqdnsByComponents(cluster, componentNames); }
ComponentLocatorService { public Map<String, List<String>> getComponentLocation(Cluster cluster, Collection<String> componentNames) { return getFqdnsByComponents(cluster, componentNames); } }
ComponentLocatorService { public Map<String, List<String>> getComponentLocation(Cluster cluster, Collection<String> componentNames) { return getFqdnsByComponents(cluster, componentNames); }  }
ComponentLocatorService { public Map<String, List<String>> getComponentLocation(Cluster cluster, Collection<String> componentNames) { return getFqdnsByComponents(cluster, componentNames); }  Map<String, List<String>> getComponentLocation(Cluster cluster, Collection<String> componentNames); Map<String, List<String>> getImpalaCoordinatorLocations(Cluster cluster); Map<String, List<String>> getComponentLocationByHostname(Cluster cluster, Collection<String> componentNames); Map<String, List<String>> getComponentLocation(Long clusterId, BlueprintTextProcessor blueprintTextProcessor,
            Collection<String> componentNames); }
ComponentLocatorService { public Map<String, List<String>> getComponentLocation(Cluster cluster, Collection<String> componentNames) { return getFqdnsByComponents(cluster, componentNames); }  Map<String, List<String>> getComponentLocation(Cluster cluster, Collection<String> componentNames); Map<String, List<String>> getImpalaCoordinatorLocations(Cluster cluster); Map<String, List<String>> getComponentLocationByHostname(Cluster cluster, Collection<String> componentNames); Map<String, List<String>> getComponentLocation(Long clusterId, BlueprintTextProcessor blueprintTextProcessor,
            Collection<String> componentNames);  }