Skip to content

Commit c59a075

Browse files
authored
Bump CRT version to 0.29.25 and pass operation name to CRT in CRT based S3 client as it will be changed to required soon (#5325)
1 parent 08abe48 commit c59a075

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
<rxjava.version>2.2.21</rxjava.version>
122122
<commons-codec.verion>1.15</commons-codec.verion>
123123
<jmh.version>1.37</jmh.version>
124-
<awscrt.version>0.29.23</awscrt.version>
124+
<awscrt.version>0.29.25</awscrt.version>
125125

126126
<!--Test dependencies -->
127127
<junit5.version>5.10.0</junit5.version>

services/s3/src/main/java/software/amazon/awssdk/services/s3/internal/crt/S3CrtAsyncHttpClient.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ public CompletableFuture<Void> execute(AsyncExecuteRequest asyncRequest) {
137137
httpExecutionAttributes.getAttribute(CRT_PROGRESS_LISTENER),
138138
s3MetaRequestFuture);
139139

140-
S3MetaRequestOptions.MetaRequestType requestType = requestType(asyncRequest);
140+
String operationName = asyncRequest.httpExecutionAttributes().getAttribute(OPERATION_NAME);
141+
S3MetaRequestOptions.MetaRequestType requestType = requestType(operationName);
141142

142143
HttpChecksum httpChecksum = httpExecutionAttributes.getAttribute(HTTP_CHECKSUM);
143144
ResumeToken resumeToken = httpExecutionAttributes.getAttribute(CRT_PAUSE_RESUME_TOKEN);
@@ -156,6 +157,7 @@ public CompletableFuture<Void> execute(AsyncExecuteRequest asyncRequest) {
156157
.withEndpoint(endpoint)
157158
.withResponseHandler(responseHandler)
158159
.withResumeToken(resumeToken)
160+
.withOperationName(operationName)
159161
.withRequestFilePath(requestFilePath)
160162
.withSigningConfig(signingConfig);
161163

@@ -202,8 +204,7 @@ public String clientName() {
202204
return "s3crt";
203205
}
204206

205-
private static S3MetaRequestOptions.MetaRequestType requestType(AsyncExecuteRequest asyncRequest) {
206-
String operationName = asyncRequest.httpExecutionAttributes().getAttribute(OPERATION_NAME);
207+
private static S3MetaRequestOptions.MetaRequestType requestType(String operationName) {
207208
if (operationName != null) {
208209
switch (operationName) {
209210
case "GetObject":

services/s3/src/test/java/software/amazon/awssdk/services/s3/internal/crt/S3CrtAsyncHttpClientTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ public void getObject_shouldSetMetaRequestTypeCorrectly() {
131131

132132
S3MetaRequestOptions actual = makeRequest(asyncExecuteRequest);
133133
assertThat(actual.getMetaRequestType()).isEqualTo(S3MetaRequestOptions.MetaRequestType.GET_OBJECT);
134+
assertThat(actual.getOperationName()).isEqualTo("GetObject");
134135
}
135136

136137
@Test
@@ -140,8 +141,20 @@ public void putObject_shouldSetMetaRequestTypeCorrectly() {
140141

141142
S3MetaRequestOptions actual = makeRequest(asyncExecuteRequest);
142143
assertThat(actual.getMetaRequestType()).isEqualTo(S3MetaRequestOptions.MetaRequestType.PUT_OBJECT);
144+
assertThat(actual.getOperationName()).isEqualTo("PutObject");
143145
}
144146

147+
@Test
148+
public void NonStreamingOperation_shouldSetMetaRequestTypeCorrectly() {
149+
AsyncExecuteRequest asyncExecuteRequest = getExecuteRequestBuilder().putHttpExecutionAttribute(OPERATION_NAME,
150+
"CreateBucket").build();
151+
152+
S3MetaRequestOptions actual = makeRequest(asyncExecuteRequest);
153+
assertThat(actual.getMetaRequestType()).isEqualTo(S3MetaRequestOptions.MetaRequestType.DEFAULT);
154+
assertThat(actual.getOperationName()).isEqualTo("CreateBucket");
155+
}
156+
157+
145158
@Test
146159
public void cancelRequest_shouldForwardCancellation() {
147160
AsyncExecuteRequest asyncExecuteRequest = getExecuteRequestBuilder().build();

0 commit comments

Comments
 (0)