Search in sources :

Example 1 with RequestOverrideConfiguration

use of software.amazon.awssdk.core.RequestOverrideConfiguration in project aws-sdk-java-v2 by aws.

the class ApplyUserAgentInterceptorTest method ddbRequest_shouldModifyRequest.

@Test
public void ddbRequest_shouldModifyRequest() {
    GetItemRequest getItemRequest = GetItemRequest.builder().build();
    SdkRequest sdkRequest = interceptor.modifyRequest(() -> getItemRequest, new ExecutionAttributes());
    RequestOverrideConfiguration requestOverrideConfiguration = sdkRequest.overrideConfiguration().get();
    assertThat(requestOverrideConfiguration.apiNames().stream().filter(a -> a.name().equals("hll") && a.version().equals("ddb-enh")).findAny()).isPresent();
}
Also used : Test(org.junit.jupiter.api.Test) List(java.util.List) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) GetItemRequest(software.amazon.awssdk.services.dynamodb.model.GetItemRequest) Optional(java.util.Optional) RequestOverrideConfiguration(software.amazon.awssdk.core.RequestOverrideConfiguration) ExecutionAttributes(software.amazon.awssdk.core.interceptor.ExecutionAttributes) SdkField(software.amazon.awssdk.core.SdkField) SdkRequest(software.amazon.awssdk.core.SdkRequest) ExecutionAttributes(software.amazon.awssdk.core.interceptor.ExecutionAttributes) SdkRequest(software.amazon.awssdk.core.SdkRequest) RequestOverrideConfiguration(software.amazon.awssdk.core.RequestOverrideConfiguration) GetItemRequest(software.amazon.awssdk.services.dynamodb.model.GetItemRequest) Test(org.junit.jupiter.api.Test)

Example 2 with RequestOverrideConfiguration

use of software.amazon.awssdk.core.RequestOverrideConfiguration in project aws-sdk-java-v2 by aws.

the class ApplyUserAgentInterceptorTest method s3Request_shouldModifyRequest.

@Test
void s3Request_shouldModifyRequest() {
    GetObjectRequest getItemRequest = GetObjectRequest.builder().build();
    SdkRequest sdkRequest = interceptor.modifyRequest(() -> getItemRequest, new ExecutionAttributes());
    RequestOverrideConfiguration requestOverrideConfiguration = sdkRequest.overrideConfiguration().get();
    assertThat(requestOverrideConfiguration.apiNames().stream().anyMatch(a -> a.name().equals("ft") && a.version().equals("s3-transfer"))).isTrue();
}
Also used : ExecutionAttributes(software.amazon.awssdk.core.interceptor.ExecutionAttributes) SdkRequest(software.amazon.awssdk.core.SdkRequest) RequestOverrideConfiguration(software.amazon.awssdk.core.RequestOverrideConfiguration) GetObjectRequest(software.amazon.awssdk.services.s3.model.GetObjectRequest) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)2 RequestOverrideConfiguration (software.amazon.awssdk.core.RequestOverrideConfiguration)2 SdkRequest (software.amazon.awssdk.core.SdkRequest)2 ExecutionAttributes (software.amazon.awssdk.core.interceptor.ExecutionAttributes)2 List (java.util.List)1 Optional (java.util.Optional)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 SdkField (software.amazon.awssdk.core.SdkField)1 GetItemRequest (software.amazon.awssdk.services.dynamodb.model.GetItemRequest)1 GetObjectRequest (software.amazon.awssdk.services.s3.model.GetObjectRequest)1