Search in sources :

Example 31 with DisabledTransferPrompt

use of ch.cyberduck.core.transfer.DisabledTransferPrompt in project cyberduck by iterate-ch.

the class SwiftSingleTransferWorkerTest method testTransferredSizeRepeat.

@Test
public void testTransferredSizeRepeat() throws Exception {
    final Local local = new Local(System.getProperty("java.io.tmpdir"), new AlphanumericRandomStringService().random());
    final byte[] content = new byte[2 * 1024 * 1024];
    new Random().nextBytes(content);
    final OutputStream out = local.getOutputStream(false);
    IOUtils.write(content, out);
    out.close();
    final Host host = new Host(new SwiftProtocol(), "identity.api.rackspacecloud.com", new Credentials(System.getProperties().getProperty("rackspace.key"), System.getProperties().getProperty("rackspace.secret")));
    final AtomicBoolean failed = new AtomicBoolean();
    final SwiftSession session = new SwiftSession(host, new DisabledX509TrustManager(), new DefaultX509KeyManager()) {

        @Override
        @SuppressWarnings("unchecked")
        public <T> T _getFeature(final Class<T> type) {
            if (type == Upload.class) {
                final SwiftRegionService regionService = new SwiftRegionService(this);
                return (T) new SwiftLargeObjectUploadFeature(this, regionService, new SwiftWriteFeature(this, regionService), 1024L * 1024L, 5) {

                    @Override
                    protected InputStream decorate(final InputStream in, final MessageDigest digest) {
                        if (failed.get()) {
                            // Second attempt successful
                            return in;
                        }
                        return new CountingInputStream(in) {

                            @Override
                            protected void beforeRead(final int n) throws IOException {
                                super.beforeRead(n);
                                if (this.getByteCount() > 1024L * 1024L) {
                                    failed.set(true);
                                    throw new SocketTimeoutException();
                                }
                            }
                        };
                    }
                };
            }
            return super._getFeature(type);
        }
    };
    session.open(Proxy.DIRECT, new DisabledHostKeyCallback(), new DisabledLoginCallback(), new DisabledCancelCallback());
    session.login(Proxy.DIRECT, new DisabledLoginCallback(), new DisabledCancelCallback());
    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, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
    final Transfer t = new UploadTransfer(session.getHost(), test, local);
    final BytecountStreamListener counter = new BytecountStreamListener();
    assertTrue(new SingleTransferWorker(session, session, t, new TransferOptions(), new TransferSpeedometer(t), new DisabledTransferPrompt() {

        @Override
        public TransferAction prompt(final TransferItem file) {
            return TransferAction.overwrite;
        }
    }, new DisabledTransferErrorCallback(), new DisabledProgressListener(), counter, new DisabledLoginCallback(), new DisabledNotificationService()) {
    }.run(session));
    local.delete();
    assertTrue(t.isComplete());
    assertEquals(content.length, new SwiftAttributesFinderFeature(session).find(test).getSize());
    assertEquals(content.length, counter.getRecv(), 0L);
    assertEquals(content.length, counter.getSent(), 0L);
    assertTrue(failed.get());
    new SwiftDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
Also used : Delete(ch.cyberduck.core.features.Delete) DisabledX509TrustManager(ch.cyberduck.core.ssl.DisabledX509TrustManager) TransferAction(ch.cyberduck.core.transfer.TransferAction) OutputStream(java.io.OutputStream) SwiftWriteFeature(ch.cyberduck.core.openstack.SwiftWriteFeature) TransferOptions(ch.cyberduck.core.transfer.TransferOptions) Random(java.util.Random) SwiftDeleteFeature(ch.cyberduck.core.openstack.SwiftDeleteFeature) MessageDigest(java.security.MessageDigest) DisabledTransferErrorCallback(ch.cyberduck.core.transfer.DisabledTransferErrorCallback) Path(ch.cyberduck.core.Path) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) DisabledNotificationService(ch.cyberduck.core.notification.DisabledNotificationService) CountingInputStream(org.apache.commons.io.input.CountingInputStream) InputStream(java.io.InputStream) CountingInputStream(org.apache.commons.io.input.CountingInputStream) Local(ch.cyberduck.core.Local) Host(ch.cyberduck.core.Host) IOException(java.io.IOException) SwiftAttributesFinderFeature(ch.cyberduck.core.openstack.SwiftAttributesFinderFeature) SwiftProtocol(ch.cyberduck.core.openstack.SwiftProtocol) BytecountStreamListener(ch.cyberduck.core.BytecountStreamListener) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) DisabledTransferPrompt(ch.cyberduck.core.transfer.DisabledTransferPrompt) SwiftRegionService(ch.cyberduck.core.openstack.SwiftRegionService) SocketTimeoutException(java.net.SocketTimeoutException) DisabledCancelCallback(ch.cyberduck.core.DisabledCancelCallback) DisabledHostKeyCallback(ch.cyberduck.core.DisabledHostKeyCallback) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) UploadTransfer(ch.cyberduck.core.transfer.UploadTransfer) Transfer(ch.cyberduck.core.transfer.Transfer) UploadTransfer(ch.cyberduck.core.transfer.UploadTransfer) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) TransferSpeedometer(ch.cyberduck.core.transfer.TransferSpeedometer) SwiftLargeObjectUploadFeature(ch.cyberduck.core.openstack.SwiftLargeObjectUploadFeature) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) TransferItem(ch.cyberduck.core.transfer.TransferItem) Credentials(ch.cyberduck.core.Credentials) SwiftSession(ch.cyberduck.core.openstack.SwiftSession) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 32 with DisabledTransferPrompt

use of ch.cyberduck.core.transfer.DisabledTransferPrompt in project cyberduck by iterate-ch.

the class SFTPSingleTransferWorkerTest method testTransferredSizeRepeat.

@Test
public void testTransferredSizeRepeat() throws Exception {
    final Local local = new Local(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString());
    final byte[] content = new byte[98305];
    new Random().nextBytes(content);
    final OutputStream out = local.getOutputStream(false);
    IOUtils.write(content, out);
    out.close();
    final BytecountStreamListener counter = new BytecountStreamListener();
    final AtomicBoolean failed = new AtomicBoolean();
    final SFTPSession session = new SFTPSession(this.session.getHost(), new DisabledX509TrustManager(), new DefaultX509KeyManager()) {

        final SFTPWriteFeature write = new SFTPWriteFeature(this) {

            @Override
            public StatusOutputStream<Void> write(final Path file, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException {
                final StatusOutputStream<Void> proxy = super.write(file, status, callback);
                if (failed.get()) {
                    // Second attempt successful
                    return proxy;
                }
                return new VoidStatusOutputStream(new CountingOutputStream(proxy) {

                    @Override
                    protected void afterWrite(final int n) throws IOException {
                        super.afterWrite(n);
                        if (this.getByteCount() >= 42768L) {
                            // Buffer size
                            assertEquals(32768L, counter.getSent());
                            failed.set(true);
                            throw new SocketTimeoutException();
                        }
                    }
                }) {

                    @Override
                    public Void getStatus() throws BackgroundException {
                        return proxy.getStatus();
                    }
                };
            }
        };

        @Override
        @SuppressWarnings("unchecked")
        public <T> T _getFeature(final Class<T> type) {
            if (type == Write.class) {
                return (T) write;
            }
            return super._getFeature(type);
        }
    };
    session.open(Proxy.DIRECT, new DisabledHostKeyCallback(), new DisabledLoginCallback(), new DisabledCancelCallback());
    session.login(Proxy.DIRECT, new DisabledLoginCallback() {

        @Override
        public Credentials prompt(final Host bookmark, final String username, final String title, final String reason, final LoginOptions options) {
            return new Credentials("test", "test");
        }
    }, new DisabledCancelCallback());
    final Path test = new Path(new SFTPHomeDirectoryService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
    final Transfer t = new UploadTransfer(session.getHost(), test, local);
    assertTrue(new SingleTransferWorker(session, session, t, new TransferOptions(), new TransferSpeedometer(t), new DisabledTransferPrompt() {

        @Override
        public TransferAction prompt(final TransferItem file) {
            return TransferAction.overwrite;
        }
    }, new DisabledTransferErrorCallback(), new DisabledProgressListener(), counter, new DisabledLoginCallback(), new DisabledNotificationService()) {
    }.run(session));
    local.delete();
    assertTrue(t.isComplete());
    assertEquals(content.length, new SFTPAttributesFinderFeature(session).find(test).getSize());
    assertEquals(content.length, counter.getRecv(), 0L);
    assertEquals(content.length, counter.getSent(), 0L);
    assertTrue(failed.get());
    new SFTPDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
Also used : SFTPAttributesFinderFeature(ch.cyberduck.core.sftp.SFTPAttributesFinderFeature) Delete(ch.cyberduck.core.features.Delete) DisabledX509TrustManager(ch.cyberduck.core.ssl.DisabledX509TrustManager) TransferAction(ch.cyberduck.core.transfer.TransferAction) OutputStream(java.io.OutputStream) VoidStatusOutputStream(ch.cyberduck.core.io.VoidStatusOutputStream) CountingOutputStream(org.apache.commons.io.output.CountingOutputStream) StatusOutputStream(ch.cyberduck.core.io.StatusOutputStream) SFTPWriteFeature(ch.cyberduck.core.sftp.SFTPWriteFeature) LoginOptions(ch.cyberduck.core.LoginOptions) SFTPSession(ch.cyberduck.core.sftp.SFTPSession) CountingOutputStream(org.apache.commons.io.output.CountingOutputStream) TransferOptions(ch.cyberduck.core.transfer.TransferOptions) Random(java.util.Random) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) DisabledTransferErrorCallback(ch.cyberduck.core.transfer.DisabledTransferErrorCallback) Path(ch.cyberduck.core.Path) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) DisabledNotificationService(ch.cyberduck.core.notification.DisabledNotificationService) VoidStatusOutputStream(ch.cyberduck.core.io.VoidStatusOutputStream) VoidStatusOutputStream(ch.cyberduck.core.io.VoidStatusOutputStream) StatusOutputStream(ch.cyberduck.core.io.StatusOutputStream) Local(ch.cyberduck.core.Local) Host(ch.cyberduck.core.Host) SFTPDeleteFeature(ch.cyberduck.core.sftp.SFTPDeleteFeature) BytecountStreamListener(ch.cyberduck.core.BytecountStreamListener) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) DisabledTransferPrompt(ch.cyberduck.core.transfer.DisabledTransferPrompt) SocketTimeoutException(java.net.SocketTimeoutException) DisabledCancelCallback(ch.cyberduck.core.DisabledCancelCallback) DisabledHostKeyCallback(ch.cyberduck.core.DisabledHostKeyCallback) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) UploadTransfer(ch.cyberduck.core.transfer.UploadTransfer) Transfer(ch.cyberduck.core.transfer.Transfer) UploadTransfer(ch.cyberduck.core.transfer.UploadTransfer) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) ConnectionCallback(ch.cyberduck.core.ConnectionCallback) TransferSpeedometer(ch.cyberduck.core.transfer.TransferSpeedometer) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) TransferItem(ch.cyberduck.core.transfer.TransferItem) BackgroundException(ch.cyberduck.core.exception.BackgroundException) Credentials(ch.cyberduck.core.Credentials) SFTPHomeDirectoryService(ch.cyberduck.core.sftp.SFTPHomeDirectoryService) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractSFTPTest(ch.cyberduck.core.sftp.AbstractSFTPTest) Test(org.junit.Test)

Example 33 with DisabledTransferPrompt

use of ch.cyberduck.core.transfer.DisabledTransferPrompt in project cyberduck by iterate-ch.

the class TransferDictionaryTest method testSerializeLastSelectedAction.

@Test
public void testSerializeLastSelectedAction() throws Exception {
    final Path p = new Path("t", EnumSet.of(Path.Type.directory));
    final SyncTransfer transfer = new SyncTransfer(new Host(new TestProtocol()), new TransferItem(p, new NullLocal("p", "t") {

        @Override
        public boolean exists() {
            return true;
        }

        @Override
        public AttributedList<Local> list() {
            return new AttributedList<Local>(Collections.singletonList(new NullLocal("p", "a")));
        }
    }));
    transfer.action(null, null, true, false, new DisabledTransferPrompt() {

        @Override
        public TransferAction prompt(final TransferItem file) {
            return TransferAction.upload;
        }
    }, new DisabledListProgressListener());
    final Transfer serialized = new TransferDictionary().deserialize(transfer.serialize(SerializerFactory.get()));
    assertNotSame(transfer, serialized);
    assertEquals(TransferAction.upload, serialized.action(null, null, true, false, new DisabledTransferPrompt() {

        @Override
        public TransferAction prompt(final TransferItem file) {
            fail();
            return null;
        }
    }, new DisabledListProgressListener()));
}
Also used : Path(ch.cyberduck.core.Path) TestProtocol(ch.cyberduck.core.TestProtocol) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) TransferAction(ch.cyberduck.core.transfer.TransferAction) NullLocal(ch.cyberduck.core.NullLocal) Local(ch.cyberduck.core.Local) Host(ch.cyberduck.core.Host) SyncTransfer(ch.cyberduck.core.transfer.SyncTransfer) DisabledTransferPrompt(ch.cyberduck.core.transfer.DisabledTransferPrompt) AttributedList(ch.cyberduck.core.AttributedList) NullLocal(ch.cyberduck.core.NullLocal) UploadTransfer(ch.cyberduck.core.transfer.UploadTransfer) SyncTransfer(ch.cyberduck.core.transfer.SyncTransfer) Transfer(ch.cyberduck.core.transfer.Transfer) DownloadTransfer(ch.cyberduck.core.transfer.DownloadTransfer) TransferItem(ch.cyberduck.core.transfer.TransferItem) Test(org.junit.Test)

Example 34 with DisabledTransferPrompt

use of ch.cyberduck.core.transfer.DisabledTransferPrompt in project cyberduck by iterate-ch.

the class SDSSingleTransferWorkerTest method testTransferredSizeRepeat.

@Test
public void testTransferredSizeRepeat() throws Exception {
    final SDSNodeIdProvider fileid = new SDSNodeIdProvider(session);
    final Local local = new Local(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString());
    // chunk size 32768
    final byte[] content = new byte[98305];
    new Random().nextBytes(content);
    final OutputStream out = local.getOutputStream(false);
    IOUtils.write(content, out);
    out.close();
    final AtomicBoolean failed = new AtomicBoolean();
    final BytecountStreamListener counter = new BytecountStreamListener();
    final SDSSession conn = new SDSSession(session.getHost().withCredentials(new Credentials(System.getProperties().getProperty("sds.user"), System.getProperties().getProperty("sds.key"))), new DisabledX509TrustManager(), new DefaultX509KeyManager()) {

        @Override
        @SuppressWarnings("unchecked")
        public <T> T _getFeature(final Class<T> type) {
            if (type == Upload.class) {
                return (T) new DefaultUploadFeature(new SDSMultipartWriteFeature(this, fileid) {

                    @Override
                    public HttpResponseOutputStream<Node> write(final Path file, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException {
                        final HttpResponseOutputStream<Node> proxy = super.write(file, status, callback);
                        if (failed.get()) {
                            // Second attempt successful
                            return proxy;
                        }
                        return new HttpResponseOutputStream<Node>(new CountingOutputStream(proxy) {

                            @Override
                            protected void afterWrite(final int n) throws IOException {
                                super.afterWrite(n);
                                if (this.getByteCount() >= 42768L) {
                                    // Buffer size
                                    assertEquals(32768L, counter.getSent());
                                    failed.set(true);
                                    throw new SocketTimeoutException();
                                }
                            }
                        }, new SDSAttributesAdapter(session), status) {

                            @Override
                            public Node getStatus() throws BackgroundException {
                                return proxy.getStatus();
                            }
                        };
                    }
                });
            }
            return super._getFeature(type);
        }
    };
    conn.open(Proxy.DIRECT, new DisabledHostKeyCallback(), new DisabledLoginCallback(), new DisabledCancelCallback());
    conn.login(Proxy.DIRECT, new DisabledLoginCallback(), new DisabledCancelCallback());
    final Path room = new SDSDirectoryFeature(conn, fileid).mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), new TransferStatus());
    final Path test = new Path(room, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
    final Transfer t = new UploadTransfer(session.getHost(), test, local);
    assertTrue(new SingleTransferWorker(conn, conn, t, new TransferOptions(), new TransferSpeedometer(t), new DisabledTransferPrompt() {

        @Override
        public TransferAction prompt(final TransferItem file) {
            return TransferAction.overwrite;
        }
    }, new DisabledTransferErrorCallback(), new DisabledProgressListener(), counter, new DisabledLoginCallback(), new DisabledNotificationService()) {
    }.run(session));
    local.delete();
    assertTrue(t.isComplete());
    assertEquals(content.length, new SDSAttributesFinderFeature(conn, fileid).find(test).getSize());
    assertEquals(content.length, counter.getRecv(), 0L);
    assertEquals(content.length, counter.getSent(), 0L);
    assertTrue(failed.get());
    new SDSDeleteFeature(conn, fileid).delete(Arrays.asList(test, room), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
Also used : Delete(ch.cyberduck.core.features.Delete) SDSDeleteFeature(ch.cyberduck.core.sds.SDSDeleteFeature) DisabledX509TrustManager(ch.cyberduck.core.ssl.DisabledX509TrustManager) TransferAction(ch.cyberduck.core.transfer.TransferAction) HttpResponseOutputStream(ch.cyberduck.core.http.HttpResponseOutputStream) OutputStream(java.io.OutputStream) CountingOutputStream(org.apache.commons.io.output.CountingOutputStream) StatusOutputStream(ch.cyberduck.core.io.StatusOutputStream) Node(ch.cyberduck.core.sds.io.swagger.client.model.Node) CountingOutputStream(org.apache.commons.io.output.CountingOutputStream) TransferOptions(ch.cyberduck.core.transfer.TransferOptions) SDSSession(ch.cyberduck.core.sds.SDSSession) Random(java.util.Random) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) SDSAttributesFinderFeature(ch.cyberduck.core.sds.SDSAttributesFinderFeature) DisabledTransferErrorCallback(ch.cyberduck.core.transfer.DisabledTransferErrorCallback) Path(ch.cyberduck.core.Path) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) DisabledNotificationService(ch.cyberduck.core.notification.DisabledNotificationService) Local(ch.cyberduck.core.Local) SDSMultipartWriteFeature(ch.cyberduck.core.sds.SDSMultipartWriteFeature) IOException(java.io.IOException) DefaultUploadFeature(ch.cyberduck.core.shared.DefaultUploadFeature) BytecountStreamListener(ch.cyberduck.core.BytecountStreamListener) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) SDSNodeIdProvider(ch.cyberduck.core.sds.SDSNodeIdProvider) DisabledTransferPrompt(ch.cyberduck.core.transfer.DisabledTransferPrompt) SocketTimeoutException(java.net.SocketTimeoutException) DisabledCancelCallback(ch.cyberduck.core.DisabledCancelCallback) DisabledHostKeyCallback(ch.cyberduck.core.DisabledHostKeyCallback) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) UploadTransfer(ch.cyberduck.core.transfer.UploadTransfer) DownloadTransfer(ch.cyberduck.core.transfer.DownloadTransfer) Transfer(ch.cyberduck.core.transfer.Transfer) UploadTransfer(ch.cyberduck.core.transfer.UploadTransfer) SDSDirectoryFeature(ch.cyberduck.core.sds.SDSDirectoryFeature) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) ConnectionCallback(ch.cyberduck.core.ConnectionCallback) TransferSpeedometer(ch.cyberduck.core.transfer.TransferSpeedometer) HttpResponseOutputStream(ch.cyberduck.core.http.HttpResponseOutputStream) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) TransferItem(ch.cyberduck.core.transfer.TransferItem) Credentials(ch.cyberduck.core.Credentials) SDSAttributesAdapter(ch.cyberduck.core.sds.SDSAttributesAdapter) AbstractSDSTest(ch.cyberduck.core.sds.AbstractSDSTest) IntegrationTest(ch.cyberduck.test.IntegrationTest) Test(org.junit.Test)

Example 35 with DisabledTransferPrompt

use of ch.cyberduck.core.transfer.DisabledTransferPrompt in project cyberduck by iterate-ch.

the class SDSSingleTransferWorkerTest method testTransferredSizeRepeatFailureOnClose.

@Test
public void testTransferredSizeRepeatFailureOnClose() throws Exception {
    final SDSNodeIdProvider fileid = new SDSNodeIdProvider(session);
    final Local local = new Local(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString());
    // chunk size 32768
    final byte[] content = new byte[98305];
    new Random().nextBytes(content);
    final OutputStream out = local.getOutputStream(false);
    IOUtils.write(content, out);
    out.close();
    final AtomicBoolean failed = new AtomicBoolean();
    final SDSSession conn = new SDSSession(session.getHost().withCredentials(new Credentials(System.getProperties().getProperty("sds.user"), System.getProperties().getProperty("sds.key"))), new DisabledX509TrustManager(), new DefaultX509KeyManager()) {

        @Override
        @SuppressWarnings("unchecked")
        public <T> T _getFeature(final Class<T> type) {
            if (type == Upload.class) {
                return (T) new DefaultUploadFeature<>(new SDSMultipartWriteFeature(this, fileid) {

                    @Override
                    public HttpResponseOutputStream<Node> write(final Path file, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException {
                        final HttpResponseOutputStream<Node> proxy = super.write(file, status, callback);
                        if (failed.get()) {
                            // Second attempt successful
                            return proxy;
                        }
                        return new HttpResponseOutputStream<Node>(new CountingOutputStream(proxy) {

                            @Override
                            public void close() throws IOException {
                                if (!failed.get()) {
                                    failed.set(true);
                                    throw new SocketTimeoutException();
                                }
                                super.close();
                            }
                        }, new SDSAttributesAdapter(session), status) {

                            @Override
                            public Node getStatus() throws BackgroundException {
                                return proxy.getStatus();
                            }
                        };
                    }
                });
            }
            return super._getFeature(type);
        }
    };
    conn.open(Proxy.DIRECT, new DisabledHostKeyCallback(), new DisabledLoginCallback(), new DisabledCancelCallback());
    conn.login(Proxy.DIRECT, new DisabledLoginCallback(), new DisabledCancelCallback());
    final Path room = new SDSDirectoryFeature(conn, fileid).mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), new TransferStatus());
    final Path test = new Path(room, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
    final Transfer t = new UploadTransfer(session.getHost(), test, local);
    final BytecountStreamListener counter = new BytecountStreamListener();
    assertTrue(new SingleTransferWorker(conn, conn, t, new TransferOptions(), new TransferSpeedometer(t), new DisabledTransferPrompt() {

        @Override
        public TransferAction prompt(final TransferItem file) {
            return TransferAction.overwrite;
        }
    }, new DisabledTransferErrorCallback(), new DisabledProgressListener(), counter, new DisabledLoginCallback(), new DisabledNotificationService()) {
    }.run(conn));
    local.delete();
    assertTrue(t.isComplete());
    assertEquals(98305L, counter.getSent(), 0L);
    assertTrue(failed.get());
    assertEquals(98305L, new SDSAttributesFinderFeature(conn, fileid).find(test).getSize());
    new SDSDeleteFeature(conn, fileid).delete(Arrays.asList(test, room), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
Also used : Delete(ch.cyberduck.core.features.Delete) SDSDeleteFeature(ch.cyberduck.core.sds.SDSDeleteFeature) DisabledX509TrustManager(ch.cyberduck.core.ssl.DisabledX509TrustManager) TransferAction(ch.cyberduck.core.transfer.TransferAction) HttpResponseOutputStream(ch.cyberduck.core.http.HttpResponseOutputStream) OutputStream(java.io.OutputStream) CountingOutputStream(org.apache.commons.io.output.CountingOutputStream) StatusOutputStream(ch.cyberduck.core.io.StatusOutputStream) Node(ch.cyberduck.core.sds.io.swagger.client.model.Node) CountingOutputStream(org.apache.commons.io.output.CountingOutputStream) TransferOptions(ch.cyberduck.core.transfer.TransferOptions) SDSSession(ch.cyberduck.core.sds.SDSSession) Random(java.util.Random) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) SDSAttributesFinderFeature(ch.cyberduck.core.sds.SDSAttributesFinderFeature) DisabledTransferErrorCallback(ch.cyberduck.core.transfer.DisabledTransferErrorCallback) Path(ch.cyberduck.core.Path) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) DisabledNotificationService(ch.cyberduck.core.notification.DisabledNotificationService) Local(ch.cyberduck.core.Local) SDSMultipartWriteFeature(ch.cyberduck.core.sds.SDSMultipartWriteFeature) IOException(java.io.IOException) BytecountStreamListener(ch.cyberduck.core.BytecountStreamListener) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) SDSNodeIdProvider(ch.cyberduck.core.sds.SDSNodeIdProvider) DisabledTransferPrompt(ch.cyberduck.core.transfer.DisabledTransferPrompt) SocketTimeoutException(java.net.SocketTimeoutException) DisabledCancelCallback(ch.cyberduck.core.DisabledCancelCallback) DisabledHostKeyCallback(ch.cyberduck.core.DisabledHostKeyCallback) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) UploadTransfer(ch.cyberduck.core.transfer.UploadTransfer) DownloadTransfer(ch.cyberduck.core.transfer.DownloadTransfer) Transfer(ch.cyberduck.core.transfer.Transfer) UploadTransfer(ch.cyberduck.core.transfer.UploadTransfer) SDSDirectoryFeature(ch.cyberduck.core.sds.SDSDirectoryFeature) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) ConnectionCallback(ch.cyberduck.core.ConnectionCallback) TransferSpeedometer(ch.cyberduck.core.transfer.TransferSpeedometer) HttpResponseOutputStream(ch.cyberduck.core.http.HttpResponseOutputStream) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) TransferItem(ch.cyberduck.core.transfer.TransferItem) Credentials(ch.cyberduck.core.Credentials) SDSAttributesAdapter(ch.cyberduck.core.sds.SDSAttributesAdapter) AbstractSDSTest(ch.cyberduck.core.sds.AbstractSDSTest) IntegrationTest(ch.cyberduck.test.IntegrationTest) Test(org.junit.Test)

Aggregations

DisabledTransferPrompt (ch.cyberduck.core.transfer.DisabledTransferPrompt)42 TransferOptions (ch.cyberduck.core.transfer.TransferOptions)40 TransferSpeedometer (ch.cyberduck.core.transfer.TransferSpeedometer)40 DisabledTransferErrorCallback (ch.cyberduck.core.transfer.DisabledTransferErrorCallback)38 Transfer (ch.cyberduck.core.transfer.Transfer)38 DisabledNotificationService (ch.cyberduck.core.notification.DisabledNotificationService)37 Test (org.junit.Test)37 UploadTransfer (ch.cyberduck.core.transfer.UploadTransfer)36 TransferItem (ch.cyberduck.core.transfer.TransferItem)34 TransferAction (ch.cyberduck.core.transfer.TransferAction)33 DisabledStreamListener (ch.cyberduck.core.io.DisabledStreamListener)31 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)27 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)27 Path (ch.cyberduck.core.Path)26 DisabledProgressListener (ch.cyberduck.core.DisabledProgressListener)25 Delete (ch.cyberduck.core.features.Delete)25 Local (ch.cyberduck.core.Local)24 IntegrationTest (ch.cyberduck.test.IntegrationTest)23 Host (ch.cyberduck.core.Host)22 DownloadTransfer (ch.cyberduck.core.transfer.DownloadTransfer)22