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();
}
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);
}
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);
}
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);
}
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();
}
Aggregations