@Test public void testConfigureKerberosViaApi() throws CloudbreakException, ApiException { KerberosConfig kerberosConfig = KerberosConfig.KerberosConfigBuilder.aKerberosConfig() .withType(KerberosType.ACTIVE_DIRECTORY) .withRealm("TESTREALM") .withUrl("kdcs") .withAdminUrl("adminhosts") .withContainerDn("container") .withPrincipal("principal") .withPassword("pw") .build(); when(clustersResourceApi.configureForKerberos(eq(cluster.getName()), any(ApiConfigureForKerberosArguments.class))) .thenReturn(new ApiCommand().id(BigDecimal.TEN)); when(clouderaManagerResourceApi.generateCredentialsCommand()).thenReturn(new ApiCommand().id(BigDecimal.ZERO)); when(clustersResourceApi.deployClientConfig(cluster.getName())).thenReturn(new ApiCommand().id(BigDecimal.valueOf(2L))); when(kerberosDetailService.isAdJoinable(kerberosConfig)).thenReturn(Boolean.TRUE); underTest.configureKerberosViaApi(client, clientConfig, stack, kerberosConfig); verify(modificationService).stopCluster(false); verify(clouderaManagerPollingServiceProvider).startPollingCmKerberosJob(stack, client, BigDecimal.TEN); verify(clouderaManagerPollingServiceProvider).startPollingCmKerberosJob(stack, client, BigDecimal.ZERO); verify(clustersResourceApi).deployClientConfig(cluster.getName()); verify(modificationService).startCluster(anySet()); }
public void configureKerberosViaApi(ApiClient client, HttpClientConfig clientConfig, Stack stack, KerberosConfig kerberosConfig) throws ApiException, CloudbreakException { Cluster cluster = stack.getCluster(); if (kerberosDetailService.isAdJoinable(kerberosConfig) || kerberosDetailService.isIpaJoinable(kerberosConfig)) { ClouderaManagerModificationService modificationService = applicationContext.getBean(ClouderaManagerModificationService.class, stack, clientConfig); ClouderaManagerResourceApi clouderaManagerResourceApi = clouderaManagerApiFactory.getClouderaManagerResourceApi(client); modificationService.stopCluster(false); ClustersResourceApi clustersResourceApi = clouderaManagerApiFactory.getClustersResourceApi(client); ApiCommand configureForKerberos = clustersResourceApi.configureForKerberos(cluster.getName(), new ApiConfigureForKerberosArguments()); clouderaManagerPollingServiceProvider.startPollingCmKerberosJob(stack, client, configureForKerberos.getId()); ApiCommand generateCredentials = clouderaManagerResourceApi.generateCredentialsCommand(); clouderaManagerPollingServiceProvider.startPollingCmKerberosJob(stack, client, generateCredentials.getId()); ApiCommand deployClusterConfig = clustersResourceApi.deployClientConfig(cluster.getName()); clouderaManagerPollingServiceProvider.startPollingCmKerberosJob(stack, client, deployClusterConfig.getId()); modificationService.startCluster(Collections.emptySet()); } }
ClouderaManagerKerberosService { public void configureKerberosViaApi(ApiClient client, HttpClientConfig clientConfig, Stack stack, KerberosConfig kerberosConfig) throws ApiException, CloudbreakException { Cluster cluster = stack.getCluster(); if (kerberosDetailService.isAdJoinable(kerberosConfig) || kerberosDetailService.isIpaJoinable(kerberosConfig)) { ClouderaManagerModificationService modificationService = applicationContext.getBean(ClouderaManagerModificationService.class, stack, clientConfig); ClouderaManagerResourceApi clouderaManagerResourceApi = clouderaManagerApiFactory.getClouderaManagerResourceApi(client); modificationService.stopCluster(false); ClustersResourceApi clustersResourceApi = clouderaManagerApiFactory.getClustersResourceApi(client); ApiCommand configureForKerberos = clustersResourceApi.configureForKerberos(cluster.getName(), new ApiConfigureForKerberosArguments()); clouderaManagerPollingServiceProvider.startPollingCmKerberosJob(stack, client, configureForKerberos.getId()); ApiCommand generateCredentials = clouderaManagerResourceApi.generateCredentialsCommand(); clouderaManagerPollingServiceProvider.startPollingCmKerberosJob(stack, client, generateCredentials.getId()); ApiCommand deployClusterConfig = clustersResourceApi.deployClientConfig(cluster.getName()); clouderaManagerPollingServiceProvider.startPollingCmKerberosJob(stack, client, deployClusterConfig.getId()); modificationService.startCluster(Collections.emptySet()); } } }
ClouderaManagerKerberosService { public void configureKerberosViaApi(ApiClient client, HttpClientConfig clientConfig, Stack stack, KerberosConfig kerberosConfig) throws ApiException, CloudbreakException { Cluster cluster = stack.getCluster(); if (kerberosDetailService.isAdJoinable(kerberosConfig) || kerberosDetailService.isIpaJoinable(kerberosConfig)) { ClouderaManagerModificationService modificationService = applicationContext.getBean(ClouderaManagerModificationService.class, stack, clientConfig); ClouderaManagerResourceApi clouderaManagerResourceApi = clouderaManagerApiFactory.getClouderaManagerResourceApi(client); modificationService.stopCluster(false); ClustersResourceApi clustersResourceApi = clouderaManagerApiFactory.getClustersResourceApi(client); ApiCommand configureForKerberos = clustersResourceApi.configureForKerberos(cluster.getName(), new ApiConfigureForKerberosArguments()); clouderaManagerPollingServiceProvider.startPollingCmKerberosJob(stack, client, configureForKerberos.getId()); ApiCommand generateCredentials = clouderaManagerResourceApi.generateCredentialsCommand(); clouderaManagerPollingServiceProvider.startPollingCmKerberosJob(stack, client, generateCredentials.getId()); ApiCommand deployClusterConfig = clustersResourceApi.deployClientConfig(cluster.getName()); clouderaManagerPollingServiceProvider.startPollingCmKerberosJob(stack, client, deployClusterConfig.getId()); modificationService.startCluster(Collections.emptySet()); } }  }
ClouderaManagerKerberosService { public void configureKerberosViaApi(ApiClient client, HttpClientConfig clientConfig, Stack stack, KerberosConfig kerberosConfig) throws ApiException, CloudbreakException { Cluster cluster = stack.getCluster(); if (kerberosDetailService.isAdJoinable(kerberosConfig) || kerberosDetailService.isIpaJoinable(kerberosConfig)) { ClouderaManagerModificationService modificationService = applicationContext.getBean(ClouderaManagerModificationService.class, stack, clientConfig); ClouderaManagerResourceApi clouderaManagerResourceApi = clouderaManagerApiFactory.getClouderaManagerResourceApi(client); modificationService.stopCluster(false); ClustersResourceApi clustersResourceApi = clouderaManagerApiFactory.getClustersResourceApi(client); ApiCommand configureForKerberos = clustersResourceApi.configureForKerberos(cluster.getName(), new ApiConfigureForKerberosArguments()); clouderaManagerPollingServiceProvider.startPollingCmKerberosJob(stack, client, configureForKerberos.getId()); ApiCommand generateCredentials = clouderaManagerResourceApi.generateCredentialsCommand(); clouderaManagerPollingServiceProvider.startPollingCmKerberosJob(stack, client, generateCredentials.getId()); ApiCommand deployClusterConfig = clustersResourceApi.deployClientConfig(cluster.getName()); clouderaManagerPollingServiceProvider.startPollingCmKerberosJob(stack, client, deployClusterConfig.getId()); modificationService.startCluster(Collections.emptySet()); } }  void configureKerberosViaApi(ApiClient client, HttpClientConfig clientConfig, Stack stack, KerberosConfig kerberosConfig); void deleteCredentials(HttpClientConfig clientConfig, Stack stack); }
ClouderaManagerKerberosService { public void configureKerberosViaApi(ApiClient client, HttpClientConfig clientConfig, Stack stack, KerberosConfig kerberosConfig) throws ApiException, CloudbreakException { Cluster cluster = stack.getCluster(); if (kerberosDetailService.isAdJoinable(kerberosConfig) || kerberosDetailService.isIpaJoinable(kerberosConfig)) { ClouderaManagerModificationService modificationService = applicationContext.getBean(ClouderaManagerModificationService.class, stack, clientConfig); ClouderaManagerResourceApi clouderaManagerResourceApi = clouderaManagerApiFactory.getClouderaManagerResourceApi(client); modificationService.stopCluster(false); ClustersResourceApi clustersResourceApi = clouderaManagerApiFactory.getClustersResourceApi(client); ApiCommand configureForKerberos = clustersResourceApi.configureForKerberos(cluster.getName(), new ApiConfigureForKerberosArguments()); clouderaManagerPollingServiceProvider.startPollingCmKerberosJob(stack, client, configureForKerberos.getId()); ApiCommand generateCredentials = clouderaManagerResourceApi.generateCredentialsCommand(); clouderaManagerPollingServiceProvider.startPollingCmKerberosJob(stack, client, generateCredentials.getId()); ApiCommand deployClusterConfig = clustersResourceApi.deployClientConfig(cluster.getName()); clouderaManagerPollingServiceProvider.startPollingCmKerberosJob(stack, client, deployClusterConfig.getId()); modificationService.startCluster(Collections.emptySet()); } }  void configureKerberosViaApi(ApiClient client, HttpClientConfig clientConfig, Stack stack, KerberosConfig kerberosConfig); void deleteCredentials(HttpClientConfig clientConfig, Stack stack);  }