Search in sources :

Example 6 with ConfigQueryEntries

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);
}
Also used : CloudbreakServiceException(com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException) FileSystem(com.sequenceiq.cloudbreak.domain.FileSystem) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) IOException(java.io.IOException) Json(com.sequenceiq.cloudbreak.common.json.Json) ConfigQueryEntries(com.sequenceiq.common.api.cloudstorage.query.ConfigQueryEntries) Test(org.junit.jupiter.api.Test)

Example 7 with ConfigQueryEntries

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());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) BaseFileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView) FileSystem(com.sequenceiq.cloudbreak.domain.FileSystem) Json(com.sequenceiq.cloudbreak.common.json.Json) ConfigQueryEntries(com.sequenceiq.common.api.cloudstorage.query.ConfigQueryEntries) Test(org.junit.jupiter.api.Test)

Aggregations

ConfigQueryEntries (com.sequenceiq.common.api.cloudstorage.query.ConfigQueryEntries)7 FileSystem (com.sequenceiq.cloudbreak.domain.FileSystem)5 BaseFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView)5 Json (com.sequenceiq.cloudbreak.common.json.Json)4 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)4 Test (org.junit.jupiter.api.Test)4 IOException (java.io.IOException)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 Handlebars (com.github.jknack.handlebars.Handlebars)1 Template (com.github.jknack.handlebars.Template)1 CloudbreakServiceException (com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)1 NotFoundException (com.sequenceiq.cloudbreak.common.exception.NotFoundException)1 TransactionExecutionException (com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionExecutionException)1 StorageLocation (com.sequenceiq.cloudbreak.domain.StorageLocation)1 HandlebarTemplate (com.sequenceiq.cloudbreak.handlebar.HandlebarTemplate)1 HandlebarUtils (com.sequenceiq.cloudbreak.handlebar.HandlebarUtils)1 TerminationFailedException (com.sequenceiq.cloudbreak.service.stack.flow.TerminationFailedException)1 StorageLocationView (com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView)1 BlueprintTextProcessor (com.sequenceiq.cloudbreak.template.processor.BlueprintTextProcessor)1 BackupResponse (com.sequenceiq.common.api.backup.response.BackupResponse)1