sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asa...@apache.org
Subject svn commit: r1607325 - /sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/mapping/MapEntriesTest.java
Date Wed, 02 Jul 2014 11:42:07 GMT
Author: asanso
Date: Wed Jul  2 11:42:06 2014
New Revision: 1607325

URL: http://svn.apache.org/r1607325
Log:
SLING-3727 - MapEntries should not update the aliasMap is enableOptimizeAliasResolution is
disabled

Modified:
    sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/mapping/MapEntriesTest.java

Modified: sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/mapping/MapEntriesTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/mapping/MapEntriesTest.java?rev=1607325&r1=1607324&r2=1607325&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/mapping/MapEntriesTest.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/mapping/MapEntriesTest.java
Wed Jul  2 11:42:06 2014
@@ -637,8 +637,8 @@ public class MapEntriesTest {
     
     //SLING-3727
     @Test
-    public void test_doRemoveAttributessWithDisableAliasOptimization() throws Exception {
-        Method method = MapEntries.class.getDeclaredMethod("doRemoveAttributes", String.class,
String[].class, boolean.class, boolean.class);
+    public void test_doUpdateAttributesWithDisableAliasOptimization() throws Exception {
+        Method method = MapEntries.class.getDeclaredMethod("doUpdateAttributes", String.class,
String[].class, boolean.class);
         method.setAccessible(true);
         
         when(resourceResolverFactory.isOptimizeAliasResolutionEnabled()).thenReturn(false);
@@ -655,7 +655,7 @@ public class MapEntriesTest {
         when(result.adaptTo(ValueMap.class)).thenReturn(buildValueMap("sling:alias", "alias"));
         
         method.invoke(mapEntries, "/parent/child",
-                new String[] { "sling:alias" }, false, false);
+                new String[] { "sling:alias" }, false);
         
         Map<String, String> aliasMap = mapEntries.getAliasMap("/parent");
         assertNull(aliasMap);
@@ -663,8 +663,27 @@ public class MapEntriesTest {
     
     //SLING-3727
     @Test
-    public void test_doUpdateAttributesWithDisableAliasOptimization() throws Exception {
+    public void test_doRemoveAttributessWithDisableAliasOptimization() throws Exception {
+        Method method = MapEntries.class.getDeclaredMethod("doRemoveAttributes", String.class,
String[].class, boolean.class, boolean.class);
+        method.setAccessible(true);
         
-    }
-    
+        when(resourceResolverFactory.isOptimizeAliasResolutionEnabled()).thenReturn(false);
+        mapEntries = new MapEntries(resourceResolverFactory, bundleContext, eventAdmin);
+        
+        Resource parent = mock(Resource.class);
+        when(parent.getPath()).thenReturn("/parent");
+
+        final Resource result = mock(Resource.class);
+        when(resourceResolver.getResource("/parent/child")).thenReturn(result);
+        when(result.getParent()).thenReturn(parent);
+        when(result.getPath()).thenReturn("/parent/child");
+        when(result.getName()).thenReturn("child");
+        when(result.adaptTo(ValueMap.class)).thenReturn(buildValueMap("sling:alias", "alias"));
+        
+        method.invoke(mapEntries, "/parent/child",
+                new String[] { "sling:alias" }, false, false);
+        
+        Map<String, String> aliasMap = mapEntries.getAliasMap("/parent");
+        assertNull(aliasMap);
+    }    
 }



Mime
View raw message