Author: pauls Date: Tue Apr 11 10:58:38 2017 New Revision: 1790952 URL: http://svn.apache.org/viewvc?rev=1790952&view=rev Log: Update testing to work with without the deprecated resource api (SLING-5983).
Modified: sling/trunk/testing/junit/scriptable/pom.xml sling/trunk/testing/junit/scriptable/src/main/java/org/apache/sling/junit/scriptable/ScriptableTestsProvider.java Modified: sling/trunk/testing/junit/scriptable/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/scriptable/pom.xml?rev=1790952&r1=1790951&r2=1790952&view=diff ============================================================================== --- sling/trunk/testing/junit/scriptable/pom.xml (original) +++ sling/trunk/testing/junit/scriptable/pom.xml Tue Apr 11 10:58:38 2017 @@ -55,6 +55,7 @@ <extensions>true</extensions> <configuration> <instructions> + <Export-Package>org.apache.sling.junit.scriptable;version="2.0.0"</Export-Package> <Private-Package>org.apache.sling.junit.scriptable.*</Private-Package> <Sling-Nodetypes>SLING-INF/nodetypes/slingtest.cnd</Sling-Nodetypes> </instructions> @@ -80,7 +81,7 @@ <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.api</artifactId> - <version>2.1.0</version> + <version>2.16.2</version> <scope>provided</scope> </dependency> <dependency> @@ -102,7 +103,7 @@ <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.jcr.resource</artifactId> - <version>2.0.6</version> + <version>2.9.3-SNAPSHOT</version> <scope>provided</scope> </dependency> <dependency> @@ -120,6 +121,7 @@ <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> + <version>2.4</version> </dependency> <dependency> <groupId>org.slf4j</groupId> Modified: sling/trunk/testing/junit/scriptable/src/main/java/org/apache/sling/junit/scriptable/ScriptableTestsProvider.java URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/scriptable/src/main/java/org/apache/sling/junit/scriptable/ScriptableTestsProvider.java?rev=1790952&r1=1790951&r2=1790952&view=diff ============================================================================== --- sling/trunk/testing/junit/scriptable/src/main/java/org/apache/sling/junit/scriptable/ScriptableTestsProvider.java (original) +++ sling/trunk/testing/junit/scriptable/src/main/java/org/apache/sling/junit/scriptable/ScriptableTestsProvider.java Tue Apr 11 10:58:38 2017 @@ -18,8 +18,10 @@ package org.apache.sling.junit.scriptabl import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Map; import javax.jcr.NodeIterator; import javax.jcr.RepositoryException; @@ -33,10 +35,12 @@ import org.apache.felix.scr.annotations. import org.apache.felix.scr.annotations.Reference; import org.apache.felix.scr.annotations.Service; import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; import org.apache.sling.engine.SlingRequestProcessor; import org.apache.sling.jcr.api.SlingRepository; -import org.apache.sling.jcr.resource.JcrResourceResolverFactory; +import org.apache.sling.jcr.resource.api.JcrResourceConstants; import org.apache.sling.junit.TestsProvider; +import org.apache.sling.spi.resource.provider.ResourceProvider; import org.osgi.framework.Constants; import org.osgi.service.component.ComponentContext; import org.slf4j.Logger; @@ -93,7 +97,7 @@ public class ScriptableTestsProvider imp private SlingRequestProcessor requestProcessor; @Reference - private JcrResourceResolverFactory resolverFactory; + private ResourceResolverFactory resolverFactory; // Need one listener per root path private List<EventListener> listeners = new ArrayList<EventListener>(); @@ -114,7 +118,9 @@ public class ScriptableTestsProvider imp protected void activate(ComponentContext ctx) throws Exception { pid = (String)ctx.getProperties().get(Constants.SERVICE_PID); session = repository.loginAdministrative(repository.getDefaultWorkspace()); - resolver = resolverFactory.getResourceResolver(session); + Map<String, Object> auth = new HashMap<String, Object>(); + auth.put(JcrResourceConstants.AUTHENTICATION_INFO_SESSION, session); + resolver = resolverFactory.getResourceResolver(auth); // Copy resource resolver paths and make sure they end with a / final String [] paths = resolver.getSearchPath();