use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.
the class StackToTemplatePreparationObjectConverterTest method testConvertWhenLoadBalanceExistsFqdnIsSet.
@Test
public void testConvertWhenLoadBalanceExistsFqdnIsSet() {
String lbUrl = "loadbalancer.domain";
when(loadBalancerConfigService.getLoadBalancerUserFacingFQDN(anyLong())).thenReturn(lbUrl);
when(blueprintViewProvider.getBlueprintView(any())).thenReturn(getBlueprintView());
TemplatePreparationObject result = underTest.convert(stackMock);
assertEquals(lbUrl, result.getGeneralClusterConfigs().getLoadBalancerGatewayFqdn().get());
}
use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.
the class StackToTemplatePreparationObjectConverterTest method testConvertWhenClusterDoesNotGivesAGatewayThenNullShouldBeStored.
@Test
public void testConvertWhenClusterDoesNotGivesAGatewayThenNullShouldBeStored() {
when(cluster.getGateway()).thenReturn(null);
when(blueprintViewProvider.getBlueprintView(any())).thenReturn(getBlueprintView());
TemplatePreparationObject result = underTest.convert(stackMock);
assertThat(result.getGatewayView()).isNull();
}
use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.
the class StackToTemplatePreparationObjectConverterTest method testConvertWhenEnvironmentBackupLocationDefinedThenBaseFileSystemConfigurationsViewShouldAddIt.
@Test
public void testConvertWhenEnvironmentBackupLocationDefinedThenBaseFileSystemConfigurationsViewShouldAddIt() throws IOException {
String backupLocation = "s3a://test";
FileSystem sourceFileSystem = new FileSystem();
FileSystem clusterServiceFileSystem = new FileSystem();
ConfigQueryEntries configQueryEntries = new ConfigQueryEntries();
BaseFileSystemConfigurationsView expected = mock(BaseFileSystemConfigurationsView.class);
List<StorageLocationView> storageLocationViews = mock(List.class);
BackupResponse backupResponse = new BackupResponse();
backupResponse.setStorageLocation(backupLocation);
DetailedEnvironmentResponse environmentResponse = DetailedEnvironmentResponse.builder().withIdBrokerMappingSource(IdBrokerMappingSource.MOCK).withCredential(new CredentialResponse()).withAdminGroupName(ADMIN_GROUP_NAME).withCrn(TestConstants.CRN).withBackup(backupResponse).build();
StorageLocation storageLocation = new StorageLocation();
storageLocation.setValue(backupLocation);
storageLocation.setProperty(RangerCloudStorageServiceConfigProvider.DEFAULT_BACKUP_DIR);
StorageLocationView backupLocationView = new StorageLocationView(storageLocation);
when(sourceCluster.getFileSystem()).thenReturn(sourceFileSystem);
when(cluster.getFileSystem()).thenReturn(clusterServiceFileSystem);
when(fileSystemConfigurationProvider.fileSystemConfiguration(eq(clusterServiceFileSystem), eq(stackMock), any(), eq(new Json("")), eq(configQueryEntries))).thenReturn(expected);
when(cmCloudStorageConfigProvider.getConfigQueryEntries()).thenReturn(configQueryEntries);
when(environmentClientService.getByCrn(anyString())).thenReturn(environmentResponse);
when(blueprintViewProvider.getBlueprintView(any())).thenReturn(getBlueprintView());
when(expected.getLocations()).thenReturn(storageLocationViews);
TemplatePreparationObject result = underTest.convert(stackMock);
assertThat(result.getFileSystemConfigurationView().isPresent()).isTrue();
assertThat(result.getFileSystemConfigurationView().get()).isEqualTo(expected);
verify(fileSystemConfigurationProvider, times(1)).fileSystemConfiguration(eq(clusterServiceFileSystem), eq(stackMock), any(), eq(new Json("")), eq(configQueryEntries));
verify(expected, times(1)).getLocations();
verify(storageLocationViews, times(1)).add(eq(backupLocationView));
}
use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.
the class StackToTemplatePreparationObjectConverterTest method testRdsSslCertificateFilePath.
@Test
void testRdsSslCertificateFilePath() {
when(blueprintViewProvider.getBlueprintView(any())).thenReturn(getBlueprintView());
TemplatePreparationObject result = underTest.convert(stackMock);
assertThat(result).isNotNull();
assertThat(result.getRdsSslCertificateFilePath()).isEqualTo(SSL_CERTS_FILE_PATH);
}
use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.
the class StackToTemplatePreparationObjectConverterTest method testConvertWhenClusterHasNoCustomConfigsThenOptionalShouldBeEmpty.
@Test
public void testConvertWhenClusterHasNoCustomConfigsThenOptionalShouldBeEmpty() {
when(blueprintViewProvider.getBlueprintView(any())).thenReturn(getBlueprintView());
TemplatePreparationObject result = underTest.convert(stackMock);
assertThat(result.getCustomConfigurationsView().isPresent()).isFalse();
}
Aggregations