@Test(expected = NotfoundException.class) public void testUploadInvalidContainer() throws Exception { final S3SingleUploadService m = new S3SingleUploadService(session, new S3WriteFeature(session, new S3DisabledMultipartService())); final Path container = new Path("nosuchcontainer.cyberduck.ch", EnumSet.of(Path.Type.directory, Path.Type.volume)); final Path test = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); final Local local = new Local(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()); LocalTouchFactory.get().touch(local); final TransferStatus status = new TransferStatus(); m.upload(test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledStreamListener(), status, new DisabledLoginCallback()); }
@Override public StorageObject upload(final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final S3Protocol.AuthenticationHeaderSignatureVersion signatureVersion = session.getSignatureVersion(); switch(signatureVersion) { case AWS4HMACSHA256: if(!HashAlgorithm.sha256.equals(status.getChecksum().algorithm)) { status.setChecksum(writer.checksum(file, status).compute(local.getInputStream(), status)); } break; } try { return super.upload(file, local, throttle, listener, status, callback); } catch(InteroperabilityException e) { if(!session.getSignatureVersion().equals(signatureVersion)) { return this.upload(file, local, throttle, listener, status, callback); } throw e; } }
S3SingleUploadService extends HttpUploadFeature<StorageObject, MessageDigest> { @Override public StorageObject upload(final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final S3Protocol.AuthenticationHeaderSignatureVersion signatureVersion = session.getSignatureVersion(); switch(signatureVersion) { case AWS4HMACSHA256: if(!HashAlgorithm.sha256.equals(status.getChecksum().algorithm)) { status.setChecksum(writer.checksum(file, status).compute(local.getInputStream(), status)); } break; } try { return super.upload(file, local, throttle, listener, status, callback); } catch(InteroperabilityException e) { if(!session.getSignatureVersion().equals(signatureVersion)) { return this.upload(file, local, throttle, listener, status, callback); } throw e; } } }
S3SingleUploadService extends HttpUploadFeature<StorageObject, MessageDigest> { @Override public StorageObject upload(final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final S3Protocol.AuthenticationHeaderSignatureVersion signatureVersion = session.getSignatureVersion(); switch(signatureVersion) { case AWS4HMACSHA256: if(!HashAlgorithm.sha256.equals(status.getChecksum().algorithm)) { status.setChecksum(writer.checksum(file, status).compute(local.getInputStream(), status)); } break; } try { return super.upload(file, local, throttle, listener, status, callback); } catch(InteroperabilityException e) { if(!session.getSignatureVersion().equals(signatureVersion)) { return this.upload(file, local, throttle, listener, status, callback); } throw e; } } S3SingleUploadService(final S3Session session, final Write<StorageObject> writer); }
S3SingleUploadService extends HttpUploadFeature<StorageObject, MessageDigest> { @Override public StorageObject upload(final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final S3Protocol.AuthenticationHeaderSignatureVersion signatureVersion = session.getSignatureVersion(); switch(signatureVersion) { case AWS4HMACSHA256: if(!HashAlgorithm.sha256.equals(status.getChecksum().algorithm)) { status.setChecksum(writer.checksum(file, status).compute(local.getInputStream(), status)); } break; } try { return super.upload(file, local, throttle, listener, status, callback); } catch(InteroperabilityException e) { if(!session.getSignatureVersion().equals(signatureVersion)) { return this.upload(file, local, throttle, listener, status, callback); } throw e; } } S3SingleUploadService(final S3Session session, final Write<StorageObject> writer); @Override StorageObject upload(final Path file, final Local local, final BandwidthThrottle throttle,
                                final StreamListener listener, final TransferStatus status, final ConnectionCallback callback); @Override Upload<StorageObject> withWriter(final Write<StorageObject> writer); }
S3SingleUploadService extends HttpUploadFeature<StorageObject, MessageDigest> { @Override public StorageObject upload(final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final S3Protocol.AuthenticationHeaderSignatureVersion signatureVersion = session.getSignatureVersion(); switch(signatureVersion) { case AWS4HMACSHA256: if(!HashAlgorithm.sha256.equals(status.getChecksum().algorithm)) { status.setChecksum(writer.checksum(file, status).compute(local.getInputStream(), status)); } break; } try { return super.upload(file, local, throttle, listener, status, callback); } catch(InteroperabilityException e) { if(!session.getSignatureVersion().equals(signatureVersion)) { return this.upload(file, local, throttle, listener, status, callback); } throw e; } } S3SingleUploadService(final S3Session session, final Write<StorageObject> writer); @Override StorageObject upload(final Path file, final Local local, final BandwidthThrottle throttle,
                                final StreamListener listener, final TransferStatus status, final ConnectionCallback callback); @Override Upload<StorageObject> withWriter(final Write<StorageObject> writer);  }