Search in sources :

Example 1 with WasbFileSystemConfigurationsView

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

the class KnoxIdBrokerConfigProviderTest method getRoleConfigWhenIdBrokerAndWasbFileSystem.

@Test
public void getRoleConfigWhenIdBrokerAndWasbFileSystem() {
    WasbFileSystemConfigurationsView fileSystemConfigurationsView = mock(WasbFileSystemConfigurationsView.class);
    when(fileSystemConfigurationsView.getType()).thenReturn("WASB");
    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) Builder(com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder) WasbFileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.wasb.WasbFileSystemConfigurationsView) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) AccountMappingView(com.sequenceiq.cloudbreak.template.views.AccountMappingView) Test(org.junit.Test)

Example 2 with WasbFileSystemConfigurationsView

use of com.sequenceiq.cloudbreak.template.filesystem.wasb.WasbFileSystemConfigurationsView 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)

Aggregations

WasbFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.wasb.WasbFileSystemConfigurationsView)2 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)1 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)1 Builder (com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder)1 AdlsFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.adls.AdlsFileSystemConfigurationsView)1 AccountMappingView (com.sequenceiq.cloudbreak.template.views.AccountMappingView)1 Test (org.junit.Test)1