@Test public void collectsHostHealthIfAvailable() throws ApiException { hostsAre( new ApiHost().hostname("host1").addHealthChecksItem(new ApiHealthCheck().name(HOST_SCM_HEALTH).summary(ApiHealthSummary.GOOD)), new ApiHost().hostname("host2").addHealthChecksItem(new ApiHealthCheck().name(HOST_SCM_HEALTH).summary(ApiHealthSummary.CONCERNING)), new ApiHost().hostname("host3").addHealthChecksItem(new ApiHealthCheck().name(HOST_SCM_HEALTH).summary(ApiHealthSummary.BAD)), new ApiHost().hostname("host4").addHealthChecksItem(new ApiHealthCheck().name(HOST_SCM_HEALTH).summary(ApiHealthSummary.NOT_AVAILABLE)), new ApiHost().hostname("host5").addHealthChecksItem(new ApiHealthCheck().name(HOST_SCM_HEALTH).summary(ApiHealthSummary.HISTORY_NOT_AVAILABLE)), new ApiHost().hostname("host6").addHealthChecksItem(new ApiHealthCheck().name(HOST_SCM_HEALTH).summary(ApiHealthSummary.DISABLED)) ); Map<HostName, ClusterManagerState.ClusterManagerStatus> expected = ImmutableMap.of( hostName("host1"), ClusterManagerState.ClusterManagerStatus.HEALTHY, hostName("host2"), ClusterManagerState.ClusterManagerStatus.HEALTHY, hostName("host3"), ClusterManagerState.ClusterManagerStatus.UNHEALTHY ); Map<HostName, ClusterManagerState.ClusterManagerStatus> actual = new TreeMap<>(subject.getHostStatuses()); assertEquals(expected, actual); }
@Override public Map<HostName, ClusterManagerState.ClusterManagerStatus> getHostStatuses() { return convertHealthSummary(getHostHealthSummary(), ClouderaManagerClusterStatusService::healthSummaryToState); }
ClouderaManagerClusterStatusService implements ClusterStatusService { @Override public Map<HostName, ClusterManagerState.ClusterManagerStatus> getHostStatuses() { return convertHealthSummary(getHostHealthSummary(), ClouderaManagerClusterStatusService::healthSummaryToState); } }
ClouderaManagerClusterStatusService implements ClusterStatusService { @Override public Map<HostName, ClusterManagerState.ClusterManagerStatus> getHostStatuses() { return convertHealthSummary(getHostHealthSummary(), ClouderaManagerClusterStatusService::healthSummaryToState); } ClouderaManagerClusterStatusService(Stack stack, HttpClientConfig clientConfig); }
ClouderaManagerClusterStatusService implements ClusterStatusService { @Override public Map<HostName, ClusterManagerState.ClusterManagerStatus> getHostStatuses() { return convertHealthSummary(getHostHealthSummary(), ClouderaManagerClusterStatusService::healthSummaryToState); } ClouderaManagerClusterStatusService(Stack stack, HttpClientConfig clientConfig); @PostConstruct void initApiClient(); @Override ClusterStatusResult getStatus(boolean blueprintPresent); @Override ExtendedHostStatuses getExtendedHostStatuses(); @Override Map<HostName, ClusterManagerState.ClusterManagerStatus> getHostStatuses(); @Override Map<HostName, String> getHostStatusesRaw(); @Override boolean isClusterManagerRunning(); }
ClouderaManagerClusterStatusService implements ClusterStatusService { @Override public Map<HostName, ClusterManagerState.ClusterManagerStatus> getHostStatuses() { return convertHealthSummary(getHostHealthSummary(), ClouderaManagerClusterStatusService::healthSummaryToState); } ClouderaManagerClusterStatusService(Stack stack, HttpClientConfig clientConfig); @PostConstruct void initApiClient(); @Override ClusterStatusResult getStatus(boolean blueprintPresent); @Override ExtendedHostStatuses getExtendedHostStatuses(); @Override Map<HostName, ClusterManagerState.ClusterManagerStatus> getHostStatuses(); @Override Map<HostName, String> getHostStatusesRaw(); @Override boolean isClusterManagerRunning();  }