use of software.amazon.awssdk.testutils.service.http.MockSyncHttpClient in project aws-sdk-java-v2 by aws.
the class TraceIdTest method traceIdInterceptorIsEnabled.
@Test
public void traceIdInterceptorIsEnabled() {
EnvironmentVariableHelper.run(env -> {
env.set("AWS_LAMBDA_FUNCTION_NAME", "foo");
env.set("_X_AMZN_TRACE_ID", "bar");
try (MockSyncHttpClient mockHttpClient = new MockSyncHttpClient();
ProtocolRestJsonClient client = ProtocolRestJsonClient.builder().region(Region.US_WEST_2).credentialsProvider(AnonymousCredentialsProvider.create()).httpClient(mockHttpClient).build()) {
mockHttpClient.stubNextResponse(HttpExecuteResponse.builder().response(SdkHttpResponse.builder().statusCode(200).build()).responseBody(AbortableInputStream.create(new StringInputStream("{}"))).build());
client.allTypes();
assertThat(mockHttpClient.getLastRequest().firstMatchingHeader("X-Amzn-Trace-Id")).hasValue("bar");
}
});
}
use of software.amazon.awssdk.testutils.service.http.MockSyncHttpClient in project aws-sdk-java-v2 by aws.
the class S3ObjectLambdaEndpointResolutionTest method setup.
@BeforeEach
public void setup() throws UnsupportedEncodingException {
mockHttpClient = new MockSyncHttpClient();
mockHttpClient.stubNextResponse(mockListObjectsResponse());
}
use of software.amazon.awssdk.testutils.service.http.MockSyncHttpClient in project aws-sdk-java-v2 by aws.
the class MultiRegionAccessPointSigningFunctionalTest method setup.
@BeforeEach
public void setup() throws UnsupportedEncodingException {
mockHttpClient = new MockSyncHttpClient();
mockHttpClient.stubNextResponse(mockListObjectsResponse());
}
use of software.amazon.awssdk.testutils.service.http.MockSyncHttpClient in project aws-sdk-java-v2 by aws.
the class OutpostAccessPointArnEndpointResolutionTest method setup.
@BeforeEach
public void setup() {
mockHttpClient = new MockSyncHttpClient();
mockSigner = (request, executionAttributes) -> request;
}
use of software.amazon.awssdk.testutils.service.http.MockSyncHttpClient in project aws-sdk-java-v2 by aws.
the class HostPrefixTest method setupClient.
@BeforeEach
public void setupClient() {
mockHttpClient = new MockSyncHttpClient();
mockAsyncClient = new MockAsyncHttpClient();
client = ProtocolRestJsonClient.builder().credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create("akid", "skid"))).region(Region.US_EAST_1).endpointOverride(URI.create("http://localhost")).httpClient(mockHttpClient).build();
asyncClient = ProtocolRestJsonAsyncClient.builder().credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create("akid", "skid"))).region(Region.US_EAST_1).endpointOverride(URI.create("http://localhost")).httpClient(mockAsyncClient).build();
}
Aggregations