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