have a look at existing integration test projects - this is a good example:

https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/models/integration-tests

https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/SimpleTest.java


Stefan


>-----Original Message-----
>From: Santiago García Pimentel [mailto:santiago.pimen...@netcentric.biz]
>Sent: Thursday, September 25, 2014 4:03 PM
>To: users@sling.apache.org
>Subject: accessing the repository in a sling test
>
>Hello,
>
>I've been trying writing some tests following the docs in
>http://sling.apache.org/documentation/development/sling-testing-tools.html
>..
>I need to write a test that runs in a sling instance. This test depend
>on some content saved in the jcr repository. What is the best way to do
>this?
>
>I used the ResourceResolverFactory to obtain a resourceResolver, but I
>get null for any resource that I try to get from it.
>
>The test runs with SlingAnnotationsTestRunner.class and I get the
>resolver using:
>
>         Session session = session.login();
>         Map<String, Object> param = new HashMap<String, Object>();
>         param.put("user.jcr.session", session);
>         ResourceResolver resolver =
>this.resolverFactory.getServiceResourceResolver(param);
>
>
>Thank you and Greetings.
>
>
>
>
>--
>*Santiago García Pimentel* | Software Engineer
>Netcentric Ibérica SL
>Av. Diagonal 123 -8ª
>08005 Barcelona
>España
>Skype: santiago.garciapimentel
>santiago.pimen...@netcentric.biz | www.netcentric.es

Reply via email to