You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:00:53 UTC

[sling-org-apache-sling-resourcemerger] 04/08: SLING-6951 correctly hide underlying grand children (which are hidden by the grandparent's sling:hideChildren)

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.resourcemerger-1.3.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourcemerger.git

commit 464a97be4cf6cd2f26b3c45ab376ebf8e7464180
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Tue Jun 13 12:46:32 2017 +0000

    SLING-6951 correctly hide underlying grand children (which are hidden by the grandparent's sling:hideChildren)
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resourcemerger@1798594 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/resourcemerger/impl/MergingResourceProvider.java | 3 ++-
 .../resourcemerger/impl/CommonMergedResourceProviderTest.java     | 8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/sling/resourcemerger/impl/MergingResourceProvider.java b/src/main/java/org/apache/sling/resourcemerger/impl/MergingResourceProvider.java
index 418cd47..7e55c4f 100644
--- a/src/main/java/org/apache/sling/resourcemerger/impl/MergingResourceProvider.java
+++ b/src/main/java/org/apache/sling/resourcemerger/impl/MergingResourceProvider.java
@@ -117,7 +117,8 @@ public class MergingResourceProvider extends ResourceProvider<Void> {
                                 onlyUnderlying = false;
                             }
                             final ExcludeEntry entry = new ExcludeEntry(value, onlyUnderlying);
-                            final Boolean hides = hides(entry, previousAncestorName, true);
+                            // check if this entry is applicable at all (always assuming the worst case, i.e. non local resource)
+                            final Boolean hides = hides(entry, previousAncestorName, false);
                             if (hides != null && hides.booleanValue() == true) {
                                 this.entries.add(new ExcludeEntry("*", entry.onlyUnderlying));
                                 break;
diff --git a/src/test/java/org/apache/sling/resourcemerger/impl/CommonMergedResourceProviderTest.java b/src/test/java/org/apache/sling/resourcemerger/impl/CommonMergedResourceProviderTest.java
index 4cc0d60..3a58c5f 100644
--- a/src/test/java/org/apache/sling/resourcemerger/impl/CommonMergedResourceProviderTest.java
+++ b/src/test/java/org/apache/sling/resourcemerger/impl/CommonMergedResourceProviderTest.java
@@ -109,7 +109,7 @@ public class CommonMergedResourceProviderTest {
         base = this.resolver.getResource("/apps/base");
         overlay = this.resolver.getResource("/apps/overlay");
         
-        this.provider = new CRUDMergingResourceProvider("/merged", new SimpleMergedResourcePicker(), false);
+        this.provider = new CRUDMergingResourceProvider("/merged", new SimpleMergedResourcePicker(), true);
     }
 
     @Test
@@ -119,10 +119,10 @@ public class CommonMergedResourceProviderTest {
             .resource("/apps/base/child1").p("property1", "frombase")
             .resource("/apps/base/child2").p("property1", "frombase")
             .resource("/apps/base/child1/grandchild").p("propertygrandchild1", "frombase")
-            .resource("/apps/base/child1/grandchild/grandgrandchild").p("propertygrandgrandchild1", "frombase")
+            .resource("/apps/base/child1/grandchild/grandgrandchildfrombase").p("propertygrandgrandchild1", "frombase")
             .resource("/apps/overlay/child1").p("property1", "fromoverlay")
             .resource("/apps/overlay/child1/grandchild").p("propertygrandchild1", "fromoverlay")
-            .resource("/apps/overlay/child1/grandchild/grandgrandchild").p("propertygrandgrandchild1", "fromoverlay")
+            .resource("/apps/overlay/child1/grandchild/grandgrandchildfromoverlay").p("propertygrandgrandchild1", "fromoverlay")
             .resource("/apps/overlay/child1/grandchild1").p("propertygrandchild1", "fromoverlay")
             .resource("/apps/overlay/child1/grandchild1/grandgrandchild1").p("propertygrandgrandchild1", "fromoverlay")
             .resource("/apps/overlay/child3").p("property1", "fromoverlay")
@@ -163,7 +163,7 @@ public class CommonMergedResourceProviderTest {
         
         // all overlay resource are still exposed, because hiding children by wildcard only hides children from underlying resources
         Assert.assertThat(iterableGrandGrandchildren, Matchers.contains(
-                ResourceMatchers.nameAndProps("grandgrandchild", Collections.singletonMap("propertygrandgrandchild1", (Object)"fromoverlay")))
+                ResourceMatchers.nameAndProps("grandgrandchildfromoverlay", Collections.singletonMap("propertygrandgrandchild1", (Object)"fromoverlay")))
         );
         
         // go down two levels (in node which is only available in overlay!)

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.