@Test public void testCollectDownscaleCandidates() { HostGroup hostGroup = new HostGroup(); Integer scalingAdjustment = 1; int defaultRootVolumeSize = 2; Set<InstanceMetaData> instanceMetadatas = new HashSet<>(); InstanceMetaData instanceMetaData1 = new InstanceMetaData(); instanceMetaData1.setDiscoveryFQDN("host1"); instanceMetaData1.setPrivateId(1L); instanceMetadatas.add(instanceMetaData1); InstanceMetaData instanceMetaData2 = new InstanceMetaData(); instanceMetaData2.setDiscoveryFQDN("host2"); instanceMetaData2.setPrivateId(2L); instanceMetadatas.add(instanceMetaData2); when(clouderaManagerDecomissioner.collectDownscaleCandidates(apiClient, stack, hostGroup, scalingAdjustment, defaultRootVolumeSize, instanceMetadatas)).thenReturn(instanceMetadatas); Set<InstanceMetaData> actual = underTest.collectDownscaleCandidates(hostGroup, scalingAdjustment, defaultRootVolumeSize, instanceMetadatas); assertEquals(instanceMetadatas, actual); verify(clouderaManagerDecomissioner).collectDownscaleCandidates(apiClient, stack, hostGroup, scalingAdjustment, defaultRootVolumeSize, instanceMetadatas); }
@Override public Set<InstanceMetaData> collectDownscaleCandidates(@Nonnull HostGroup hostGroup, Integer scalingAdjustment, int defaultRootVolumeSize, Set<InstanceMetaData> instanceMetaDatasInStack) { return clouderaManagerDecomissioner.collectDownscaleCandidates(client, stack, hostGroup, scalingAdjustment, defaultRootVolumeSize, instanceMetaDatasInStack); }
ClouderaManagerClusterDecomissionService implements ClusterDecomissionService { @Override public Set<InstanceMetaData> collectDownscaleCandidates(@Nonnull HostGroup hostGroup, Integer scalingAdjustment, int defaultRootVolumeSize, Set<InstanceMetaData> instanceMetaDatasInStack) { return clouderaManagerDecomissioner.collectDownscaleCandidates(client, stack, hostGroup, scalingAdjustment, defaultRootVolumeSize, instanceMetaDatasInStack); } }
ClouderaManagerClusterDecomissionService implements ClusterDecomissionService { @Override public Set<InstanceMetaData> collectDownscaleCandidates(@Nonnull HostGroup hostGroup, Integer scalingAdjustment, int defaultRootVolumeSize, Set<InstanceMetaData> instanceMetaDatasInStack) { return clouderaManagerDecomissioner.collectDownscaleCandidates(client, stack, hostGroup, scalingAdjustment, defaultRootVolumeSize, instanceMetaDatasInStack); } ClouderaManagerClusterDecomissionService(Stack stack, HttpClientConfig clientConfig); }
ClouderaManagerClusterDecomissionService implements ClusterDecomissionService { @Override public Set<InstanceMetaData> collectDownscaleCandidates(@Nonnull HostGroup hostGroup, Integer scalingAdjustment, int defaultRootVolumeSize, Set<InstanceMetaData> instanceMetaDatasInStack) { return clouderaManagerDecomissioner.collectDownscaleCandidates(client, stack, hostGroup, scalingAdjustment, defaultRootVolumeSize, instanceMetaDatasInStack); } 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 Set<InstanceMetaData> collectDownscaleCandidates(@Nonnull HostGroup hostGroup, Integer scalingAdjustment, int defaultRootVolumeSize, Set<InstanceMetaData> instanceMetaDatasInStack) { return clouderaManagerDecomissioner.collectDownscaleCandidates(client, stack, hostGroup, scalingAdjustment, defaultRootVolumeSize, instanceMetaDatasInStack); } 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);  }