You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2021/08/18 14:42:26 UTC

[GitHub] [sling-org-apache-sling-resourceresolver] henrykuijpers commented on a change in pull request #46: SLING-10447 Improve the querys that are used to load vanity paths, by specifying path restrictions

henrykuijpers commented on a change in pull request #46:
URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/46#discussion_r691306477



##########
File path: src/test/java/org/apache/sling/resourceresolver/impl/mapping/MapEntriesTest.java
##########
@@ -370,26 +381,31 @@ public void test_vanity_path_updates() throws Exception {
     @Test
     public void test_vanity_path_registration_include_exclude() throws IOException {
         final String[] validPaths = {"/libs/somewhere", "/libs/a/b", "/foo/a", "/baa/a"};
-        final String[] invalidPaths = {"/libs/denied/a", "/libs/denied/b/c", "/nowhere"};
 
         final List<Resource> resources = new ArrayList<>();
         for(final String val : validPaths) {
             resources.add(getVanityPathResource(val));
         }
-        for(final String val : invalidPaths) {
-            resources.add(getVanityPathResource(val));
-        }
-
-
-        when(resourceResolver.findResources(anyString(), eq("sql"))).thenAnswer(new Answer<Iterator<Resource>>() {
-
-            @Override
-            public Iterator<Resource> answer(InvocationOnMock invocation) throws Throwable {
-                if (invocation.getArguments()[0].toString().contains("sling:vanityPath")) {
-                    return resources.iterator();
-                } else {
-                    return Collections.<Resource> emptySet().iterator();
-                }
+        when(resourceResolver.findResources(anyString(), eq("sql"))).thenAnswer((Answer<Iterator<Resource>>) invocation -> {

Review comment:
       Indeed, it looks like `ResourceResolverType.JCR_OAK` is a solution that can actually parse and execute a query. Very cool! I've been using it in the project I'm working on and that's really nice. It's also nice that I was able to get com.day.cq.search working in the unit test, to test the predicate search that we're executing. But that's something outside Sling, of course.
   
   I've created https://issues.apache.org/jira/browse/SLING-10742 to tackle this.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org