You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Henry Kuijpers (Jira)" <ji...@apache.org> on 2023/04/11 08:13:00 UTC

[jira] [Created] (SLING-11823) Sling Mocks: Allow specifying service ranking (or additional properties) when calling registerAdapter()

Henry Kuijpers created SLING-11823:
--------------------------------------

             Summary: Sling Mocks: Allow specifying service ranking (or additional properties) when calling registerAdapter()
                 Key: SLING-11823
                 URL: https://issues.apache.org/jira/browse/SLING-11823
             Project: Sling
          Issue Type: Improvement
          Components: Testing
    Affects Versions: Testing Sling Mock 3.4.4
            Reporter: Henry Kuijpers


{code:java}
final Session mockedSession = mock(Session.class);
doThrow(new RepositoryException("Failure")).when(mockedSession).move("/content/test", "/content/test2");
context.registerAdapter(ResourceResolver.class, Session.class, mockedSession);
{code}

The consequence of this is that an adapterfactory is registered etc, however, it will not be called, since it has a lower service ranking than existing adapters (in case of JCR/OAK ResourceResolverType). 

It would be nice to be able to specify additional properties, or at least be able to specify the service ranking, so that one of those adapters could be forced to be the first in the list.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)