Search in sources :

Example 86 with ClouderaManagerRepo

use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.

the class RangerCloudStorageServiceConfigProviderTest method defaultRangerHdfsAuditUrlWithSingleNamenode.

@Test
public void defaultRangerHdfsAuditUrlWithSingleNamenode() {
    CmTemplateProcessor templateProcessor = mock(CmTemplateProcessor.class);
    BlueprintView blueprintView = mock(BlueprintView.class);
    when(blueprintView.getProcessor()).thenReturn(templateProcessor);
    when(templateProcessor.getHostGroupsWithComponent(HdfsRoles.NAMENODE)).thenReturn(Set.of("gateway"));
    TemplatePreparationObject preparationObject = getTemplatePreparationObjectForAws(false, false).withBlueprintView(blueprintView).withProductDetails(new ClouderaManagerRepo().withVersion("7.2.0"), List.of()).build();
    List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(templateProcessor, preparationObject);
    assertEquals(1, serviceConfigs.size());
    assertEquals("ranger_plugin_hdfs_audit_url", serviceConfigs.get(0).getName());
    assertEquals("hdfs://g", serviceConfigs.get(0).getValue());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.jupiter.api.Test)

Example 87 with ClouderaManagerRepo

use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.

the class RangerCloudStorageServiceConfigProviderTest method testGetRangerCloudStorageServiceConfigsWithBackup.

@Test
public void testGetRangerCloudStorageServiceConfigsWithBackup() {
    CmTemplateProcessor templateProcessor = mock(CmTemplateProcessor.class);
    TemplatePreparationObject preparationObject = getTemplatePreparationObjectForAws(true, true, true).withBlueprintView(mock(BlueprintView.class)).withCloudPlatform(CloudPlatform.AWS).withProductDetails(new ClouderaManagerRepo().withVersion("7.2.2"), List.of()).build();
    List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(templateProcessor, preparationObject);
    assertEquals(2, serviceConfigs.size());
    assertEquals("ranger_plugin_hdfs_audit_url", serviceConfigs.get(0).getName());
    assertEquals("s3a://bucket/ranger/audit", serviceConfigs.get(0).getValue());
    assertEquals("cloud_storage_paths", serviceConfigs.get(1).getName());
    assertEquals("HIVE_METASTORE_WAREHOUSE=s3a://bucket/warehouse/tablespace/managed/hive," + "HIVE_REPLICA_WAREHOUSE=s3a://bucket/hive_replica_functions_dir," + "HIVE_METASTORE_EXTERNAL_WAREHOUSE=s3a://bucket/warehouse/tablespace/external/hive," + "RANGER_AUDIT=s3a://bucket/ranger/audit," + "HBASE_ROOT=s3a://bucket/hbase," + "BACKUP_LOCATION=s3a://bucket/backup/location", serviceConfigs.get(1).getValue());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.jupiter.api.Test)

Example 88 with ClouderaManagerRepo

use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.

the class RangerCloudStorageServiceConfigProviderTest method testGetRangerAwsCloudStorageServiceConfigs.

@Test
public void testGetRangerAwsCloudStorageServiceConfigs() {
    CmTemplateProcessor templateProcessor = mock(CmTemplateProcessor.class);
    TemplatePreparationObject preparationObject = getTemplatePreparationObjectForAws(true, true).withBlueprintView(mock(BlueprintView.class)).withCloudPlatform(CloudPlatform.AWS).withProductDetails(new ClouderaManagerRepo().withVersion("7.2.2"), List.of()).build();
    List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(templateProcessor, preparationObject);
    assertEquals(2, serviceConfigs.size());
    assertEquals("ranger_plugin_hdfs_audit_url", serviceConfigs.get(0).getName());
    assertEquals("s3a://bucket/ranger/audit", serviceConfigs.get(0).getValue());
    assertEquals("cloud_storage_paths", serviceConfigs.get(1).getName());
    assertEquals("HIVE_METASTORE_WAREHOUSE=s3a://bucket/warehouse/tablespace/managed/hive," + "HIVE_REPLICA_WAREHOUSE=s3a://bucket/hive_replica_functions_dir," + "HIVE_METASTORE_EXTERNAL_WAREHOUSE=s3a://bucket/warehouse/tablespace/external/hive," + "RANGER_AUDIT=s3a://bucket/ranger/audit," + "HBASE_ROOT=s3a://bucket/hbase", serviceConfigs.get(1).getValue());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.jupiter.api.Test)

Example 89 with ClouderaManagerRepo

use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.

the class RangerUserSyncRoleConfigProviderTest method testAwsWhenCmVersionIs726ShouldReturnWithRangerAsSysAdmin.

@Test
public void testAwsWhenCmVersionIs726ShouldReturnWithRangerAsSysAdmin() {
    TemplatePreparationObject preparationObject = TemplatePreparationObject.Builder.builder().withCloudPlatform(CloudPlatform.AWS).withServicePrincipals(null).withProductDetails(new ClouderaManagerRepo().withVersion("7.2.6"), new ArrayList<>()).withGeneralClusterConfigs(new GeneralClusterConfigs()).build();
    List<ApiClusterTemplateConfig> serviceConfigs = underTest.getRoleConfigs(RANGER_USERSYNC, preparationObject);
    assertEquals(2, serviceConfigs.size());
    assertEquals("conf/ranger-ugsync-site.xml_role_safety_valve", serviceConfigs.get(0).getName());
    assertEquals("<property><name>ranger.usersync.unix.backend</name><value>nss</value></property>", serviceConfigs.get(0).getValue());
    assertEquals("ranger.usersync.group.based.role.assignment.rules", serviceConfigs.get(1).getName());
    assertEquals("&ROLE_SYS_ADMIN:g:mockAdmin", serviceConfigs.get(1).getValue());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) GeneralClusterConfigs(com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.Test)

Example 90 with ClouderaManagerRepo

use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.

the class RangerUserSyncRoleConfigProviderTest method testAzureWithRaz.

@Test
public void testAzureWithRaz() {
    GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
    generalClusterConfigs.setEnableRangerRaz(true);
    TemplatePreparationObject preparationObject = TemplatePreparationObject.Builder.builder().withCloudPlatform(CloudPlatform.AZURE).withProductDetails(new ClouderaManagerRepo().withVersion("7.2.6"), new ArrayList<>()).withServicePrincipals(generateServicePrincipals()).withGeneralClusterConfigs(generalClusterConfigs).build();
    List<ApiClusterTemplateConfig> serviceConfigs = underTest.getRoleConfigs(RANGER_USERSYNC, preparationObject);
    assertEquals(3, serviceConfigs.size());
    assertEquals("conf/ranger-ugsync-site.xml_role_safety_valve", serviceConfigs.get(0).getName());
    assertEquals("<property><name>ranger.usersync.unix.backend</name><value>nss</value></property>", serviceConfigs.get(0).getValue());
    assertEquals("ranger.usersync.group.based.role.assignment.rules", serviceConfigs.get(1).getName());
    assertEquals("&ROLE_SYS_ADMIN:g:mockAdmin", serviceConfigs.get(1).getValue());
    assertEquals("ranger_usersync_azure_user_mapping", serviceConfigs.get(2).getName());
    assertEquals("hive=3d4fcb5f-51b7-473c-9ca4-9d1e501f47u8;" + "ranger=f346892c-8d70-464c-8330-6ed1112bd880;hbase=286463ce-41c5-4f03-89f6-adb7109394ec", serviceConfigs.get(2).getValue());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) GeneralClusterConfigs(com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs) ArrayList(java.util.ArrayList) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.Test)

Aggregations

ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)96 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)40 Test (org.junit.jupiter.api.Test)38 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)28 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)20 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)17 ApiClient (com.cloudera.api.swagger.client.ApiClient)15 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)15 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)15 Test (org.junit.Test)15 ClouderaManagerProduct (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct)14 DisplayName (org.junit.jupiter.api.DisplayName)14 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)13 MethodSource (org.junit.jupiter.params.provider.MethodSource)13 ArrayList (java.util.ArrayList)12 HashMap (java.util.HashMap)12 Map (java.util.Map)10 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)9 BigDecimal (java.math.BigDecimal)9 VirtualGroupRequest (com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest)8