Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SQS test #5203

Merged
merged 4 commits into from
May 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import software.amazon.awssdk.http.AbortableInputStream;
import software.amazon.awssdk.http.HttpExecuteResponse;
import software.amazon.awssdk.http.SdkHttpResponse;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.sqs.internal.MessageMD5ChecksumInterceptor;
import software.amazon.awssdk.services.sqs.model.MessageAttributeValue;
import software.amazon.awssdk.services.sqs.model.SendMessageResponse;
Expand All @@ -43,6 +44,7 @@
*/
public class MessageMD5ChecksumValidationDisableTest {
private static final AwsBasicCredentials CLIENT_CREDENTIALS = AwsBasicCredentials.create("ca", "cs");
private static final Region CLIENT_REGION = Region.US_WEST_2;
private static final String MESSAGE_ID = "0f433476-621e-4638-811a-112d2c2e41d7";

private MockAsyncHttpClient asyncHttpClient;
Expand All @@ -65,6 +67,7 @@ public void md5ValidationEnabled_default_md5InResponse_Works() {
asyncHttpClient.stubResponses(responseWithMd5());
SqsAsyncClient client = SqsAsyncClient.builder()
.credentialsProvider(StaticCredentialsProvider.create(CLIENT_CREDENTIALS))
.region(CLIENT_REGION)
.httpClient(asyncHttpClient)
.build();

Expand All @@ -79,6 +82,7 @@ public void md5ValidationEnabled_default_noMd5InResponse_throwsException() {
asyncHttpClient.stubResponses(responseWithoutMd5());
SqsAsyncClient client = SqsAsyncClient.builder()
.credentialsProvider(StaticCredentialsProvider.create(CLIENT_CREDENTIALS))
.region(CLIENT_REGION)
.httpClient(asyncHttpClient)
.build();

Expand All @@ -93,6 +97,7 @@ public void md5ValidationDisabled_md5InResponse_Works() {
asyncHttpClient.stubResponses(responseWithMd5());
SqsAsyncClient client = SqsAsyncClient.builder()
.credentialsProvider(StaticCredentialsProvider.create(CLIENT_CREDENTIALS))
.region(CLIENT_REGION)
.httpClient(asyncHttpClient)
.checksumValidationEnabled(false)
.build();
Expand All @@ -108,6 +113,7 @@ public void md5ValidationDisabled_noMd5InResponse_Works() {
asyncHttpClient.stubResponses(responseWithoutMd5());
SqsAsyncClient client = SqsAsyncClient.builder()
.credentialsProvider(StaticCredentialsProvider.create(CLIENT_CREDENTIALS))
.region(CLIENT_REGION)
.httpClient(asyncHttpClient)
.checksumValidationEnabled(false)
.build();
Expand All @@ -123,6 +129,7 @@ public void sync_md5ValidationDisabled_noMd5InResponse_Works() {
syncHttpClient.stubResponses(responseWithoutMd5());
SqsClient client = SqsClient.builder()
.credentialsProvider(StaticCredentialsProvider.create(CLIENT_CREDENTIALS))
.region(CLIENT_REGION)
.httpClient(syncHttpClient)
.checksumValidationEnabled(false)
.build();
Expand Down Expand Up @@ -154,7 +161,7 @@ private static HttpExecuteResponse responseWithoutMd5() {
}

protected static Map<String, MessageAttributeValue> createAttributeValues() {
Map<String, MessageAttributeValue> attrs = new HashMap();
Map<String, MessageAttributeValue> attrs = new HashMap<>();
attrs.put("attribute-1", MessageAttributeValue.builder().dataType("String").stringValue("tmp").build());
return Collections.unmodifiableMap(attrs);
}
Expand Down
Loading