use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.
the class ClouderaManagerSetupServiceTest method testConfigureKerberosWhenCMVersionIsHigherThen630ShouldCallConfigureKerberos.
@Test
public void testConfigureKerberosWhenCMVersionIsHigherThen630ShouldCallConfigureKerberos() throws Exception {
KerberosConfig kerberosConfig = mock(KerberosConfig.class);
ClouderaManagerRepo clouderaManagerRepo = new ClouderaManagerRepo();
clouderaManagerRepo.setVersion("6.5.0");
when(clusterComponentProvider.getClouderaManagerRepoDetails(anyLong())).thenReturn(clouderaManagerRepo);
underTest.configureKerberos(kerberosConfig);
verify(kerberosService, times(0)).configureKerberosViaApi(any(ApiClient.class), any(HttpClientConfig.class), any(Stack.class), any(KerberosConfig.class));
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.
the class ClouderaManagerSetupServiceTest method testSetupProxyWhenProxysetupThrowApiExceptionShouldThrowClouderaManagerOperationFailedException.
@Test
public void testSetupProxyWhenProxysetupThrowApiExceptionShouldThrowClouderaManagerOperationFailedException() throws ApiException {
ApiException error = mock(ApiException.class);
ClouderaManagerResourceApi clouderaManagerResourceApi = mock(ClouderaManagerResourceApi.class);
when(clouderaManagerApiFactory.getClouderaManagerResourceApi(any(ApiClient.class))).thenReturn(clouderaManagerResourceApi);
doThrow(error).when(clouderaManagerResourceApi).updateConfig(anyString(), any(ApiConfigList.class));
ClouderaManagerRepo clouderaManagerRepo = new ClouderaManagerRepo();
clouderaManagerRepo.setVersion("7.1.0");
when(clusterComponentProvider.getClouderaManagerRepoDetails(anyLong())).thenReturn(clouderaManagerRepo);
ClouderaManagerOperationFailedException actual = assertThrows(ClouderaManagerOperationFailedException.class, () -> underTest.setupProxy(testProxyConfig()));
verify(clouderaManagerResourceApi, times(1)).updateConfig(anyString(), any(ApiConfigList.class));
assertEquals(ClouderaManagerOperationFailedException.class, actual.getClass());
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.
the class ClouderaManagerSetupServiceTest method testConfigureKerberosWhenCMVersionIsLowerThen630ShouldCallConfigureKerberos.
@Test
public void testConfigureKerberosWhenCMVersionIsLowerThen630ShouldCallConfigureKerberos() throws Exception {
KerberosConfig kerberosConfig = mock(KerberosConfig.class);
ClouderaManagerRepo clouderaManagerRepo = new ClouderaManagerRepo();
clouderaManagerRepo.setVersion("6.2.0");
when(clusterComponentProvider.getClouderaManagerRepoDetails(anyLong())).thenReturn(clouderaManagerRepo);
doNothing().when(kerberosService).configureKerberosViaApi(any(ApiClient.class), any(HttpClientConfig.class), any(Stack.class), any(KerberosConfig.class));
underTest.configureKerberos(kerberosConfig);
verify(kerberosService, times(1)).configureKerberosViaApi(any(ApiClient.class), any(HttpClientConfig.class), any(Stack.class), any(KerberosConfig.class));
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.
the class ClouderaManagerSetupServiceTest method testRefreshParcelReposWhenApiExceptionOccursShouldThrowCloudbreakServiceException.
@Test
public void testRefreshParcelReposWhenApiExceptionOccursShouldThrowCloudbreakServiceException() {
ClouderaManagerRepo clouderaManagerRepo = mock(ClouderaManagerRepo.class);
when(clouderaManagerRepo.getPredefined()).thenReturn(true);
when(clusterComponentProvider.getClouderaManagerRepoDetails(anyLong())).thenReturn(clouderaManagerRepo);
doThrow(new ClouderaManagerOperationFailedException("error")).when(clouderaManagerApiFactory).getClouderaManagerResourceApi(any(ApiClient.class));
CloudbreakServiceException actual = assertThrows(CloudbreakServiceException.class, () -> underTest.refreshParcelRepos());
assertEquals(CloudbreakServiceException.class, actual.getClass());
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.
the class ClouderaManagerSetupServiceTest method testConfigureKerberosWhenThrowApiExceptionThenShouldThrowClouderaManagerOperationFailedException.
@Test
public void testConfigureKerberosWhenThrowApiExceptionThenShouldThrowClouderaManagerOperationFailedException() throws Exception {
ApiException error = mock(ApiException.class);
KerberosConfig kerberosConfig = mock(KerberosConfig.class);
ClouderaManagerRepo clouderaManagerRepo = new ClouderaManagerRepo();
clouderaManagerRepo.setVersion("6.2.0");
when(error.getResponseBody()).thenReturn(null);
when(error.getMessage()).thenReturn("error");
when(clusterComponentProvider.getClouderaManagerRepoDetails(anyLong())).thenReturn(clouderaManagerRepo);
doThrow(error).when(kerberosService).configureKerberosViaApi(any(ApiClient.class), any(HttpClientConfig.class), any(Stack.class), any(KerberosConfig.class));
ClouderaManagerOperationFailedException actual = assertThrows(ClouderaManagerOperationFailedException.class, () -> underTest.configureKerberos(kerberosConfig));
verify(kerberosService, times(1)).configureKerberosViaApi(any(ApiClient.class), any(HttpClientConfig.class), any(Stack.class), any(KerberosConfig.class));
assertEquals(ClouderaManagerOperationFailedException.class, actual.getClass());
}
Aggregations