use of com.sequenceiq.cloudbreak.domain.cloudstorage.StorageLocation in project cloudbreak by hortonworks.
the class CloudStorageConverter method requestToFileSystem.
public FileSystem requestToFileSystem(CloudStorageBase cloudStorageRequest) {
FileSystem fileSystem = new FileSystem();
fileSystem.setName(nameGenerator.generateName(FILESYSTEM));
FileSystemType fileSystemType = fileSystemResolver.determineFileSystemType(cloudStorageRequest);
fileSystem.setType(fileSystemType);
CloudStorage cloudStorage = new CloudStorage();
String s3GuardDynamoTableName = getS3GuardDynamoTableName(cloudStorageRequest);
cloudStorage.setS3GuardDynamoTableName(s3GuardDynamoTableName);
List<StorageLocation> storageLocations = cloudStorageRequest.getLocations().stream().map(this::storageLocationRequestToStorageLocation).collect(Collectors.toList());
cloudStorage.setLocations(storageLocations);
if (cloudStorageRequest.getIdentities() != null) {
List<CloudIdentity> cloudIdentities = cloudStorageRequest.getIdentities().stream().map(this::identityRequestToCloudIdentity).collect(Collectors.toList());
cloudStorage.setCloudIdentities(cloudIdentities);
}
cloudStorage.setAccountMapping(accountMappingRequestToAccountMapping(cloudStorageRequest.getAccountMapping()));
fileSystem.setCloudStorage(cloudStorage);
return fileSystem;
}
use of com.sequenceiq.cloudbreak.domain.cloudstorage.StorageLocation in project cloudbreak by hortonworks.
the class RemoteDataContextWorkaroundService method prepareFilesytem.
public FileSystem prepareFilesytem(Cluster requestedCluster, Stack datalakeStack) {
prepareFilesystemIfNotPresentedButSdxHasIt(requestedCluster, datalakeStack);
if (hasFilesystem(requestedCluster.getFileSystem())) {
FileSystem fileSystem = requestedCluster.getFileSystem();
if (hasLocations(fileSystem)) {
CloudStorage cloudStorage = fileSystem.getCloudStorage();
FileSystem dlFileSystem = datalakeStack.getCluster().getFileSystem();
if (hasFilesystem(dlFileSystem)) {
if (hasLocations(dlFileSystem)) {
List<StorageLocation> dlStorageLocations = dlFileSystem.getCloudStorage().getLocations();
List<StorageLocation> hiveRelatedStorageConfigs = getHiveRelatedStorageConfigs(dlStorageLocations);
if (sdxHasHiveStorageConfiguration(hiveRelatedStorageConfigs)) {
List<StorageLocation> storageLocations = getStorageLocationsWithoutHiveRelatedLocations(cloudStorage.getLocations());
storageLocations.addAll(hiveRelatedStorageConfigs);
cloudStorage.setLocations(storageLocations);
fileSystem.setCloudStorage(cloudStorage);
}
}
}
}
}
return requestedCluster.getFileSystem();
}
use of com.sequenceiq.cloudbreak.domain.cloudstorage.StorageLocation in project cloudbreak by hortonworks.
the class RemoteDataContextWorkaroundServiceTest method testFileSystemWhenHiveInSdxAndDistroXShouldReturnWithSdxHiveConfigs.
@Test
public void testFileSystemWhenHiveInSdxAndDistroXShouldReturnWithSdxHiveConfigs() throws IOException {
FileSystem fileSystem = underTest.prepareFilesytem(mockRequestedCluster(mockStorageLocation(3), mockStorageLocation(4)), mockStack(mockStorageLocation(1), mockStorageLocation(2)));
List<StorageLocation> locations = fileSystem.getCloudStorage().getLocations();
Assert.assertEquals(2, locations.size());
Assert.assertTrue(hasPropretyWithIndex(locations, 1));
Assert.assertTrue(hasPropretyWithIndex(locations, 2));
}
use of com.sequenceiq.cloudbreak.domain.cloudstorage.StorageLocation in project cloudbreak by hortonworks.
the class RemoteDataContextWorkaroundServiceTest method testFileSystemWhenHivePathNotPresentedInDistroXAndSdxDoesNotContainsItShouldReturnWithSdxConfigs.
@Test
public void testFileSystemWhenHivePathNotPresentedInDistroXAndSdxDoesNotContainsItShouldReturnWithSdxConfigs() throws IOException {
when(nameGenerator.generateName(APIResourceType.FILESYSTEM)).thenReturn("appletree");
FileSystem fileSystem = underTest.prepareFilesytem(mockRequestedCluster(mockRds(HIVE)), mockStack());
List<StorageLocation> locations = fileSystem.getCloudStorage().getLocations();
Assert.assertEquals(0, locations.size());
}
use of com.sequenceiq.cloudbreak.domain.cloudstorage.StorageLocation 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);
}
Aggregations