Search in sources :

Example 1 with DefaultTouchFeature

use of ch.cyberduck.core.shared.DefaultTouchFeature in project cyberduck by iterate-ch.

the class B2TouchFeatureTest method testTouchEncryptedDefaultFeature.

@Test
public void testTouchEncryptedDefaultFeature() throws Exception {
    final Path home = new Path("/test-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
    final CryptoVault cryptomator = new CryptoVault(new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)));
    final Path vault = cryptomator.create(session, new VaultCredentials("test"), new DisabledPasswordStore(), vaultVersion);
    session.withRegistry(new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator));
    final B2VersionIdProvider fileid = new B2VersionIdProvider(session);
    final Path test = new CryptoTouchFeature<>(session, new DefaultTouchFeature<>(new B2WriteFeature(session, fileid)), new B2WriteFeature(session, fileid), cryptomator).touch(new Path(vault, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)), new TransferStatus());
    assertNotNull(test.attributes().getVersionId());
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(test));
    cryptomator.getFeature(session, Delete.class, new B2DeleteFeature(session, fileid)).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) B2VersionIdProvider(ch.cyberduck.core.b2.B2VersionIdProvider) B2WriteFeature(ch.cyberduck.core.b2.B2WriteFeature) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) DefaultTouchFeature(ch.cyberduck.core.shared.DefaultTouchFeature) B2DeleteFeature(ch.cyberduck.core.b2.B2DeleteFeature) 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) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) AbstractB2Test(ch.cyberduck.core.b2.AbstractB2Test) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 2 with DefaultTouchFeature

use of ch.cyberduck.core.shared.DefaultTouchFeature in project cyberduck by iterate-ch.

the class FTPListServiceTest method testListCryptomator.

@Test
public void testListCryptomator() 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 test = new Path(vault, new AlphanumericRandomStringService().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));
    assertTrue(new CryptoListService(session, new FTPListService(session, null, null), cryptomator).list(vault, new DisabledListProgressListener()).isEmpty());
    new CryptoTouchFeature<>(session, new DefaultTouchFeature<>(new FTPWriteFeature(session)), new FTPWriteFeature(session), cryptomator).touch(test, new TransferStatus());
    assertEquals(test, new CryptoListService(session, new FTPListService(session, null, null), cryptomator).list(vault, new DisabledListProgressListener()).get(0));
    cryptomator.getFeature(session, Delete.class, new FTPDeleteFeature(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) DefaultHomeFinderService(ch.cyberduck.core.shared.DefaultHomeFinderService) DefaultTouchFeature(ch.cyberduck.core.shared.DefaultTouchFeature) FTPDeleteFeature(ch.cyberduck.core.ftp.FTPDeleteFeature) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) FTPListService(ch.cyberduck.core.ftp.list.FTPListService) FTPWriteFeature(ch.cyberduck.core.ftp.FTPWriteFeature) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractFTPTest(ch.cyberduck.core.ftp.AbstractFTPTest)

Example 3 with DefaultTouchFeature

use of ch.cyberduck.core.shared.DefaultTouchFeature in project cyberduck by iterate-ch.

the class FTPMoveFeatureTest method testMove.

@Test
public void testMove() 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 folder = new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    final Path file = new Path(folder, new AlphanumericRandomStringService().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));
    cryptomator.getFeature(session, Directory.class, new FTPDirectoryFeature(session)).mkdir(folder, new TransferStatus());
    new CryptoTouchFeature<>(session, new DefaultTouchFeature<>(new FTPWriteFeature(session)), new FTPWriteFeature(session), cryptomator).touch(file, new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(file));
    final Move move = cryptomator.getFeature(session, Move.class, new FTPMoveFeature(session));
    // rename file
    final Path fileRenamed = new Path(folder, "f1", EnumSet.of(Path.Type.file));
    move.move(file, fileRenamed, new TransferStatus(), new Delete.DisabledCallback(), new DisabledConnectionCallback());
    assertFalse(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(file));
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(fileRenamed));
    // rename folder
    final Path folderRenamed = new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    move.move(folder, folderRenamed, new TransferStatus(), new Delete.DisabledCallback(), new DisabledConnectionCallback());
    assertFalse(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(folder));
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(folderRenamed));
    final Path fileRenamedInRenamedFolder = new Path(folderRenamed, "f1", EnumSet.of(Path.Type.file));
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(fileRenamedInRenamedFolder));
    cryptomator.getFeature(session, Delete.class, new FTPDeleteFeature(session)).delete(Arrays.asList(fileRenamedInRenamedFolder, folderRenamed, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
Also used : Path(ch.cyberduck.core.Path) FTPDirectoryFeature(ch.cyberduck.core.ftp.FTPDirectoryFeature) Delete(ch.cyberduck.core.features.Delete) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) FTPMoveFeature(ch.cyberduck.core.ftp.FTPMoveFeature) DefaultHomeFinderService(ch.cyberduck.core.shared.DefaultHomeFinderService) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) DefaultTouchFeature(ch.cyberduck.core.shared.DefaultTouchFeature) FTPDeleteFeature(ch.cyberduck.core.ftp.FTPDeleteFeature) 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) FTPWriteFeature(ch.cyberduck.core.ftp.FTPWriteFeature) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) Directory(ch.cyberduck.core.features.Directory) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractFTPTest(ch.cyberduck.core.ftp.AbstractFTPTest)

Example 4 with DefaultTouchFeature

use of ch.cyberduck.core.shared.DefaultTouchFeature in project cyberduck by iterate-ch.

the class FTPTouchFeatureTest 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 FTPWriteFeature(session)), new FTPWriteFeature(session), cryptomator).touch(test, new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(test));
    cryptomator.getFeature(session, Delete.class, new FTPDeleteFeature(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) DefaultTouchFeature(ch.cyberduck.core.shared.DefaultTouchFeature) FTPDeleteFeature(ch.cyberduck.core.ftp.FTPDeleteFeature) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) DefaultFindFeature(ch.cyberduck.core.shared.DefaultFindFeature) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) FTPWriteFeature(ch.cyberduck.core.ftp.FTPWriteFeature) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractFTPTest(ch.cyberduck.core.ftp.AbstractFTPTest)

Example 5 with DefaultTouchFeature

use of ch.cyberduck.core.shared.DefaultTouchFeature in project cyberduck by iterate-ch.

the class FTPTouchFeatureTest method testTouchLongFilenameEncrypted.

@Test
public void testTouchLongFilenameEncrypted() 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 FTPWriteFeature(session)), new FTPWriteFeature(session), cryptomator).touch(test, new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(test));
    cryptomator.getFeature(session, Delete.class, new FTPDeleteFeature(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) DefaultTouchFeature(ch.cyberduck.core.shared.DefaultTouchFeature) FTPDeleteFeature(ch.cyberduck.core.ftp.FTPDeleteFeature) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) DefaultFindFeature(ch.cyberduck.core.shared.DefaultFindFeature) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) FTPWriteFeature(ch.cyberduck.core.ftp.FTPWriteFeature) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractFTPTest(ch.cyberduck.core.ftp.AbstractFTPTest)

Aggregations

DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)44 DisabledPasswordCallback (ch.cyberduck.core.DisabledPasswordCallback)44 DisabledPasswordStore (ch.cyberduck.core.DisabledPasswordStore)44 Path (ch.cyberduck.core.Path)44 DefaultTouchFeature (ch.cyberduck.core.shared.DefaultTouchFeature)44 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)44 DefaultVaultRegistry (ch.cyberduck.core.vault.DefaultVaultRegistry)44 VaultCredentials (ch.cyberduck.core.vault.VaultCredentials)44 IntegrationTest (ch.cyberduck.test.IntegrationTest)44 Test (org.junit.Test)44 AlphanumericRandomStringService (ch.cyberduck.core.AlphanumericRandomStringService)42 Delete (ch.cyberduck.core.features.Delete)40 CryptoFindFeature (ch.cyberduck.core.cryptomator.features.CryptoFindFeature)30 DefaultFindFeature (ch.cyberduck.core.shared.DefaultFindFeature)28 DefaultHomeFinderService (ch.cyberduck.core.shared.DefaultHomeFinderService)16 Directory (ch.cyberduck.core.features.Directory)15 DisabledListProgressListener (ch.cyberduck.core.DisabledListProgressListener)14 CryptoListService (ch.cyberduck.core.cryptomator.features.CryptoListService)14 CryptoAttributesFeature (ch.cyberduck.core.cryptomator.features.CryptoAttributesFeature)13 DisabledConnectionCallback (ch.cyberduck.core.DisabledConnectionCallback)9