Search in sources :

Example 41 with DisabledProgressListener

use of ch.cyberduck.core.DisabledProgressListener in project cyberduck by iterate-ch.

the class SpectraBulkServiceTest method testPreUploadLargeFile.

@Test
public void testPreUploadLargeFile() throws Exception {
    final Host host = new Host(new SpectraProtocol() {

        @Override
        public Scheme getScheme() {
            return Scheme.http;
        }
    }, System.getProperties().getProperty("spectra.hostname"), Integer.valueOf(System.getProperties().getProperty("spectra.port")), new Credentials(System.getProperties().getProperty("spectra.user"), System.getProperties().getProperty("spectra.key")));
    final SpectraSession session = new SpectraSession(host, new DisabledX509TrustManager(), new DefaultX509KeyManager());
    final LoginConnectionService service = new LoginConnectionService(new DisabledLoginCallback() {

        @Override
        public void warn(final Host bookmark, final String title, final String message, final String continueButton, final String disconnectButton, final String preference) {
        // 
        }
    }, new DisabledHostKeyCallback(), new DisabledPasswordStore(), new DisabledProgressListener());
    service.connect(session, new DisabledCancelCallback());
    final Map<TransferItem, TransferStatus> files = new HashMap<>();
    final TransferStatus status = new TransferStatus();
    final Path file = new Path(String.format("/cyberduck/%s", new AlphanumericRandomStringService().random()), EnumSet.of(Path.Type.file));
    files.put(new TransferItem(file), // 11GB
    status.withLength(112640000000L));
    final SpectraBulkService bulk = new SpectraBulkService(session);
    bulk.pre(Transfer.Type.upload, files, new DisabledConnectionCallback());
    assertFalse(status.getParameters().isEmpty());
    assertNotNull(status.getParameters().get("job"));
    final List<TransferStatus> list = bulk.query(Transfer.Type.upload, file, status);
    assertFalse(list.isEmpty());
    long offset = 0;
    for (TransferStatus s : list) {
        assertEquals(offset, s.getOffset());
        assertTrue(s.getLength() > 0);
        offset += s.getLength();
    }
    try {
        bulk.pre(Transfer.Type.download, files, new DisabledConnectionCallback());
        fail();
    } catch (BackgroundException e) {
    // 
    }
    new SpectraDeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback());
    session.close();
}
Also used : Delete(ch.cyberduck.core.features.Delete) DisabledX509TrustManager(ch.cyberduck.core.ssl.DisabledX509TrustManager) Scheme(ch.cyberduck.core.Scheme) HashMap(java.util.HashMap) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) Path(ch.cyberduck.core.Path) LoginConnectionService(ch.cyberduck.core.LoginConnectionService) Host(ch.cyberduck.core.Host) DisabledCancelCallback(ch.cyberduck.core.DisabledCancelCallback) DisabledHostKeyCallback(ch.cyberduck.core.DisabledHostKeyCallback) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) TransferItem(ch.cyberduck.core.transfer.TransferItem) Credentials(ch.cyberduck.core.Credentials) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) BackgroundException(ch.cyberduck.core.exception.BackgroundException) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 42 with DisabledProgressListener

use of ch.cyberduck.core.DisabledProgressListener in project cyberduck by iterate-ch.

the class CopyWorkerTest method testCopyFileToDirectory.

@Test
public void testCopyFileToDirectory() throws Exception {
    final Path home = new DefaultHomeFinderService(session).find();
    final Path sourceFile = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
    new DAVTouchFeature(session).touch(sourceFile, new TransferStatus());
    assertTrue(new DAVFindFeature(session).find(sourceFile));
    final Path targetFolder = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    final Path targetFile = new Path(targetFolder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
    new DAVDirectoryFeature(session).mkdir(targetFolder, new TransferStatus());
    assertTrue(new DAVFindFeature(session).find(targetFolder));
    // copy file into vault
    final CopyWorker worker = new CopyWorker(Collections.singletonMap(sourceFile, targetFile), new SessionPool.SingleSessionPool(session), PathCache.empty(), new DisabledProgressListener(), new DisabledConnectionCallback());
    worker.run(session);
    assertTrue(new DAVFindFeature(session).find(sourceFile));
    assertTrue(new DAVFindFeature(session).find(targetFile));
    new DeleteWorker(new DisabledLoginCallback(), Arrays.asList(sourceFile, targetFolder), PathCache.empty(), new DisabledProgressListener()).run(session);
}
Also used : Path(ch.cyberduck.core.Path) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) SessionPool(ch.cyberduck.core.pool.SessionPool) DefaultHomeFinderService(ch.cyberduck.core.shared.DefaultHomeFinderService) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) DAVFindFeature(ch.cyberduck.core.dav.DAVFindFeature) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) DAVDirectoryFeature(ch.cyberduck.core.dav.DAVDirectoryFeature) DAVTouchFeature(ch.cyberduck.core.dav.DAVTouchFeature) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractDAVTest(ch.cyberduck.core.dav.AbstractDAVTest)

Example 43 with DisabledProgressListener

use of ch.cyberduck.core.DisabledProgressListener in project cyberduck by iterate-ch.

the class CopyWorkerTest method testCopyFile.

@Test
public void testCopyFile() throws Exception {
    final Path home = new DefaultHomeFinderService(session).find();
    final Path source = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
    final Path target = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
    new DAVTouchFeature(session).touch(source, new TransferStatus());
    assertTrue(new DAVFindFeature(session).find(source));
    final CopyWorker worker = new CopyWorker(Collections.singletonMap(source, target), new SessionPool.SingleSessionPool(session), PathCache.empty(), new DisabledProgressListener(), new DisabledConnectionCallback());
    worker.run(session);
    assertTrue(new DAVFindFeature(session).find(source));
    assertTrue(new DAVFindFeature(session).find(target));
    new DeleteWorker(new DisabledLoginCallback(), Arrays.asList(source, target), PathCache.empty(), new DisabledProgressListener()).run(session);
}
Also used : Path(ch.cyberduck.core.Path) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) SessionPool(ch.cyberduck.core.pool.SessionPool) DefaultHomeFinderService(ch.cyberduck.core.shared.DefaultHomeFinderService) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) DAVFindFeature(ch.cyberduck.core.dav.DAVFindFeature) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) DAVTouchFeature(ch.cyberduck.core.dav.DAVTouchFeature) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractDAVTest(ch.cyberduck.core.dav.AbstractDAVTest)

Example 44 with DisabledProgressListener

use of ch.cyberduck.core.DisabledProgressListener in project cyberduck by iterate-ch.

the class CopyWorkerTest method testCopyDirectory.

@Test
public void testCopyDirectory() throws Exception {
    final Path home = new DefaultHomeFinderService(session).find();
    final Path folder = new DAVDirectoryFeature(session).mkdir(new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus());
    final Path sourceFile = new DAVTouchFeature(session).touch(new Path(folder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
    assertTrue(new DAVFindFeature(session).find(folder));
    assertTrue(new DAVFindFeature(session).find(sourceFile));
    final Path targetFolder = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    final Path targetFile = new Path(targetFolder, sourceFile.getName(), EnumSet.of(Path.Type.file));
    final CopyWorker worker = new CopyWorker(Collections.singletonMap(folder, targetFolder), new SessionPool.SingleSessionPool(session), PathCache.empty(), new DisabledProgressListener(), new DisabledConnectionCallback());
    worker.run(session);
    assertTrue(new DAVFindFeature(session).find(targetFolder));
    assertTrue(new DAVFindFeature(session).find(targetFile));
    assertTrue(new DAVFindFeature(session).find(folder));
    assertTrue(new DAVFindFeature(session).find(sourceFile));
    new DeleteWorker(new DisabledLoginCallback(), Arrays.asList(folder, targetFile), PathCache.empty(), new DisabledProgressListener()).run(session);
}
Also used : Path(ch.cyberduck.core.Path) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) SessionPool(ch.cyberduck.core.pool.SessionPool) DefaultHomeFinderService(ch.cyberduck.core.shared.DefaultHomeFinderService) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) DAVFindFeature(ch.cyberduck.core.dav.DAVFindFeature) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) DAVDirectoryFeature(ch.cyberduck.core.dav.DAVDirectoryFeature) DAVTouchFeature(ch.cyberduck.core.dav.DAVTouchFeature) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractDAVTest(ch.cyberduck.core.dav.AbstractDAVTest)

Example 45 with DisabledProgressListener

use of ch.cyberduck.core.DisabledProgressListener in project cyberduck by iterate-ch.

the class AzureSingleTransferWorkerTest method download.

private void download(final Host host) throws ch.cyberduck.core.exception.BackgroundException, java.io.IOException {
    final OperationContext context = new OperationContext();
    final AzureSession session = new AzureSession(host);
    session.open(Proxy.DIRECT, new DisabledHostKeyCallback(), new DisabledLoginCallback(), new DisabledCancelCallback());
    session.login(Proxy.DIRECT, new DisabledLoginCallback(), new DisabledCancelCallback());
    final Path home = new Path("cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
    final Path test = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
    final Local localFile = TemporaryFileServiceFactory.get().create(test.getName());
    {
        final byte[] content = RandomUtils.nextBytes(39864);
        final TransferStatus writeStatus = new TransferStatus().withLength(content.length).withChecksum(new SHA256ChecksumCompute().compute(new ByteArrayInputStream(content), new TransferStatus()));
        final StatusOutputStream out = new AzureWriteFeature(session, context).write(test, writeStatus, new DisabledConnectionCallback());
        assertNotNull(out);
        new StreamCopier(writeStatus, writeStatus).withLimit((long) content.length).transfer(new ByteArrayInputStream(content), out);
        out.close();
    }
    final byte[] content = RandomUtils.nextBytes(39864);
    final TransferStatus writeStatus = new TransferStatus().withLength(content.length).withChecksum(new SHA256ChecksumCompute().compute(new ByteArrayInputStream(content), new TransferStatus()));
    final StatusOutputStream<Void> out = new AzureWriteFeature(session, context).write(test, writeStatus, new DisabledConnectionCallback());
    assertNotNull(out);
    new StreamCopier(writeStatus, writeStatus).withLimit((long) content.length).transfer(new ByteArrayInputStream(content), out);
    out.close();
    final Transfer t = new DownloadTransfer(new Host(new TestProtocol()), Collections.singletonList(new TransferItem(test, localFile)), new NullFilter<>());
    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(), new DisabledStreamListener(), new DisabledLoginCallback(), new DisabledNotificationService()) {
    }.run(session));
    assertArrayEquals(content, IOUtils.toByteArray(localFile.getInputStream()));
    new AzureDeleteFeature(session, context).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
    localFile.delete();
}
Also used : Delete(ch.cyberduck.core.features.Delete) TestProtocol(ch.cyberduck.core.TestProtocol) TransferAction(ch.cyberduck.core.transfer.TransferAction) AzureWriteFeature(ch.cyberduck.core.azure.AzureWriteFeature) TransferOptions(ch.cyberduck.core.transfer.TransferOptions) DownloadTransfer(ch.cyberduck.core.transfer.DownloadTransfer) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) DisabledTransferErrorCallback(ch.cyberduck.core.transfer.DisabledTransferErrorCallback) OperationContext(com.microsoft.azure.storage.OperationContext) Path(ch.cyberduck.core.Path) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) DisabledNotificationService(ch.cyberduck.core.notification.DisabledNotificationService) DisabledStreamListener(ch.cyberduck.core.io.DisabledStreamListener) AzureSession(ch.cyberduck.core.azure.AzureSession) StatusOutputStream(ch.cyberduck.core.io.StatusOutputStream) Local(ch.cyberduck.core.Local) Host(ch.cyberduck.core.Host) DisabledTransferPrompt(ch.cyberduck.core.transfer.DisabledTransferPrompt) DisabledCancelCallback(ch.cyberduck.core.DisabledCancelCallback) ByteArrayInputStream(java.io.ByteArrayInputStream) DisabledHostKeyCallback(ch.cyberduck.core.DisabledHostKeyCallback) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) AzureDeleteFeature(ch.cyberduck.core.azure.AzureDeleteFeature) Transfer(ch.cyberduck.core.transfer.Transfer) DownloadTransfer(ch.cyberduck.core.transfer.DownloadTransfer) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) TransferSpeedometer(ch.cyberduck.core.transfer.TransferSpeedometer) TransferItem(ch.cyberduck.core.transfer.TransferItem) SHA256ChecksumCompute(ch.cyberduck.core.io.SHA256ChecksumCompute) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) StreamCopier(ch.cyberduck.core.io.StreamCopier)

Aggregations

DisabledProgressListener (ch.cyberduck.core.DisabledProgressListener)166 Test (org.junit.Test)147 Host (ch.cyberduck.core.Host)135 Path (ch.cyberduck.core.Path)128 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)103 TestProtocol (ch.cyberduck.core.TestProtocol)95 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)94 NullSession (ch.cyberduck.core.NullSession)68 IntegrationTest (ch.cyberduck.test.IntegrationTest)65 DisabledPasswordStore (ch.cyberduck.core.DisabledPasswordStore)59 NullLocal (ch.cyberduck.core.NullLocal)49 AlphanumericRandomStringService (ch.cyberduck.core.AlphanumericRandomStringService)48 DisabledCancelCallback (ch.cyberduck.core.DisabledCancelCallback)48 DisabledHostKeyCallback (ch.cyberduck.core.DisabledHostKeyCallback)48 Credentials (ch.cyberduck.core.Credentials)43 Delete (ch.cyberduck.core.features.Delete)42 Local (ch.cyberduck.core.Local)40 LoginConnectionService (ch.cyberduck.core.LoginConnectionService)39 DefaultX509KeyManager (ch.cyberduck.core.ssl.DefaultX509KeyManager)36 DisabledConnectionCallback (ch.cyberduck.core.DisabledConnectionCallback)34