Search in sources :

Example 56 with GeneralClusterConfigs

use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs in project cloudbreak by hortonworks.

the class RangerCloudStorageServiceConfigProviderTest method getTemplatePreparationObjectForAws.

private TemplatePreparationObject.Builder getTemplatePreparationObjectForAws(boolean includeLocations, boolean above721, boolean includeBackup) {
    HostgroupView gateway = new HostgroupView("gateway", 1, InstanceGroupType.GATEWAY, Set.of("g"));
    HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.CORE, Set.of("m1", "m2"));
    HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, Set.of("w1", "w2", "w3"));
    List<StorageLocationView> locations = new ArrayList<>();
    if (includeLocations) {
        locations.add(new StorageLocationView(getRangerAuditCloudStorageDirAws()));
        if (above721) {
            locations.add(new StorageLocationView(buildStorageLocation("hive.metastore.warehouse.dir", "s3a://bucket/warehouse/tablespace/managed/hive")));
            locations.add(new StorageLocationView(buildStorageLocation("hive.repl.replica.functions.root.dir", "s3a://bucket/hive_replica_functions_dir")));
            locations.add(new StorageLocationView(buildStorageLocation("hive.metastore.warehouse.external.dir", "s3a://bucket/warehouse/tablespace/external/hive")));
            locations.add(new StorageLocationView(buildStorageLocation("hbase.rootdir", "s3a://bucket/hbase")));
            if (includeBackup) {
                locations.add(new StorageLocationView(buildStorageLocation(DEFAULT_BACKUP_DIR, "s3a://bucket/backup/location")));
            }
        }
    }
    S3FileSystemConfigurationsView fileSystemConfigurationsView = new S3FileSystemConfigurationsView(new S3FileSystem(), locations, false);
    GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
    generalClusterConfigs.setPrimaryGatewayInstanceDiscoveryFQDN(Optional.of("fqdn"));
    return Builder.builder().withFileSystemConfigurationView(fileSystemConfigurationsView).withHostgroupViews(Set.of(gateway, master, worker)).withGeneralClusterConfigs(generalClusterConfigs);
}
Also used : StorageLocationView(com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView) GeneralClusterConfigs(com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs) ArrayList(java.util.ArrayList) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) S3FileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView) S3FileSystem(com.sequenceiq.common.api.filesystem.S3FileSystem)

Example 57 with GeneralClusterConfigs

use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs 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 58 with GeneralClusterConfigs

use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs 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)

Example 59 with GeneralClusterConfigs

use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs in project cloudbreak by hortonworks.

the class RangerUserSyncRoleConfigProviderTest method testAzureWhenCmVersionIs726ShouldReturnWithRangerAsSysAdmin.

@Test
public void testAzureWhenCmVersionIs726ShouldReturnWithRangerAsSysAdmin() {
    GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
    generalClusterConfigs.setEnableRangerRaz(false);
    TemplatePreparationObject preparationObject = TemplatePreparationObject.Builder.builder().withCloudPlatform(CloudPlatform.AZURE).withProductDetails(new ClouderaManagerRepo().withVersion("7.2.6"), new ArrayList<>()).withServicePrincipals(null).withGeneralClusterConfigs(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) ArrayList(java.util.ArrayList) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.Test)

Example 60 with GeneralClusterConfigs

use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs in project cloudbreak by hortonworks.

the class RangerUserSyncRoleConfigProviderTest method testAzureWithRazNoServicePrincipals.

@Test
public void testAzureWithRazNoServicePrincipals() {
    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(Collections.emptyMap()).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("", 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

GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)67 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)52 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)28 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)21 Test (org.junit.jupiter.api.Test)20 BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)19 Test (org.junit.Test)18 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)16 DisplayName (org.junit.jupiter.api.DisplayName)16 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)16 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)15 MethodSource (org.junit.jupiter.params.provider.MethodSource)13 DatalakeView (com.sequenceiq.cloudbreak.template.views.DatalakeView)12 BlueprintTextProcessor (com.sequenceiq.cloudbreak.template.processor.BlueprintTextProcessor)11 Gateway (com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway)10 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)10 HashSet (java.util.HashSet)8 VirtualGroupRequest (com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest)7 ArrayList (java.util.ArrayList)7 HostsResourceApi (com.cloudera.api.swagger.HostsResourceApi)6