atlas-remote-test won't execute
Description
When running atlas-remote-test --server localhost -p 1990 --context-path confluence -u 8.0.0, this error occurs:
Environment
Testing Notes
Add notes...
Activity
Switching to Apache HttpComponents' HttpClient indeed fixes the problem:
I’ve replicated this on my machine using a demo project I put together, by running mvn amps:remote-test -Dserver=localhost -Dhttp.port=5990 -Dcontext.path=refapp (this is what atlas-remote-test runs under the hood).
FWIW, the test passes if I run it from IDEA (as expected, because AMPS is not being used in this scenario).
Thanks for finding the root cause, that’s really helpful.
Root cause is a bug in Apache Wink 1.4 - BasicAuthSecurityHandler. The handler does an unauthenticated request. The request fails with 401. The request is retried with added Basic Authentication. However, the previous response Entity is not consumed. Thus, the java.lang.IllegalStateException is thrown.
Could be fixed by creating a custom basic auth handler instead, e.g.:
But dropping Apache Wink or redesigning RemoteTest might be another option.
Just using response.consumeContent(); will not resolve the problem (tried that - does not work and runs into the same error). Replacing Apache Wink is one solution. Apache Wink is retired and only atlas-remote-test depends on it. Thus, replacing could be an easy option.
I wonder if a fix would be as easy as adding response.consumeContent(); after lines 314 and 328 in RemoteTestMojo. It seems plausible because the response body is never used.
Here’s the full stacktrace: