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