Search in sources :

Example 1 with AdlsFileSystemConfigurationsView

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

the class S3ConfigProviderTest method getTemplatePreparationObject.

private TemplatePreparationObject getTemplatePreparationObject(boolean useS3FileSystem, boolean fillDynamoTableName, boolean includeLocations) {
    HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1);
    HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, 2);
    List<StorageLocationView> locations = new ArrayList<>();
    if (includeLocations) {
        locations.add(new StorageLocationView(getStorageLocation("hive.metastore.warehouse.dir", "s3a://bucket-first/warehouse/managed")));
        locations.add(new StorageLocationView(getStorageLocation("hive.metastore.warehouse.external.dir", "s3a://bucket-first/warehouse/external")));
        locations.add(new StorageLocationView(getStorageLocation("ranger_plugin_hdfs_audit_url", "s3a://bucket-second/ranger/audit")));
    }
    BaseFileSystemConfigurationsView fileSystemConfigurationsView;
    if (useS3FileSystem) {
        S3FileSystem s3FileSystem = new S3FileSystem();
        if (fillDynamoTableName) {
            s3FileSystem.setS3GuardDynamoTableName("dynamoTable");
        }
        fileSystemConfigurationsView = new S3FileSystemConfigurationsView(s3FileSystem, locations, false);
    } else {
        fileSystemConfigurationsView = new AdlsFileSystemConfigurationsView(new AdlsFileSystem(), locations, false);
    }
    Gateway gateway = TestUtil.gatewayEnabledWithExposedKnoxServices("NAMENODE");
    PlacementView placementView = new PlacementView("region", "az");
    return Builder.builder().withFileSystemConfigurationView(fileSystemConfigurationsView).withHostgroupViews(Set.of(master, worker)).withGateway(gateway, "/cb/secret/signkey", new HashSet<>()).withPlacementView(placementView).withDefaultTags(Map.of("apple", "apple1")).build();
}
Also used : StorageLocationView(com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView) BaseFileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) ArrayList(java.util.ArrayList) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) AdlsFileSystem(com.sequenceiq.common.api.filesystem.AdlsFileSystem) PlacementView(com.sequenceiq.cloudbreak.template.views.PlacementView) S3FileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView) S3FileSystem(com.sequenceiq.common.api.filesystem.S3FileSystem) AdlsFileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.adls.AdlsFileSystemConfigurationsView) HashSet(java.util.HashSet)

Example 2 with AdlsFileSystemConfigurationsView

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

the class AzureFileSystemConfigProvider method decorateFileSystemConfiguration.

public BaseFileSystemConfigurationsView decorateFileSystemConfiguration(String uuid, Json credentialAttributes, Resource resourceByType, BaseFileSystemConfigurationsView fsConfiguration) {
    String resourceGroupName = resourceByType == null ? "" : resourceByType.getResourceName();
    // we have to lookup secret key from the credential because it is not stored in client side
    if (fsConfiguration instanceof AdlsFileSystemConfigurationsView) {
        String adlsTrackingTag = (cbVersion != null) ? ADLS_TRACKING_CLUSTERNAME_VALUE + '-' + cbVersion : ADLS_TRACKING_CLUSTERNAME_VALUE;
        AdlsFileSystemConfigurationsView fileSystemConfigurationsView = (AdlsFileSystemConfigurationsView) fsConfiguration;
        if (StringUtils.isEmpty(fileSystemConfigurationsView.getClientId())) {
            String credentialString = String.valueOf(credentialAttributes.getMap().get(CREDENTIAL_SECRET_KEY));
            String clientId = String.valueOf(credentialAttributes.getMap().get(ACCESS_KEY));
            fileSystemConfigurationsView.setCredential(credentialString);
            fileSystemConfigurationsView.setClientId(clientId);
        }
        if (StringUtils.isEmpty(fileSystemConfigurationsView.getTenantId())) {
            String tenantId = String.valueOf(credentialAttributes.getMap().get(TENANT_ID));
            fileSystemConfigurationsView.setTenantId(tenantId);
        }
        fileSystemConfigurationsView.setAdlsTrackingClusterNameKey(uuid);
        fileSystemConfigurationsView.setAdlsTrackingClusterTypeKey(adlsTrackingTag);
        fileSystemConfigurationsView.setResourceGroupName(resourceGroupName);
    } else if (fsConfiguration instanceof WasbFileSystemConfigurationsView) {
        ((WasbFileSystemConfigurationsView) fsConfiguration).setResourceGroupName(resourceGroupName);
    }
    return fsConfiguration;
}
Also used : WasbFileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.wasb.WasbFileSystemConfigurationsView) AdlsFileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.adls.AdlsFileSystemConfigurationsView)

Example 3 with AdlsFileSystemConfigurationsView

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

the class AbstractFileSystemConfiguratorTest method testCreateResource.

@Test
public void testCreateResource() {
    AdlsFileSystemConfigurationsView adlsFileSystemConfigurationsView = new AdlsFileSystemConfigurationsView(adlsFileSystem(), new HashSet<>(), false);
    Map<String, String> actual = underTest.createResources(adlsFileSystemConfigurationsView);
    Assert.assertEquals(emptyMap(), actual);
}
Also used : AdlsFileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.adls.AdlsFileSystemConfigurationsView) Test(org.junit.Test)

Example 4 with AdlsFileSystemConfigurationsView

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

the class TemplateCoreTestUtil method adlsFileSystemConfiguration.

public static AdlsFileSystemConfigurationsView adlsFileSystemConfiguration(Collection<StorageLocationView> storageLocationViews) {
    AdlsFileSystemConfigurationsView adlsFileSystemConfigurationsView = new AdlsFileSystemConfigurationsView(adlsFileSystem(), storageLocationViews, false);
    adlsFileSystemConfigurationsView.setAdlsTrackingClusterNameKey("normal-cluster");
    adlsFileSystemConfigurationsView.setAdlsTrackingClusterTypeKey("normal-cluster-type");
    adlsFileSystemConfigurationsView.setResourceGroupName("group");
    return adlsFileSystemConfigurationsView;
}
Also used : AdlsFileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.adls.AdlsFileSystemConfigurationsView)

Example 5 with AdlsFileSystemConfigurationsView

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

the class AbstractFileSystemConfiguratorTest method testGetScriptsWhenNoReplace.

@Test
public void testGetScriptsWhenNoReplace() {
    Credential credential = Credential.builder().crn("crn1").build();
    AdlsFileSystemConfigurationsView adlsFileSystemConfigurationsView = new AdlsFileSystemConfigurationsView(adlsFileSystem(), new HashSet<>(), false);
    List<RecipeScript> actual = underTest.getScripts(credential, adlsFileSystemConfigurationsView);
    List<RecipeScript> expected = singletonList(new RecipeScript("echo '$replace'", ExecutionType.ALL_NODES, RecipeType.POST_CLOUDERA_MANAGER_START));
    Assert.assertEquals(expected, actual);
}
Also used : Credential(com.sequenceiq.cloudbreak.dto.credential.Credential) RecipeScript(com.sequenceiq.cloudbreak.common.model.recipe.RecipeScript) AdlsFileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.adls.AdlsFileSystemConfigurationsView) Test(org.junit.Test)

Aggregations

AdlsFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.adls.AdlsFileSystemConfigurationsView)9 Test (org.junit.Test)5 Credential (com.sequenceiq.cloudbreak.dto.credential.Credential)3 RecipeScript (com.sequenceiq.cloudbreak.common.model.recipe.RecipeScript)2 Gateway (com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway)2 BaseFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView)2 StorageLocationView (com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView)2 S3FileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView)2 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)2 PlacementView (com.sequenceiq.cloudbreak.template.views.PlacementView)2 AdlsFileSystem (com.sequenceiq.common.api.filesystem.AdlsFileSystem)2 S3FileSystem (com.sequenceiq.common.api.filesystem.S3FileSystem)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)1 WasbFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.wasb.WasbFileSystemConfigurationsView)1