@Test public void start() { ArgumentCaptor<InitiateMultipartUploadRequest> request = ArgumentCaptor .forClass(InitiateMultipartUploadRequest.class); InitiateMultipartUploadResult response = mock(InitiateMultipartUploadResult.class); when(response.getUploadId()).thenReturn(UPLOAD_ID); when(s3.initiateMultipartUpload(request.capture())).thenReturn(response); String result = underTest.start(); assertThat(result, is(UPLOAD_ID)); assertThat(request.getValue().getBucketName(), is(BUCKET)); assertThat(request.getValue().getKey(), is(KEY)); }
String start() { bytes = 0; InitiateMultipartUploadRequest request = new InitiateMultipartUploadRequest(bucket, key); if(enableServerSideEncryption) { ObjectMetadata objectMetadata = new ObjectMetadata(); objectMetadata.setSSEAlgorithm(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION); request.setObjectMetadata(objectMetadata); } String uploadId = s3.initiateMultipartUpload(request).getUploadId(); stopwatch.start(); log.info("Starting upload to s3: return uploadId; }
S3MultipartUpload { String start() { bytes = 0; InitiateMultipartUploadRequest request = new InitiateMultipartUploadRequest(bucket, key); if(enableServerSideEncryption) { ObjectMetadata objectMetadata = new ObjectMetadata(); objectMetadata.setSSEAlgorithm(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION); request.setObjectMetadata(objectMetadata); } String uploadId = s3.initiateMultipartUpload(request).getUploadId(); stopwatch.start(); log.info("Starting upload to s3: return uploadId; } }
S3MultipartUpload { String start() { bytes = 0; InitiateMultipartUploadRequest request = new InitiateMultipartUploadRequest(bucket, key); if(enableServerSideEncryption) { ObjectMetadata objectMetadata = new ObjectMetadata(); objectMetadata.setSSEAlgorithm(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION); request.setObjectMetadata(objectMetadata); } String uploadId = s3.initiateMultipartUpload(request).getUploadId(); stopwatch.start(); log.info("Starting upload to s3: return uploadId; }  }
S3MultipartUpload { String start() { bytes = 0; InitiateMultipartUploadRequest request = new InitiateMultipartUploadRequest(bucket, key); if(enableServerSideEncryption) { ObjectMetadata objectMetadata = new ObjectMetadata(); objectMetadata.setSSEAlgorithm(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION); request.setObjectMetadata(objectMetadata); } String uploadId = s3.initiateMultipartUpload(request).getUploadId(); stopwatch.start(); log.info("Starting upload to s3: return uploadId; }   }
S3MultipartUpload { String start() { bytes = 0; InitiateMultipartUploadRequest request = new InitiateMultipartUploadRequest(bucket, key); if(enableServerSideEncryption) { ObjectMetadata objectMetadata = new ObjectMetadata(); objectMetadata.setSSEAlgorithm(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION); request.setObjectMetadata(objectMetadata); } String uploadId = s3.initiateMultipartUpload(request).getUploadId(); stopwatch.start(); log.info("Starting upload to s3: return uploadId; }    }