use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.
the class StackToTemplatePreparationObjectConverterTest method testConvertWhenDataLakeIdNotNullThenExpectedSharedServiceConfigsShouldBeStored.
@Test
public void testConvertWhenDataLakeIdNotNullThenExpectedSharedServiceConfigsShouldBeStored() {
// just in case adding one to avoid matching with the class variable
SharedServiceConfigsView expected = new SharedServiceConfigsView();
when(datalakeService.createSharedServiceConfigsView(stackMock)).thenReturn(expected);
when(blueprintViewProvider.getBlueprintView(any())).thenReturn(getBlueprintView());
TemplatePreparationObject result = underTest.convert(stackMock);
assertThat(result.getSharedServiceConfigs().isPresent()).isTrue();
assertThat(result.getSharedServiceConfigs().get()).isEqualTo(expected);
}
use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.
the class StackToTemplatePreparationObjectConverterTest method testConvertCloudPlatformMatches.
@Test
public void testConvertCloudPlatformMatches() {
when(blueprintViewProvider.getBlueprintView(any())).thenReturn(getBlueprintView());
TemplatePreparationObject result = underTest.convert(stackMock);
assertThat(result.getCloudPlatform()).isEqualTo(CloudPlatform.AWS);
}
use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.
the class StackV4RequestToTemplatePreparationObjectConverterTest method testStackInputAccountMappings.
@Test
public void testStackInputAccountMappings() {
when(cloudStorageValidationUtil.isCloudStorageConfigured(any(CloudStorageRequest.class))).thenReturn(true);
CloudStorageRequest cloudStorage = mock(CloudStorageRequest.class);
when(cluster.getCloudStorage()).thenReturn(cloudStorage);
AccountMappingBase accountMapping = new AccountMappingBase();
accountMapping.setGroupMappings(GROUP_MAPPINGS);
accountMapping.setUserMappings(USER_MAPPINGS);
when(cloudStorage.getAccountMapping()).thenReturn(accountMapping);
TemplatePreparationObject result = underTest.convert(source);
AccountMappingView accountMappingView = result.getAccountMappingView();
assertNotNull(accountMappingView);
assertEquals(GROUP_MAPPINGS, accountMappingView.getGroupMappings());
assertEquals(USER_MAPPINGS, accountMappingView.getUserMappings());
}
use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.
the class StackV4RequestToTemplatePreparationObjectConverterTest method testConvertWhenClusterHasCloudStorageThenConvertedFileSystemShouldBeStoredComingFromFileSystemConfigurationProvider.
@Test
public void testConvertWhenClusterHasCloudStorageThenConvertedFileSystemShouldBeStoredComingFromFileSystemConfigurationProvider() throws IOException {
BaseFileSystemConfigurationsView expected = mock(BaseFileSystemConfigurationsView.class);
CloudStorageRequest cloudStorageRequest = new CloudStorageRequest();
FileSystem fileSystem = new FileSystem();
ConfigQueryEntries configQueryEntries = new ConfigQueryEntries();
when(cloudStorageValidationUtil.isCloudStorageConfigured(cloudStorageRequest)).thenReturn(true);
when(cluster.getCloudStorage()).thenReturn(cloudStorageRequest);
when(cloudStorageConverter.requestToFileSystem(cloudStorageRequest)).thenReturn(fileSystem);
when(cmCloudStorageConfigProvider.getConfigQueryEntries()).thenReturn(configQueryEntries);
when(fileSystemConfigurationProvider.fileSystemConfiguration(fileSystem, source, credential.getAttributes(), configQueryEntries)).thenReturn(expected);
TemplatePreparationObject result = underTest.convert(source);
assertTrue(result.getFileSystemConfigurationView().isPresent());
assertEquals(expected, result.getFileSystemConfigurationView().get());
}
use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.
the class StackV4RequestToTemplatePreparationObjectConverterTest method testConvertWhenStackHasNoInstanceGroupThenTheHostGroupViewParameterShouldContainOnlyAnEmptySet.
@Test
public void testConvertWhenStackHasNoInstanceGroupThenTheHostGroupViewParameterShouldContainOnlyAnEmptySet() {
when(source.getInstanceGroups()).thenReturn(Collections.emptyList());
TemplatePreparationObject result = underTest.convert(source);
assertTrue(result.getHostgroupViews().isEmpty());
}
Aggregations