Skip to content

test(sdk-core): remove apache-client and netty-nio-client test dependencies - #7324

Open
joviegas wants to merge 1 commit into
masterfrom
joviegas/remove-http-client-dep-from-sdk-core
Open

test(sdk-core): remove apache-client and netty-nio-client test dependencies#7324
joviegas wants to merge 1 commit into
masterfrom
joviegas/remove-http-client-dep-from-sdk-core

Conversation

@joviegas

@joviegas joviegas commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

sdk-core depended on apache-client and netty-nio-client at test scope. Those dependencies blocked adding tests for sdk-core behavior to test/http-client-tests: every HTTP client module test-depends on test/http-client-tests, so pointing it at sdk-core closes the cycle sdk-core -> apache-client -> http-client-tests -> sdk-core, which results Maven build failure with cyclic dependency error.

This PR removes both dependencies, so test/http-client-tests now depends on sdk-core. The eight existing tests that need a real HTTP client move into four suites there, which each client module runs by subclassing.

Modifications

POM files

File Change
core/sdk-core/pom.xml Removes the apache-client and netty-nio-client test dependencies.
test/http-client-tests/pom.xml Adds a compile dependency on sdk-core, required by the relocated test suites.

Deleted

File Change
sdk-core AmazonHttpClientWireMockTest Its three tests moved to SdkHttpClientSdkPipelineBehaviorTestSuite.
sdk-core SdkTransactionIdInHeaderTest Its test moved to SdkHttpClientSdkPipelineBehaviorTestSuite.
sdk-core ContentStreamProviderWireMockTest Its test moved to SdkHttpClientSdkPipelineBehaviorTestSuite.
sdk-core AmazonHttpClientSslHandshakeTimeoutTest (src/it) Its test moved to SdkHttpClientSslHandshakeTimeoutTestSuite, which apache-client subclasses as ApacheHttpClientSslHandshakeTimeoutTest.
sdk-core ConnectionPoolMaxConnectionsIntegrationTest (src/it) Its test moved to SdkHttpClientConnectionPoolTestSuite, which apache-client subclasses as ApacheConnectionPoolMaxConnectionsTest.
sdk-core core/http/server/MockServer Used org.apache.http. Its UNRESPONSIVE and OVERLOADED behaviors were added to the shared MockServer in http-client-tests, leaving one implementation instead of two.
sdk-core UnresponsiveMockServerTestBase Its only consumer was the SSL handshake test. SdkHttpClientSslHandshakeTimeoutTestSuite now starts the mock server itself.
sdk-core MockServerTestBase Its only subclass was UnresponsiveMockServerTestBase.

Modified

File Change
sdk-core ClasspathSdkHttpServiceProviderTest Replaces ApacheSdkHttpService and NettySdkAsyncHttpService with two test-local service implementations. The provider selects implementations by class name from a priority map, so the real classes are not required. All four scenarios are unchanged.
sdk-core utils/HttpTestUtils testSdkHttpClient() and testSdkAsyncHttpClient() return the new stub clients instead of loading Apache or Netty through ServiceLoader. The remaining methods are unchanged.
sdk-core HttpClientApiCallTimeoutTest Drops the WireMock rule and stubs, and passes StubSdkHttpClient to the client builder. Error-path cases build a second client that returns a 500 status. Stays on JUnit 4 with the original sleep values and assertions.
sdk-core HttpClientApiCallAttemptTimeoutTest Same change as HttpClientApiCallTimeoutTest.
sdk-core AsyncHttpClientApiCallTimeoutTests Same change, using StubSdkAsyncHttpClient. The slowApiAttempt test moved to SdkAsyncHttpClientApiCallAttemptTimeoutTestSuite, because it needs a delayed response from a real server.
http-client-tests http/server/MockServer Adds the UNRESPONSIVE and OVERLOADED behaviors and a non-TLS startServer(), ported from the deleted sdk-core copy. Existing behaviors and the TLS startServer overload are unchanged.

Added

File Change
sdk-core utils/StubSdkHttpClient In-memory SdkHttpClient that returns a configurable status code without opening a socket. Replaces the ServiceLoader-provided Apache client in tests.
sdk-core utils/StubSdkAsyncHttpClient Async equivalent, replacing the ServiceLoader-provided Netty client.
http-client-tests SdkHttpClientSdkPipelineBehaviorTestSuite Abstract suite holding the five relocated sync tests. Subclasses provide the client through createSdkHttpClient().
http-client-tests SdkAsyncHttpClientApiCallAttemptTimeoutTestSuite Abstract suite holding the relocated slowApiAttempt test.
http-client-tests SdkHttpClientConnectionPoolTestSuite Abstract suite holding the relocated connection pool test. Applies to sync clients that expose maxConnections, which is apache-client and apache5-client. Subclasses supply the client and the exception their HTTP library raises on pool exhaustion.
http-client-tests SdkHttpClientSslHandshakeTimeoutTestSuite Abstract suite holding the relocated SSL handshake timeout test. Applies to sync clients that expose a socket timeout, which is apache-client, apache5-client and url-connection-client. Subclasses supply the client.
apache-client ApacheHttpClientSdkPipelineBehaviorTest Runs the sync suite against ApacheHttpClient.
netty-nio-client NettyNioAsyncHttpClientApiCallAttemptTimeoutTest Runs the async suite against NettyNioAsyncHttpClient.
apache-client ApacheHttpClientSslHandshakeTimeoutTest Subclass of SdkHttpClientSslHandshakeTimeoutTestSuite. Supplies an ApacheHttpClient with the socket timeout the suite asks for.
apache-client ApacheConnectionPoolMaxConnectionsTest Subclass of SdkHttpClientConnectionPoolTestSuite. Supplies an ApacheHttpClient with maxConnections(1) and names ConnectionPoolTimeoutException as the expected cause.
http-client-tests utils/HttpTestUtils Copy of the sdk-core helper, without the ServiceLoader factory methods, so callers pass a client explicitly. Also holds executionContext(...).
http-client-tests utils/ValidSdkObjects Copy of the sdk-core helper, same package.
http-client-tests utils/http/WireMockTestBase Copy of the sdk-core helper, same package.
http-client-tests core/http/NoopTestRequest Copy of the sdk-core helper, same package.
http-client-tests internal/util/ResponseHandlerTestUtils Copy of the sdk-core helper, same package.
http-client-tests internal/util/AsyncResponseHandlerTestUtils Copy of the sdk-core helper, same package.
http-client-tests internal/http/response/NullErrorResponseHandler Copy of the sdk-core helper, same package.
http-client-tests internal/http/response/EmptySdkResponseHandler Copy of the sdk-core helper, same package. Used by the relocated connection pool test.

The helpers are copies because the relocated tests drive the sdk-core execution pipeline, and this repository does not
publish test-jars, so http-client-tests cannot reference classes under sdk-core/src/test.

License

  • I confirm that this pull request can be released under the Apache 2 license

@joviegas
joviegas requested a review from a team as a code owner August 26, 2026 22:19
@joviegas
joviegas force-pushed the joviegas/remove-http-client-dep-from-sdk-core branch 5 times, most recently from e5b1fd9 to 7ecb620 Compare August 27, 2026 19:47
@joviegas
joviegas force-pushed the joviegas/remove-http-client-dep-from-sdk-core branch from 7ecb620 to 53319e6 Compare August 27, 2026 20:30
* directly.
*/
public static ExecutionContext executionContext(SdkHttpFullRequest request) {
InterceptorContext incerceptorContext =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit : interceptor* typo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants