Skip to content

Commit 3fb3881

Browse files
authored
Merge Apache 5.x Preview to Master (#6220)
* Add initial empty module for Apache5x for seting up package (#6075) * Add initial module for Apache5x for seting up package * Add based on new module checklist * Baseline or Copy all the ApacheSDKHttpClient classes to newly added Apache5SDKHttpClient (#6088) * Add initial module for Apache5x for seting up package * Add based on new module checklist * Baseline all the classes from Apache4 SDK client to the new Apache5 module * Phase 2 , getting Apache 5 compilation and Junit ready along with clearing Checkstyles and spotbug issues (#6100) * Phase 2 , getting Apache 5 compilation and Junit ready along with clearing Checkstyles and spotbug issues * Handle comments from review * Handle comments from Zoe * Update the snap shot * Fix HTTP authentication retry failures by improving RepeatableInputStreamRequestEntity repeatability (#6132) * Fix HTTP authentication retry failures by improving RepeatableInputStreamRequestEntity repeatability * Upated test cases * Handled comments * Updated snap shot after merge from master * Revert "Updated snap shot after merge from master" This reverts commit 64f7d33. * Updated snap shot after merge from master * Fix architecture test failures for apache5.x (#6140) * Fix architecture test failures for apache5.x * Checkstyle issues * Updated snap shot after merge from master * Use reference of PoolingHttpClientConnectionManager instead of HttpClientConnectionManager for Connection Manager (#6147) * Fix architecture test failures for apache5.x * Checkstyle issues * Update to use PoolingHttpClientConnectionManager class reference that is implementation of HttpClientConnectionManager * Fix Apache5 HTTP client retry failures with non-resettable streams (#6154) * Fix architecture test failures for apache5.x * Checkstyle issues * Update to use PoolingHttpClientConnectionManager class reference that is implementation of HttpClientConnectionManager * Fix stream reset failure in RepeatableInputStreamRequestEntity by storing content reference to avoid multiple ContentStreamProvider.newStream() calls that cause IOException when retrying requests with non-resettable streams * writeTo_ConcurrentWrites_HandlesCorrectly no longer needed since even Apache 4.x doesnot suports this * Merge PR#6165 #6165 * Disable Client based retries and define httpcore5 httpclient5 in .brazil.json (#6191) * Fix architecture test failures for apache5.x * Checkstyle issues * Update to use PoolingHttpClientConnectionManager class reference that is implementation of HttpClientConnectionManager * Fix stream reset failure in RepeatableInputStreamRequestEntity by storing content reference to avoid multiple ContentStreamProvider.newStream() calls that cause IOException when retrying requests with non-resettable streams * writeTo_ConcurrentWrites_HandlesCorrectly no longer needed since even Apache 4.x doesnot suports this * Fix connectionPoolingWorks by setting skipping setConnectionTimeToLive is value is set to 0 since 0 is treated as Infinite timeToLive in Sdk and Apache 4.x but treated as immediate closeConnection in apache 5.x * disableAutomaticRetries in Apache 5.x since SDK handles retries , also define Apache5 dependencies in .brazil.json * Added Test case for Async , handled review ocmments * Update snapshots * Do not buffer the Response stream using BufferedHttpEntity (#6200) * Fix architecture test failures for apache5.x * Checkstyle issues * Update to use PoolingHttpClientConnectionManager class reference that is implementation of HttpClientConnectionManager * Fix stream reset failure in RepeatableInputStreamRequestEntity by storing content reference to avoid multiple ContentStreamProvider.newStream() calls that cause IOException when retrying requests with non-resettable streams * writeTo_ConcurrentWrites_HandlesCorrectly no longer needed since even Apache 4.x doesnot suports this * Fix connectionPoolingWorks by setting skipping setConnectionTimeToLive is value is set to 0 since 0 is treated as Infinite timeToLive in Sdk and Apache 4.x but treated as immediate closeConnection in apache 5.x * disableAutomaticRetries in Apache 5.x since SDK handles retries , also define Apache5 dependencies in .brazil.json * Added Test case for Async , handled review ocmments * Donot do buffer the response using BufferedHttpEntity since it might cause memory issue, this behaviour is same as Apache4.x * Fix compilation issues * Fix checkstyle issues * Remove test which are specific to apache http * Merge from master * Apache5x SDkBenhmark Tests (#6206) * Fix architecture test failures for apache5.x * Checkstyle issues * Update to use PoolingHttpClientConnectionManager class reference that is implementation of HttpClientConnectionManager * Fix stream reset failure in RepeatableInputStreamRequestEntity by storing content reference to avoid multiple ContentStreamProvider.newStream() calls that cause IOException when retrying requests with non-resettable streams * writeTo_ConcurrentWrites_HandlesCorrectly no longer needed since even Apache 4.x doesnot suports this * Fix connectionPoolingWorks by setting skipping setConnectionTimeToLive is value is set to 0 since 0 is treated as Infinite timeToLive in Sdk and Apache 4.x but treated as immediate closeConnection in apache 5.x * disableAutomaticRetries in Apache 5.x since SDK handles retries , also define Apache5 dependencies in .brazil.json * Added Test case for Async , handled review ocmments * Donot do buffer the response using BufferedHttpEntity since it might cause memory issue, this behaviour is same as Apache4.x * Fix compilation issues * Fix checkstyle issues * Remove test which are specific to apache http * Add benchmark for Apache5 and add Streaming Api test cases * Clean up unused APIs and add test to make sure it can be handled with alternatives (#6211) * Clean up unused APIs and add test to make sure it can be handled with alternatives * Added NTCredentials to keep backward compatibilty with Apache4.x * Upgrade Apache5 org.apache.httpcomponents.client5 to latest available version (#6214) * Fix architecture test failures for apache5.x * Checkstyle issues * Update to use PoolingHttpClientConnectionManager class reference that is implementation of HttpClientConnectionManager * Fix stream reset failure in RepeatableInputStreamRequestEntity by storing content reference to avoid multiple ContentStreamProvider.newStream() calls that cause IOException when retrying requests with non-resettable streams * writeTo_ConcurrentWrites_HandlesCorrectly no longer needed since even Apache 4.x doesnot suports this * Fix connectionPoolingWorks by setting skipping setConnectionTimeToLive is value is set to 0 since 0 is treated as Infinite timeToLive in Sdk and Apache 4.x but treated as immediate closeConnection in apache 5.x * disableAutomaticRetries in Apache 5.x since SDK handles retries , also define Apache5 dependencies in .brazil.json * Added Test case for Async , handled review ocmments * Donot do buffer the response using BufferedHttpEntity since it might cause memory issue, this behaviour is same as Apache4.x * Fix compilation issues * Fix checkstyle issues * Remove test which are specific to apache http * Add benchmark for Apache5 and add Streaming Api test cases * Update Apache5 to 5.5 * Preview API annotation added for Public APIs and TODOs addressed (#6215) * Fix architecture test failures for apache5.x * Checkstyle issues * Update to use PoolingHttpClientConnectionManager class reference that is implementation of HttpClientConnectionManager * Fix stream reset failure in RepeatableInputStreamRequestEntity by storing content reference to avoid multiple ContentStreamProvider.newStream() calls that cause IOException when retrying requests with non-resettable streams * writeTo_ConcurrentWrites_HandlesCorrectly no longer needed since even Apache 4.x doesnot suports this * Fix connectionPoolingWorks by setting skipping setConnectionTimeToLive is value is set to 0 since 0 is treated as Infinite timeToLive in Sdk and Apache 4.x but treated as immediate closeConnection in apache 5.x * disableAutomaticRetries in Apache 5.x since SDK handles retries , also define Apache5 dependencies in .brazil.json * Added Test case for Async , handled review ocmments * Donot do buffer the response using BufferedHttpEntity since it might cause memory issue, this behaviour is same as Apache4.x * Fix compilation issues * Fix checkstyle issues * Remove test which are specific to apache http * Add benchmark for Apache5 and add Streaming Api test cases * Update Apache5 to 5.5 * Preview ready , addressing open TODOs * Added PublicApi since checkstyle was failing * Updated the snapshot * Updated thr Brazil package nma e to have preview as suffix * Updated Version as -PREVIEW to release apache5 as preview release (#6219) * Updated Version as -PREVIEW * japi cmp needs to be disables since this is a new version and we dont have old version to compare * Handled Surface API review comments (#6224) * Handled Surface API review comments * Added a single test for localaddress , handled review comments * Removing internal package name as -preview after internal discussion * Fix transient text case failures * update pom.xml for apache5.x * Handled commed for merge to master PR 6220 (#6240) * Handled Surface API review comments * Added a single test for localaddress , handled review comments * Removing internal package name as -preview after internal discussion * Fix transient text case failures * Handled comment for merge to master PR for apache 5.x * Added change logs * Review comment * Handled Review comments
1 parent 19e7766 commit 3fb3881

File tree

77 files changed

+8824
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+8824
-8
lines changed

.brazil.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"modules": {
55
"annotations": { "packageName": "AwsJavaSdk-Core-Annotations" },
66
"apache-client": { "packageName": "AwsJavaSdk-HttpClient-ApacheClient" },
7+
"apache5-client": { "packageName": "AwsJavaSdk-HttpClient-Apache5Client" },
78
"arns": { "packageName": "AwsJavaSdk-Core-Arns" },
89
"auth": { "packageName": "AwsJavaSdk-Core-Auth" },
910
"auth-crt": { "packageName": "AwsJavaSdk-Core-AuthCrt" },
@@ -140,7 +141,9 @@
140141
"io.netty:netty-transport-classes-epoll": { "packageName": "Netty4", "packageVersion": "4.1" },
141142
"io.netty:netty-transport-native-unix-common": { "packageName": "Netty4", "packageVersion": "4.1" },
142143
"org.apache.httpcomponents:httpclient": { "packageName": "Apache-HttpComponents-HttpClient", "packageVersion": "4.5.x" },
144+
"org.apache.httpcomponents.client5:httpclient5": { "packageName": "Apache-HttpComponents-HttpClient5", "packageVersion": "5.0.x" },
143145
"org.apache.httpcomponents:httpcore": { "packageName": "Apache-HttpComponents-HttpCore", "packageVersion": "4.4.x" },
146+
"org.apache.httpcomponents.core5:httpcore5": { "packageName": "Apache-HttpComponents-HttpCore5", "packageVersion": "5.0.x" },
144147
"org.eclipse.jdt:org.eclipse.jdt.core": { "packageName": "AwsJavaSdk-Codegen-EclipseJdtDependencies", "packageVersion": "2.0" },
145148
"org.eclipse.text:org.eclipse.text": { "packageName": "AwsJavaSdk-Codegen-EclipseJdtDependencies", "packageVersion": "2.0" },
146149
"org.reactivestreams:reactive-streams": { "packageName": "Maven-org-reactivestreams_reactive-streams", "packageVersion": "1.x" },
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"type": "feature",
3+
"category": "Apache HTTP Client 5",
4+
"contributor": "",
5+
"description": "Preview Release of AWS SDK Apache5 HttpClient with Apache HttpClient 5.5.x"
6+
}

bom-internal/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@
9494
<artifactId>httpcore</artifactId>
9595
<version>${httpcomponents.httpcore.version}</version>
9696
</dependency>
97+
<dependency>
98+
<groupId>org.apache.httpcomponents.client5</groupId>
99+
<artifactId>httpclient5</artifactId>
100+
<version>${httpcomponents.client5.version}</version>
101+
</dependency>
102+
<dependency>
103+
<groupId>org.apache.httpcomponents.core5</groupId>
104+
<artifactId>httpcore5</artifactId>
105+
<version>${httpcomponents.core5.version}</version>
106+
</dependency>
97107
<dependency>
98108
<groupId>commons-codec</groupId>
99109
<artifactId>commons-codec</artifactId>

bom/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@
192192
<artifactId>apache-client</artifactId>
193193
<version>${awsjavasdk.version}</version>
194194
</dependency>
195+
<dependency>
196+
<groupId>software.amazon.awssdk</groupId>
197+
<artifactId>apache5-client</artifactId>
198+
<version>${awsjavasdk.version}-PREVIEW</version>
199+
</dependency>
195200
<dependency>
196201
<groupId>software.amazon.awssdk</groupId>
197202
<artifactId>netty-nio-client</artifactId>

build-tools/src/main/resources/software/amazon/awssdk/spotbugs-suppressions.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@
285285
<Class name="software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap"/>
286286
<Class name="software.amazon.awssdk.http.nio.netty.internal.http2.FlushOnReadHandler"/>
287287
<Class name="software.amazon.awssdk.http.apache.internal.conn.IdleConnectionReaper"/>
288+
<Class name="software.amazon.awssdk.http.apache5.internal.conn.IdleConnectionReaper"/>
288289
<Class name="software.amazon.awssdk.eventnotifications.s3.internal.DefaultS3EventNotificationWriter"/>
289290
<Class name="software.amazon.awssdk.policybuilder.iam.internal.DefaultIamPolicyWriter"/>
290291
</Or>
@@ -337,6 +338,7 @@
337338
<Class name="~software\.amazon\.awssdk\.utils\.CompletableFutureUtils" />
338339
<Class name="~software\.amazon\.awssdk\.metrics\.publishers\.cloudwatch\.CloudWatchMetricPublisher" />
339340
<Class name="~software\.amazon\.awssdk\.http\.apache\.internal\.conn\.IdleConnectionReaper\$ReaperTask" />
341+
<Class name="~software\.amazon\.awssdk\.http\.apache5\.internal\.conn\.IdleConnectionReaper\$ReaperTask" />
340342
<Class name="~software\.amazon\.awssdk\.core\.internal\.retry\.RateLimitingTokenBucket" />
341343
<Class name="~software\.amazon\.awssdk\.core\.internal\.waiters\.WaiterExecutor" />
342344
<Class name="~software\.amazon\.awssdk\.regions\.internal\.util\.EC2MetadataUtils" />

http-clients/apache-client/pom.xml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,42 @@
9292
<artifactId>wiremock-jre8</artifactId>
9393
<scope>test</scope>
9494
</dependency>
95+
96+
<!-- Added for WIRE logging details while testing-->
97+
<dependency>
98+
<groupId>org.apache.logging.log4j</groupId>
99+
<artifactId>log4j-api</artifactId>
100+
<scope>test</scope>
101+
</dependency>
102+
<dependency>
103+
<groupId>org.apache.logging.log4j</groupId>
104+
<artifactId>log4j-core</artifactId>
105+
<scope>test</scope>
106+
</dependency>
107+
<dependency>
108+
<groupId>org.apache.logging.log4j</groupId>
109+
<artifactId>log4j-slf4j-impl</artifactId>
110+
<scope>test</scope>
111+
</dependency>
112+
<dependency>
113+
<groupId>org.slf4j</groupId>
114+
<artifactId>jcl-over-slf4j</artifactId>
115+
<scope>test</scope>
116+
<version>${slf4j.version}</version>
117+
</dependency>
118+
<dependency>
119+
<groupId>org.mockito</groupId>
120+
<artifactId>mockito-junit-jupiter</artifactId>
121+
<scope>test</scope>
122+
</dependency>
123+
124+
<dependency>
125+
<groupId>org.junit.jupiter</groupId>
126+
<artifactId>junit-jupiter</artifactId>
127+
<scope>test</scope>
128+
</dependency>
129+
130+
95131
</dependencies>
96132

97133
<build>

http-clients/apache-client/src/test/java/software/amazon/awssdk/http/apache/ApacheClientTlsAuthTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public static void setUp() throws IOException {
8383

8484
wireMockServer = new WireMockServer(wireMockConfig()
8585
.dynamicHttpsPort()
86+
.dynamicPort()
8687
.needClientAuth(true)
8788
.keystorePath(serverKeyStore.toAbsolutePath().toString())
8889
.keystorePassword(STORE_PASSWORD)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
package software.amazon.awssdk.http.apache;
16+
17+
import java.net.InetAddress;
18+
import java.time.Duration;
19+
import org.junit.jupiter.api.DisplayName;
20+
import software.amazon.awssdk.http.SdkHttpClient;
21+
import software.amazon.awssdk.http.SdkHttpClientLocalAddressFunctionalTestSuite;
22+
23+
@DisplayName("Apache HTTP Client - Local Address Functional Tests")
24+
class ApacheHttpClientLocalAddressFunctionalTest extends SdkHttpClientLocalAddressFunctionalTestSuite {
25+
26+
@Override
27+
protected SdkHttpClient createHttpClient(InetAddress localAddress, Duration connectionTimeout) {
28+
return ApacheHttpClient.builder()
29+
.localAddress(localAddress)
30+
.connectionTimeout(connectionTimeout)
31+
.build();
32+
}
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
package software.amazon.awssdk.http.apache;
17+
18+
import software.amazon.awssdk.http.HttpClientUriNormalizationTestSuite;
19+
import software.amazon.awssdk.http.SdkHttpClient;
20+
21+
public class ApacheHttpClientUriNormalizationTest extends HttpClientUriNormalizationTestSuite {
22+
23+
24+
@Override
25+
protected SdkHttpClient createSdkHttpClient() {
26+
return ApacheHttpClient.create();
27+
}
28+
}
29+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
package software.amazon.awssdk.http.apache;
17+
18+
19+
import org.junit.jupiter.api.DisplayName;
20+
import software.amazon.awssdk.http.SdkHttpClient;
21+
import software.amazon.awssdk.http.SdkHttpClientUriSanitizationTestSuite;
22+
23+
@DisplayName("Apache HTTP Client - URI Sanitization Tests")
24+
class ApacheHttpClientUriSanitizationTest extends SdkHttpClientUriSanitizationTestSuite {
25+
26+
@Override
27+
protected SdkHttpClient createHttpClient() {
28+
return ApacheHttpClient.create();
29+
}
30+
}

0 commit comments

Comments
 (0)