Search in sources :

Example 6 with SFTPMoveFeature

use of ch.cyberduck.core.sftp.SFTPMoveFeature in project cyberduck by iterate-ch.

the class SFTPMoveFeatureTest method testMoveToDifferentFolderCryptomator.

@Test
public void testMoveToDifferentFolderCryptomator() throws Exception {
    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, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
    final Path targetFolder = new Path(vault, UUID.randomUUID().toString(), EnumSet.of(Path.Type.directory));
    final Path target = new Path(targetFolder, UUID.randomUUID().toString(), 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 CryptoTouchFeature<>(session, new DefaultTouchFeature<>(new SFTPWriteFeature(session)), new SFTPWriteFeature(session), cryptomator), 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));
    cryptomator.getFeature(session, Move.class, new SFTPMoveFeature(session)).move(source, target, new TransferStatus(), new Delete.DisabledCallback(), new DisabledConnectionCallback());
    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) Delete(ch.cyberduck.core.features.Delete) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) SFTPWriteFeature(ch.cyberduck.core.sftp.SFTPWriteFeature) SFTPDeleteFeature(ch.cyberduck.core.sftp.SFTPDeleteFeature) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) DefaultFindFeature(ch.cyberduck.core.shared.DefaultFindFeature) Move(ch.cyberduck.core.features.Move) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) CryptoTouchFeature(ch.cyberduck.core.cryptomator.features.CryptoTouchFeature) SFTPDirectoryFeature(ch.cyberduck.core.sftp.SFTPDirectoryFeature) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) SFTPHomeDirectoryService(ch.cyberduck.core.sftp.SFTPHomeDirectoryService) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) Directory(ch.cyberduck.core.features.Directory) SFTPMoveFeature(ch.cyberduck.core.sftp.SFTPMoveFeature) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractSFTPTest(ch.cyberduck.core.sftp.AbstractSFTPTest)

Aggregations

DisabledConnectionCallback (ch.cyberduck.core.DisabledConnectionCallback)6 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)6 DisabledPasswordCallback (ch.cyberduck.core.DisabledPasswordCallback)6 DisabledPasswordStore (ch.cyberduck.core.DisabledPasswordStore)6 Path (ch.cyberduck.core.Path)6 CryptoFindFeature (ch.cyberduck.core.cryptomator.features.CryptoFindFeature)6 Delete (ch.cyberduck.core.features.Delete)6 Move (ch.cyberduck.core.features.Move)6 AbstractSFTPTest (ch.cyberduck.core.sftp.AbstractSFTPTest)6 SFTPDeleteFeature (ch.cyberduck.core.sftp.SFTPDeleteFeature)6 SFTPHomeDirectoryService (ch.cyberduck.core.sftp.SFTPHomeDirectoryService)6 SFTPMoveFeature (ch.cyberduck.core.sftp.SFTPMoveFeature)6 DefaultFindFeature (ch.cyberduck.core.shared.DefaultFindFeature)6 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)6 DefaultVaultRegistry (ch.cyberduck.core.vault.DefaultVaultRegistry)6 VaultCredentials (ch.cyberduck.core.vault.VaultCredentials)6 IntegrationTest (ch.cyberduck.test.IntegrationTest)6 Test (org.junit.Test)6 CryptoTouchFeature (ch.cyberduck.core.cryptomator.features.CryptoTouchFeature)5 Directory (ch.cyberduck.core.features.Directory)5