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/01/09 14:55:28 UTC

[sling-org-apache-sling-servlets-resolver] branch issue/SLING-8936 updated (f7c08f7 -> 45f2ffd)

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

bdelacretaz pushed a change to branch issue/SLING-8936
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-servlets-resolver.git.


    from f7c08f7  SLING-8936 - WIP: wait for Sling, getting 503 for a long time so far
     new 8ed3fc0  SLING-8936: add pax debugging option
     new 45f2ffd  SLING-8936: basic ServletSelectionIT

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pom.xml                                            |  3 ++
 ...faultServletIT.java => ServletSelectionIT.java} | 32 +++++++++++++++-------
 2 files changed, 25 insertions(+), 10 deletions(-)
 rename src/test/java/org/apache/sling/servlets/resolver/it/{DefaultServletIT.java => ServletSelectionIT.java} (81%)


[sling-org-apache-sling-servlets-resolver] 02/02: SLING-8936: basic ServletSelectionIT

Posted by bd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 45f2ffdbfd3dbfa450becd1dc0cb5f34cd9da847
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Jan 9 15:55:03 2020 +0100

    SLING-8936: basic ServletSelectionIT
---
 ...faultServletIT.java => ServletSelectionIT.java} | 32 +++++++++++++++-------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/src/test/java/org/apache/sling/servlets/resolver/it/DefaultServletIT.java b/src/test/java/org/apache/sling/servlets/resolver/it/ServletSelectionIT.java
similarity index 81%
rename from src/test/java/org/apache/sling/servlets/resolver/it/DefaultServletIT.java
rename to src/test/java/org/apache/sling/servlets/resolver/it/ServletSelectionIT.java
index 1b4084e..20be2d0 100644
--- a/src/test/java/org/apache/sling/servlets/resolver/it/DefaultServletIT.java
+++ b/src/test/java/org/apache/sling/servlets/resolver/it/ServletSelectionIT.java
@@ -20,6 +20,7 @@ package org.apache.sling.servlets.resolver.it;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.lang.reflect.Method;
@@ -45,7 +46,7 @@ import org.osgi.framework.ServiceReference;
 
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerClass.class)
-public class DefaultServletIT extends ServletResolverTestSupport {
+public class ServletSelectionIT extends ServletResolverTestSupport {
 
     private final static int STARTUP_WAIT_SECONDS = 30;
 
@@ -55,8 +56,9 @@ public class DefaultServletIT extends ServletResolverTestSupport {
     @Inject
     private ResourceResolverFactory resourceResolverFactory;
 
-    private MockSlingHttpServletResponse executeRequest(String path) throws Exception {
+    private MockSlingHttpServletResponse executeRequest(String path, int expectedStatus) throws Exception {
         final ResourceResolver resourceResolver = resourceResolverFactory.getAdministrativeResourceResolver(null);
+        assertNotNull("Expecting ResourceResolver", resourceResolver);
         final MockSlingHttpServletRequest request = new MockSlingHttpServletRequest(resourceResolver);
         request.setPathInfo(path);
         final MockSlingHttpServletResponse response = new MockSlingHttpServletResponse();
@@ -76,11 +78,15 @@ public class DefaultServletIT extends ServletResolverTestSupport {
                 "processRequest", 
                 HttpServletRequest.class, HttpServletResponse.class, ResourceResolver.class);
             assertNotNull("Expecting processRequest method", processMethod);
-            processMethod.invoke(processor, request, response, null);
+            processMethod.invoke(processor, request, response, resourceResolver);
         } finally {
             bundleContext.ungetService(ref);
         }
 
+        if(expectedStatus > 0) {
+            assertEquals("Expected status " + expectedStatus + " at " + path, expectedStatus, response.getStatus());
+        }
+
         return response;
     }
 
@@ -88,10 +94,10 @@ public class DefaultServletIT extends ServletResolverTestSupport {
     public void waitForStableSling() throws Exception {
         final int expectedStatus = 200;
         final List<Integer> statuses = new ArrayList<>();
-        final String path = "/starter.html";
+        final String path = "/.json";
         final long endTime = System.currentTimeMillis() + STARTUP_WAIT_SECONDS * 1000;
         while(System.currentTimeMillis() < endTime) {
-            final int status = executeRequest(path).getStatus();
+            final int status = executeRequest(path, -1).getStatus();
             statuses.add(status);
             if(status == expectedStatus) {
                 return;
@@ -102,11 +108,17 @@ public class DefaultServletIT extends ServletResolverTestSupport {
     }
 
     @Test
-    public void testDefaultServlet() throws Exception {
-        final MockSlingHttpServletResponse response = executeRequest("/starter.html");
-        assertEquals(200, response.getStatus());
-        final String TODO_SHOULD_NOT_BE_EMPTY = "";
-        assertEquals(TODO_SHOULD_NOT_BE_EMPTY, response.getOutputAsString());
+    public void testDefaultJsonServlet() throws Exception {
+        final MockSlingHttpServletResponse response = executeRequest("/.json", 200);
+        final String content = response.getOutputAsString();
+        final String [] expected = {
+            "jcr:primaryType\":\"rep:root",
+            "jcr:mixinTypes\":[\"rep:AccessControllable\"]"
+        };
+        for(String s : expected) {
+            assertTrue("Expecting in output: " + s + ", got " + content, content.contains(s));
+        }
+
     }
 
 }
\ No newline at end of file


[sling-org-apache-sling-servlets-resolver] 01/02: SLING-8936: add pax debugging option

Posted by bd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 8ed3fc0a568e3f0db3fa1ce9317e665997215217
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Jan 9 15:52:11 2020 +0100

    SLING-8936: add pax debugging option
---
 pom.xml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/pom.xml b/pom.xml
index a15c604..38cde94 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,6 +45,8 @@
 
     <properties>
         <site.jira.version.id>12314292</site.jira.version.id>
+        <!-- To debug the pax process, override this with -D -->
+        <pax.vm.options>-Xmx256M -XX:MaxPermSize=256m</pax.vm.options>
     </properties>
 
     <build>
@@ -132,6 +134,7 @@
                     </execution>
                 </executions>
                 <configuration>
+                    <argLine>${pax.vm.options}</argLine>
                     <redirectTestOutputToFile>true</redirectTestOutputToFile>
                     <systemProperties>
                         <property>