You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Bertrand Delacretaz (Jira)" <ji...@apache.org> on 2021/06/02 09:39:00 UTC

[jira] [Created] (SLING-10445) Helper for HTTP access in Pax Exam tests

Bertrand Delacretaz created SLING-10445:
-------------------------------------------

             Summary: Helper for HTTP access in Pax Exam tests
                 Key: SLING-10445
                 URL: https://issues.apache.org/jira/browse/SLING-10445
             Project: Sling
          Issue Type: Improvement
          Components: Testing
    Affects Versions: Testing PaxExam 3.1.0
            Reporter: Bertrand Delacretaz
            Assignee: Bertrand Delacretaz


Eric Norman has written utilities in the [jackrabbit-accessmanager/AccessManagerClientTestSupport|https://github.com/apache/sling-org-apache-sling-jcr-jackrabbit-accessmanager/blob/master/src/test/java/org/apache/sling/jcr/jackrabbit/accessmanager/it/AccessManagerClientTestSupport.java] class that I think would fit well as helpers in the testing-paxeam module. This can help us move more tests away from the bigĀ {{launchpad-integration-tests}} module, closer to the code that they test, as done in SLING-10437

I don't have time to implement this right now, so consider this ticket as a reminder to myself to do it later in my Copious Free Time. Or if someone wants to go ahead feel free to reassign this ticket to yourself.

A suggested usage scenario is getting a configured {{HttpClient}} starting with a {{BundleContext}}. To test it, it should allow for simplifying that {{AccessManagerClientTestSupport}} class by removing all the {{HttpClient}} setup code and making that reusable in the new helper.

To simplify the {{Credentials}} handling, as we are often reusing the same ones, the {{HttpClient}} might store several named {{Credentials}} and include a {{useCredentials}} method which sets one of them as the default for the next requests.

The client configuration is mostly in the {{before}} method of that class, with {{getBaseServerUri}} computing the server URL from the OSGi configs.

The {{jackrabbit-usermanager}} module has a similar {{ClientTestSupport}} class that would also benefit from the same refactorings.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)