use of com.sequenceiq.common.api.cloudstorage.query.ConfigQueryEntries in project cloudbreak by hortonworks.
the class StackToTemplatePreparationObjectConverterTest method testConvertIfTheAttemptOfObtainingBaseFileSystemConfigurationsViewThrowsIOExceptionThenCloudbreakServiceExceptionShouldComeOutside.
@Test
public void testConvertIfTheAttemptOfObtainingBaseFileSystemConfigurationsViewThrowsIOExceptionThenCloudbreakServiceExceptionShouldComeOutside() throws IOException {
String ioExceptionMessage = "Unable to obtain BaseFileSystemConfigurationsView";
IOException invokedException = new IOException(ioExceptionMessage);
FileSystem sourceFileSystem = new FileSystem();
FileSystem clusterServiceFileSystem = new FileSystem();
ConfigQueryEntries configQueryEntries = new ConfigQueryEntries();
when(sourceCluster.getFileSystem()).thenReturn(sourceFileSystem);
when(cluster.getFileSystem()).thenReturn(clusterServiceFileSystem);
when(stackMock.getEnvironmentCrn()).thenReturn("envCredentialCRN");
when(fileSystemConfigurationProvider.fileSystemConfiguration(eq(clusterServiceFileSystem), eq(stackMock), any(), eq(new Json("")), eq(configQueryEntries))).thenThrow(invokedException);
when(cmCloudStorageConfigProvider.getConfigQueryEntries()).thenReturn(configQueryEntries);
CloudbreakServiceException cloudbreakServiceException = assertThrows(CloudbreakServiceException.class, () -> underTest.convert(stackMock));
assertThat(cloudbreakServiceException).hasMessage(ioExceptionMessage).hasCause(invokedException);
}
use of com.sequenceiq.common.api.cloudstorage.query.ConfigQueryEntries in project cloudbreak by hortonworks.
the class StackToTemplatePreparationObjectConverterTest method testConvertWhenClusterDoesNotProvidesFileSystemThenBaseFileSystemConfigurationsViewShouldBeEmpty.
@Test
public void testConvertWhenClusterDoesNotProvidesFileSystemThenBaseFileSystemConfigurationsViewShouldBeEmpty() throws IOException {
FileSystem clusterServiceFileSystem = new FileSystem();
BaseFileSystemConfigurationsView expected = mock(BaseFileSystemConfigurationsView.class);
when(sourceCluster.getFileSystem()).thenReturn(null);
when(cluster.getFileSystem()).thenReturn(clusterServiceFileSystem);
when(fileSystemConfigurationProvider.fileSystemConfiguration(clusterServiceFileSystem, stackMock, resourceType -> Collections.EMPTY_LIST, new Json(""), new ConfigQueryEntries())).thenReturn(expected);
when(blueprintViewProvider.getBlueprintView(any())).thenReturn(getBlueprintView());
TemplatePreparationObject result = underTest.convert(stackMock);
assertThat(result.getFileSystemConfigurationView().isPresent()).isFalse();
verify(fileSystemConfigurationProvider, times(0)).fileSystemConfiguration(clusterServiceFileSystem, stackMock, resourceType -> Collections.EMPTY_LIST, new Json(""), new ConfigQueryEntries());
}
Aggregations