Search in sources :

Example 21 with BaseFileSystemConfigurationsView

use of com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView in project cloudbreak by hortonworks.

the class KnoxIdBrokerConfigProviderTest method getRoleConfigWhenIdBrokerAndAdlsGen2FileSystemAndValidCMVersionInvalidEntity.

@Test
public void getRoleConfigWhenIdBrokerAndAdlsGen2FileSystemAndValidCMVersionInvalidEntity() {
    BaseFileSystemConfigurationsView fileSystemConfigurationsView = mock(BaseFileSystemConfigurationsView.class);
    when(fileSystemConfigurationsView.getType()).thenReturn("ADLS_GEN_2");
    TemplatePreparationObject tpo = new Builder().withCloudPlatform(CloudPlatform.AZURE).withFileSystemConfigurationView(fileSystemConfigurationsView).withAccountMappingView(new AccountMappingView(GROUP_MAPPINGS, USER_MAPPINGS)).withProductDetails(generateCMRepo(CMRepositoryVersionUtil.CLOUDERAMANAGER_VERSION_7_1_0), null).build();
    List<ApiClusterTemplateConfig> result = underTest.getRoleConfigs(IDBROKER, tpo);
    Map<String, String> configNameToValueMap = getConfigNameToValueMap(result);
    assertThat(configNameToValueMap).containsOnly(Map.entry(IDBROKER_AZURE_USER_MAPPING, USER_MAPPINGS_STR), Map.entry(IDBROKER_AZURE_GROUP_MAPPING, GROUP_MAPPINGS_STR));
    Map<String, String> configNameToVariableNameMap = getConfigNameToVariableNameMap(result);
    assertThat(configNameToVariableNameMap).isEmpty();
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) BaseFileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView) Builder(com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) AccountMappingView(com.sequenceiq.cloudbreak.template.views.AccountMappingView) Test(org.junit.Test)

Example 22 with BaseFileSystemConfigurationsView

use of com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView in project cloudbreak by hortonworks.

the class KnoxIdBrokerConfigProviderTest method getRoleConfigWhenIdBrokerAndAdlsFileSystem.

@Test
public void getRoleConfigWhenIdBrokerAndAdlsFileSystem() {
    BaseFileSystemConfigurationsView fileSystemConfigurationsView = mock(BaseFileSystemConfigurationsView.class);
    when(fileSystemConfigurationsView.getType()).thenReturn("ADLS");
    TemplatePreparationObject tpo = new Builder().withCloudPlatform(CloudPlatform.AZURE).withFileSystemConfigurationView(fileSystemConfigurationsView).withAccountMappingView(new AccountMappingView(GROUP_MAPPINGS, USER_MAPPINGS)).withProductDetails(generateCMRepo(CMRepositoryVersionUtil.CLOUDERAMANAGER_VERSION_7_1_0), null).build();
    List<ApiClusterTemplateConfig> result = underTest.getRoleConfigs(IDBROKER, tpo);
    Map<String, String> configNameToValueMap = getConfigNameToValueMap(result);
    assertThat(configNameToValueMap).containsOnly(Map.entry(IDBROKER_AZURE_USER_MAPPING, USER_MAPPINGS_STR), Map.entry(IDBROKER_AZURE_GROUP_MAPPING, GROUP_MAPPINGS_STR));
    Map<String, String> configNameToVariableNameMap = getConfigNameToVariableNameMap(result);
    assertThat(configNameToVariableNameMap).isEmpty();
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) BaseFileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView) Builder(com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) AccountMappingView(com.sequenceiq.cloudbreak.template.views.AccountMappingView) Test(org.junit.Test)

Example 23 with BaseFileSystemConfigurationsView

use of com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView in project cloudbreak by hortonworks.

the class KnoxIdBrokerConfigProviderTest method getRoleConfigWhenIdBrokerAndGcsFileSystem.

@Test
public void getRoleConfigWhenIdBrokerAndGcsFileSystem() {
    BaseFileSystemConfigurationsView fileSystemConfigurationsView = mock(BaseFileSystemConfigurationsView.class);
    when(fileSystemConfigurationsView.getType()).thenReturn("GCS");
    TemplatePreparationObject tpo = new Builder().withCloudPlatform(CloudPlatform.GCP).withFileSystemConfigurationView(fileSystemConfigurationsView).withAccountMappingView(new AccountMappingView(GROUP_MAPPINGS, USER_MAPPINGS)).build();
    List<ApiClusterTemplateConfig> result = underTest.getRoleConfigs(IDBROKER, tpo);
    Map<String, String> configNameToValueMap = getConfigNameToValueMap(result);
    assertThat(configNameToValueMap).containsOnly(Map.entry(IDBROKER_GCP_USER_MAPPING, USER_MAPPINGS_STR), Map.entry(IDBROKER_GCP_GROUP_MAPPING, GROUP_MAPPINGS_STR));
    Map<String, String> configNameToVariableNameMap = getConfigNameToVariableNameMap(result);
    assertThat(configNameToVariableNameMap).isEmpty();
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) BaseFileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView) Builder(com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) AccountMappingView(com.sequenceiq.cloudbreak.template.views.AccountMappingView) Test(org.junit.Test)

Example 24 with BaseFileSystemConfigurationsView

use of com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView in project cloudbreak by hortonworks.

the class CoreConfigProviderTest method isHdfsSecurityGroupCacheReloadPropertyPresent.

@Test
public void isHdfsSecurityGroupCacheReloadPropertyPresent() {
    CmTemplateProcessor mockTemplateProcessor = mock(CmTemplateProcessor.class);
    TemplatePreparationObject templatePreparationObject = mock(TemplatePreparationObject.class);
    BaseFileSystemConfigurationsView fileSystemConfiguration = mock(BaseFileSystemConfigurationsView.class);
    Optional<BaseFileSystemConfigurationsView> fileSystemConfigurationView = Optional.of(fileSystemConfiguration);
    when(mockTemplateProcessor.isRoleTypePresentInService(KAFKA_SERVICE, List.of(KAFKA_BROKER))).thenReturn(true);
    when(mockTemplateProcessor.getRoleConfig(CORE_SETTINGS, STORAGEOPERATIONS, CoreConfigProvider.CORE_DEFAULTFS)).thenReturn(Optional.empty());
    when(mockTemplateProcessor.isRoleTypePresentInService(HDFS, List.of(NAMENODE))).thenReturn(true);
    when(templatePreparationObject.getFileSystemConfigurationView()).thenReturn(fileSystemConfigurationView);
    doNothing().when(s3ConfigProvider).getServiceConfigs(any(TemplatePreparationObject.class), any(StringBuilder.class));
    String coreSafetyValveProperty = ConfigUtils.getSafetyValveProperty("hadoop.security.groups.cache.background.reload", "true");
    List<ApiClusterTemplateConfig> expected = List.of(config("core_site_safety_valve", coreSafetyValveProperty));
    assertThat(underTest.getServiceConfigs(mockTemplateProcessor, templatePreparationObject)).hasSameElementsAs(expected);
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) BaseFileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.Test)

Example 25 with BaseFileSystemConfigurationsView

use of com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView in project cloudbreak by hortonworks.

the class CoreConfigProviderTest method isConfigurationNeededWhenKafkaPresentedHdfsPresentedAndStorageConfiguredMustReturnFalse.

@Test
public void isConfigurationNeededWhenKafkaPresentedHdfsPresentedAndStorageConfiguredMustReturnFalse() {
    CmTemplateProcessor mockTemplateProcessor = mock(CmTemplateProcessor.class);
    TemplatePreparationObject templatePreparationObject = mock(TemplatePreparationObject.class);
    BaseFileSystemConfigurationsView fileSystemConfiguration = mock(BaseFileSystemConfigurationsView.class);
    Optional<BaseFileSystemConfigurationsView> fileSystemConfigurationView = Optional.of(fileSystemConfiguration);
    when(mockTemplateProcessor.isRoleTypePresentInService(KAFKA_SERVICE, List.of(KAFKA_BROKER))).thenReturn(true);
    when(mockTemplateProcessor.isRoleTypePresentInService(HDFS, List.of(NAMENODE))).thenReturn(true);
    when(templatePreparationObject.getFileSystemConfigurationView()).thenReturn(fileSystemConfigurationView);
    Assert.assertFalse(underTest.isConfigurationNeeded(mockTemplateProcessor, templatePreparationObject));
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) BaseFileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) Test(org.junit.Test)

Aggregations

BaseFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView)26 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)20 Test (org.junit.Test)16 Builder (com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder)10 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)9 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)7 StorageLocationView (com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView)7 AccountMappingView (com.sequenceiq.cloudbreak.template.views.AccountMappingView)7 FileSystem (com.sequenceiq.cloudbreak.domain.FileSystem)6 StorageLocation (com.sequenceiq.cloudbreak.domain.StorageLocation)5 Gateway (com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway)5 ConfigQueryEntries (com.sequenceiq.common.api.cloudstorage.query.ConfigQueryEntries)5 ArrayList (java.util.ArrayList)5 S3FileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView)4 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)4 S3FileSystem (com.sequenceiq.common.api.filesystem.S3FileSystem)4 Json (com.sequenceiq.cloudbreak.common.json.Json)3 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)3 Test (org.junit.jupiter.api.Test)3 VirtualGroupRequest (com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest)2