sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tom...@apache.org
Subject svn commit: r1658445 [2/2] - in /sling/trunk: ./ bundles/api/src/main/java/org/apache/sling/api/resource/ bundles/jcr/it-resource-versioning/ bundles/jcr/it-resource-versioning/src/ bundles/jcr/it-resource-versioning/src/test/ bundles/jcr/it-resource-v...
Date Mon, 09 Feb 2015 16:00:53 GMT
Modified: sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/ResourceResolverImplTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/ResourceResolverImplTest.java?rev=1658445&r1=1658444&r2=1658445&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/ResourceResolverImplTest.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/ResourceResolverImplTest.java
Mon Feb  9 16:00:52 2015
@@ -26,6 +26,7 @@ import static org.junit.Assert.assertTru
 import static org.junit.Assert.fail;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;

Modified: sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/tree/ProviderHandlerTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/tree/ProviderHandlerTest.java?rev=1658445&r1=1658444&r2=1658445&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/tree/ProviderHandlerTest.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/tree/ProviderHandlerTest.java
Mon Feb  9 16:00:52 2015
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -84,6 +85,7 @@ public class ProviderHandlerTest {
 
     @Test public void testServletRegistrationAndSyntheticResources() {
         final String servletpath = "/libs/a/b/GET.servlet";
+        final Map<String, String> emptyParams = Collections.emptyMap();
 
         final Resource servletResource = Mockito.mock(Resource.class);
 
@@ -96,20 +98,20 @@ public class ProviderHandlerTest {
 
         root.bindResourceProvider(leaveProvider, leaveProperties);
 
-        final Resource parent = root.getResource(getResourceResolverContext(), null, ResourceUtil.getParent(servletpath),
false);
+        final Resource parent = root.getResource(getResourceResolverContext(), null, ResourceUtil.getParent(servletpath),
emptyParams, false);
         assertNotNull("Parent must be available", parent);
         assertTrue("Resource should be synthetic", ResourceUtil.isSyntheticResource(parent));
 
-        final Resource servlet = root.getResource(getResourceResolverContext(), null, servletpath,
false);
+        final Resource servlet = root.getResource(getResourceResolverContext(), null, servletpath,
emptyParams,false);
         assertNotNull("Servlet resource must not be null", servlet);
         assertEquals(servletResource, servlet);
 
-        assertNotNull(root.getResource(getResourceResolverContext(), null, "/libs", false));
+        assertNotNull(root.getResource(getResourceResolverContext(), null, "/libs", emptyParams,
false));
 
         // now check when doing a resolve()
-        assertNull(root.getResource(getResourceResolverContext(), null, "/libs", true));
-        assertNull(root.getResource(getResourceResolverContext(), null, ResourceUtil.getParent(servletpath),
true));
-        assertNotNull(root.getResource(getResourceResolverContext(), null, servletpath, true));
+        assertNull(root.getResource(getResourceResolverContext(), null, "/libs", emptyParams,
true));
+        assertNull(root.getResource(getResourceResolverContext(), null, ResourceUtil.getParent(servletpath),
emptyParams, true));
+        assertNotNull(root.getResource(getResourceResolverContext(), null, servletpath, emptyParams,
true));
     }
 
     private ResourceResolverContext getResourceResolverContext() {
@@ -125,7 +127,7 @@ public class ProviderHandlerTest {
         }
 
         @Override
-        public Resource getResource(ResourceResolverContext ctx, ResourceResolver resourceResolver,
String path) {
+        public Resource getResource(ResourceResolverContext ctx, ResourceResolver resourceResolver,
String path, Map<String, String> parameters) {
             return null;
         }
 

Modified: sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/tree/ResourceProviderEntryTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/tree/ResourceProviderEntryTest.java?rev=1658445&r1=1658444&r2=1658445&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/tree/ResourceProviderEntryTest.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/tree/ResourceProviderEntryTest.java
Mon Feb  9 16:00:52 2015
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertFal
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
 
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -41,6 +42,8 @@ import org.osgi.framework.Constants;
 
 public class ResourceProviderEntryTest {
 
+    private static final Map<String, String> EMPTY_PARAMS = Collections.emptyMap();
+    
     private ResourceResolver rootResolver;
 
     private ResourceProviderEntry root;
@@ -55,14 +58,14 @@ public class ResourceProviderEntryTest {
     }
 
     @Test public void testRootProvider() {
-        assertNull(root.getResource(null, null, "relpath", false));
+        assertNull(root.getResource(null, null, "relpath", EMPTY_PARAMS, false));
         final ResourceResolverContext ctx = getResourceResolverContext();
-        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/", false));
-        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/rootel", false));
-        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/rootel/child",
false));
-        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/apps/sling/sample/html.js",
false));
+        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/", EMPTY_PARAMS,
false));
+        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/rootel", EMPTY_PARAMS,
false));
+        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/rootel/child",
EMPTY_PARAMS, false));
+        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/apps/sling/sample/html.js",
EMPTY_PARAMS, false));
         assertEqualsResolver(this.rootResolver, root.getResource(ctx, null,
-            "/apps/sling/microsling/html.js", false));
+            "/apps/sling/microsling/html.js", EMPTY_PARAMS, false));
     }
 
     @Test public void testAdd1Provider() {
@@ -77,15 +80,15 @@ public class ResourceProviderEntryTest {
         root.addResourceProvider(firstPath, new ResourceProviderHandler(first, firstProps));
 
 
-        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/", false));
-        assertEqualsResolver(resolver, root.getResource(ctx, null, "/rootel", false));
-        assertEqualsResolver(resolver, root.getResource(ctx, null, "/rootel/html.js", false));
-        assertEqualsResolver(resolver, root.getResource(ctx, null, "/rootel/child", false));
-        assertEqualsResolver(resolver, root.getResource(ctx, null, "/rootel/child/html.js",
false));
+        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/", EMPTY_PARAMS,
false));
+        assertEqualsResolver(resolver, root.getResource(ctx, null, "/rootel", EMPTY_PARAMS,
false));
+        assertEqualsResolver(resolver, root.getResource(ctx, null, "/rootel/html.js", EMPTY_PARAMS,
false));
+        assertEqualsResolver(resolver, root.getResource(ctx, null, "/rootel/child", EMPTY_PARAMS,
false));
+        assertEqualsResolver(resolver, root.getResource(ctx, null, "/rootel/child/html.js",
EMPTY_PARAMS, false));
         assertEqualsResolver(this.rootResolver, root.getResource(ctx, null,
-            "/apps/sling/sample/html.js", false));
+            "/apps/sling/sample/html.js", EMPTY_PARAMS, false));
         assertEqualsResolver(this.rootResolver, root.getResource(ctx, null,
-            "/apps/sling/microsling/html.js", false));
+            "/apps/sling/microsling/html.js", EMPTY_PARAMS, false));
     }
 
     @Test public void testAdd3Providers() {
@@ -115,15 +118,15 @@ public class ResourceProviderEntryTest {
         root.addResourceProvider(secondPath, new ResourceProviderHandler(second, secondProps));
         root.addResourceProvider(thirdPath, new ResourceProviderHandler(third, thirdProps));
 
-        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/", false));
-        assertEqualsResolver(firstResolver, root.getResource(ctx, null, "/rootel", false));
-        assertEqualsResolver(firstResolver, root.getResource(ctx, null, "/rootel/html.js",
false));
-        assertEqualsResolver(secondResolver, root.getResource(ctx, null, "/rootel/child",
false));
-        assertEqualsResolver(secondResolver, root.getResource(ctx, null, "/rootel/child/html.js",
false));
+        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/", EMPTY_PARAMS,
false));
+        assertEqualsResolver(firstResolver, root.getResource(ctx, null, "/rootel", EMPTY_PARAMS,
false));
+        assertEqualsResolver(firstResolver, root.getResource(ctx, null, "/rootel/html.js",
EMPTY_PARAMS, false));
+        assertEqualsResolver(secondResolver, root.getResource(ctx, null, "/rootel/child",
EMPTY_PARAMS, false));
+        assertEqualsResolver(secondResolver, root.getResource(ctx, null, "/rootel/child/html.js",
EMPTY_PARAMS, false));
         assertEqualsResolver(thirdResolver,
-            root.getResource(ctx, null, "/apps/sling/sample/html.js", false));
+            root.getResource(ctx, null, "/apps/sling/sample/html.js", EMPTY_PARAMS, false));
         final Resource resource = root.getResource(ctx, null,
-            "/apps/sling/microsling/html.js", false);
+            "/apps/sling/microsling/html.js", EMPTY_PARAMS, false);
         assertEqualsResolver(this.rootResolver, resource);
     }
 
@@ -154,15 +157,15 @@ public class ResourceProviderEntryTest {
         root.addResourceProvider(secondPath, new ResourceProviderHandler(second, secondProps));
         root.addResourceProvider(thirdPath, new ResourceProviderHandler(third, thirdProps));
 
-        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/", false));
-        assertEqualsResolver(firstResolver, root.getResource(ctx, null, "/rootel", false));
-        assertEqualsResolver(firstResolver, root.getResource(ctx, null, "/rootel/html.js",
false));
-        assertEqualsResolver(secondResolver, root.getResource(ctx, null, "/rootel/child",
false));
-        assertEqualsResolver(secondResolver, root.getResource(ctx, null, "/rootel/child/html.js",
false));
+        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/", EMPTY_PARAMS,
false));
+        assertEqualsResolver(firstResolver, root.getResource(ctx, null, "/rootel", EMPTY_PARAMS,
false));
+        assertEqualsResolver(firstResolver, root.getResource(ctx, null, "/rootel/html.js",
EMPTY_PARAMS, false));
+        assertEqualsResolver(secondResolver, root.getResource(ctx, null, "/rootel/child",
EMPTY_PARAMS, false));
+        assertEqualsResolver(secondResolver, root.getResource(ctx, null, "/rootel/child/html.js",
EMPTY_PARAMS, false));
         assertEqualsResolver(thirdResolver,
-           root.getResource(ctx, null, "/apps/sling/sample/html.js", false));
+           root.getResource(ctx, null, "/apps/sling/sample/html.js", EMPTY_PARAMS, false));
         Resource resource = root.getResource(ctx, null,
-              "/apps/sling/microsling/html.js", false);
+              "/apps/sling/microsling/html.js", EMPTY_PARAMS, false);
         assertEqualsResolver(this.rootResolver, resource);
     }
 
@@ -193,22 +196,22 @@ public class ResourceProviderEntryTest {
         root.addResourceProvider(secondPath, new ResourceProviderHandler(second, secondProps));
         root.addResourceProvider(thirdPath, new ResourceProviderHandler(third, thirdProps));
 
-        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/", false));
-        assertEqualsResolver(firstResolver, root.getResource(ctx, null, "/rootel/html.js",
false));
-        assertEqualsResolver(secondResolver, root.getResource(ctx, null, "/rootel/child/html.js",
false));
+        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/", EMPTY_PARAMS,
false));
+        assertEqualsResolver(firstResolver, root.getResource(ctx, null, "/rootel/html.js",
EMPTY_PARAMS, false));
+        assertEqualsResolver(secondResolver, root.getResource(ctx, null, "/rootel/child/html.js",
EMPTY_PARAMS, false));
 
         root.removeResourceProvider(firstPath, new ResourceProviderHandler(first, firstProps));
 
-        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/", false));
-        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/rootel/sddsf/sdfsdf/html.js",
false));
-        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/rootel/html.js",
false));
-        assertEqualsResolver(secondResolver, root.getResource(ctx, null, "/rootel/child/html.js",
false));
+        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/", EMPTY_PARAMS,
false));
+        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/rootel/sddsf/sdfsdf/html.js",
EMPTY_PARAMS, false));
+        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/rootel/html.js",
EMPTY_PARAMS, false));
+        assertEqualsResolver(secondResolver, root.getResource(ctx, null, "/rootel/child/html.js",
EMPTY_PARAMS, false));
 
         root.addResourceProvider(firstPath, new ResourceProviderHandler(first, firstProps));
 
-        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/", false));
-        assertEqualsResolver(firstResolver, root.getResource(ctx, null, "/rootel/html.js",
false));
-        assertEqualsResolver(secondResolver, root.getResource(ctx, null, "/rootel/child/html.js",
false));
+        assertEqualsResolver(this.rootResolver, root.getResource(ctx, null, "/", EMPTY_PARAMS,
false));
+        assertEqualsResolver(firstResolver, root.getResource(ctx, null, "/rootel/html.js",
EMPTY_PARAMS, false));
+        assertEqualsResolver(secondResolver, root.getResource(ctx, null, "/rootel/child/html.js",
EMPTY_PARAMS, false));
     }
 
     @Test public void testRemoveTheOnlyProvider() {
@@ -226,14 +229,14 @@ public class ResourceProviderEntryTest {
 
             e.addResourceProvider(path, new ResourceProviderHandler(p, props));
             {
-                final Resource r = e.getResource(ctx, null, path, false);
+                final Resource r = e.getResource(ctx, null, path, EMPTY_PARAMS, false);
                 assertEqualsResolver(resolver, r);
                 assertFalse(r instanceof SyntheticResource);
             }
 
             e.removeResourceProvider(path, new ResourceProviderHandler(p, props));
             {
-                final Resource r = e.getResource(ctx, null, path, false);
+                final Resource r = e.getResource(ctx, null, path, EMPTY_PARAMS, false);
                 // If our provider is indeed gone, we should get one of the following conditions
                 if(r == null) {
                     //fine

Added: sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/tree/params/PathParametersParserTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/tree/params/PathParametersParserTest.java?rev=1658445&view=auto
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/tree/params/PathParametersParserTest.java
(added)
+++ sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/tree/params/PathParametersParserTest.java
Mon Feb  9 16:00:52 2015
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sling.resourceresolver.impl.tree.params;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class PathParametersParserTest {
+
+    private PathParser parser = new PathParser();
+
+    @Test
+    public void nullParsesToNull() {
+        parser.parse(null);
+        assertNull(parser.getPath());
+        assertTrue(parser.getParameters().isEmpty());
+    }
+
+    @Test
+    public void emptyParsesToEmpty() {
+        parser.parse("");
+        assertEquals("", parser.getPath());
+        assertTrue(parser.getParameters().isEmpty());
+    }
+
+    @Test
+    public void noParametersReturnEmptyMap() {
+        parser.parse("/path/with/no/parameters");
+        assertEquals("/path/with/no/parameters", parser.getPath());
+        assertTrue(parser.getParameters().isEmpty());
+    }
+
+    @Test
+    public void parameterCanBeAddedAfterResource() {
+        parser.parse("/content/test;key1=xyz");
+        assertEquals("/content/test", parser.getPath());
+        assertEquals(map("key1", "xyz"), parser.getParameters());
+
+        parser.parse("/content/test;key1=xyz.html");
+        assertEquals("/content/test.html", parser.getPath());
+        assertEquals(map("key1", "xyz"), parser.getParameters());
+    }
+
+    @Test
+    public void parameterCanBeEscaped() {
+        parser.parse("/content/test;key1='xyz'");
+        assertEquals("/content/test", parser.getPath());
+        assertEquals(map("key1", "xyz"), parser.getParameters());
+
+        parser.parse("/content/test;key1='xyz'.html");
+        assertEquals("/content/test.html", parser.getPath());
+        assertEquals(map("key1", "xyz"), parser.getParameters());
+    }
+
+    @Test
+    public void multipleParametersAreAllowed() {
+        parser.parse("/content/test;key1=xyz;key2=abc");
+        assertEquals("/content/test", parser.getPath());
+        assertEquals(map("key1", "xyz", "key2", "abc"), parser.getParameters());
+
+        parser.parse("/content/test;key1=xyz;key2=abc.html");
+        assertEquals("/content/test.html", parser.getPath());
+        assertEquals(map("key1", "xyz", "key2", "abc"), parser.getParameters());
+    }
+
+    @Test
+    public void multipleParametersCanBeEscaped() {
+        parser.parse("/content/test;key1='a.b';key2='c.d'");
+        assertEquals("/content/test", parser.getPath());
+        assertEquals(map("key1", "a.b", "key2", "c.d"), parser.getParameters());
+
+        parser.parse("/content/test;key1='a.b';key2='c.d'.html");
+        assertEquals("/content/test.html", parser.getPath());
+        assertEquals(map("key1", "a.b", "key2", "c.d"), parser.getParameters());
+    }
+
+    @Test
+    public void parameterCanBeAddedAfterExtension() {
+        parser.parse("/content/test.html;key1=xyz");
+        assertEquals("/content/test.html", parser.getPath());
+        assertEquals(map("key1", "xyz"), parser.getParameters());
+
+        parser.parse("/content/test.html;key1=xyz/suffix");
+        assertEquals("/content/test.html/suffix", parser.getPath());
+        assertEquals(map("key1", "xyz"), parser.getParameters());
+
+    }
+
+    @Test
+    public void dotDoesntHaveToBeEscapedAfterExtension() {
+        parser.parse("/content/test.html;v=1.0");
+        assertEquals("/content/test.html", parser.getPath());
+        assertEquals(map("v", "1.0"), parser.getParameters());
+
+        parser.parse("/content/test.html;v=1.0/suffix");
+        assertEquals("/content/test.html/suffix", parser.getPath());
+        assertEquals(map("v", "1.0"), parser.getParameters());
+    }
+
+    @Test
+    public void slashHaveToBeEscapedAfterExtension() {
+        parser.parse("/content/test.html;v='1/0'");
+        assertEquals("/content/test.html", parser.getPath());
+        assertEquals(map("v", "1/0"), parser.getParameters());
+
+        parser.parse("/content/test.html;v='1/0'/suffix");
+        assertEquals("/content/test.html/suffix", parser.getPath());
+        assertEquals(map("v", "1/0"), parser.getParameters());
+    }
+
+    @Test
+    public void quoteHasToBeClosed() {
+        testInvalidParams("/content/test;key1='a.b;key2=cde.html/asd");
+    }
+
+    @Test
+    public void emptyValueIsAllowed() {
+        parser.parse("/content/test;key1=''.html");
+        assertEquals("/content/test.html", parser.getPath());
+        assertEquals(map("key1", ""), parser.getParameters());
+
+        parser.parse("/content/test;key1=.html");
+        assertEquals("/content/test.html", parser.getPath());
+        assertEquals(map("key1", ""), parser.getParameters());
+    }
+
+    @Test
+    public void parametersWithoutEqualsSignAreInvalid() {
+        testInvalidParams("/content/test;key1.html");
+    }
+
+    @Test
+    public void parametersInTheMiddleOfThePathAreInvalid() {
+        testInvalidParams("/content;key=value/test.html");
+    }
+
+    @Test
+    public void parametersInTheSuffixAreInvalid() {
+        testInvalidParams("/content/test.html/suffix;key=value");
+    }
+
+    private static Map<String, String> map(String... values) {
+        Map<String, String> m = new HashMap<String, String>();
+        for (int i = 0; i < values.length; i += 2) {
+            m.put(values[i], values[i + 1]);
+        }
+        return m;
+    }
+
+    private void testInvalidParams(String path) {
+        parser.parse(path);
+        assertEquals(path, parser.getPath());
+        assertEquals(map(), parser.getParameters());
+    }
+}

Modified: sling/trunk/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/pom.xml?rev=1658445&r1=1658444&r2=1658445&view=diff
==============================================================================
--- sling/trunk/pom.xml (original)
+++ sling/trunk/pom.xml Mon Feb  9 16:00:52 2015
@@ -142,6 +142,7 @@
         <module>bundles/jcr/jackrabbit-accessmanager</module>
         <module>bundles/jcr/jcr-wrapper</module>
         <module>bundles/jcr/resource</module>
+        <module>bundles/jcr/it-resource-versioning</module>
         <module>bundles/jcr/registration</module>
         <module>bundles/jcr/webdav</module>
         <module>bundles/jcr/davex</module>

Modified: sling/trunk/testing/mocks/sling-mock/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/testing/mocks/sling-mock/pom.xml?rev=1658445&r1=1658444&r2=1658445&view=diff
==============================================================================
--- sling/trunk/testing/mocks/sling-mock/pom.xml (original)
+++ sling/trunk/testing/mocks/sling-mock/pom.xml Mon Feb  9 16:00:52 2015
@@ -81,13 +81,13 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.api</artifactId>
-            <version>2.4.0</version>
+            <version>2.8.1-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.resourceresolver</artifactId>
-            <version>1.1.0</version>
+            <version>1.1.13-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
         <dependency>
@@ -99,7 +99,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.jcr.resource</artifactId>
-            <version>2.3.6</version>
+            <version>2.4.5-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
         <dependency>

Modified: sling/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/MockJcrResourceResolverFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/MockJcrResourceResolverFactory.java?rev=1658445&r1=1658444&r2=1658445&view=diff
==============================================================================
--- sling/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/MockJcrResourceResolverFactory.java
(original)
+++ sling/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/MockJcrResourceResolverFactory.java
Mon Feb  9 16:00:52 2015
@@ -29,6 +29,7 @@ import org.apache.sling.api.resource.Res
 import org.apache.sling.api.resource.ResourceResolverFactory;
 import org.apache.sling.jcr.api.SlingRepository;
 import org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProviderFactory;
+import org.apache.sling.jcr.resource.internal.helper.jcr.PathMapper;
 import org.apache.sling.resourceresolver.impl.CommonResourceResolverFactoryImpl;
 import org.apache.sling.resourceresolver.impl.ResourceAccessSecurityTracker;
 import org.apache.sling.resourceresolver.impl.ResourceResolverImpl;
@@ -57,7 +58,7 @@ class MockJcrResourceResolverFactory imp
     private ResourceResolver getResourceResolverInternal(Map<String, Object> authenticationInfo,
boolean isAdmin) throws LoginException {
         // setup mock OSGi environment
         BundleContext bundleContext = MockOsgi.newBundleContext();
-        
+
         Dictionary<String, Object> resourceProviderFactoryFactoryProps = new Hashtable<String,
Object>();
         resourceProviderFactoryFactoryProps.put(Constants.SERVICE_VENDOR, "sling-mock");
         resourceProviderFactoryFactoryProps.put(Constants.SERVICE_DESCRIPTION, "sling-mock");
@@ -67,13 +68,14 @@ class MockJcrResourceResolverFactory imp
 
         // setup mocked JCR environment
         bundleContext.registerService(SlingRepository.class.getName(), this.slingRepository,
null);
+        bundleContext.registerService(PathMapper.class.getName(), new PathMapper(), null);
 
         // setup real sling JCR resource provider implementation for use in
         // mocked context
         JcrResourceProviderFactory jcrResourceProviderFactory = new JcrResourceProviderFactory();
         MockOsgi.injectServices(jcrResourceProviderFactory, bundleContext);
         MockOsgi.activate(jcrResourceProviderFactory, bundleContext, ImmutableMap.<String,
Object> of());
-        
+
         ResourceProvider resourceProvider;
         if (isAdmin) {
             resourceProvider = jcrResourceProviderFactory.getAdministrativeResourceProvider(authenticationInfo);
@@ -81,7 +83,7 @@ class MockJcrResourceResolverFactory imp
         else {
             resourceProvider = jcrResourceProviderFactory.getResourceProvider(authenticationInfo);
         }
-        
+
         Dictionary<Object, Object> resourceProviderProps = new Hashtable<Object,
Object>();
         resourceProviderProps.put(ResourceProvider.ROOTS, new String[] { "/" });
         bundleContext.registerService(ResourceProvider.class.getName(), resourceProvider,
resourceProviderProps);
@@ -112,7 +114,7 @@ class MockJcrResourceResolverFactory imp
     public ResourceResolver getResourceResolver(final Map<String, Object> authenticationInfo)
throws LoginException {
         return getResourceResolverInternal(authenticationInfo, false);
     }
-    
+
     @Override
     public ResourceResolver getAdministrativeResourceResolver(final Map<String, Object>
authenticationInfo)
             throws LoginException {
@@ -125,4 +127,9 @@ class MockJcrResourceResolverFactory imp
         return getResourceResolverInternal(authenticationInfo, true);
     }
 
+    @Override
+    public ResourceResolver getThreadResourceResolver() {
+        return null;
+    }
+
 }



Mime
View raw message