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 10:18:00 UTC

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

    [ https://issues.apache.org/jira/browse/SLING-10445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17355629#comment-17355629 ] 

Bertrand Delacretaz commented on SLING-10445:
---------------------------------------------

We might question whether we need this considering that the [PaxExamServer|https://github.com/apache/sling-org-apache-sling-testing-paxexam/blob/master/src/test/java/org/apache/sling/testing/paxexam/it/tests/SlingOptionsPaxExamServerIT.java] rule allows for running HTTP tests against OSGi services.

I think both can be useful, the {{PaxExamServer}} rule is good for HTTP-only tests whereas this new helper would allow "hybrid" tests which combine in-OSGi-framework and HTTP tests.


> 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
>            Priority: Minor
>
> 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)