You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2020/03/19 14:36:23 UTC

[sling-org-apache-sling-servlets-resolver] branch master updated: SLING-9222 - add .EMPTY. tests to ServletSelectionIT, as examples as there's a link to that class in the docs

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 23e5181  SLING-9222 - add .EMPTY. tests to ServletSelectionIT, as examples as there's a link to that class in the docs
23e5181 is described below

commit 23e518129f1cfac3a804dd61f992fb07e2740931
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Mar 19 15:34:37 2020 +0100

    SLING-9222 - add .EMPTY. tests to ServletSelectionIT, as examples as there's a link to that class in the docs
---
 .../servlets/resolver/it/ServletSelectionIT.java   | 35 ++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/src/test/java/org/apache/sling/servlets/resolver/it/ServletSelectionIT.java b/src/test/java/org/apache/sling/servlets/resolver/it/ServletSelectionIT.java
index 71b2827..b094769 100644
--- a/src/test/java/org/apache/sling/servlets/resolver/it/ServletSelectionIT.java
+++ b/src/test/java/org/apache/sling/servlets/resolver/it/ServletSelectionIT.java
@@ -81,6 +81,25 @@ public class ServletSelectionIT extends ServletResolverTestSupport {
         .with(P_STRICT_PATHS, "true")
         .with(P_SELECTORS, new String[] { "one", "two" })
         .register(bundleContext);
+
+        new TestServlet("EmptySelectors")
+        .with(P_PATHS, "/emptySel")
+        .with(P_STRICT_PATHS, "true")
+        .with(P_SELECTORS, new String[] { ".EMPTY." })
+        .register(bundleContext);
+
+        new TestServlet("EmptyExtensions")
+        .with(P_PATHS, "/emptyExt")
+        .with(P_STRICT_PATHS, "true")
+        .with(P_EXTENSIONS, new String[] { ".EMPTY." })
+        .register(bundleContext);
+
+        new TestServlet("EmptyExtensionsAndSelectors")
+        .with(P_PATHS, "/emptyExtSel")
+        .with(P_STRICT_PATHS, "true")
+        .with(P_SELECTORS, new String[] { ".EMPTY." })
+        .with(P_EXTENSIONS, new String[] { ".EMPTY." })
+        .register(bundleContext);
     }
 
     @Test
@@ -170,4 +189,20 @@ public class ServletSelectionIT extends ServletResolverTestSupport {
         assertTestServlet("/extpaths_multiple.two.html", "ExtPathsMultipleSelectors");
         assertTestServlet("/extpaths_multiple.three.html", HttpServletResponse.SC_FORBIDDEN);
     }
+
+    @Test
+    public void testEmptyExtensionsAndSelectors() throws Exception {
+        assertTestServlet("/emptyExtSel", "EmptyExtensionsAndSelectors");
+        assertTestServlet("/emptyExtSel.ext", HttpServletResponse.SC_FORBIDDEN);
+        assertTestServlet("/emptyExtSel.sel.ext", HttpServletResponse.SC_FORBIDDEN);
+
+        assertTestServlet("/emptyExt", "EmptyExtensions");
+        assertTestServlet("/emptyExt.sel.", "EmptyExtensions");
+        assertTestServlet("/emptyExt.sel.ext", HttpServletResponse.SC_FORBIDDEN);
+
+        assertTestServlet("/emptySel", "EmptySelectors");
+        assertTestServlet("/emptySel.", "EmptySelectors");
+        assertTestServlet("/emptySel.ext", "EmptySelectors");
+        assertTestServlet("/emptySel.sel.ext", HttpServletResponse.SC_FORBIDDEN);
+    }
 }
\ No newline at end of file