Search in sources :

Example 1 with FTPDirectoryFeature

use of ch.cyberduck.core.ftp.FTPDirectoryFeature in project cyberduck by iterate-ch.

the class FTPDirectoryFeatureTest method testMakeDirectoryLongFilenameEncrypted.

@Test
public void testMakeDirectoryLongFilenameEncrypted() 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.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));
    cryptomator.getFeature(session, Directory.class, new FTPDirectoryFeature(session)).mkdir(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) FTPDirectoryFeature(ch.cyberduck.core.ftp.FTPDirectoryFeature) 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) FTPDeleteFeature(ch.cyberduck.core.ftp.FTPDeleteFeature) 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) Directory(ch.cyberduck.core.features.Directory) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractFTPTest(ch.cyberduck.core.ftp.AbstractFTPTest)

Example 2 with FTPDirectoryFeature

use of ch.cyberduck.core.ftp.FTPDirectoryFeature 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 3 with FTPDirectoryFeature

use of ch.cyberduck.core.ftp.FTPDirectoryFeature in project cyberduck by iterate-ch.

the class FTPDirectoryFeatureTest method testMakeDirectoryEncrypted.

@Test
public void testMakeDirectoryEncrypted() 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 testdirectory = new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    final Path testdirectory2 = new Path(testdirectory, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    final Path testfile2 = new Path(testdirectory2, 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(testdirectory, new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(testdirectory));
    cryptomator.getFeature(session, Directory.class, new FTPDirectoryFeature(session)).mkdir(testdirectory2, new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(testdirectory2));
    assertFalse(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(testfile2));
    cryptomator.getFeature(session, Delete.class, new FTPDeleteFeature(session)).delete(Arrays.asList(testdirectory2, testdirectory), 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) DefaultHomeFinderService(ch.cyberduck.core.shared.DefaultHomeFinderService) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) FTPDeleteFeature(ch.cyberduck.core.ftp.FTPDeleteFeature) 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) Directory(ch.cyberduck.core.features.Directory) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractFTPTest(ch.cyberduck.core.ftp.AbstractFTPTest)

Example 4 with FTPDirectoryFeature

use of ch.cyberduck.core.ftp.FTPDirectoryFeature in project cyberduck by iterate-ch.

the class FTPListServiceTest method testListEmptyDirectoryList.

@Test
public void testListEmptyDirectoryList() throws Exception {
    final FTPListService list = new FTPListService(session, null, TimeZone.getDefault());
    list.remove(FTPListService.Command.stat);
    list.remove(FTPListService.Command.lista);
    list.remove(FTPListService.Command.mlsd);
    final Path home = new FTPWorkdirService(session).find();
    final Path directory = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    new FTPDirectoryFeature(session).mkdir(directory, new TransferStatus());
    assertTrue(list.list(directory, new DisabledListProgressListener()).isEmpty());
    new FTPDeleteFeature(session).delete(Collections.singletonList(directory), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
Also used : Path(ch.cyberduck.core.Path) FTPDirectoryFeature(ch.cyberduck.core.ftp.FTPDirectoryFeature) Delete(ch.cyberduck.core.features.Delete) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) FTPDeleteFeature(ch.cyberduck.core.ftp.FTPDeleteFeature) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) FTPWorkdirService(ch.cyberduck.core.ftp.FTPWorkdirService) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest) AbstractFTPTest(ch.cyberduck.core.ftp.AbstractFTPTest)

Aggregations

AlphanumericRandomStringService (ch.cyberduck.core.AlphanumericRandomStringService)4 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)4 Path (ch.cyberduck.core.Path)4 Delete (ch.cyberduck.core.features.Delete)4 AbstractFTPTest (ch.cyberduck.core.ftp.AbstractFTPTest)4 FTPDeleteFeature (ch.cyberduck.core.ftp.FTPDeleteFeature)4 FTPDirectoryFeature (ch.cyberduck.core.ftp.FTPDirectoryFeature)4 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)4 IntegrationTest (ch.cyberduck.test.IntegrationTest)4 Test (org.junit.Test)4 DisabledPasswordCallback (ch.cyberduck.core.DisabledPasswordCallback)3 DisabledPasswordStore (ch.cyberduck.core.DisabledPasswordStore)3 CryptoFindFeature (ch.cyberduck.core.cryptomator.features.CryptoFindFeature)3 Directory (ch.cyberduck.core.features.Directory)3 DefaultFindFeature (ch.cyberduck.core.shared.DefaultFindFeature)3 DefaultHomeFinderService (ch.cyberduck.core.shared.DefaultHomeFinderService)3 DefaultVaultRegistry (ch.cyberduck.core.vault.DefaultVaultRegistry)3 VaultCredentials (ch.cyberduck.core.vault.VaultCredentials)3 DisabledConnectionCallback (ch.cyberduck.core.DisabledConnectionCallback)1 DisabledListProgressListener (ch.cyberduck.core.DisabledListProgressListener)1