Search in sources :

Example 1 with AccountMapping

use of com.sequenceiq.cloudbreak.domain.cloudstorage.AccountMapping in project cloudbreak by hortonworks.

the class CloudStorageConverter method accountMappingRequestToAccountMapping.

private AccountMapping accountMappingRequestToAccountMapping(AccountMappingBase accountMappingRequest) {
    AccountMapping accountMapping = null;
    if (accountMappingRequest != null) {
        accountMapping = new AccountMapping();
        accountMapping.setGroupMappings(new HashMap<>(accountMappingRequest.getGroupMappings()));
        accountMapping.setUserMappings(new HashMap<>(accountMappingRequest.getUserMappings()));
    }
    return accountMapping;
}
Also used : AccountMapping(com.sequenceiq.cloudbreak.domain.cloudstorage.AccountMapping)

Example 2 with AccountMapping

use of com.sequenceiq.cloudbreak.domain.cloudstorage.AccountMapping in project cloudbreak by hortonworks.

the class ClouderaManagerStorageErrorMapperTest method setUp.

@BeforeEach
void setUp() {
    underTest = new ClouderaManagerStorageErrorMapper();
    exception = new CloudStorageConfigurationFailedException(EXCEPTION_MESSAGE);
    cluster = new Cluster();
    fileSystem = new FileSystem();
    cloudStorage = new CloudStorage();
    cloudIdentity = new CloudIdentity();
    cloudIdentity.setIdentityType(CloudIdentityType.ID_BROKER);
    cloudStorage.setCloudIdentities(List.of(cloudIdentity));
    accountMapping = new AccountMapping();
    accountMapping.setUserMappings(Map.ofEntries(entry("hive", "myDataAccessRole"), entry("solr", "myRangerAuditRole")));
    cloudStorage.setAccountMapping(accountMapping);
    StorageLocation locationRangerAudit = new StorageLocation();
    locationRangerAudit.setType(CloudStorageCdpService.RANGER_AUDIT);
    locationRangerAudit.setValue("myRangerAuditLocation");
    cloudStorage.setLocations(List.of(locationRangerAudit));
    fileSystem.setCloudStorage(cloudStorage);
    cluster.setFileSystem(fileSystem);
}
Also used : CloudStorage(com.sequenceiq.cloudbreak.domain.cloudstorage.CloudStorage) FileSystem(com.sequenceiq.cloudbreak.domain.FileSystem) CloudIdentity(com.sequenceiq.cloudbreak.domain.cloudstorage.CloudIdentity) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) CloudStorageConfigurationFailedException(com.sequenceiq.cloudbreak.cm.exception.CloudStorageConfigurationFailedException) AccountMapping(com.sequenceiq.cloudbreak.domain.cloudstorage.AccountMapping) StorageLocation(com.sequenceiq.cloudbreak.domain.cloudstorage.StorageLocation) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with AccountMapping

use of com.sequenceiq.cloudbreak.domain.cloudstorage.AccountMapping in project cloudbreak by hortonworks.

the class StackToTemplatePreparationObjectConverterTest method testStackInputAccountMappings.

@Test
public void testStackInputAccountMappings() {
    FileSystem sourceFileSystem = mock(FileSystem.class);
    CloudStorage sourceCloudStorage = mock(CloudStorage.class);
    when(sourceCluster.getFileSystem()).thenReturn(sourceFileSystem);
    when(sourceFileSystem.getCloudStorage()).thenReturn(sourceCloudStorage);
    AccountMapping accountMapping = new AccountMapping();
    accountMapping.setGroupMappings(GROUP_MAPPINGS);
    accountMapping.setUserMappings(USER_MAPPINGS);
    when(sourceCloudStorage.getAccountMapping()).thenReturn(accountMapping);
    when(blueprintViewProvider.getBlueprintView(any())).thenReturn(getBlueprintView());
    TemplatePreparationObject result = underTest.convert(stackMock);
    AccountMappingView accountMappingView = result.getAccountMappingView();
    assertThat(accountMappingView).isNotNull();
    assertThat(accountMappingView.getGroupMappings()).isEqualTo(GROUP_MAPPINGS);
    assertThat(accountMappingView.getUserMappings()).isEqualTo(USER_MAPPINGS);
}
Also used : CloudStorage(com.sequenceiq.cloudbreak.domain.cloudstorage.CloudStorage) TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) FileSystem(com.sequenceiq.cloudbreak.domain.FileSystem) AccountMapping(com.sequenceiq.cloudbreak.domain.cloudstorage.AccountMapping) AccountMappingView(com.sequenceiq.cloudbreak.template.views.AccountMappingView) Test(org.junit.jupiter.api.Test)

Aggregations

AccountMapping (com.sequenceiq.cloudbreak.domain.cloudstorage.AccountMapping)3 FileSystem (com.sequenceiq.cloudbreak.domain.FileSystem)2 CloudStorage (com.sequenceiq.cloudbreak.domain.cloudstorage.CloudStorage)2 CloudStorageConfigurationFailedException (com.sequenceiq.cloudbreak.cm.exception.CloudStorageConfigurationFailedException)1 CloudIdentity (com.sequenceiq.cloudbreak.domain.cloudstorage.CloudIdentity)1 StorageLocation (com.sequenceiq.cloudbreak.domain.cloudstorage.StorageLocation)1 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)1 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)1 AccountMappingView (com.sequenceiq.cloudbreak.template.views.AccountMappingView)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Test (org.junit.jupiter.api.Test)1