Search in sources :

Example 1 with AsyncAws4Signer

use of software.amazon.awssdk.auth.signer.AsyncAws4Signer in project aws-sdk-java-v2 by aws.

the class SignedAsyncRequestBodyUploadIntegrationTest method setup.

@BeforeClass
public static void setup() throws Exception {
    S3IntegrationTestBase.setUp();
    // Use a mock so we can introspect easily to verify that the signer was used for the request
    mockSigner = mock(TestSigner.class);
    AsyncAws4Signer realSigner = AsyncAws4Signer.create();
    when(mockSigner.sign(any(SdkHttpFullRequest.class), any(AsyncRequestBody.class), any(ExecutionAttributes.class))).thenAnswer(i -> {
        SdkHttpFullRequest request = i.getArgument(0, SdkHttpFullRequest.class);
        AsyncRequestBody body = i.getArgument(1, AsyncRequestBody.class);
        ExecutionAttributes executionAttributes = i.getArgument(2, ExecutionAttributes.class);
        return realSigner.sign(request, body, executionAttributes);
    });
    testClient = s3AsyncClientBuilder().overrideConfiguration(o -> o.putAdvancedOption(SIGNER, mockSigner).addExecutionInterceptor(capturingInterceptor)).build();
    createBucket(BUCKET);
}
Also used : SdkHttpFullRequest(software.amazon.awssdk.http.SdkHttpFullRequest) ExecutionAttributes(software.amazon.awssdk.core.interceptor.ExecutionAttributes) AsyncRequestBody(software.amazon.awssdk.core.async.AsyncRequestBody) AsyncAws4Signer(software.amazon.awssdk.auth.signer.AsyncAws4Signer) BeforeClass(org.junit.BeforeClass)

Aggregations

BeforeClass (org.junit.BeforeClass)1 AsyncAws4Signer (software.amazon.awssdk.auth.signer.AsyncAws4Signer)1 AsyncRequestBody (software.amazon.awssdk.core.async.AsyncRequestBody)1 ExecutionAttributes (software.amazon.awssdk.core.interceptor.ExecutionAttributes)1 SdkHttpFullRequest (software.amazon.awssdk.http.SdkHttpFullRequest)1