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

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

commit d8edb1d1c2c2e2f1f541a19763d6cb6d367aaeed
Author: Angela Schreiber <[email protected]>
AuthorDate: Thu Aug 6 15:03:51 2020 +0200

    SLING-9620 - ResourceMapperImpl.getAllMappings does not respect 
multi-valued sling:alias
    
    Add failing tests
    
    rombert: ignoring tests until they pass, small tweak to 
InMemoryResourceProvider
---
 .../impl/mapping/InMemoryResourceProvider.java        |  4 ++++
 .../impl/mapping/ResourceMapperImplTest.java          | 19 +++++++++++++++++++
 2 files changed, 23 insertions(+)

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 956a25d..28a8c1b 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
@@ -65,6 +65,10 @@ public class InMemoryResourceProvider extends 
ResourceProvider<Void> {
         putResource(path, Collections.singletonMap(key, value));
     }
 
+    public void putResource(String path, String key, Object... values) {
+        putResource(path, Collections.singletonMap(key, values));
+    }
+
     public void putResource(String path, String key, Object value, String 
key2, Object value2) {
         Map<String, Object> props = new HashMap<>();
         props.put(key, value);
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 479ff0e..c4b2def 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
@@ -47,6 +47,7 @@ import 
org.apache.sling.spi.resource.provider.ResourceProvider;
 import org.apache.sling.testing.mock.osgi.junit.OsgiContext;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 
@@ -87,6 +88,7 @@ public class ResourceMapperImplTest {
         resourceProvider.putResource("/"); // root
         resourceProvider.putResource("/here"); // regular page
         resourceProvider.putResource("/there", PROP_ALIAS, "alias-value"); // 
with alias
+        resourceProvider.putResource("/there-multiple", PROP_ALIAS, 
"alias-value-1", "alias-value-2"); // with multivalued alias
         resourceProvider.putResource("/somewhere", PROP_ALIAS, 
"alias-value-2"); // with alias and also /etc/map
         resourceProvider.putResource("/there/that"); // parent has alias
         
@@ -172,6 +174,23 @@ public class ResourceMapperImplTest {
     }
 
     /**
+     * Validates that mappings for a existing resource with multiple alias 
contain the alias and the resource's path
+     *
+     * @throws LoginException
+     */
+    @Test
+    @Ignore("SLING-9620")
+    public void mapResourceWithMultivaluedAlias() {
+
+        ExpectedMappings.existingResource("/there-multiple")
+                .singleMapping("/alias-value-1")
+                .singleMappingWithRequest("/app/alias-value-1")
+                .allMappings("/alias-value-1", "/alias-value-2", 
"/there-multiple")
+                .allMappingsWithRequest("/app/alias-value-1", 
"/app/alias-value-2", "/app/there-multiple")
+                .verify(resolver, req);
+    }
+
+    /**
      * Validates that mappings for a existing resource with an alias and 
/etc/map entry
      * contain the /etc/map entry, the alias and the resource's path
      * 

Reply via email to