You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Stefan Seifert (Jira)" <ji...@apache.org> on 2020/10/08 15:33:00 UTC

[jira] [Commented] (SLING-9680) Sling Mocks: Add easy way to inject SlingBindings into MockSlingHttpServletRequest

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

Stefan Seifert commented on SLING-9680:
---------------------------------------

with this PR it works automatically if custom BindingsValueProviders are added at the beginning of the unit test before touching the mocked request or anything it it.
it also works at a later position, but because the OSGi events required to detect such late registrations are handled asynchronously by the EventAdmin some milliseconds sleep time might be required to makes sure the new provider is detected.

> Sling Mocks: Add easy way to inject SlingBindings into MockSlingHttpServletRequest
> ----------------------------------------------------------------------------------
>
>                 Key: SLING-9680
>                 URL: https://issues.apache.org/jira/browse/SLING-9680
>             Project: Sling
>          Issue Type: Improvement
>          Components: Testing
>    Affects Versions: Testing Sling Mock 2.5.0
>            Reporter: Konrad Windszus
>            Assignee: Stefan Seifert
>            Priority: Major
>             Fix For: Testing Sling Mock 2.6.4
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> As SlingBindings are often crucial when dealing with Sling Models there should be an easy way to set them for a mocked request (https://sling.apache.org/documentation/development/sling-mock.html#slinghttpservletrequest)
> A dedicated method which automatically fills the SlingBindings with the mandatory stuff and another one to add additional bindings would be very helpful.
> Also injecting values from all registered {{BindingsValuesProvider}} with a specific context would be useful.



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