@Test(expected = NotfoundException.class) public void testMoveNotFound() throws Exception { final Path container = new Path("test.cyberduck.ch", EnumSet.of(Path.Type.directory, Path.Type.volume)); container.attributes().setRegion("IAD"); final Path test = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); test.attributes().setRegion("IAD"); new SwiftMoveFeature(session).move(test, new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)), new TransferStatus(), new Delete.DisabledCallback(), new DisabledConnectionCallback()); }
@Override public Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback) throws BackgroundException { if(containerService.getContainer(file).equals(containerService.getContainer(renamed))) { final Path rename = new SwiftDefaultCopyFeature(session, regionService).copy(file, renamed, new TransferStatus().length(file.attributes().getSize()), connectionCallback); new SwiftDeleteFeature(session).delete(Collections.singletonMap(file, status), connectionCallback, callback, false); return rename; } else { final Path copy = new SwiftSegmentCopyService(session, regionService).copy(file, renamed, new TransferStatus().length(file.attributes().getSize()), connectionCallback); new SwiftDeleteFeature(session).delete(Collections.singletonMap(file, status), connectionCallback, callback); return copy; } }
SwiftMoveFeature implements Move { @Override public Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback) throws BackgroundException { if(containerService.getContainer(file).equals(containerService.getContainer(renamed))) { final Path rename = new SwiftDefaultCopyFeature(session, regionService).copy(file, renamed, new TransferStatus().length(file.attributes().getSize()), connectionCallback); new SwiftDeleteFeature(session).delete(Collections.singletonMap(file, status), connectionCallback, callback, false); return rename; } else { final Path copy = new SwiftSegmentCopyService(session, regionService).copy(file, renamed, new TransferStatus().length(file.attributes().getSize()), connectionCallback); new SwiftDeleteFeature(session).delete(Collections.singletonMap(file, status), connectionCallback, callback); return copy; } } }
SwiftMoveFeature implements Move { @Override public Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback) throws BackgroundException { if(containerService.getContainer(file).equals(containerService.getContainer(renamed))) { final Path rename = new SwiftDefaultCopyFeature(session, regionService).copy(file, renamed, new TransferStatus().length(file.attributes().getSize()), connectionCallback); new SwiftDeleteFeature(session).delete(Collections.singletonMap(file, status), connectionCallback, callback, false); return rename; } else { final Path copy = new SwiftSegmentCopyService(session, regionService).copy(file, renamed, new TransferStatus().length(file.attributes().getSize()), connectionCallback); new SwiftDeleteFeature(session).delete(Collections.singletonMap(file, status), connectionCallback, callback); return copy; } } SwiftMoveFeature(final SwiftSession session);  SwiftMoveFeature(final SwiftSession session, final SwiftRegionService regionService); }
SwiftMoveFeature implements Move { @Override public Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback) throws BackgroundException { if(containerService.getContainer(file).equals(containerService.getContainer(renamed))) { final Path rename = new SwiftDefaultCopyFeature(session, regionService).copy(file, renamed, new TransferStatus().length(file.attributes().getSize()), connectionCallback); new SwiftDeleteFeature(session).delete(Collections.singletonMap(file, status), connectionCallback, callback, false); return rename; } else { final Path copy = new SwiftSegmentCopyService(session, regionService).copy(file, renamed, new TransferStatus().length(file.attributes().getSize()), connectionCallback); new SwiftDeleteFeature(session).delete(Collections.singletonMap(file, status), connectionCallback, callback); return copy; } } SwiftMoveFeature(final SwiftSession session);  SwiftMoveFeature(final SwiftSession session, final SwiftRegionService regionService); @Override Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback); @Override boolean isSupported(final Path source, final Path target); }
SwiftMoveFeature implements Move { @Override public Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback) throws BackgroundException { if(containerService.getContainer(file).equals(containerService.getContainer(renamed))) { final Path rename = new SwiftDefaultCopyFeature(session, regionService).copy(file, renamed, new TransferStatus().length(file.attributes().getSize()), connectionCallback); new SwiftDeleteFeature(session).delete(Collections.singletonMap(file, status), connectionCallback, callback, false); return rename; } else { final Path copy = new SwiftSegmentCopyService(session, regionService).copy(file, renamed, new TransferStatus().length(file.attributes().getSize()), connectionCallback); new SwiftDeleteFeature(session).delete(Collections.singletonMap(file, status), connectionCallback, callback); return copy; } } SwiftMoveFeature(final SwiftSession session);  SwiftMoveFeature(final SwiftSession session, final SwiftRegionService regionService); @Override Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback); @Override boolean isSupported(final Path source, final Path target);  }