@Test public void testMove() throws Exception { final B2FileidProvider fileid = new B2FileidProvider(session).withCache(cache); final Path container = new Path("test-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume)); final String name = new AlphanumericRandomStringService().random(); final Path test = new B2TouchFeature(session, fileid).touch(new Path(container, name, EnumSet.of(Path.Type.file)), new TransferStatus()); assertTrue(new B2FindFeature(session, fileid).find(test)); final Path target = new Path(container, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); new B2MoveFeature(session, fileid).move(test, target, new TransferStatus(), new Delete.DisabledCallback(), new DisabledConnectionCallback()); assertFalse(new B2FindFeature(session, fileid).find(new Path(container, name, EnumSet.of(Path.Type.file)))); assertTrue(new B2FindFeature(session, fileid).find(target)); new B2DeleteFeature(session, fileid).delete(Collections.<Path>singletonList(target), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
@Override public Path move(final Path source, final Path target, final TransferStatus status, final Delete.Callback delete, final ConnectionCallback callback) throws BackgroundException { final Path copy = proxy.copy(source, target, status.length(source.attributes().getSize()), callback); new B2DeleteFeature(session, fileid).delete(Collections.singletonList(new Path(source)), callback, delete); return copy; }
B2MoveFeature implements Move { @Override public Path move(final Path source, final Path target, final TransferStatus status, final Delete.Callback delete, final ConnectionCallback callback) throws BackgroundException { final Path copy = proxy.copy(source, target, status.length(source.attributes().getSize()), callback); new B2DeleteFeature(session, fileid).delete(Collections.singletonList(new Path(source)), callback, delete); return copy; } }
B2MoveFeature implements Move { @Override public Path move(final Path source, final Path target, final TransferStatus status, final Delete.Callback delete, final ConnectionCallback callback) throws BackgroundException { final Path copy = proxy.copy(source, target, status.length(source.attributes().getSize()), callback); new B2DeleteFeature(session, fileid).delete(Collections.singletonList(new Path(source)), callback, delete); return copy; } B2MoveFeature(final B2Session session, final B2FileidProvider fileid); }
B2MoveFeature implements Move { @Override public Path move(final Path source, final Path target, final TransferStatus status, final Delete.Callback delete, final ConnectionCallback callback) throws BackgroundException { final Path copy = proxy.copy(source, target, status.length(source.attributes().getSize()), callback); new B2DeleteFeature(session, fileid).delete(Collections.singletonList(new Path(source)), callback, delete); return copy; } B2MoveFeature(final B2Session session, final B2FileidProvider fileid); @Override Path move(final Path source, final Path target, final TransferStatus status, final Delete.Callback delete, final ConnectionCallback callback); @Override boolean isSupported(final Path source, final Path target); @Override boolean isRecursive(final Path source, final Path target); }
B2MoveFeature implements Move { @Override public Path move(final Path source, final Path target, final TransferStatus status, final Delete.Callback delete, final ConnectionCallback callback) throws BackgroundException { final Path copy = proxy.copy(source, target, status.length(source.attributes().getSize()), callback); new B2DeleteFeature(session, fileid).delete(Collections.singletonList(new Path(source)), callback, delete); return copy; } B2MoveFeature(final B2Session session, final B2FileidProvider fileid); @Override Path move(final Path source, final Path target, final TransferStatus status, final Delete.Callback delete, final ConnectionCallback callback); @Override boolean isSupported(final Path source, final Path target); @Override boolean isRecursive(final Path source, final Path target);  }