3 Replies Latest reply on Oct 15, 2015 7:30 PM by Oliver-2012

    local repository access with sling resource resolver

    Oliver-2012

      I like to create test classes which can be started on local system connecting to an AEM repository. To be able to use same code as running inside repository, I need to have a proper ResourceResolver initialized. Of course, inside a running AEM instance, I just get it from the SlingHttpServletRequest. How can I get a ResourceResolver from local test class?

       

      Sample code:

      ResourceResolver resResolver = ????

      PageManager pageMgr = resResolver.adaptTo(PageManager.class);

      ....

      • 0. Re: local repository access with sling resource resolver
        Oliver-2012 Level 1

        thanks for the reply.

        I want to run the code outside of the Repository instance (outside of AEM). I don't want to run any tests remotely, i.e. like in a JSP that still resides on the AEM itself.

        My goal is just to open a connection to the repository like I can do with JcrUtils.getRepository(). This way I still can connect and operate to any JCR nodes directly. But I like to use the Sling Features (i.e. adaptTo).