incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From enor...@apache.org
Subject svn commit: r993606 - in /sling/trunk: bundles/extensions/bundleresource/src/main/java/org/apache/sling/bundleresource/impl/ launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/ launchpad/test-services/ launchpad...
Date Wed, 08 Sep 2010 05:10:48 GMT
Author: enorman
Date: Wed Sep  8 05:10:48 2010
New Revision: 993606

URL: http://svn.apache.org/viewvc?rev=993606&view=rev
Log:
SLING-1733 - BundleResourceProvider would fail to find resources when multiple bundles had
the same Sling-Bundle-Resources path

Added:
    sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/res/sling-test/sling/SLING-1733/
    sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/res/sling-test/sling/SLING-1733/sling-1733.txt
  (with props)
Modified:
    sling/trunk/bundles/extensions/bundleresource/src/main/java/org/apache/sling/bundleresource/impl/BundleResourceProvider.java
    sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/BundleContentTest.java
    sling/trunk/launchpad/test-services/pom.xml

Modified: sling/trunk/bundles/extensions/bundleresource/src/main/java/org/apache/sling/bundleresource/impl/BundleResourceProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/bundleresource/src/main/java/org/apache/sling/bundleresource/impl/BundleResourceProvider.java?rev=993606&r1=993605&r2=993606&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/bundleresource/src/main/java/org/apache/sling/bundleresource/impl/BundleResourceProvider.java
(original)
+++ sling/trunk/bundles/extensions/bundleresource/src/main/java/org/apache/sling/bundleresource/impl/BundleResourceProvider.java
Wed Sep  8 05:10:48 2010
@@ -114,10 +114,11 @@ public class BundleResourceProvider impl
     public Iterator<Resource> listChildren(final Resource parent)
             throws SlingException {
 
-        // bundle resources can handle this request directly
-        if (parent instanceof BundleResource) {
-            return ((BundleResource) parent).listChildren();
-        }
+     	if (((BundleResource)parent).getBundle() == this.bundle) { 
+            // bundle resources can handle this request directly when the parent
+    		//  resource is in the same bundle as this provider.
+            return ((BundleResource) parent).listChildren(); 
+    	}
 
         // ensure this provider may have children of the parent
         String parentPath = parent.getPath();

Modified: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/BundleContentTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/BundleContentTest.java?rev=993606&r1=993605&r2=993606&view=diff
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/BundleContentTest.java
(original)
+++ sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/BundleContentTest.java
Wed Sep  8 05:10:48 2010
@@ -18,6 +18,8 @@ package org.apache.sling.launchpad.webap
 
 import java.io.IOException;
 
+import org.apache.sling.commons.json.JSONException;
+import org.apache.sling.commons.json.JSONObject;
 import org.apache.sling.commons.testing.integration.HttpTestBase;
 
 public class BundleContentTest extends HttpTestBase {
@@ -39,4 +41,18 @@ public class BundleContentTest extends H
         final String content = getContent(HTTP_BASE_URL + "/sling-test/sling.2.json", CONTENT_TYPE_JSON);
         assertTrue("Content contains " + expected + " (" + content + ")", content.contains(expected));
     }
+    
+    /**
+     * Test fix for SLING-1733 - BundleResourceProvider fails to find resources when multiple
bundles have the same Sling-Bundle-Resources path
+     */
+    public void testBundleContentParentFromMultipleBundles() throws IOException, JSONException
{
+        final String content = getContent(HTTP_BASE_URL + "/system.1.json", CONTENT_TYPE_JSON);
+        JSONObject jsonObj = new JSONObject(content);
+
+        //provided by the servlets.post bundle
+        assertTrue("Expected sling.js in the /system folder", jsonObj.has("sling.js"));
+
+        //provided by the launchpad.test-services bundle
+        assertTrue("Expected sling-1733.txt in the /system folder", jsonObj.has("sling-1733.txt"));
+    }
 }

Modified: sling/trunk/launchpad/test-services/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/test-services/pom.xml?rev=993606&r1=993605&r2=993606&view=diff
==============================================================================
--- sling/trunk/launchpad/test-services/pom.xml (original)
+++ sling/trunk/launchpad/test-services/pom.xml Wed Sep  8 05:10:48 2010
@@ -64,7 +64,10 @@
                             SLING-INF/nodetypes/test.cnd
                         </Sling-Nodetypes>
                         <Sling-Initial-Content>SLING-INF/content;path:=/sling-test</Sling-Initial-Content>
-                        <Sling-Bundle-Resources>/sling-test/sling/from-bundle;path:=/SLING-INF/res/sling-test/sling/from-bundle</Sling-Bundle-Resources>
+                        <Sling-Bundle-Resources>
+                        	/sling-test/sling/from-bundle;path:=/SLING-INF/res/sling-test/sling/from-bundle,
+                        	/system;path:=/SLING-INF/res/sling-test/sling/SLING-1733
+                        </Sling-Bundle-Resources>
                     </instructions>
                 </configuration>
             </plugin>

Added: sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/res/sling-test/sling/SLING-1733/sling-1733.txt
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/res/sling-test/sling/SLING-1733/sling-1733.txt?rev=993606&view=auto
==============================================================================
--- sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/res/sling-test/sling/SLING-1733/sling-1733.txt
(added)
+++ sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/res/sling-test/sling/SLING-1733/sling-1733.txt
Wed Sep  8 05:10:48 2010
@@ -0,0 +1 @@
+This is a text file provided by the bundle resource provider.
\ No newline at end of file

Propchange: sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/res/sling-test/sling/SLING-1733/sling-1733.txt
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message