Search in sources :

Example 1 with AzureMoveFeature

use of ch.cyberduck.core.azure.AzureMoveFeature in project cyberduck by iterate-ch.

the class AzureMoveFeatureTest method testMove.

@Test
public void testMove() throws Exception {
    final Path home = new Path("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 Path folder = cryptomator.getFeature(session, Directory.class, new AzureDirectoryFeature(session, null)).mkdir(new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus());
    final Path file = new CryptoTouchFeature<Void>(session, new AzureTouchFeature(session, null), new AzureWriteFeature(session, null), cryptomator).touch(new Path(folder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(file));
    final Move move = cryptomator.getFeature(session, Move.class, new AzureMoveFeature(session, null));
    // 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 AzureFindFeature(session, null), cryptomator).find(file));
    assertTrue(new CryptoFindFeature(session, new AzureFindFeature(session, null), cryptomator).find(fileRenamed));
    // rename folder
    final Path folderRenamed = new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.placeholder));
    move.move(folder, folderRenamed, new TransferStatus(), new Delete.DisabledCallback(), new DisabledConnectionCallback());
    assertFalse(new CryptoFindFeature(session, new AzureFindFeature(session, null), cryptomator).find(folder));
    assertTrue(new CryptoFindFeature(session, new AzureFindFeature(session, null), cryptomator).find(folderRenamed));
    final Path fileRenamedInRenamedFolder = new Path(folderRenamed, "f1", EnumSet.of(Path.Type.file));
    assertTrue(new CryptoFindFeature(session, new AzureFindFeature(session, null), cryptomator).find(fileRenamedInRenamedFolder));
    cryptomator.getFeature(session, Delete.class, new AzureDeleteFeature(session, null)).delete(Arrays.asList(fileRenamedInRenamedFolder, folderRenamed, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
    session.close();
}
Also used : Path(ch.cyberduck.core.Path) Delete(ch.cyberduck.core.features.Delete) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) AzureFindFeature(ch.cyberduck.core.azure.AzureFindFeature) AzureDirectoryFeature(ch.cyberduck.core.azure.AzureDirectoryFeature) AzureWriteFeature(ch.cyberduck.core.azure.AzureWriteFeature) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) AzureMoveFeature(ch.cyberduck.core.azure.AzureMoveFeature) AzureTouchFeature(ch.cyberduck.core.azure.AzureTouchFeature) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) DefaultFindFeature(ch.cyberduck.core.shared.DefaultFindFeature) Move(ch.cyberduck.core.features.Move) AzureDeleteFeature(ch.cyberduck.core.azure.AzureDeleteFeature) 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) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) Directory(ch.cyberduck.core.features.Directory) AbstractAzureTest(ch.cyberduck.core.azure.AbstractAzureTest) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Aggregations

AlphanumericRandomStringService (ch.cyberduck.core.AlphanumericRandomStringService)1 DisabledConnectionCallback (ch.cyberduck.core.DisabledConnectionCallback)1 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)1 DisabledPasswordCallback (ch.cyberduck.core.DisabledPasswordCallback)1 DisabledPasswordStore (ch.cyberduck.core.DisabledPasswordStore)1 Path (ch.cyberduck.core.Path)1 AbstractAzureTest (ch.cyberduck.core.azure.AbstractAzureTest)1 AzureDeleteFeature (ch.cyberduck.core.azure.AzureDeleteFeature)1 AzureDirectoryFeature (ch.cyberduck.core.azure.AzureDirectoryFeature)1 AzureFindFeature (ch.cyberduck.core.azure.AzureFindFeature)1 AzureMoveFeature (ch.cyberduck.core.azure.AzureMoveFeature)1 AzureTouchFeature (ch.cyberduck.core.azure.AzureTouchFeature)1 AzureWriteFeature (ch.cyberduck.core.azure.AzureWriteFeature)1 CryptoFindFeature (ch.cyberduck.core.cryptomator.features.CryptoFindFeature)1 Delete (ch.cyberduck.core.features.Delete)1 Directory (ch.cyberduck.core.features.Directory)1 Move (ch.cyberduck.core.features.Move)1 DefaultFindFeature (ch.cyberduck.core.shared.DefaultFindFeature)1 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)1 DefaultVaultRegistry (ch.cyberduck.core.vault.DefaultVaultRegistry)1