You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by re...@apache.org on 2025/02/03 19:02:43 UTC

(sling-org-apache-sling-resourceresolver) branch SLING-12636 updated (248e49b -> c983862)

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

reschke pushed a change to branch SLING-12636
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git


    from 248e49b  SLING-12636: Resource Resolver - fix test
     new 1fe660c  Revert "SLING-12636: Resource Resolver - fix test"
     new c983862  SLING-12636: Resource Resolver - fix test to properly initialize and adjust test expections (and explain them)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../impl/mapping/VanityPathMapEntriesTest.java               | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)


(sling-org-apache-sling-resourceresolver) 02/02: SLING-12636: Resource Resolver - fix test to properly initialize and adjust test expections (and explain them)

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

reschke pushed a commit to branch SLING-12636
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git

commit c983862efb39420a6ca4e0f9b958141e5aecadbf
Author: Julian Reschke <re...@apache.org>
AuthorDate: Mon Feb 3 20:02:35 2025 +0100

    SLING-12636: Resource Resolver - fix test to properly initialize and adjust test expections (and explain them)
---
 .../impl/mapping/VanityPathMapEntriesTest.java            | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/test/java/org/apache/sling/resourceresolver/impl/mapping/VanityPathMapEntriesTest.java b/src/test/java/org/apache/sling/resourceresolver/impl/mapping/VanityPathMapEntriesTest.java
index d0da9df..0503824 100644
--- a/src/test/java/org/apache/sling/resourceresolver/impl/mapping/VanityPathMapEntriesTest.java
+++ b/src/test/java/org/apache/sling/resourceresolver/impl/mapping/VanityPathMapEntriesTest.java
@@ -436,7 +436,7 @@ public class VanityPathMapEntriesTest extends AbstractMappingMapEntriesTest {
         when(parent.getValueMap()).thenReturn(buildValueMap("sling:vanityPath", "/target/found1"));
         when(resourceResolver.getResource(parent.getPath())).thenReturn(parent);
 
-        Resource child = mock(Resource.class, "jcrcontent");
+        Resource child = mock(Resource.class, "jcr:content");
         when(child.getPath()).thenReturn("/foo/parent/jcr:content");
         when(child.getName()).thenReturn("jcr:content");
         when(child.getValueMap()).thenReturn(buildValueMap("sling:vanityPath", "/target/found2"));
@@ -454,13 +454,10 @@ public class VanityPathMapEntriesTest extends AbstractMappingMapEntriesTest {
 
         when(resourceResolver.findResources(anyString(), eq("JCR-SQL2"))).thenAnswer((Answer<Iterator<Resource>>) invocation -> Collections.emptyIterator());
 
-        mapEntries.doInit();
-        mapEntries.initializeVanityPaths();
+        initializeVanityPaths();
 
-        // map entries should have no alias atm
-        assertTrue( mapEntries.getResolveMaps().isEmpty());
-        // till now, we already have 2 events being sent
-        Mockito.verify(eventAdmin,Mockito.times(2)).postEvent(ArgumentMatchers.any(Event.class));
+        // till now, we have exactly one event, generated by the MapEntries constructor
+        Mockito.verify(eventAdmin, Mockito.times(1)).postEvent(ArgumentMatchers.any(Event.class));
 
         // 3 updates at the same onChange call
         mapEntries.onChange(Arrays.asList(
@@ -477,8 +474,8 @@ public class VanityPathMapEntriesTest extends AbstractMappingMapEntriesTest {
         assertTrue(entries.stream().anyMatch(e -> e.getPattern().contains("/target/found2")));
         assertTrue(entries.stream().anyMatch(e -> e.getPattern().contains("/target/found3")));
 
-        // a single event is sent for all 3 added vanity paths
-        Mockito.verify(eventAdmin,Mockito.times(3)).postEvent(ArgumentMatchers.any(Event.class));
+        // an additional single event is sent for all 3 added vanity paths
+        Mockito.verify(eventAdmin, Mockito.times(2)).postEvent(ArgumentMatchers.any(Event.class));
     }
 
     @Test


(sling-org-apache-sling-resourceresolver) 01/02: Revert "SLING-12636: Resource Resolver - fix test"

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

reschke pushed a commit to branch SLING-12636
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git

commit 1fe660c2fc282303bc847bf36916ae55f1fead07
Author: Julian Reschke <re...@apache.org>
AuthorDate: Mon Feb 3 19:16:59 2025 +0100

    Revert "SLING-12636: Resource Resolver - fix test"
    
    This reverts commit 248e49b3f1e4f1058b4a3dc5426e824da9f73a59.
---
 .../sling/resourceresolver/impl/mapping/VanityPathMapEntriesTest.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/sling/resourceresolver/impl/mapping/VanityPathMapEntriesTest.java b/src/test/java/org/apache/sling/resourceresolver/impl/mapping/VanityPathMapEntriesTest.java
index a855c9d..d0da9df 100644
--- a/src/test/java/org/apache/sling/resourceresolver/impl/mapping/VanityPathMapEntriesTest.java
+++ b/src/test/java/org/apache/sling/resourceresolver/impl/mapping/VanityPathMapEntriesTest.java
@@ -454,7 +454,8 @@ public class VanityPathMapEntriesTest extends AbstractMappingMapEntriesTest {
 
         when(resourceResolver.findResources(anyString(), eq("JCR-SQL2"))).thenAnswer((Answer<Iterator<Resource>>) invocation -> Collections.emptyIterator());
 
-        initializeVanityPaths();
+        mapEntries.doInit();
+        mapEntries.initializeVanityPaths();
 
         // map entries should have no alias atm
         assertTrue( mapEntries.getResolveMaps().isEmpty());