sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject svn commit: r1759570 - in /sling/trunk/contrib/extensions/sling-oak-restrictions/src: main/java/org/apache/sling/slingoakrestrictions/impl/ test/java/org/apache/sling/slingoakrestrictions/impl/
Date Wed, 07 Sep 2016 09:26:23 GMT
Author: rombert
Date: Wed Sep  7 09:26:23 2016
New Revision: 1759570

URL: http://svn.apache.org/viewvc?rev=1759570&view=rev
Log:
SLING-6042 - Use sling:resourceTypesWithDescendants instead of sling:resourceTypesWithChildren

Submitted-By: Georg Henzler

Closes #168

Modified:
    sling/trunk/contrib/extensions/sling-oak-restrictions/src/main/java/org/apache/sling/slingoakrestrictions/impl/SlingRestrictionProviderImpl.java
    sling/trunk/contrib/extensions/sling-oak-restrictions/src/test/java/org/apache/sling/slingoakrestrictions/impl/SlingRestrictionProviderImplTest.java

Modified: sling/trunk/contrib/extensions/sling-oak-restrictions/src/main/java/org/apache/sling/slingoakrestrictions/impl/SlingRestrictionProviderImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/sling-oak-restrictions/src/main/java/org/apache/sling/slingoakrestrictions/impl/SlingRestrictionProviderImpl.java?rev=1759570&r1=1759569&r2=1759570&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/sling-oak-restrictions/src/main/java/org/apache/sling/slingoakrestrictions/impl/SlingRestrictionProviderImpl.java
(original)
+++ sling/trunk/contrib/extensions/sling-oak-restrictions/src/main/java/org/apache/sling/slingoakrestrictions/impl/SlingRestrictionProviderImpl.java
Wed Sep  7 09:26:23 2016
@@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory;
  *
  * <ul>
  * <li>{@link #SLING_RESOURCE_TYPES}: A restriction that allows to match against resource
types (matches are exact and do not include children).</li>
- * <li>{@link #SLING_RESOURCE_TYPES_WITH_CHILDREN}: A restriction that allows to match
against resource types and all sub nodes of matching resource types.</li>
+ * <li>{@link #SLING_RESOURCE_TYPES_WITH_DESCENDANTS}: A restriction that allows to
match against resource types and all sub nodes of matching resource types.</li>
  * </ul>
  * 
  * Further sling restriction can be added here in future.
@@ -54,7 +54,7 @@ public class SlingRestrictionProviderImp
     private static final Logger LOG = LoggerFactory.getLogger(SlingRestrictionProviderImpl.class);
 
     public static final String SLING_RESOURCE_TYPES = "sling:resourceTypes";
-    public static final String SLING_RESOURCE_TYPES_WITH_CHILDREN = "sling:resourceTypesWithChildren";
+    public static final String SLING_RESOURCE_TYPES_WITH_DESCENDANTS = "sling:resourceTypesWithDescendants";
 
     public SlingRestrictionProviderImpl() {
         super(supportedRestrictions());
@@ -62,7 +62,7 @@ public class SlingRestrictionProviderImp
 
     private static Map<String, RestrictionDefinition> supportedRestrictions() {
         RestrictionDefinition slingResourceTypes = new RestrictionDefinitionImpl(SLING_RESOURCE_TYPES,
Type.STRINGS, false);
-        RestrictionDefinition slingResourceTypesWithChildren = new RestrictionDefinitionImpl(SLING_RESOURCE_TYPES_WITH_CHILDREN,
Type.STRINGS, false);
+        RestrictionDefinition slingResourceTypesWithChildren = new RestrictionDefinitionImpl(SLING_RESOURCE_TYPES_WITH_DESCENDANTS,
Type.STRINGS, false);
         Map<String, RestrictionDefinition> supportedRestrictions = new HashMap<String,
RestrictionDefinition>();
         supportedRestrictions.put(slingResourceTypes.getName(), slingResourceTypes);
         supportedRestrictions.put(slingResourceTypesWithChildren.getName(), slingResourceTypesWithChildren);
@@ -81,7 +81,7 @@ public class SlingRestrictionProviderImp
                 LOG.trace("Returning resourceTypePattern={} for rep:slingResourceTypes in
getPattern(String,Tree)", resourceTypePattern);
                 return resourceTypePattern;
             }
-            PropertyState resourceTypesWithChildren = tree.getProperty(SLING_RESOURCE_TYPES_WITH_CHILDREN);
+            PropertyState resourceTypesWithChildren = tree.getProperty(SLING_RESOURCE_TYPES_WITH_DESCENDANTS);
             if (resourceTypesWithChildren != null) {
                 ResourceTypePattern resourceTypePattern = new ResourceTypePattern(resourceTypesWithChildren.getValue(Type.STRINGS),
oakPath, true);
                 LOG.trace("Returning resourceTypePattern={} for rep:slingResourceTypesWithChildren
in getPattern(String,Tree)", resourceTypePattern);
@@ -104,7 +104,7 @@ public class SlingRestrictionProviderImp
                             "Returning resourceTypePattern={} for rep:slingResourceTypes
in getPattern(String,Set<Restriction>)",
                             resourceTypePattern);
                     return resourceTypePattern;
-                } else if(SLING_RESOURCE_TYPES_WITH_CHILDREN.equals(name)) {
+                } else if(SLING_RESOURCE_TYPES_WITH_DESCENDANTS.equals(name)) {
                     ResourceTypePattern resourceTypePattern = new ResourceTypePattern(r.getProperty().getValue(Type.STRINGS),
oakPath, true);
                     LOG.trace(
                             "Returning resourceTypePattern={} for rep:slingResourceTypesWithChildren
in getPattern(String,Set<Restriction>)",

Modified: sling/trunk/contrib/extensions/sling-oak-restrictions/src/test/java/org/apache/sling/slingoakrestrictions/impl/SlingRestrictionProviderImplTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/sling-oak-restrictions/src/test/java/org/apache/sling/slingoakrestrictions/impl/SlingRestrictionProviderImplTest.java?rev=1759570&r1=1759569&r2=1759570&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/sling-oak-restrictions/src/test/java/org/apache/sling/slingoakrestrictions/impl/SlingRestrictionProviderImplTest.java
(original)
+++ sling/trunk/contrib/extensions/sling-oak-restrictions/src/test/java/org/apache/sling/slingoakrestrictions/impl/SlingRestrictionProviderImplTest.java
Wed Sep  7 09:26:23 2016
@@ -19,7 +19,6 @@ package org.apache.sling.slingoakrestric
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.MockitoAnnotations.initMocks;
 
@@ -82,9 +81,9 @@ public class SlingRestrictionProviderImp
     }
 
     @Test
-    public void testGetPatternFromTreeResourceTypesWithChildren() {
+    public void testGetPatternFromTreeResourceTypesWithDescendants() {
         
-        doReturn(restrictionProperty).when(restrictionNodeTree).getProperty(SlingRestrictionProviderImpl.SLING_RESOURCE_TYPES_WITH_CHILDREN);
+        doReturn(restrictionProperty).when(restrictionNodeTree).getProperty(SlingRestrictionProviderImpl.SLING_RESOURCE_TYPES_WITH_DESCENDANTS);
         doReturn(Arrays.asList(RESOURCE_TYPE1, RESOURCE_TYPE2)).when(restrictionProperty).getValue(Type.STRINGS);
         
         slingRestrictionProviderImpl = new SlingRestrictionProviderImpl();
@@ -115,9 +114,9 @@ public class SlingRestrictionProviderImp
     }
 
     @Test
-    public void testGetPatternFromRestrictionsResourceTypesWithChildren() {
+    public void testGetPatternFromRestrictionsResourceTypesWithDescendants() {
         
-        doReturn(SlingRestrictionProviderImpl.SLING_RESOURCE_TYPES_WITH_CHILDREN).when(definition).getName();
+        doReturn(SlingRestrictionProviderImpl.SLING_RESOURCE_TYPES_WITH_DESCENDANTS).when(definition).getName();
         doReturn(Arrays.asList(RESOURCE_TYPE1, RESOURCE_TYPE2)).when(restrictionProperty).getValue(Type.STRINGS);
         
         slingRestrictionProviderImpl = new SlingRestrictionProviderImpl();



Mime
View raw message