@Test public void testTouch() throws Exception { final Path container = new Path("test-us-east-1-cyberduck", EnumSet.of(Path.Type.volume)); final Path test = new S3TouchFeature(session).touch( new Path(container, new AsciiRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus().withMime("text/plain")); assertNull(test.attributes().getVersionId()); assertTrue(new S3FindFeature(session).find(test)); final Map<String, String> metadata = new S3MetadataFeature(session, new S3AccessControlListFeature(session)).getMetadata(test); assertFalse(metadata.isEmpty()); assertEquals("text/plain", metadata.get("Content-Type")); assertEquals(test.attributes(), new S3AttributesFinderFeature(session).find(test)); new S3DefaultDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); assertFalse(new S3FindFeature(session).find(test)); }
@Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { status.setChecksum(writer.checksum(file, status).compute(new NullInputStream(0L), status)); status.setLength(0L); final StatusOutputStream<StorageObject> out = writer.write(file, status, new DisabledConnectionCallback()); new DefaultStreamCloser().close(out); final S3Object metadata = (S3Object) out.getStatus(); return new Path(file.getParent(), file.getName(), file.getType(), new S3AttributesFinderFeature(session).toAttributes(metadata)); }
S3TouchFeature implements Touch<StorageObject> { @Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { status.setChecksum(writer.checksum(file, status).compute(new NullInputStream(0L), status)); status.setLength(0L); final StatusOutputStream<StorageObject> out = writer.write(file, status, new DisabledConnectionCallback()); new DefaultStreamCloser().close(out); final S3Object metadata = (S3Object) out.getStatus(); return new Path(file.getParent(), file.getName(), file.getType(), new S3AttributesFinderFeature(session).toAttributes(metadata)); } }
S3TouchFeature implements Touch<StorageObject> { @Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { status.setChecksum(writer.checksum(file, status).compute(new NullInputStream(0L), status)); status.setLength(0L); final StatusOutputStream<StorageObject> out = writer.write(file, status, new DisabledConnectionCallback()); new DefaultStreamCloser().close(out); final S3Object metadata = (S3Object) out.getStatus(); return new Path(file.getParent(), file.getName(), file.getType(), new S3AttributesFinderFeature(session).toAttributes(metadata)); } S3TouchFeature(final S3Session session); }
S3TouchFeature implements Touch<StorageObject> { @Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { status.setChecksum(writer.checksum(file, status).compute(new NullInputStream(0L), status)); status.setLength(0L); final StatusOutputStream<StorageObject> out = writer.write(file, status, new DisabledConnectionCallback()); new DefaultStreamCloser().close(out); final S3Object metadata = (S3Object) out.getStatus(); return new Path(file.getParent(), file.getName(), file.getType(), new S3AttributesFinderFeature(session).toAttributes(metadata)); } S3TouchFeature(final S3Session session); @Override Path touch(final Path file, final TransferStatus status); @Override boolean isSupported(final Path workdir, final String filename); @Override Touch<StorageObject> withWriter(final Write<StorageObject> writer); }
S3TouchFeature implements Touch<StorageObject> { @Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { status.setChecksum(writer.checksum(file, status).compute(new NullInputStream(0L), status)); status.setLength(0L); final StatusOutputStream<StorageObject> out = writer.write(file, status, new DisabledConnectionCallback()); new DefaultStreamCloser().close(out); final S3Object metadata = (S3Object) out.getStatus(); return new Path(file.getParent(), file.getName(), file.getType(), new S3AttributesFinderFeature(session).toAttributes(metadata)); } S3TouchFeature(final S3Session session); @Override Path touch(final Path file, final TransferStatus status); @Override boolean isSupported(final Path workdir, final String filename); @Override Touch<StorageObject> withWriter(final Write<StorageObject> writer);  }