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 2021/05/28 13:24:03 UTC

[sling-org-apache-sling-resourceresolver] branch master updated: SLING-10431 - ResourceMapperImpl tests no longer running with optimised alias resolution

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 4406b8f  SLING-10431 - ResourceMapperImpl tests no longer running with optimised alias resolution
4406b8f is described below

commit 4406b8fed0fedb48202fc6472fb552c36aa06e35
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Fri May 28 15:13:41 2021 +0200

    SLING-10431 - ResourceMapperImpl tests no longer running with optimised alias resolution
    
    Adapt to the new query and also make it slightly nicer by default by removing a trailing whitespace.
---
 .../org/apache/sling/resourceresolver/impl/mapping/MapEntries.java    | 2 +-
 .../sling/resourceresolver/impl/mapping/InMemoryResourceProvider.java | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java b/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
index 4240875..000e62b 100644
--- a/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
+++ b/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
@@ -1058,7 +1058,7 @@ public class MapEntries implements
             baseQuery.append(")");
         }
 
-        baseQuery.append(" AND sling:alias IS NOT NULL ");
+        baseQuery.append(" AND sling:alias IS NOT NULL");
         String aliasQuery = baseQuery.toString();
         logger.debug("Query to fetch alias [{}] ", aliasQuery);
 
diff --git a/src/test/java/org/apache/sling/resourceresolver/impl/mapping/InMemoryResourceProvider.java b/src/test/java/org/apache/sling/resourceresolver/impl/mapping/InMemoryResourceProvider.java
index 718ed55..57ebaeb 100644
--- a/src/test/java/org/apache/sling/resourceresolver/impl/mapping/InMemoryResourceProvider.java
+++ b/src/test/java/org/apache/sling/resourceresolver/impl/mapping/InMemoryResourceProvider.java
@@ -97,7 +97,9 @@ public class InMemoryResourceProvider extends ResourceProvider<Void>{
             @Override
             public Iterator<Resource> findResources(@NotNull ResolveContext<Void> ctx, String query, String language) {
                 
-                if  ( "SELECT sling:alias FROM nt:base WHERE sling:alias IS NOT NULL".equals(query) ) {
+                // we don't explicitly filter paths under jcr:system, but we don't expect to have such resources either
+                // and this stub provider is not the proper location to test JCR queries
+                if  ( "SELECT sling:alias FROM nt:base AS page WHERE (NOT ISDESCENDANTNODE(page,\"/jcr:system\")) AND sling:alias IS NOT NULL".equals(query) ) {
                     return resourcesWithProperty(ctx, "sling:alias")
                         .iterator();
                 }