You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2022/09/08 11:26:50 UTC

[sling-org-apache-sling-launchpad-integration-tests] branch feature/SLING-11569-requestdispatcher-include-responsebuilder created (now 3b13d6f)

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

sseifert pushed a change to branch feature/SLING-11569-requestdispatcher-include-responsebuilder
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-launchpad-integration-tests.git


      at 3b13d6f  SLING-11569 Test case to validate including output from other servlets via RequestDispatcher

This branch includes the following new commits:

     new 3b13d6f  SLING-11569 Test case to validate including output from other servlets via RequestDispatcher

The 1 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.



[sling-org-apache-sling-launchpad-integration-tests] 01/01: SLING-11569 Test case to validate including output from other servlets via RequestDispatcher

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

sseifert pushed a commit to branch feature/SLING-11569-requestdispatcher-include-responsebuilder
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-launchpad-integration-tests.git

commit 3b13d6f253fa0b586927b268bd41b364bebcac14
Author: Stefan Seifert <st...@users.noreply.github.com>
AuthorDate: Thu Sep 8 13:19:06 2022 +0200

    SLING-11569 Test case to validate including output from other servlets via RequestDispatcher
---
 .../servlets/RequestDispatcherServletTest.java     | 57 ++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/RequestDispatcherServletTest.java b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/RequestDispatcherServletTest.java
new file mode 100644
index 0000000..d42e4bd
--- /dev/null
+++ b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/RequestDispatcherServletTest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.launchpad.webapp.integrationtest.servlets;
+
+import java.io.IOException;
+
+import org.apache.sling.commons.testing.integration.HttpTestBase;
+import org.junit.Test;
+
+/**
+ * Test servlets including other servlet responses via RequestDispatcher.
+ */
+public class RequestDispatcherServletTest extends HttpTestBase {
+
+    @Test
+    public void testOriginalResponse() throws IOException {
+        String content = getContent(HTTP_BASE_URL + "/testing/requestDispatcher/originalResponse", CONTENT_TYPE_PLAIN);
+
+        assertEquals("OriginalResponse", content);
+    }
+
+    /**
+     * Test includes output of OriginalResponseServlet directly via RequestDispatcher.
+     */
+    @Test
+    public void testIncludeDirect() throws IOException {
+        String content = getContent(HTTP_BASE_URL + "/testing/requestDispatcher/includeDirect", CONTENT_TYPE_PLAIN);
+
+        assertEquals("includeDirect(OriginalResponse)", content);
+    }
+
+    /**
+     * Test includes output of OriginalResponseServlet indirectly via RequestDispatcher, using a "synthetic response"
+     * created with Sling Builders API to buffer the response.
+     */
+    @Test
+    public void testIncludeBuffered() throws IOException {
+        String content = getContent(HTTP_BASE_URL + "/testing/requestDispatcher/includeBuffered", CONTENT_TYPE_PLAIN);
+
+        assertEquals("includeBuffered(OriginalResponse)", content);
+    }
+
+}
\ No newline at end of file