Search in sources :

Example 76 with TemplatePreparationObject

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);
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) SharedServiceConfigsView(com.sequenceiq.cloudbreak.template.views.SharedServiceConfigsView) Test(org.junit.jupiter.api.Test)

Example 77 with TemplatePreparationObject

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);
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) Test(org.junit.jupiter.api.Test)

Example 78 with TemplatePreparationObject

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());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) AccountMappingBase(com.sequenceiq.common.api.cloudstorage.AccountMappingBase) CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) AccountMappingView(com.sequenceiq.cloudbreak.template.views.AccountMappingView) Test(org.junit.Test)

Example 79 with TemplatePreparationObject

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

Example 80 with TemplatePreparationObject

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());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) Test(org.junit.Test)

Aggregations

TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)266 Test (org.junit.Test)133 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)127 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)116 Test (org.junit.jupiter.api.Test)87 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)53 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)48 List (java.util.List)45 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)40 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)38 Builder (com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder)36 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)35 ArrayList (java.util.ArrayList)34 BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)32 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)27 MethodSource (org.junit.jupiter.params.provider.MethodSource)23 BaseFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView)20 AccountMappingView (com.sequenceiq.cloudbreak.template.views.AccountMappingView)17 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)16 DisplayName (org.junit.jupiter.api.DisplayName)16