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();
}
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();
}
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();
}
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);
}
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));
}
Aggregations