use of com.amazonaws.s3.model.GetObjectRequest in project aws-sdk-java-v2 by aws.
the class SyncServerSideEncryptionIntegrationTest method sse_AWSKMS_succeeds.
@Test
public void sse_AWSKMS_succeeds() throws Exception {
String key = UUID.randomUUID().toString();
PutObjectRequest request = PutObjectRequest.builder().key(key).bucket(BUCKET).serverSideEncryption(ServerSideEncryption.AWS_KMS).build();
s3.putObject(request, file.toPath());
GetObjectRequest getObjectRequest = GetObjectRequest.builder().key(key).bucket(BUCKET).build();
String response = s3.getObject(getObjectRequest, ResponseTransformer.toBytes()).asUtf8String();
SdkAsserts.assertStringEqualsStream(response, new FileInputStream(file));
}
use of com.amazonaws.s3.model.GetObjectRequest in project aws-sdk-java-v2 by aws.
the class SyncServerSideEncryptionIntegrationTest method sse_onBucket_succeeds.
@Test
public void sse_onBucket_succeeds() throws FileNotFoundException {
String key = UUID.randomUUID().toString();
PutObjectRequest request = PutObjectRequest.builder().key(key).bucket(BUCKET_WITH_SSE).build();
s3.putObject(request, file.toPath());
GetObjectRequest getObjectRequest = GetObjectRequest.builder().key(key).bucket(BUCKET_WITH_SSE).build();
String response = s3.getObject(getObjectRequest, ResponseTransformer.toBytes()).asUtf8String();
SdkAsserts.assertStringEqualsStream(response, new FileInputStream(file));
}
use of com.amazonaws.s3.model.GetObjectRequest in project aws-sdk-java-v2 by aws.
the class AsyncServerSideEncryptionIntegrationTest method sse_onBucket_succeeds.
@Test
public void sse_onBucket_succeeds() throws FileNotFoundException {
String key = UUID.randomUUID().toString();
PutObjectRequest request = PutObjectRequest.builder().key(key).bucket(BUCKET_WITH_SSE).build();
s3Async.putObject(request, file.toPath()).join();
GetObjectRequest getObjectRequest = GetObjectRequest.builder().key(key).bucket(BUCKET_WITH_SSE).build();
verifyGetResponse(getObjectRequest);
}
use of com.amazonaws.s3.model.GetObjectRequest in project aws-sdk-java-v2 by aws.
the class GetBucketPolicyInterceptorTest method nonGetBucketPolicyResponse_ShouldNotModifyResponse.
@Test
public void nonGetBucketPolicyResponse_ShouldNotModifyResponse() {
GetObjectRequest request = GetObjectRequest.builder().build();
Context.ModifyHttpResponse context = modifyHttpResponseContent(request, SdkHttpResponse.builder().statusCode(200).build());
Optional<InputStream> inputStream = interceptor.modifyHttpResponseContent(context, new ExecutionAttributes());
assertThat(inputStream).isEqualTo(context.responseBody());
}
use of com.amazonaws.s3.model.GetObjectRequest in project aws-sdk-java-v2 by aws.
the class GetObjectPresignRequestTest method equalsAndHashCode_differentProperty_getObjectRequest.
@Test
public void equalsAndHashCode_differentProperty_getObjectRequest() {
GetObjectRequest otherGetObjectRequest = GetObjectRequest.builder().bucket("other-bucket").key("other-key").build();
GetObjectPresignRequest getObjectPresignRequest = GetObjectPresignRequest.builder().getObjectRequest(GET_OBJECT_REQUEST).signatureDuration(Duration.ofSeconds(123L)).build();
GetObjectPresignRequest otherGetObjectPresignRequest = GetObjectPresignRequest.builder().getObjectRequest(otherGetObjectRequest).signatureDuration(Duration.ofSeconds(123L)).build();
assertThat(otherGetObjectPresignRequest).isNotEqualTo(getObjectPresignRequest);
assertThat(otherGetObjectPresignRequest.hashCode()).isNotEqualTo(getObjectPresignRequest.hashCode());
}
Aggregations