@Test public void testInitApiClientShouldCreateTheApiClient() throws ClusterClientInitException, ClouderaManagerClientInitException { ReflectionTestUtils.setField(underTest, "client", null); ApiClient client = Mockito.mock(ApiClient.class); when(clouderaManagerApiClientProvider.getClient(GATEWAY_PORT, USER, PASSWORD, clientConfig)).thenReturn(client); underTest.initApiClient(); assertEquals(client, ReflectionTestUtils.getField(underTest, "client")); verify(clouderaManagerApiClientProvider).getClient(GATEWAY_PORT, USER, PASSWORD, clientConfig); }
@PostConstruct public void initApiClient() throws ClusterClientInitException { Cluster cluster = stack.getCluster(); String user = cluster.getCloudbreakAmbariUser(); String password = cluster.getCloudbreakAmbariPassword(); try { client = clouderaManagerApiClientProvider.getClient(stack.getGatewayPort(), user, password, clientConfig); } catch (ClouderaManagerClientInitException e) { throw new ClusterClientInitException(e); } }
ClouderaManagerClusterDecomissionService implements ClusterDecomissionService { @PostConstruct public void initApiClient() throws ClusterClientInitException { Cluster cluster = stack.getCluster(); String user = cluster.getCloudbreakAmbariUser(); String password = cluster.getCloudbreakAmbariPassword(); try { client = clouderaManagerApiClientProvider.getClient(stack.getGatewayPort(), user, password, clientConfig); } catch (ClouderaManagerClientInitException e) { throw new ClusterClientInitException(e); } } }
ClouderaManagerClusterDecomissionService implements ClusterDecomissionService { @PostConstruct public void initApiClient() throws ClusterClientInitException { Cluster cluster = stack.getCluster(); String user = cluster.getCloudbreakAmbariUser(); String password = cluster.getCloudbreakAmbariPassword(); try { client = clouderaManagerApiClientProvider.getClient(stack.getGatewayPort(), user, password, clientConfig); } catch (ClouderaManagerClientInitException e) { throw new ClusterClientInitException(e); } } ClouderaManagerClusterDecomissionService(Stack stack, HttpClientConfig clientConfig); }
ClouderaManagerClusterDecomissionService implements ClusterDecomissionService { @PostConstruct public void initApiClient() throws ClusterClientInitException { Cluster cluster = stack.getCluster(); String user = cluster.getCloudbreakAmbariUser(); String password = cluster.getCloudbreakAmbariPassword(); try { client = clouderaManagerApiClientProvider.getClient(stack.getGatewayPort(), user, password, clientConfig); } catch (ClouderaManagerClientInitException e) { throw new ClusterClientInitException(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 { @PostConstruct public void initApiClient() throws ClusterClientInitException { Cluster cluster = stack.getCluster(); String user = cluster.getCloudbreakAmbariUser(); String password = cluster.getCloudbreakAmbariPassword(); try { client = clouderaManagerApiClientProvider.getClient(stack.getGatewayPort(), user, password, clientConfig); } catch (ClouderaManagerClientInitException e) { throw new ClusterClientInitException(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);  }