Search in sources :

Example 1 with AsciiRandomStringService

use of ch.cyberduck.core.AsciiRandomStringService in project cyberduck by iterate-ch.

the class DropboxWriteFeatureTest method testWriteLibreOfficeLockHash.

@Test(expected = AccessDeniedException.class)
public void testWriteLibreOfficeLockHash() throws Exception {
    final DropboxWriteFeature write = new DropboxWriteFeature(session);
    final TransferStatus status = new TransferStatus();
    final byte[] content = RandomUtils.nextBytes(0);
    status.setLength(content.length);
    final Path test = new Path(new DefaultHomeFinderService(session).find(), ".~lock." + new AsciiRandomStringService().random() + "#", EnumSet.of(Path.Type.file));
    final OutputStream out = write.write(test, status, new DisabledConnectionCallback());
    new StreamCopier(new TransferStatus(), new TransferStatus()).transfer(new ByteArrayInputStream(content), out);
}
Also used : Path(ch.cyberduck.core.Path) AsciiRandomStringService(ch.cyberduck.core.AsciiRandomStringService) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OutputStream(java.io.OutputStream) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) DefaultHomeFinderService(ch.cyberduck.core.shared.DefaultHomeFinderService) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) StreamCopier(ch.cyberduck.core.io.StreamCopier) AbstractDropboxTest(ch.cyberduck.core.AbstractDropboxTest) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 2 with AsciiRandomStringService

use of ch.cyberduck.core.AsciiRandomStringService in project cyberduck by iterate-ch.

the class DropboxWriteFeatureTest method testWriteLibreOfficeLock.

@Test(expected = AccessDeniedException.class)
public void testWriteLibreOfficeLock() throws Exception {
    final DropboxWriteFeature write = new DropboxWriteFeature(session);
    final TransferStatus status = new TransferStatus();
    final byte[] content = RandomUtils.nextBytes(0);
    status.setLength(content.length);
    final Path test = new Path(new DefaultHomeFinderService(session).find(), ".~lock." + new AsciiRandomStringService().random(), EnumSet.of(Path.Type.file));
    final OutputStream out = write.write(test, status, new DisabledConnectionCallback());
    new StreamCopier(new TransferStatus(), new TransferStatus()).transfer(new ByteArrayInputStream(content), out);
}
Also used : Path(ch.cyberduck.core.Path) AsciiRandomStringService(ch.cyberduck.core.AsciiRandomStringService) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OutputStream(java.io.OutputStream) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) DefaultHomeFinderService(ch.cyberduck.core.shared.DefaultHomeFinderService) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) StreamCopier(ch.cyberduck.core.io.StreamCopier) AbstractDropboxTest(ch.cyberduck.core.AbstractDropboxTest) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 3 with AsciiRandomStringService

use of ch.cyberduck.core.AsciiRandomStringService in project cyberduck by iterate-ch.

the class GoogleStorageWebsiteDistributionConfigurationTest method testWrite.

@Test
public void testWrite() throws Exception {
    final DistributionConfiguration configuration = new GoogleStorageWebsiteDistributionConfiguration(session);
    final Path bucket = new Path(new AsciiRandomStringService().random().toLowerCase(Locale.ROOT), EnumSet.of(Path.Type.directory, Path.Type.volume));
    new GoogleStorageDirectoryFeature(session).mkdir(bucket, new TransferStatus());
    configuration.write(bucket, new Distribution(Distribution.WEBSITE, null, true), new DisabledLoginCallback());
    final Distribution distribution = configuration.read(bucket, Distribution.WEBSITE, new DisabledLoginCallback());
    assertTrue(distribution.isEnabled());
    assertEquals(configuration.getName(), distribution.getName());
    new GoogleStorageDeleteFeature(session).delete(Collections.<Path>singletonList(bucket), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
Also used : Path(ch.cyberduck.core.Path) Delete(ch.cyberduck.core.features.Delete) AsciiRandomStringService(ch.cyberduck.core.AsciiRandomStringService) Distribution(ch.cyberduck.core.cdn.Distribution) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) DistributionConfiguration(ch.cyberduck.core.cdn.DistributionConfiguration) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 4 with AsciiRandomStringService

use of ch.cyberduck.core.AsciiRandomStringService in project cyberduck by iterate-ch.

the class GoogleStorageMoveFeatureTest method testMoveWithServerSideEncryptionBucketPolicy.

@Test
public void testMoveWithServerSideEncryptionBucketPolicy() throws Exception {
    final Path container = new Path("cyberduck-test-eu", EnumSet.of(Path.Type.directory, Path.Type.volume));
    final Path test = new Path(container, new AsciiRandomStringService().random(), EnumSet.of(Path.Type.file));
    final GoogleStorageTouchFeature touch = new GoogleStorageTouchFeature(session);
    final TransferStatus status = new TransferStatus();
    status.setEncryption(new Encryption.Algorithm("AES256", null));
    touch.touch(test, status);
    assertTrue(new GoogleStorageFindFeature(session).find(test));
    final Path renamed = new Path(container, new AsciiRandomStringService().random(), EnumSet.of(Path.Type.file));
    new GoogleStorageMoveFeature(session).move(test, renamed, new TransferStatus(), new Delete.DisabledCallback(), new DisabledConnectionCallback());
    assertFalse(new GoogleStorageFindFeature(session).find(test));
    assertTrue(new GoogleStorageFindFeature(session).find(renamed));
    new GoogleStorageDeleteFeature(session).delete(Collections.singletonList(renamed), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
Also used : Path(ch.cyberduck.core.Path) Delete(ch.cyberduck.core.features.Delete) AsciiRandomStringService(ch.cyberduck.core.AsciiRandomStringService) Encryption(ch.cyberduck.core.features.Encryption) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 5 with AsciiRandomStringService

use of ch.cyberduck.core.AsciiRandomStringService in project cyberduck by iterate-ch.

the class GoogleStorageDeleteFeatureTest method testDeleteContainer.

@Test
public void testDeleteContainer() throws Exception {
    final Path container = new Path(new AsciiRandomStringService().random().toLowerCase(Locale.ROOT), EnumSet.of(Path.Type.volume, Path.Type.directory));
    container.attributes().setRegion("us");
    new GoogleStorageDirectoryFeature(session).mkdir(container, new TransferStatus());
    assertTrue(new GoogleStorageFindFeature(session).find(container));
    new GoogleStorageDeleteFeature(session).delete(Collections.singletonList(container), new DisabledLoginCallback(), new Delete.DisabledCallback());
    assertFalse(new GoogleStorageFindFeature(session).find(container));
}
Also used : Path(ch.cyberduck.core.Path) Delete(ch.cyberduck.core.features.Delete) AsciiRandomStringService(ch.cyberduck.core.AsciiRandomStringService) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Aggregations

AsciiRandomStringService (ch.cyberduck.core.AsciiRandomStringService)66 Path (ch.cyberduck.core.Path)64 Test (org.junit.Test)64 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)61 IntegrationTest (ch.cyberduck.test.IntegrationTest)56 Delete (ch.cyberduck.core.features.Delete)52 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)51 DisabledConnectionCallback (ch.cyberduck.core.DisabledConnectionCallback)22 DisabledListProgressListener (ch.cyberduck.core.DisabledListProgressListener)18 AlphanumericRandomStringService (ch.cyberduck.core.AlphanumericRandomStringService)12 Host (ch.cyberduck.core.Host)8 ByteArrayInputStream (java.io.ByteArrayInputStream)8 StreamCopier (ch.cyberduck.core.io.StreamCopier)7 DisabledProgressListener (ch.cyberduck.core.DisabledProgressListener)6 NullLocal (ch.cyberduck.core.NullLocal)5 NullTransferSession (ch.cyberduck.core.NullTransferSession)5 SimplePathPredicate (ch.cyberduck.core.SimplePathPredicate)5 TestProtocol (ch.cyberduck.core.TestProtocol)5 DisabledStreamListener (ch.cyberduck.core.io.DisabledStreamListener)5 DefaultHomeFinderService (ch.cyberduck.core.shared.DefaultHomeFinderService)5