29
29
import software .amazon .awssdk .http .AbortableInputStream ;
30
30
import software .amazon .awssdk .http .HttpExecuteResponse ;
31
31
import software .amazon .awssdk .http .SdkHttpResponse ;
32
+ import software .amazon .awssdk .regions .Region ;
32
33
import software .amazon .awssdk .services .sqs .internal .MessageMD5ChecksumInterceptor ;
33
34
import software .amazon .awssdk .services .sqs .model .MessageAttributeValue ;
34
35
import software .amazon .awssdk .services .sqs .model .SendMessageResponse ;
43
44
*/
44
45
public class MessageMD5ChecksumValidationDisableTest {
45
46
private static final AwsBasicCredentials CLIENT_CREDENTIALS = AwsBasicCredentials .create ("ca" , "cs" );
47
+ private static final Region CLIENT_REGION = Region .US_WEST_2 ;
46
48
private static final String MESSAGE_ID = "0f433476-621e-4638-811a-112d2c2e41d7" ;
47
49
48
50
private MockAsyncHttpClient asyncHttpClient ;
@@ -65,6 +67,7 @@ public void md5ValidationEnabled_default_md5InResponse_Works() {
65
67
asyncHttpClient .stubResponses (responseWithMd5 ());
66
68
SqsAsyncClient client = SqsAsyncClient .builder ()
67
69
.credentialsProvider (StaticCredentialsProvider .create (CLIENT_CREDENTIALS ))
70
+ .region (CLIENT_REGION )
68
71
.httpClient (asyncHttpClient )
69
72
.build ();
70
73
@@ -79,6 +82,7 @@ public void md5ValidationEnabled_default_noMd5InResponse_throwsException() {
79
82
asyncHttpClient .stubResponses (responseWithoutMd5 ());
80
83
SqsAsyncClient client = SqsAsyncClient .builder ()
81
84
.credentialsProvider (StaticCredentialsProvider .create (CLIENT_CREDENTIALS ))
85
+ .region (CLIENT_REGION )
82
86
.httpClient (asyncHttpClient )
83
87
.build ();
84
88
@@ -93,6 +97,7 @@ public void md5ValidationDisabled_md5InResponse_Works() {
93
97
asyncHttpClient .stubResponses (responseWithMd5 ());
94
98
SqsAsyncClient client = SqsAsyncClient .builder ()
95
99
.credentialsProvider (StaticCredentialsProvider .create (CLIENT_CREDENTIALS ))
100
+ .region (CLIENT_REGION )
96
101
.httpClient (asyncHttpClient )
97
102
.checksumValidationEnabled (false )
98
103
.build ();
@@ -108,6 +113,7 @@ public void md5ValidationDisabled_noMd5InResponse_Works() {
108
113
asyncHttpClient .stubResponses (responseWithoutMd5 ());
109
114
SqsAsyncClient client = SqsAsyncClient .builder ()
110
115
.credentialsProvider (StaticCredentialsProvider .create (CLIENT_CREDENTIALS ))
116
+ .region (CLIENT_REGION )
111
117
.httpClient (asyncHttpClient )
112
118
.checksumValidationEnabled (false )
113
119
.build ();
@@ -123,6 +129,7 @@ public void sync_md5ValidationDisabled_noMd5InResponse_Works() {
123
129
syncHttpClient .stubResponses (responseWithoutMd5 ());
124
130
SqsClient client = SqsClient .builder ()
125
131
.credentialsProvider (StaticCredentialsProvider .create (CLIENT_CREDENTIALS ))
132
+ .region (CLIENT_REGION )
126
133
.httpClient (syncHttpClient )
127
134
.checksumValidationEnabled (false )
128
135
.build ();
@@ -154,7 +161,7 @@ private static HttpExecuteResponse responseWithoutMd5() {
154
161
}
155
162
156
163
protected static Map <String , MessageAttributeValue > createAttributeValues () {
157
- Map <String , MessageAttributeValue > attrs = new HashMap ();
164
+ Map <String , MessageAttributeValue > attrs = new HashMap <> ();
158
165
attrs .put ("attribute-1" , MessageAttributeValue .builder ().dataType ("String" ).stringValue ("tmp" ).build ());
159
166
return Collections .unmodifiableMap (attrs );
160
167
}
0 commit comments