Search in sources :

Example 16 with DAVWriteFeature

use of ch.cyberduck.core.dav.DAVWriteFeature in project cyberduck by iterate-ch.

the class CopyWorkerTest method testCopyToDifferentFolderCryptomator.

@Test
public void testCopyToDifferentFolderCryptomator() throws Exception {
    final Path home = new DefaultHomeFinderService(session).find();
    final Path vault = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    final Path source = new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
    final Path targetFolder = new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    final Path target = new Path(targetFolder, 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);
    new CryptoTouchFeature<>(session, new DefaultTouchFeature<>(new DAVWriteFeature(session)), new DAVWriteFeature(session), cryptomator).touch(source, new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(source));
    cryptomator.getFeature(session, Directory.class, new DAVDirectoryFeature(session)).mkdir(targetFolder, new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(targetFolder));
    final CopyWorker worker = new CopyWorker(Collections.singletonMap(source, target), new SessionPool.SingleSessionPool(session, registry), PathCache.empty(), new DisabledProgressListener(), new DisabledConnectionCallback());
    worker.run(session);
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(source));
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(target));
    new DeleteWorker(new DisabledLoginCallback(), Collections.singletonList(vault), PathCache.empty(), new DisabledProgressListener()).run(session);
}
Also used : Path(ch.cyberduck.core.Path) DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) SessionPool(ch.cyberduck.core.pool.SessionPool) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) DeleteWorker(ch.cyberduck.core.worker.DeleteWorker) DefaultHomeFinderService(ch.cyberduck.core.shared.DefaultHomeFinderService) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) CopyWorker(ch.cyberduck.core.worker.CopyWorker) DefaultTouchFeature(ch.cyberduck.core.shared.DefaultTouchFeature) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) DefaultFindFeature(ch.cyberduck.core.shared.DefaultFindFeature) DAVWriteFeature(ch.cyberduck.core.dav.DAVWriteFeature) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) DAVDirectoryFeature(ch.cyberduck.core.dav.DAVDirectoryFeature) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) Directory(ch.cyberduck.core.features.Directory) AbstractDAVTest(ch.cyberduck.core.dav.AbstractDAVTest) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 17 with DAVWriteFeature

use of ch.cyberduck.core.dav.DAVWriteFeature in project cyberduck by iterate-ch.

the class DAVTouchFeatureTest method testTouchLongFilenameEncryptedDefaultFeature.

@Test
public void testTouchLongFilenameEncryptedDefaultFeature() throws Exception {
    assumeTrue(vaultVersion == CryptoVault.VAULT_VERSION_DEPRECATED);
    final Path home = new DefaultHomeFinderService(session).find();
    final Path vault = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    final Path test = new Path(vault, 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 DAVWriteFeature(session)), new DAVWriteFeature(session), cryptomator).touch(test, new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(test));
    cryptomator.getFeature(session, Delete.class, new DAVDeleteFeature(session)).delete(Arrays.asList(test, 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) DefaultHomeFinderService(ch.cyberduck.core.shared.DefaultHomeFinderService) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) DAVDeleteFeature(ch.cyberduck.core.dav.DAVDeleteFeature) DefaultTouchFeature(ch.cyberduck.core.shared.DefaultTouchFeature) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) DefaultFindFeature(ch.cyberduck.core.shared.DefaultFindFeature) DAVWriteFeature(ch.cyberduck.core.dav.DAVWriteFeature) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) AbstractDAVTest(ch.cyberduck.core.dav.AbstractDAVTest) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Aggregations

AlphanumericRandomStringService (ch.cyberduck.core.AlphanumericRandomStringService)17 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)17 Path (ch.cyberduck.core.Path)17 DAVWriteFeature (ch.cyberduck.core.dav.DAVWriteFeature)17 DefaultHomeFinderService (ch.cyberduck.core.shared.DefaultHomeFinderService)17 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)17 IntegrationTest (ch.cyberduck.test.IntegrationTest)17 Test (org.junit.Test)17 DisabledPasswordCallback (ch.cyberduck.core.DisabledPasswordCallback)16 DisabledPasswordStore (ch.cyberduck.core.DisabledPasswordStore)16 AbstractDAVTest (ch.cyberduck.core.dav.AbstractDAVTest)16 DefaultVaultRegistry (ch.cyberduck.core.vault.DefaultVaultRegistry)16 VaultCredentials (ch.cyberduck.core.vault.VaultCredentials)16 CryptoFindFeature (ch.cyberduck.core.cryptomator.features.CryptoFindFeature)14 DisabledConnectionCallback (ch.cyberduck.core.DisabledConnectionCallback)13 DAVDeleteFeature (ch.cyberduck.core.dav.DAVDeleteFeature)11 DefaultFindFeature (ch.cyberduck.core.shared.DefaultFindFeature)11 DAVFindFeature (ch.cyberduck.core.dav.DAVFindFeature)10 DisabledProgressListener (ch.cyberduck.core.DisabledProgressListener)9 DAVDirectoryFeature (ch.cyberduck.core.dav.DAVDirectoryFeature)9