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 2015/02/19 21:23:12 UTC

[jira] [Resolved] (SLING-4437) MockJcrResourceResolverFactory should allow to register services dynamically.

     [ https://issues.apache.org/jira/browse/SLING-4437?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Seifert resolved SLING-4437.
-----------------------------------
    Resolution: Fixed

Completed: At revision: 1660995  

i've implemented a slightly different apporach re-using the bundle context already available or that can be passed to the resource resolver factory (that makes more sense anyway).

so you can register additional classes before creating the resource resolver e.g. in the bundle context of the SlingContext rule and it should work.

please give it a try.

> MockJcrResourceResolverFactory should allow to register services dynamically.
> -----------------------------------------------------------------------------
>
>                 Key: SLING-4437
>                 URL: https://issues.apache.org/jira/browse/SLING-4437
>             Project: Sling
>          Issue Type: Improvement
>          Components: Testing
>    Affects Versions: Testing Sling Mock 1.1.2
>            Reporter: Tomek Rękawek
>            Assignee: Stefan Seifert
>              Labels: mocks
>             Fix For: Testing Sling Mock 1.2.0
>
>         Attachments: SLING-4437.patch
>
>
> The {{MockJcrResourceResolverFactory}} class creates it's own mocked OSGi BundleContext and uses it to create a ResourceResolverFactory. Part of the OSGi environment initialization performed in the class is registering OSGi services to be available by the mocked resolver. By default there is only one service - SlingRepository.
> However, the more recent versions of ResourceProvider implementations requires other services, eg. PathMapper. Right now there is no way to inject this service into the mocked OSGi container. The {{MockJcrResourceResolverFactory}} should allow to register custom services, so it'll be compatible with the future versions of ResourceResolvers and Providers.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)