Search in sources :

Example 26 with DefaultVaultRegistry

use of ch.cyberduck.core.vault.DefaultVaultRegistry in project cyberduck by iterate-ch.

the class SwiftDirectoryFeatureTest method testMakeDirectoryEncrypted.

@Test
public void testMakeDirectoryEncrypted() throws Exception {
    final Path home = new Path("/test.cyberduck.ch", EnumSet.of(Path.Type.volume, Path.Type.directory));
    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.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 SwiftDirectoryFeature(session)).mkdir(test, new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(test));
    cryptomator.getFeature(session, Delete.class, new SwiftDeleteFeature(session)).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) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) SwiftDirectoryFeature(ch.cyberduck.core.openstack.SwiftDirectoryFeature) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) DefaultFindFeature(ch.cyberduck.core.shared.DefaultFindFeature) SwiftDeleteFeature(ch.cyberduck.core.openstack.SwiftDeleteFeature) 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) AbstractSwiftTest(ch.cyberduck.core.openstack.AbstractSwiftTest) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 27 with DefaultVaultRegistry

use of ch.cyberduck.core.vault.DefaultVaultRegistry in project cyberduck by iterate-ch.

the class SwiftDirectoryFeatureTest method testMakeDirectoryLongFilenameEncrypted.

@Test
public void testMakeDirectoryLongFilenameEncrypted() throws Exception {
    assumeTrue(vaultVersion == CryptoVault.VAULT_VERSION_DEPRECATED);
    final Path home = new Path("/test.cyberduck.ch", EnumSet.of(Path.Type.volume, Path.Type.directory));
    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 SwiftDirectoryFeature(session)).mkdir(test, new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(test));
    cryptomator.getFeature(session, Delete.class, new SwiftDeleteFeature(session)).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) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) SwiftDirectoryFeature(ch.cyberduck.core.openstack.SwiftDirectoryFeature) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) DefaultFindFeature(ch.cyberduck.core.shared.DefaultFindFeature) SwiftDeleteFeature(ch.cyberduck.core.openstack.SwiftDeleteFeature) 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) AbstractSwiftTest(ch.cyberduck.core.openstack.AbstractSwiftTest) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 28 with DefaultVaultRegistry

use of ch.cyberduck.core.vault.DefaultVaultRegistry in project cyberduck by iterate-ch.

the class S3DirectoryFeatureTest method testMakeDirectoryEncrypted.

@Test
public void testMakeDirectoryEncrypted() throws Exception {
    final Path home = new Path("test-eu-central-1-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
    final Path vault = new Path(home, new AlphanumericRandomStringService().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));
    final Path test = cryptomator.getFeature(session, Directory.class, new S3DirectoryFeature(session, new S3WriteFeature(session))).mkdir(new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus());
    final String versionId = test.attributes().getVersionId();
    assertTrue(test.getType().contains(Path.Type.placeholder));
    assertTrue(new CryptoFindFeature(session, new S3FindFeature(session), cryptomator).find(test));
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(test));
    final PathAttributes attributes = new CryptoAttributesFeature(session, new S3AttributesFinderFeature(session), cryptomator).find(test);
    assertEquals(versionId, attributes.getVersionId());
    cryptomator.getFeature(session, Delete.class, new S3DefaultDeleteFeature(session)).delete(Arrays.asList(test, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
Also used : Path(ch.cyberduck.core.Path) Delete(ch.cyberduck.core.features.Delete) S3AttributesFinderFeature(ch.cyberduck.core.s3.S3AttributesFinderFeature) S3FindFeature(ch.cyberduck.core.s3.S3FindFeature) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) S3DefaultDeleteFeature(ch.cyberduck.core.s3.S3DefaultDeleteFeature) PathAttributes(ch.cyberduck.core.PathAttributes) S3DirectoryFeature(ch.cyberduck.core.s3.S3DirectoryFeature) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) CryptoAttributesFeature(ch.cyberduck.core.cryptomator.features.CryptoAttributesFeature) 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) S3WriteFeature(ch.cyberduck.core.s3.S3WriteFeature) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) Directory(ch.cyberduck.core.features.Directory) AbstractS3Test(ch.cyberduck.core.s3.AbstractS3Test) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 29 with DefaultVaultRegistry

use of ch.cyberduck.core.vault.DefaultVaultRegistry in project cyberduck by iterate-ch.

the class S3DirectoryFeatureTest method testMakeDirectoryLongFilenameEncrypted.

@Test
public void testMakeDirectoryLongFilenameEncrypted() throws Exception {
    assumeTrue(vaultVersion == CryptoVault.VAULT_VERSION_DEPRECATED);
    final Path home = new Path("test-eu-central-1-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
    final Path vault = new Path(home, new AlphanumericRandomStringService().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));
    final Path test = cryptomator.getFeature(session, Directory.class, new S3DirectoryFeature(session, new S3WriteFeature(session))).mkdir(new Path(vault, new AlphanumericRandomStringService(130).random(), EnumSet.of(Path.Type.directory)), new TransferStatus());
    final String versionId = test.attributes().getVersionId();
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(test));
    final PathAttributes attributes = new CryptoAttributesFeature(session, new S3AttributesFinderFeature(session), cryptomator).find(test);
    assertEquals(versionId, attributes.getVersionId());
    cryptomator.getFeature(session, Delete.class, new S3DefaultDeleteFeature(session)).delete(Arrays.asList(test, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
Also used : Path(ch.cyberduck.core.Path) Delete(ch.cyberduck.core.features.Delete) S3AttributesFinderFeature(ch.cyberduck.core.s3.S3AttributesFinderFeature) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) S3DefaultDeleteFeature(ch.cyberduck.core.s3.S3DefaultDeleteFeature) PathAttributes(ch.cyberduck.core.PathAttributes) S3DirectoryFeature(ch.cyberduck.core.s3.S3DirectoryFeature) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) CryptoAttributesFeature(ch.cyberduck.core.cryptomator.features.CryptoAttributesFeature) 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) S3WriteFeature(ch.cyberduck.core.s3.S3WriteFeature) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) Directory(ch.cyberduck.core.features.Directory) AbstractS3Test(ch.cyberduck.core.s3.AbstractS3Test) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 30 with DefaultVaultRegistry

use of ch.cyberduck.core.vault.DefaultVaultRegistry in project cyberduck by iterate-ch.

the class S3MoveFeatureTest method testMove.

@Test
public void testMove() throws Exception {
    final Path home = new Path("test-eu-central-1-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
    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 S3DirectoryFeature(session, new S3WriteFeature(session))).mkdir(folder, new TransferStatus());
    new CryptoTouchFeature<StorageObject>(session, new S3TouchFeature(session), new S3WriteFeature(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 S3MoveFeature(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 S3FindFeature(session), cryptomator).find(file));
    assertTrue(new CryptoFindFeature(session, new S3FindFeature(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 S3FindFeature(session), cryptomator).find(folder));
    assertTrue(new CryptoFindFeature(session, new S3FindFeature(session), cryptomator).find(folderRenamed));
    final Path fileRenamedInRenamedFolder = new Path(folderRenamed, "f1", EnumSet.of(Path.Type.file));
    assertTrue(new CryptoFindFeature(session, new S3FindFeature(session), cryptomator).find(fileRenamedInRenamedFolder));
    cryptomator.getFeature(session, Delete.class, new S3DefaultDeleteFeature(session)).delete(Arrays.asList(fileRenamedInRenamedFolder, folderRenamed, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
Also used : Path(ch.cyberduck.core.Path) Delete(ch.cyberduck.core.features.Delete) S3FindFeature(ch.cyberduck.core.s3.S3FindFeature) VaultCredentials(ch.cyberduck.core.vault.VaultCredentials) StorageObject(org.jets3t.service.model.StorageObject) S3TouchFeature(ch.cyberduck.core.s3.S3TouchFeature) S3DefaultDeleteFeature(ch.cyberduck.core.s3.S3DefaultDeleteFeature) S3DirectoryFeature(ch.cyberduck.core.s3.S3DirectoryFeature) CryptoFindFeature(ch.cyberduck.core.cryptomator.features.CryptoFindFeature) 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) S3MoveFeature(ch.cyberduck.core.s3.S3MoveFeature) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) S3WriteFeature(ch.cyberduck.core.s3.S3WriteFeature) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) Directory(ch.cyberduck.core.features.Directory) AbstractS3Test(ch.cyberduck.core.s3.AbstractS3Test) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Aggregations

DefaultVaultRegistry (ch.cyberduck.core.vault.DefaultVaultRegistry)169 Test (org.junit.Test)169 DisabledPasswordCallback (ch.cyberduck.core.DisabledPasswordCallback)157 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)148 Path (ch.cyberduck.core.Path)146 VaultCredentials (ch.cyberduck.core.vault.VaultCredentials)145 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)143 DisabledPasswordStore (ch.cyberduck.core.DisabledPasswordStore)143 IntegrationTest (ch.cyberduck.test.IntegrationTest)143 Delete (ch.cyberduck.core.features.Delete)136 AlphanumericRandomStringService (ch.cyberduck.core.AlphanumericRandomStringService)135 CryptoFindFeature (ch.cyberduck.core.cryptomator.features.CryptoFindFeature)123 DefaultFindFeature (ch.cyberduck.core.shared.DefaultFindFeature)72 DisabledConnectionCallback (ch.cyberduck.core.DisabledConnectionCallback)70 CryptoAttributesFeature (ch.cyberduck.core.cryptomator.features.CryptoAttributesFeature)62 CryptoReadFeature (ch.cyberduck.core.cryptomator.features.CryptoReadFeature)50 StreamCopier (ch.cyberduck.core.io.StreamCopier)50 Directory (ch.cyberduck.core.features.Directory)49 InputStream (java.io.InputStream)47 DefaultTouchFeature (ch.cyberduck.core.shared.DefaultTouchFeature)44