Search in sources :

Example 96 with DisabledProgressListener

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"));
}
Also used : DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) LoginConnectionService(ch.cyberduck.core.LoginConnectionService) Host(ch.cyberduck.core.Host) ProfilePlistReader(ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader) Profile(ch.cyberduck.core.Profile) ProtocolFactory(ch.cyberduck.core.ProtocolFactory) LoginOptions(ch.cyberduck.core.LoginOptions) DisabledCancelCallback(ch.cyberduck.core.DisabledCancelCallback) DisabledHostKeyCallback(ch.cyberduck.core.DisabledHostKeyCallback) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) Credentials(ch.cyberduck.core.Credentials) DefaultX509TrustManager(ch.cyberduck.core.ssl.DefaultX509TrustManager) Before(org.junit.Before)

Example 97 with DisabledProgressListener

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"));
}
Also used : DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) LoginConnectionService(ch.cyberduck.core.LoginConnectionService) Host(ch.cyberduck.core.Host) ProfilePlistReader(ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader) Profile(ch.cyberduck.core.Profile) ProtocolFactory(ch.cyberduck.core.ProtocolFactory) LoginOptions(ch.cyberduck.core.LoginOptions) DisabledCancelCallback(ch.cyberduck.core.DisabledCancelCallback) DisabledHostKeyCallback(ch.cyberduck.core.DisabledHostKeyCallback) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) Credentials(ch.cyberduck.core.Credentials) DefaultX509TrustManager(ch.cyberduck.core.ssl.DefaultX509TrustManager) Before(org.junit.Before)

Example 98 with DisabledProgressListener

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());
}
Also used : Path(ch.cyberduck.core.Path) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) Delete(ch.cyberduck.core.features.Delete) SessionPool(ch.cyberduck.core.pool.SessionPool) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) MoveWorker(ch.cyberduck.core.worker.MoveWorker) SFTPWriteFeature(ch.cyberduck.core.sftp.SFTPWriteFeature) SFTPDeleteFeature(ch.cyberduck.core.sftp.SFTPDeleteFeature) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) DefaultTouchFeature(ch.cyberduck.core.shared.DefaultTouchFeature) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) DefaultFindFeature(ch.cyberduck.core.shared.DefaultFindFeature) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) SFTPDirectoryFeature(ch.cyberduck.core.sftp.SFTPDirectoryFeature) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) SFTPHomeDirectoryService(ch.cyberduck.core.sftp.SFTPHomeDirectoryService) Directory(ch.cyberduck.core.features.Directory) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractSFTPTest(ch.cyberduck.core.sftp.AbstractSFTPTest) Test(org.junit.Test)

Example 99 with DisabledProgressListener

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();
}
Also used : Path(ch.cyberduck.core.Path) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) Delete(ch.cyberduck.core.features.Delete) SessionPool(ch.cyberduck.core.pool.SessionPool) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) SFTPFindFeature(ch.cyberduck.core.sftp.SFTPFindFeature) MoveWorker(ch.cyberduck.core.worker.MoveWorker) SFTPDeleteFeature(ch.cyberduck.core.sftp.SFTPDeleteFeature) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) SFTPTouchFeature(ch.cyberduck.core.sftp.SFTPTouchFeature) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) DefaultFindFeature(ch.cyberduck.core.shared.DefaultFindFeature) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) SFTPDirectoryFeature(ch.cyberduck.core.sftp.SFTPDirectoryFeature) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) SFTPHomeDirectoryService(ch.cyberduck.core.sftp.SFTPHomeDirectoryService) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractSFTPTest(ch.cyberduck.core.sftp.AbstractSFTPTest) Test(org.junit.Test)

Example 100 with DisabledProgressListener

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();
}
Also used : Path(ch.cyberduck.core.Path) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) Delete(ch.cyberduck.core.features.Delete) SessionPool(ch.cyberduck.core.pool.SessionPool) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) SFTPFindFeature(ch.cyberduck.core.sftp.SFTPFindFeature) MoveWorker(ch.cyberduck.core.worker.MoveWorker) SFTPDeleteFeature(ch.cyberduck.core.sftp.SFTPDeleteFeature) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) SFTPTouchFeature(ch.cyberduck.core.sftp.SFTPTouchFeature) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) DefaultFindFeature(ch.cyberduck.core.shared.DefaultFindFeature) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) SFTPDirectoryFeature(ch.cyberduck.core.sftp.SFTPDirectoryFeature) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) SFTPHomeDirectoryService(ch.cyberduck.core.sftp.SFTPHomeDirectoryService) Directory(ch.cyberduck.core.features.Directory) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractSFTPTest(ch.cyberduck.core.sftp.AbstractSFTPTest) Test(org.junit.Test)

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