Search code examples
javaapache-commons-httpclient

To where was HttpClient's LocalTestServer moved?


I've read about how HttpClient's LocalTestServer can be used for automated testing, however I can't seem to find where it's been moved. I tried defining dependency to httpclient with tests classifier:

'org.apache.httpcomponents:httpclient:4.5.2:tests'

but there doesn't seem to be a LocalTestServer class defined in there. Has this been discontinued?


Solution

  • Your test should now extend org.apache.http.localserver.LocalServerTestBase.

    This is available in the httpclient module with classifier tests.

    Your pom could look like:

    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.5.2</version>
        <scope>test</scope>
        <classifier>tests</classifier>
    </dependency>
    

    Related issue:

    https://issues.apache.org/jira/browse/HTTPCLIENT-1172

    Related changeset:

    https://github.com/apache/httpclient/commit/2ebd8202849c1f4a17d4320543e315a46cbfdc10