@Test public void testFileSystemWhenHivePathNotPresentedInDistroXAndSdxDoesNotContainsItShouldReturnWithSdxConfigs() throws IOException { when(nameGenerator.generateName(APIResourceType.FILESYSTEM)).thenReturn("appletree"); when(stackService.getById(anyLong())).thenReturn(mockStack()); FileSystem fileSystem = underTest .prepareFilesytem( mockRequestedCluster(mockRds(HIVE)), mockDatalakeResources()); List<StorageLocation> locations = fileSystem.getCloudStorage().getLocations(); Assert.assertEquals(0, locations.size()); }
public FileSystem prepareFilesytem(Cluster requestedCluster, DatalakeResources datalakeResources) { Stack stack = stackService.getById(datalakeResources.getDatalakeStackId()); prepareFilesystemIfNotPresentedButSdxHasIt(requestedCluster, stack); if (hasFilesystem(requestedCluster.getFileSystem())) { FileSystem fileSystem = requestedCluster.getFileSystem(); if (hasLocations(fileSystem)) { CloudStorage cloudStorage = fileSystem.getCloudStorage(); FileSystem dlFileSystem = stack.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(); }
RemoteDataContextWorkaroundService { public FileSystem prepareFilesytem(Cluster requestedCluster, DatalakeResources datalakeResources) { Stack stack = stackService.getById(datalakeResources.getDatalakeStackId()); prepareFilesystemIfNotPresentedButSdxHasIt(requestedCluster, stack); if (hasFilesystem(requestedCluster.getFileSystem())) { FileSystem fileSystem = requestedCluster.getFileSystem(); if (hasLocations(fileSystem)) { CloudStorage cloudStorage = fileSystem.getCloudStorage(); FileSystem dlFileSystem = stack.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(); } }
RemoteDataContextWorkaroundService { public FileSystem prepareFilesytem(Cluster requestedCluster, DatalakeResources datalakeResources) { Stack stack = stackService.getById(datalakeResources.getDatalakeStackId()); prepareFilesystemIfNotPresentedButSdxHasIt(requestedCluster, stack); if (hasFilesystem(requestedCluster.getFileSystem())) { FileSystem fileSystem = requestedCluster.getFileSystem(); if (hasLocations(fileSystem)) { CloudStorage cloudStorage = fileSystem.getCloudStorage(); FileSystem dlFileSystem = stack.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(); }  }
RemoteDataContextWorkaroundService { public FileSystem prepareFilesytem(Cluster requestedCluster, DatalakeResources datalakeResources) { Stack stack = stackService.getById(datalakeResources.getDatalakeStackId()); prepareFilesystemIfNotPresentedButSdxHasIt(requestedCluster, stack); if (hasFilesystem(requestedCluster.getFileSystem())) { FileSystem fileSystem = requestedCluster.getFileSystem(); if (hasLocations(fileSystem)) { CloudStorage cloudStorage = fileSystem.getCloudStorage(); FileSystem dlFileSystem = stack.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(); }  Set<RDSConfig> prepareRdsConfigs(Cluster requestedCluster, DatalakeResources datalakeResources); FileSystem prepareFilesytem(Cluster requestedCluster, DatalakeResources datalakeResources); }
RemoteDataContextWorkaroundService { public FileSystem prepareFilesytem(Cluster requestedCluster, DatalakeResources datalakeResources) { Stack stack = stackService.getById(datalakeResources.getDatalakeStackId()); prepareFilesystemIfNotPresentedButSdxHasIt(requestedCluster, stack); if (hasFilesystem(requestedCluster.getFileSystem())) { FileSystem fileSystem = requestedCluster.getFileSystem(); if (hasLocations(fileSystem)) { CloudStorage cloudStorage = fileSystem.getCloudStorage(); FileSystem dlFileSystem = stack.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(); }  Set<RDSConfig> prepareRdsConfigs(Cluster requestedCluster, DatalakeResources datalakeResources); FileSystem prepareFilesytem(Cluster requestedCluster, DatalakeResources datalakeResources);  }