-
Notifications
You must be signed in to change notification settings - Fork 931
Preview API annotation added for Public APIs and TODOs addressed #6215
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
Merged
joviegas
merged 28 commits into
feature/master/apache5x
from
joviegas/apache-5-achitecture-test-fix
Jun 30, 2025
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
9e8fc15
Fix architecture test failures for apache5.x
joviegas 70a120e
Merge branch 'feature/master/apache5x' into joviegas/apache-5-achitec…
joviegas c7b09a2
Merge issues resolved
joviegas 068cada
Checkstyle issues
joviegas 4766e74
Update to use PoolingHttpClientConnectionManager class reference that…
joviegas c81efdc
Merge branch 'master' into joviegas/apache-5-achitecture-test-fix
joviegas 6b64589
Merge branch 'feature/master/apache5x' into joviegas/apache-5-achitec…
joviegas 89debeb
Merge branch 'feature/master/apache5x' into joviegas/apache-5-achitec…
joviegas 7f9e77f
Fix stream reset failure in RepeatableInputStreamRequestEntity by sto…
joviegas 5fb2d35
writeTo_ConcurrentWrites_HandlesCorrectly no longer needed since even…
joviegas 52fedbd
Merge branch 'feature/master/apache5x' into joviegas/apache-5-achitec…
joviegas 8b83790
Fix connectionPoolingWorks by setting skipping setConnectionTimeToLi…
joviegas 14a2ead
disableAutomaticRetries in Apache 5.x since SDK handles retries , als…
joviegas 9431959
Merge branch 'feature/master/apache5x' into joviegas/apache-5-achitec…
joviegas 5f33ad9
Added Test case for Async , handled review ocmments
joviegas 270c0f7
Donot do buffer the response using BufferedHttpEntity since it might …
joviegas 1a18785
merge from master
joviegas e2d16ad
Fix compilation issues
joviegas 85efdaf
Fix checkstyle issues
joviegas bb70f7d
Remove test which are specific to apache http
joviegas 8deb7d0
Merge branch 'feature/master/apache5x' into joviegas/apache-5-achitec…
joviegas ca832c7
Merge branch 'feature/master/apache5x' into joviegas/apache-5-achitec…
joviegas 602c659
Add benchmark for Apache5 and add Streaming Api test cases
joviegas 6e4332f
Merge branch 'feature/master/apache5x' into joviegas/apache-5-achitec…
joviegas 40f144b
Update Apache5 to 5.5
joviegas f4a9af0
Preview ready , addressing open TODOs
joviegas 676486b
Merge branch 'feature/master/apache5x' into joviegas/apache-5-achitec…
joviegas 59f75fe
Added PublicApi since checkstyle was failing
joviegas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...src/test/java/software/amazon/awssdk/http/apache/ApacheHttpClientUriSanitizationTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
package software.amazon.awssdk.http.apache; | ||
|
||
|
||
import org.junit.jupiter.api.DisplayName; | ||
import software.amazon.awssdk.http.SdkHttpClient; | ||
import software.amazon.awssdk.http.SdkHttpClientUriSanitizationTestSuite; | ||
|
||
@DisplayName("Apache HTTP Client - URI Sanitization Tests") | ||
class ApacheHttpClientUriSanitizationTest extends SdkHttpClientUriSanitizationTestSuite { | ||
|
||
@Override | ||
protected SdkHttpClient createHttpClient() { | ||
return ApacheHttpClient.create(); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ | |
import software.amazon.awssdk.utils.http.SdkHttpUtils; | ||
|
||
/** | ||
* Responsible for creating Apache HttpClient 4 request objects. | ||
* Responsible for creating Apache HttpClient 5 request objects. | ||
*/ | ||
@SdkInternalApi | ||
public class Apache5HttpRequestFactory { | ||
|
@@ -59,7 +59,6 @@ public HttpUriRequestBase create(final HttpExecuteRequest request, final Apache5 | |
return base; | ||
} | ||
|
||
//TODO : check if this is still valid | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added test cases |
||
/** | ||
* | ||
* The Apache HTTP client doesn't allow consecutive slashes in the URI. For S3 | ||
|
30 changes: 30 additions & 0 deletions
30
...c/test/java/software/amazon/awssdk/http/apache5/Apache5HttpClientUriSanitizationTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
package software.amazon.awssdk.http.apache5; | ||
|
||
|
||
import org.junit.jupiter.api.DisplayName; | ||
import software.amazon.awssdk.http.SdkHttpClient; | ||
import software.amazon.awssdk.http.SdkHttpClientUriSanitizationTestSuite; | ||
|
||
@DisplayName("Apache5 HTTP Client - URI Sanitization Tests") | ||
class Apache5HttpClientUriSanitizationTest extends SdkHttpClientUriSanitizationTestSuite { | ||
|
||
@Override | ||
protected SdkHttpClient createHttpClient() { | ||
return Apache5HttpClient.create(); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
...ests/src/main/java/software/amazon/awssdk/http/SdkHttpClientUriSanitizationTestSuite.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
package software.amazon.awssdk.http; | ||
|
||
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; | ||
import static com.github.tomakehurst.wiremock.client.WireMock.any; | ||
import static com.github.tomakehurst.wiremock.client.WireMock.anyUrl; | ||
import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor; | ||
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; | ||
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import com.github.tomakehurst.wiremock.junit5.WireMockExtension; | ||
import com.github.tomakehurst.wiremock.junit5.WireMockTest; | ||
import java.net.URI; | ||
import java.util.stream.Stream; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
|
||
/** | ||
* Abstract test suite for testing URI sanitization functionality across different HTTP client implementations. | ||
* Verifies that consecutive slashes in URIs are properly encoded. | ||
*/ | ||
@WireMockTest | ||
public abstract class SdkHttpClientUriSanitizationTestSuite { | ||
|
||
@RegisterExtension | ||
static WireMockExtension wireMock = WireMockExtension.newInstance() | ||
.options(wireMockConfig().dynamicPort()) | ||
.build(); | ||
|
||
private SdkHttpClient client; | ||
|
||
protected abstract SdkHttpClient createHttpClient(); | ||
|
||
@BeforeEach | ||
void setUp() { | ||
client = createHttpClient(); | ||
// Generic stub for all requests | ||
wireMock.stubFor(any(anyUrl()) | ||
.willReturn(aResponse() | ||
.withStatus(200) | ||
.withBody("success"))); | ||
} | ||
|
||
@AfterEach | ||
void tearDown() { | ||
if (client != null) { | ||
client.close(); | ||
} | ||
} | ||
|
||
@ParameterizedTest(name = "URI path: ''{0}'' should become ''{1}''") | ||
@MethodSource("provideUriSanitizationTestCases") | ||
@DisplayName("URI paths should be properly sanitized") | ||
void uriPathsShouldBeProperlySanitized(String inputPath, String expectedPath) throws Exception { | ||
SdkHttpFullRequest request = createRequestWithPath(inputPath); | ||
HttpExecuteResponse response = executeRequest(request); | ||
|
||
assertThat(response.httpResponse().statusCode()).isEqualTo(200); | ||
wireMock.verify(getRequestedFor(urlPathEqualTo(expectedPath))); | ||
} | ||
|
||
private static Stream<Arguments> provideUriSanitizationTestCases() { | ||
return Stream.of( | ||
// Normal paths should remain unchanged | ||
Arguments.of("/normal/path", "/normal/path"), | ||
Arguments.of("/api/v1/users/123", "/api/v1/users/123"), | ||
Arguments.of("/single/slash/only", "/single/slash/only"), | ||
|
||
// Consecutive slashes should be encoded | ||
Arguments.of("/path//to//resource", "/path/%2Fto/%2Fresource"), | ||
Arguments.of("/folder//file.txt", "/folder/%2Ffile.txt"), | ||
Arguments.of("//leading//double", "/%2Fleading/%2Fdouble"), | ||
Arguments.of("/trailing//", "/trailing/%2F"), | ||
Arguments.of("/multiple///slashes", "/multiple/%2F/slashes"), | ||
Arguments.of("/four////slashes", "/four/%2F/%2Fslashes"), | ||
|
||
// Edge cases | ||
Arguments.of("//", "/%2F"), | ||
Arguments.of("///", "/%2F/"), | ||
Arguments.of("////", "/%2F/%2F") | ||
); | ||
} | ||
|
||
private SdkHttpFullRequest createRequestWithPath(String path) { | ||
URI uri = URI.create("http://localhost:" + wireMock.getPort() + path); | ||
|
||
return SdkHttpFullRequest.builder() | ||
.uri(uri) | ||
.method(SdkHttpMethod.GET) | ||
.putHeader("Host", uri.getHost() + ":" + uri.getPort()) | ||
.build(); | ||
} | ||
|
||
private HttpExecuteResponse executeRequest(SdkHttpFullRequest request) throws Exception { | ||
return client.prepareRequest( | ||
HttpExecuteRequest.builder() | ||
.request(request) | ||
.build()) | ||
.call(); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added test cases