Search in sources :

Example 41 with DefaultTouchFeature

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

the class DriveMoveFeatureTest method testMove.

@Test
public void testMove() throws Exception {
    final Path home = DriveHomeFinderService.MYDRIVE_FOLDER;
    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 DriveFileIdProvider fileid = new DriveFileIdProvider(session);
    final Path folder = cryptomator.getFeature(session, Directory.class, new DriveDirectoryFeature(session, fileid)).mkdir(new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus());
    final Path file = new CryptoTouchFeature<>(session, new DefaultTouchFeature<>(new DriveWriteFeature(session, fileid)), new DriveWriteFeature(session, fileid), 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 DriveMoveFeature(session, fileid));
    // rename file
    final Path fileRenamed = move.move(file, new Path(folder, "f1", EnumSet.of(Path.Type.file)), new TransferStatus(), new Delete.DisabledCallback(), new DisabledConnectionCallback());
    assertEquals(file.attributes().getFileId(), fileRenamed.attributes().getFileId());
    assertFalse(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(file));
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(fileRenamed));
    assertEquals(fileRenamed.attributes().getFileId(), new CryptoAttributesFeature(session, new DriveAttributesFinderFeature(session, fileid), cryptomator).find(fileRenamed).getFileId());
    // 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 DriveDeleteFeature(session, fileid)).delete(Arrays.asList(fileRenamedInRenamedFolder, folderRenamed, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
Also used : Delete(ch.cyberduck.core.features.Delete) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) DefaultFindFeature(ch.cyberduck.core.shared.DefaultFindFeature) Move(ch.cyberduck.core.features.Move) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) DriveMoveFeature(ch.cyberduck.core.googledrive.DriveMoveFeature) Directory(ch.cyberduck.core.features.Directory) Path(ch.cyberduck.core.Path) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) DriveWriteFeature(ch.cyberduck.core.googledrive.DriveWriteFeature) DriveDeleteFeature(ch.cyberduck.core.googledrive.DriveDeleteFeature) DriveDirectoryFeature(ch.cyberduck.core.googledrive.DriveDirectoryFeature) DriveAttributesFinderFeature(ch.cyberduck.core.googledrive.DriveAttributesFinderFeature) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) CryptoAttributesFeature(ch.cyberduck.core.cryptomator.features.CryptoAttributesFeature) DefaultTouchFeature(ch.cyberduck.core.shared.DefaultTouchFeature) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) DriveFileIdProvider(ch.cyberduck.core.googledrive.DriveFileIdProvider) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) AbstractDriveTest(ch.cyberduck.core.googledrive.AbstractDriveTest) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 42 with DefaultTouchFeature

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

the class DriveTouchFeatureTest method testTouch.

@Test
public void testTouch() throws Exception {
    final Path home = DriveHomeFinderService.MYDRIVE_FOLDER;
    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 DriveFileIdProvider idProvider = new DriveFileIdProvider(session);
    final Path test = new CryptoTouchFeature<>(session, new DefaultTouchFeature<>(new DriveWriteFeature(session, idProvider)), new DriveWriteFeature(session, idProvider), cryptomator).touch(new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(test));
    final Path found = new CryptoListService(session, new DriveListService(session, idProvider), cryptomator).list(test.getParent(), new DisabledListProgressListener()).find(new SimplePathPredicate(test));
    final String fileId = found.attributes().getFileId();
    assertNotNull(fileId);
    cryptomator.getFeature(session, Delete.class, new DriveDeleteFeature(session, idProvider)).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) DriveListService(ch.cyberduck.core.googledrive.DriveListService) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) DriveWriteFeature(ch.cyberduck.core.googledrive.DriveWriteFeature) DriveDeleteFeature(ch.cyberduck.core.googledrive.DriveDeleteFeature) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) DefaultTouchFeature(ch.cyberduck.core.shared.DefaultTouchFeature) 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) SimplePathPredicate(ch.cyberduck.core.SimplePathPredicate) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) DriveFileIdProvider(ch.cyberduck.core.googledrive.DriveFileIdProvider) AbstractDriveTest(ch.cyberduck.core.googledrive.AbstractDriveTest) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 43 with DefaultTouchFeature

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

the class AzureListServiceTest method testListCryptomator.

@Test
public void testListCryptomator() 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 test = new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
    assertTrue(new CryptoListService(session, new AzureObjectListService(session, null), cryptomator).list(vault, new DisabledListProgressListener()).isEmpty());
    new CryptoTouchFeature<>(session, new DefaultTouchFeature<>(new AzureWriteFeature(session, null)), new AzureWriteFeature(session, null), cryptomator).touch(test, new TransferStatus());
    assertEquals(test, new CryptoListService(session, new AzureObjectListService(session, null), cryptomator).list(vault, new DisabledListProgressListener()).get(0));
    cryptomator.getFeature(session, Delete.class, new AzureDeleteFeature(session, null)).delete(Arrays.asList(test, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
    session.close();
}
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) AzureObjectListService(ch.cyberduck.core.azure.AzureObjectListService) AzureWriteFeature(ch.cyberduck.core.azure.AzureWriteFeature) DefaultTouchFeature(ch.cyberduck.core.shared.DefaultTouchFeature) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) 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) AbstractAzureTest(ch.cyberduck.core.azure.AbstractAzureTest) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 44 with DefaultTouchFeature

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

the class B2ListServiceTest method testListCryptomator.

@Test
public void testListCryptomator() throws Exception {
    final Path home = new Path("test-cyberduck", EnumSet.of(Path.Type.volume, Path.Type.directory));
    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);
    assertTrue(new CryptoListService(session, new B2ListService(session, fileid), cryptomator).list(vault, new DisabledListProgressListener()).isEmpty());
    final Path test = new CryptoTouchFeature<BaseB2Response>(session, new DefaultTouchFeature<BaseB2Response>(new B2WriteFeature(session, fileid)), new B2WriteFeature(session, fileid), cryptomator).touch(new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
    test.attributes().setVersionId(new CryptoVersionIdProvider(session, fileid, cryptomator).getVersionId(test, new DisabledListProgressListener()));
    assertEquals(test, new CryptoListService(session, new B2ListService(session, fileid), cryptomator).list(vault, new DisabledListProgressListener()).get(0));
    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) CryptoListService(ch.cyberduck.core.cryptomator.features.CryptoListService) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) B2ListService(ch.cyberduck.core.b2.B2ListService) B2VersionIdProvider(ch.cyberduck.core.b2.B2VersionIdProvider) B2WriteFeature(ch.cyberduck.core.b2.B2WriteFeature) DefaultTouchFeature(ch.cyberduck.core.shared.DefaultTouchFeature) B2DeleteFeature(ch.cyberduck.core.b2.B2DeleteFeature) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) BaseB2Response(synapticloop.b2.response.BaseB2Response) CryptoVersionIdProvider(ch.cyberduck.core.cryptomator.features.CryptoVersionIdProvider) 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)

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