@Test public void testRestartStaleServices() throws CloudbreakException, ApiException { ClouderaManagerModificationService modificationService = Mockito.mock(ClouderaManagerModificationService.class); MgmtServiceResourceApi mgmtServiceResourceApi = Mockito.mock(MgmtServiceResourceApi.class); ClustersResourceApi clustersResourceApi = Mockito.mock(ClustersResourceApi.class); when(applicationContext.getBean(ClouderaManagerModificationService.class, stack, clientConfig)).thenReturn(modificationService); when(clouderaManagerApiFactory.getMgmtServiceResourceApi(apiClient)).thenReturn(mgmtServiceResourceApi); when(clouderaManagerApiFactory.getClustersResourceApi(apiClient)).thenReturn(clustersResourceApi); underTest.restartStaleServices(); verify(applicationContext).getBean(ClouderaManagerModificationService.class, stack, clientConfig); verify(clouderaManagerApiFactory).getMgmtServiceResourceApi(apiClient); verify(clouderaManagerApiFactory).getClustersResourceApi(apiClient); verify(modificationService).restartStaleServices(mgmtServiceResourceApi, clustersResourceApi); }
@Override public void restartStaleServices() throws CloudbreakException { try { applicationContext.getBean(ClouderaManagerModificationService.class, stack, clientConfig) .restartStaleServices(clouderaManagerApiFactory.getMgmtServiceResourceApi(client), clouderaManagerApiFactory.getClustersResourceApi(client)); } catch (ApiException e) { LOGGER.error("Couldn't restart stale services", e); throw new CloudbreakException("Couldn't restart stale services", e); } }
ClouderaManagerClusterDecomissionService implements ClusterDecomissionService { @Override public void restartStaleServices() throws CloudbreakException { try { applicationContext.getBean(ClouderaManagerModificationService.class, stack, clientConfig) .restartStaleServices(clouderaManagerApiFactory.getMgmtServiceResourceApi(client), clouderaManagerApiFactory.getClustersResourceApi(client)); } catch (ApiException e) { LOGGER.error("Couldn't restart stale services", e); throw new CloudbreakException("Couldn't restart stale services", e); } } }
ClouderaManagerClusterDecomissionService implements ClusterDecomissionService { @Override public void restartStaleServices() throws CloudbreakException { try { applicationContext.getBean(ClouderaManagerModificationService.class, stack, clientConfig) .restartStaleServices(clouderaManagerApiFactory.getMgmtServiceResourceApi(client), clouderaManagerApiFactory.getClustersResourceApi(client)); } catch (ApiException e) { LOGGER.error("Couldn't restart stale services", e); throw new CloudbreakException("Couldn't restart stale services", e); } } ClouderaManagerClusterDecomissionService(Stack stack, HttpClientConfig clientConfig); }
ClouderaManagerClusterDecomissionService implements ClusterDecomissionService { @Override public void restartStaleServices() throws CloudbreakException { try { applicationContext.getBean(ClouderaManagerModificationService.class, stack, clientConfig) .restartStaleServices(clouderaManagerApiFactory.getMgmtServiceResourceApi(client), clouderaManagerApiFactory.getClustersResourceApi(client)); } catch (ApiException e) { LOGGER.error("Couldn't restart stale services", e); throw new CloudbreakException("Couldn't restart stale services", e); } } ClouderaManagerClusterDecomissionService(Stack stack, HttpClientConfig clientConfig); @PostConstruct void initApiClient(); @Override void verifyNodesAreRemovable(Stack stack, Collection<InstanceMetaData> removableInstances); @Override Set<InstanceMetaData> collectDownscaleCandidates(@Nonnull HostGroup hostGroup, Integer scalingAdjustment, int defaultRootVolumeSize,
            Set<InstanceMetaData> instanceMetaDatasInStack); @Override Map<String, InstanceMetaData> collectHostsToRemove(@Nonnull HostGroup hostGroup, Set<String> hostNames); @Override Set<String> decommissionClusterNodes(Map<String, InstanceMetaData> hostsToRemove); @Override void removeManagementServices(); @Override void deleteHostFromCluster(InstanceMetaData data); @Override void deleteUnusedCredentialsFromCluster(); @Override void restartStaleServices(); @Override Map<String, Map<String, String>> getStatusOfComponentsForHost(String host); }
ClouderaManagerClusterDecomissionService implements ClusterDecomissionService { @Override public void restartStaleServices() throws CloudbreakException { try { applicationContext.getBean(ClouderaManagerModificationService.class, stack, clientConfig) .restartStaleServices(clouderaManagerApiFactory.getMgmtServiceResourceApi(client), clouderaManagerApiFactory.getClustersResourceApi(client)); } catch (ApiException e) { LOGGER.error("Couldn't restart stale services", e); throw new CloudbreakException("Couldn't restart stale services", e); } } ClouderaManagerClusterDecomissionService(Stack stack, HttpClientConfig clientConfig); @PostConstruct void initApiClient(); @Override void verifyNodesAreRemovable(Stack stack, Collection<InstanceMetaData> removableInstances); @Override Set<InstanceMetaData> collectDownscaleCandidates(@Nonnull HostGroup hostGroup, Integer scalingAdjustment, int defaultRootVolumeSize,
            Set<InstanceMetaData> instanceMetaDatasInStack); @Override Map<String, InstanceMetaData> collectHostsToRemove(@Nonnull HostGroup hostGroup, Set<String> hostNames); @Override Set<String> decommissionClusterNodes(Map<String, InstanceMetaData> hostsToRemove); @Override void removeManagementServices(); @Override void deleteHostFromCluster(InstanceMetaData data); @Override void deleteUnusedCredentialsFromCluster(); @Override void restartStaleServices(); @Override Map<String, Map<String, String>> getStatusOfComponentsForHost(String host);  }