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