@Test public void testCopyManifestSameBucket() throws Exception { final Path container = new Path("test.cyberduck.ch", EnumSet.of(Path.Type.directory, Path.Type.volume)); container.attributes().setRegion("IAD"); final Path originFolder = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.directory)); final Path sourceFile = new Path(originFolder, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); final SwiftRegionService regionService = new SwiftRegionService(session); final SwiftSegmentService segmentService = new SwiftSegmentService(session, ".segments-test/"); prepareFile(sourceFile, regionService, segmentService); final SwiftFindFeature findFeature = new SwiftFindFeature(session); assertTrue(findFeature.find(sourceFile)); final List<Path> sourceSegments = segmentService.list(sourceFile); final Path targetFolder = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.directory)); final Path targetFile = new Path(targetFolder, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); final Path copiedFile = new SwiftDefaultCopyFeature(session, regionService) .copy(sourceFile, targetFile, new TransferStatus(), new DisabledConnectionCallback()); assertTrue(findFeature.find(copiedFile)); final List<Path> targetSegments = segmentService.list(targetFile); assertTrue(sourceSegments.containsAll(targetSegments) && targetSegments.containsAll(sourceSegments)); new SwiftDeleteFeature(session, segmentService, regionService).delete( Collections.singletonMap(sourceFile, new TransferStatus()), new DisabledPasswordCallback(), new Delete.DisabledCallback(), false); assertFalse(findFeature.find(sourceFile)); assertTrue(targetSegments.stream().allMatch(p -> { try { return findFeature.find(p); } catch(BackgroundException e) { return false; } })); new SwiftDeleteFeature(session, segmentService, regionService).delete( Collections.singletonMap(copiedFile, new TransferStatus()), new DisabledPasswordCallback(), new Delete.DisabledCallback(), true); assertFalse(findFeature.find(copiedFile)); }
@Override public Path copy(final Path source, final Path target, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { return copy(source, segmentService.list(source), target, status, callback); }
SwiftLargeObjectCopyFeature implements Copy { @Override public Path copy(final Path source, final Path target, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { return copy(source, segmentService.list(source), target, status, callback); } }
SwiftLargeObjectCopyFeature implements Copy { @Override public Path copy(final Path source, final Path target, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { return copy(source, segmentService.list(source), target, status, callback); } SwiftLargeObjectCopyFeature(final SwiftSession session);  SwiftLargeObjectCopyFeature(final SwiftSession session, final SwiftRegionService regionService);  SwiftLargeObjectCopyFeature(final SwiftSession session, final SwiftRegionService regionService,
                                       final SwiftSegmentService segmentService); }
SwiftLargeObjectCopyFeature implements Copy { @Override public Path copy(final Path source, final Path target, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { return copy(source, segmentService.list(source), target, status, callback); } SwiftLargeObjectCopyFeature(final SwiftSession session);  SwiftLargeObjectCopyFeature(final SwiftSession session, final SwiftRegionService regionService);  SwiftLargeObjectCopyFeature(final SwiftSession session, final SwiftRegionService regionService,
                                       final SwiftSegmentService segmentService); @Override Path copy(final Path source, final Path target, final TransferStatus status, final ConnectionCallback callback); @Override boolean isSupported(final Path source, final Path target); Path copy(final Path source, final List<Path> sourceParts, final Path target, final TransferStatus status,
                     final ConnectionCallback callback); }
SwiftLargeObjectCopyFeature implements Copy { @Override public Path copy(final Path source, final Path target, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { return copy(source, segmentService.list(source), target, status, callback); } SwiftLargeObjectCopyFeature(final SwiftSession session);  SwiftLargeObjectCopyFeature(final SwiftSession session, final SwiftRegionService regionService);  SwiftLargeObjectCopyFeature(final SwiftSession session, final SwiftRegionService regionService,
                                       final SwiftSegmentService segmentService); @Override Path copy(final Path source, final Path target, final TransferStatus status, final ConnectionCallback callback); @Override boolean isSupported(final Path source, final Path target); Path copy(final Path source, final List<Path> sourceParts, final Path target, final TransferStatus status,
                     final ConnectionCallback callback);  }