Search in sources :

Example 6 with SFTPListService

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

the class SFTPAttributesFinderFeatureTest method testFindDefaultAttributesFinderWithCacheCryptomator.

@Test
public void testFindDefaultAttributesFinderWithCacheCryptomator() throws Exception {
    final Path home = new SFTPHomeDirectoryService(session).find();
    final Path vault = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    final CryptoVault cryptomator = new CryptoVault(vault);
    cryptomator.create(session, new VaultCredentials("test"), new DisabledPasswordStore(), vaultVersion);
    session.withRegistry(new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator));
    final Path test = new CryptoTouchFeature<>(session, new DefaultTouchFeature<>(new SFTPWriteFeature(session)), new SFTPWriteFeature(session), cryptomator).touch(new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
    final Path found = new CryptoListService(session, new SFTPListService(session), cryptomator).list(test.getParent(), new DisabledListProgressListener()).get(test);
    assertEquals(0L, found.attributes().getSize());
    final Cache<Path> cache = new PathCache(1);
    final AttributedList<Path> list = new AttributedList<>();
    list.add(found);
    cache.put(vault, list);
    final PathAttributes attributes = new CachingAttributesFinderFeature(cache, new CryptoAttributesFeature(session, new DefaultAttributesFinderFeature(session), cryptomator)).find(test);
    assertNotNull(attributes);
    assertEquals(0L, attributes.getSize());
    assertEquals(0L, cache.get(vault).get(0).attributes().getSize());
    cryptomator.getFeature(session, Delete.class, new SFTPDeleteFeature(session)).delete(Arrays.asList(test, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
Also used : Delete(ch.cyberduck.core.features.Delete) CryptoListService(ch.cyberduck.core.cryptomator.features.CryptoListService) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) CachingAttributesFinderFeature(ch.cyberduck.core.CachingAttributesFinderFeature) SFTPWriteFeature(ch.cyberduck.core.sftp.SFTPWriteFeature) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) Path(ch.cyberduck.core.Path) PathCache(ch.cyberduck.core.PathCache) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) PathAttributes(ch.cyberduck.core.PathAttributes) SFTPDeleteFeature(ch.cyberduck.core.sftp.SFTPDeleteFeature) CryptoAttributesFeature(ch.cyberduck.core.cryptomator.features.CryptoAttributesFeature) DefaultTouchFeature(ch.cyberduck.core.shared.DefaultTouchFeature) DefaultAttributesFinderFeature(ch.cyberduck.core.shared.DefaultAttributesFinderFeature) AttributedList(ch.cyberduck.core.AttributedList) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) SFTPListService(ch.cyberduck.core.sftp.SFTPListService) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) SFTPHomeDirectoryService(ch.cyberduck.core.sftp.SFTPHomeDirectoryService) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractSFTPTest(ch.cyberduck.core.sftp.AbstractSFTPTest)

Example 7 with SFTPListService

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

the class SFTPListServiceTest method testListCryptomator.

@Test
public void testListCryptomator() 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 test = new Path(vault, 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));
    assertTrue(new CryptoListService(session, new SFTPListService(session), cryptomator).list(vault, new DisabledListProgressListener()).isEmpty());
    new CryptoTouchFeature<>(session, new CryptoTouchFeature<>(session, new DefaultTouchFeature<>(new SFTPWriteFeature(session)), new SFTPWriteFeature(session), cryptomator), new SFTPWriteFeature(session), cryptomator).touch(test, new TransferStatus());
    Assert.assertEquals(test, new CryptoListService(session, new SFTPListService(session), cryptomator).list(vault, new DisabledListProgressListener()).get(0));
    cryptomator.getFeature(session, Delete.class, new SFTPDeleteFeature(session)).delete(Arrays.asList(test, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
Also used : Path(ch.cyberduck.core.Path) Delete(ch.cyberduck.core.features.Delete) CryptoListService(ch.cyberduck.core.cryptomator.features.CryptoListService) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) SFTPWriteFeature(ch.cyberduck.core.sftp.SFTPWriteFeature) SFTPDeleteFeature(ch.cyberduck.core.sftp.SFTPDeleteFeature) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) SFTPListService(ch.cyberduck.core.sftp.SFTPListService) CryptoTouchFeature(ch.cyberduck.core.cryptomator.features.CryptoTouchFeature) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) SFTPHomeDirectoryService(ch.cyberduck.core.sftp.SFTPHomeDirectoryService) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractSFTPTest(ch.cyberduck.core.sftp.AbstractSFTPTest)

Example 8 with SFTPListService

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

the class SFTPSymlinkFeatureTest method testSymlink.

@Test
public void testSymlink() 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 CryptoVault cryptomator = new CryptoVault(vault);
    cryptomator.create(session, new VaultCredentials("test"), new DisabledPasswordStore(), vaultVersion);
    session.withRegistry(new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator));
    final Path target = new Path(vault, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
    new CryptoTouchFeature<>(session, new CryptoTouchFeature<>(session, new DefaultTouchFeature<>(new SFTPWriteFeature(session)), new SFTPWriteFeature(session), cryptomator), new SFTPWriteFeature(session), cryptomator).touch(target, new TransferStatus());
    final Path link = new Path(vault, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file, AbstractPath.Type.symboliclink));
    new CryptoSymlinkFeature(session, new SFTPSymlinkFeature(session), cryptomator).symlink(link, target.getName());
    assertTrue(new CryptoFindFeature(session, new SFTPFindFeature(session), cryptomator).find(link));
    assertEquals(EnumSet.of(Path.Type.file, Path.Type.symboliclink, Path.Type.decrypted), new CryptoListService(session, new SFTPListService(session), cryptomator).list(vault, new DisabledListProgressListener()).get(link).getType());
    cryptomator.getFeature(session, Delete.class, new SFTPDeleteFeature(session)).delete(Collections.singletonList(link), new DisabledLoginCallback(), new Delete.DisabledCallback());
    assertFalse(new CryptoFindFeature(session, new SFTPFindFeature(session), cryptomator).find(link));
    assertTrue(new CryptoFindFeature(session, new SFTPFindFeature(session), cryptomator).find(target));
    cryptomator.getFeature(session, Delete.class, new SFTPDeleteFeature(session)).delete(Collections.singletonList(target), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
Also used : AbstractPath(ch.cyberduck.core.AbstractPath) Path(ch.cyberduck.core.Path) Delete(ch.cyberduck.core.features.Delete) CryptoListService(ch.cyberduck.core.cryptomator.features.CryptoListService) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) SFTPFindFeature(ch.cyberduck.core.sftp.SFTPFindFeature) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) CryptoSymlinkFeature(ch.cyberduck.core.cryptomator.features.CryptoSymlinkFeature) SFTPSymlinkFeature(ch.cyberduck.core.sftp.SFTPSymlinkFeature) 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) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) SFTPListService(ch.cyberduck.core.sftp.SFTPListService) CryptoTouchFeature(ch.cyberduck.core.cryptomator.features.CryptoTouchFeature) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) SFTPHomeDirectoryService(ch.cyberduck.core.sftp.SFTPHomeDirectoryService) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractSFTPTest(ch.cyberduck.core.sftp.AbstractSFTPTest)

Aggregations

CryptoListService (ch.cyberduck.core.cryptomator.features.CryptoListService)8 Delete (ch.cyberduck.core.features.Delete)8 AbstractSFTPTest (ch.cyberduck.core.sftp.AbstractSFTPTest)8 SFTPDeleteFeature (ch.cyberduck.core.sftp.SFTPDeleteFeature)8 SFTPHomeDirectoryService (ch.cyberduck.core.sftp.SFTPHomeDirectoryService)8 SFTPListService (ch.cyberduck.core.sftp.SFTPListService)8 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)8 DefaultVaultRegistry (ch.cyberduck.core.vault.DefaultVaultRegistry)8 VaultCredentials (ch.cyberduck.core.vault.VaultCredentials)8 IntegrationTest (ch.cyberduck.test.IntegrationTest)8 Test (org.junit.Test)8 DisabledListProgressListener (ch.cyberduck.core.DisabledListProgressListener)7 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)7 DisabledPasswordCallback (ch.cyberduck.core.DisabledPasswordCallback)7 DisabledPasswordStore (ch.cyberduck.core.DisabledPasswordStore)7 Path (ch.cyberduck.core.Path)7 SFTPWriteFeature (ch.cyberduck.core.sftp.SFTPWriteFeature)7 CryptoFindFeature (ch.cyberduck.core.cryptomator.features.CryptoFindFeature)6 SFTPFindFeature (ch.cyberduck.core.sftp.SFTPFindFeature)6 AlphanumericRandomStringService (ch.cyberduck.core.AlphanumericRandomStringService)5