sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject [sling-org-apache-sling-resourcemerger] 17/24: Add test for hiding properties
Date Tue, 07 Nov 2017 09:58:57 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit f5ca99b5488db75e233f1b2679aacbc0adbdff27
Author: Carsten Ziegeler <cziegeler@apache.org>
AuthorDate: Fri Feb 7 11:23:04 2014 +0000

    Add test for hiding properties
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resourcemerger@1565619
13f79535-47bb-0310-9956-ffa450edef68
---
 .../impl/MergedResourceProviderTest.java           | 31 +++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/sling/resourcemerger/impl/MergedResourceProviderTest.java
b/src/test/java/org/apache/sling/resourcemerger/impl/MergedResourceProviderTest.java
index e942e35..e6d703f 100644
--- a/src/test/java/org/apache/sling/resourcemerger/impl/MergedResourceProviderTest.java
+++ b/src/test/java/org/apache/sling/resourcemerger/impl/MergedResourceProviderTest.java
@@ -48,11 +48,21 @@ public class MergedResourceProviderTest {
                                           .resource("a")
                                             .resource("1").p("a", "1").p("b", "2")
                                             .resource("./2").p(ResourceResolver.PROPERTY_RESOURCE_TYPE,
"apps")
+                                            .resource("./3").p("e", "2")
+                                                            .p(MergedResourceConstants.PN_HIDE_PROPERTIES,
"*")
+                                                            .p("b", "x")
+                                                            .p("d", "1")
+                                            .resource("./4").p("e", "2")
+                                                            .p(MergedResourceConstants.PN_HIDE_PROPERTIES,
new String[] {"a", "c"})
+                                                            .p("b", "x")
+                                                            .p("d", "1")
                                             .resource("./X")
                                         .resource("/libs")
                                           .resource("a")
                                             .resource("1").p("a", "5").p("c", "2")
                                             .resource("./2").p(ResourceResolver.PROPERTY_RESOURCE_TYPE,
"libs")
+                                            .resource("./3").p("a", "1").p("b", "2").p("c",
"3")
+                                            .resource("./4").p("a", "1").p("b", "2").p("c",
"3")
                                             .resource("./Y")
                                         .commit();
 
@@ -68,9 +78,11 @@ public class MergedResourceProviderTest {
         while ( i.hasNext() ) {
             names.add(i.next().getName());
         }
-        assertEquals(4, names.size());
+        assertEquals(6, names.size());
         assertTrue(names.contains("1"));
         assertTrue(names.contains("2"));
+        assertTrue(names.contains("3"));
+        assertTrue(names.contains("4"));
         assertTrue(names.contains("Y"));
         assertTrue(names.contains("X"));
     }
@@ -95,4 +107,21 @@ public class MergedResourceProviderTest {
         assertEquals("a/1", rsrcA1.getResourceType());
 
     }
+
+    @Test public void testClearProperties() {
+        final Resource rsrcA3 = this.provider.getResource(this.resolver, "/merged/a/3");
+        final ValueMap vm = rsrcA3.adaptTo(ValueMap.class);
+        assertNotNull(vm);
+        assertEquals(0, vm.size());
+    }
+
+    @Test public void testHideProperties() {
+        final Resource rsrcA4 = this.provider.getResource(this.resolver, "/merged/a/4");
+        final ValueMap vm = rsrcA4.adaptTo(ValueMap.class);
+        assertNotNull(vm);
+        assertEquals(3, vm.size());
+        assertEquals("1", vm.get("d"));
+        assertEquals("2", vm.get("e"));
+        assertEquals("x", vm.get("b"));
+    }
 }

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

Mime
View raw message