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);
}
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);
}
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());
}
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());
}
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));
}
Aggregations