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

joerghoh pushed a commit to branch jcr_content-resource-aliasing-tests
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git

commit cd131b102123a873662ebc7be526b2c4f402d5bc
Author: Joerg Hoh <joerg...@apache.org>
AuthorDate: Sun Sep 17 18:10:01 2023 +0200

    failing test
---
 .../impl/mapping/ResourceMapperImplTest.java           | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git 
a/src/test/java/org/apache/sling/resourceresolver/impl/mapping/ResourceMapperImplTest.java
 
b/src/test/java/org/apache/sling/resourceresolver/impl/mapping/ResourceMapperImplTest.java
index 42bbfe0..084b1bd 100644
--- 
a/src/test/java/org/apache/sling/resourceresolver/impl/mapping/ResourceMapperImplTest.java
+++ 
b/src/test/java/org/apache/sling/resourceresolver/impl/mapping/ResourceMapperImplTest.java
@@ -109,6 +109,8 @@ public class ResourceMapperImplTest {
         resourceProvider.putResource("/there-multiple", PROP_ALIAS, 
"alias-value-3", "alias-value-4"); // with multivalued alias
         resourceProvider.putResource("/somewhere", PROP_ALIAS, 
"alias-value-2"); // with alias and also /etc/map
         resourceProvider.putResource("/there/that"); // parent has alias
+        resourceProvider.putResource("/content1");
+        resourceProvider.putResource("/content1/jcr:content", PROP_ALIAS, 
"jcr:content-alias"); // jcr:content resource
         resourceProvider.putResource("/content");
         resourceProvider.putResource("/content/virtual");
         resourceProvider.putResource("/content/virtual/foo"); // matches 
virtual.host.com.80 mapping entry
@@ -231,6 +233,22 @@ public class ResourceMapperImplTest {
             .allMappingsWithRequest("/app/alias-value", "/app/there")
             .verify(resolver, req);
     }
+    
+    /**
+     * Validates that a jcr:content resource cannot be aliased, but instead 
its parent resource is
+     *
+     * @throws LoginException
+     */
+    @Test
+    public void mapJcrContentResourceWithAlias() {
+
+        ExpectedMappings.existingResource("/content1/jcr:content")
+            .singleMapping("/jcr:content-alias/jcr:content")
+            .singleMappingWithRequest("/app/jcr:content-alias/jcr:content")
+            .allMappings("/jcr:content-alias/jcr:content", 
"/content1/jcr:content")
+            .allMappingsWithRequest("/app/content1/jcr:content", 
"/app/jcr:content-alias/jcr:content")
+            .verify(resolver, req);
+    }
 
     /**
      * Validates that mappings for a existing resource with multiple alias 
contain the alias and the resource's path

Reply via email to