use of ch.cyberduck.core.DisabledProgressListener in project cyberduck by iterate-ch.
the class AbstractS3Test method setupDefault.
@Before
public void setupDefault() throws Exception {
final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new S3Protocol())));
final Profile profile = new ProfilePlistReader(factory).read(this.getClass().getResourceAsStream("/S3 (HTTPS).cyberduckprofile"));
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(System.getProperties().getProperty("s3.key"), System.getProperties().getProperty("s3.secret"))) {
@Override
public String getProperty(final String key) {
if ("s3.listing.metadata.enable".equals(key)) {
return String.valueOf(false);
}
if ("s3.versioning.references.enable".equals(key)) {
return String.valueOf(true);
}
return super.getProperty(key);
}
};
session = new S3Session(host, new DefaultX509TrustManager(), new DefaultX509KeyManager());
final LoginConnectionService login = new LoginConnectionService(new DisabledLoginCallback() {
@Override
public Credentials prompt(final Host bookmark, final String username, final String title, final String reason, final LoginOptions options) {
fail(reason);
return null;
}
}, new DisabledHostKeyCallback(), new DisabledPasswordStore(), new DisabledProgressListener());
login.check(session, new DisabledCancelCallback());
session.getHost().getCredentials().setPassword(System.getProperties().getProperty("s3.secret"));
}
use of ch.cyberduck.core.DisabledProgressListener in project cyberduck by iterate-ch.
the class AbstractS3Test method setupVirtualHost.
@Before
public void setupVirtualHost() throws Exception {
final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new S3Protocol())));
final Profile profile = new ProfilePlistReader(factory).read(this.getClass().getResourceAsStream("/S3 (HTTPS).cyberduckprofile"));
final Host host = new Host(profile, "test-eu-west-3-cyberduck.s3.amazonaws.com", new Credentials(System.getProperties().getProperty("s3.key"), System.getProperties().getProperty("s3.secret")));
virtualhost = new S3Session(host, new DefaultX509TrustManager(), new DefaultX509KeyManager());
final LoginConnectionService login = new LoginConnectionService(new DisabledLoginCallback() {
@Override
public Credentials prompt(final Host bookmark, final String username, final String title, final String reason, final LoginOptions options) {
fail(reason);
return null;
}
}, new DisabledHostKeyCallback(), new DisabledPasswordStore(), new DisabledProgressListener());
login.check(virtualhost, new DisabledCancelCallback());
virtualhost.getHost().getCredentials().setPassword(System.getProperties().getProperty("s3.secret"));
}
use of ch.cyberduck.core.DisabledProgressListener in project cyberduck by iterate-ch.
the class MoveWorkerTest method testMoveToDifferentFolderLongFilenameCryptomator.
@Test
public void testMoveToDifferentFolderLongFilenameCryptomator() throws Exception {
assumeTrue(vaultVersion == CryptoVault.VAULT_VERSION_DEPRECATED);
final Path home = new SFTPHomeDirectoryService(session).find();
final Path vault = new Path(home, UUID.randomUUID().toString(), EnumSet.of(Path.Type.directory));
final Path source = new Path(vault, new AlphanumericRandomStringService(130).random(), EnumSet.of(Path.Type.file));
final Path targetFolder = new Path(vault, new AlphanumericRandomStringService(130).random(), EnumSet.of(Path.Type.directory));
final Path target = new Path(targetFolder, new AlphanumericRandomStringService(130).random(), EnumSet.of(Path.Type.file));
final CryptoVault cryptomator = new CryptoVault(vault);
cryptomator.create(session, new VaultCredentials("test"), new DisabledPasswordStore(), vaultVersion);
session.withRegistry(new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator));
new CryptoTouchFeature<>(session, new DefaultTouchFeature<>(new SFTPWriteFeature(session)), new SFTPWriteFeature(session), cryptomator).touch(source, new TransferStatus());
assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(source));
cryptomator.getFeature(session, Directory.class, new SFTPDirectoryFeature(session)).mkdir(targetFolder, new TransferStatus());
assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(targetFolder));
final MoveWorker worker = new MoveWorker(Collections.singletonMap(source, target), new SessionPool.SingleSessionPool(session), PathCache.empty(), new DisabledProgressListener(), new DisabledLoginCallback());
worker.run(session);
assertFalse(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(source));
assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(target));
cryptomator.getFeature(session, Delete.class, new SFTPDeleteFeature(session)).delete(Arrays.asList(target, targetFolder, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
use of ch.cyberduck.core.DisabledProgressListener in project cyberduck by iterate-ch.
the class MoveWorkerTest method testMoveDirectoryIntoVault.
@Test
public void testMoveDirectoryIntoVault() throws Exception {
final Path home = new SFTPHomeDirectoryService(session).find();
final Path vault = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
final Path clearFolder = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
final Path clearFile = new Path(clearFolder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
new SFTPDirectoryFeature(session).mkdir(clearFolder, new TransferStatus());
new SFTPTouchFeature(session).touch(clearFile, new TransferStatus());
assertTrue(new SFTPFindFeature(session).find(clearFolder));
assertTrue(new SFTPFindFeature(session).find(clearFile));
final CryptoVault cryptomator = new CryptoVault(vault);
cryptomator.create(session, new VaultCredentials("test"), new DisabledPasswordStore(), vaultVersion);
final DefaultVaultRegistry registry = new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator);
session.withRegistry(registry);
// move directory into vault
final Path encryptedFolder = new Path(vault, clearFolder.getName(), EnumSet.of(Path.Type.directory));
final Path encryptedFile = new Path(encryptedFolder, clearFile.getName(), EnumSet.of(Path.Type.file));
final MoveWorker worker = new MoveWorker(Collections.singletonMap(clearFolder, encryptedFolder), new SessionPool.SingleSessionPool(session), PathCache.empty(), new DisabledProgressListener(), new DisabledLoginCallback());
worker.run(session);
assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(encryptedFolder));
assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(encryptedFile));
assertFalse(new SFTPFindFeature(session).find(clearFolder));
assertFalse(new SFTPFindFeature(session).find(clearFile));
cryptomator.getFeature(session, Delete.class, new SFTPDeleteFeature(session)).delete(Arrays.asList(encryptedFile, encryptedFolder, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
registry.clear();
}
use of ch.cyberduck.core.DisabledProgressListener in project cyberduck by iterate-ch.
the class MoveWorkerTest method testMoveFileIntoVault.
@Test
public void testMoveFileIntoVault() throws Exception {
final Path home = new SFTPHomeDirectoryService(session).find();
final Path vault = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
final Path clearFile = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
new SFTPTouchFeature(session).touch(clearFile, new TransferStatus());
assertTrue(new SFTPFindFeature(session).find(clearFile));
final Path encryptedFolder = new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
final Path encryptedFile = new Path(encryptedFolder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
final CryptoVault cryptomator = new CryptoVault(vault);
cryptomator.create(session, new VaultCredentials("test"), new DisabledPasswordStore(), vaultVersion);
final DefaultVaultRegistry registry = new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator);
session.withRegistry(registry);
cryptomator.getFeature(session, Directory.class, new SFTPDirectoryFeature(session)).mkdir(encryptedFolder, new TransferStatus());
assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(encryptedFolder));
// move file into vault
final MoveWorker worker = new MoveWorker(Collections.singletonMap(clearFile, encryptedFile), new SessionPool.SingleSessionPool(session), PathCache.empty(), new DisabledProgressListener(), new DisabledLoginCallback());
worker.run(session);
assertFalse(new SFTPFindFeature(session).find(clearFile));
assertTrue(new CryptoFindFeature(session, new SFTPFindFeature(session), cryptomator).find(encryptedFile));
cryptomator.getFeature(session, Delete.class, new SFTPDeleteFeature(session)).delete(Arrays.asList(encryptedFile, encryptedFolder, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
registry.clear();
}
Aggregations