This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to branch issue/SLING-13070 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-starter-integration-tests.git
commit ccbc487361c62b036e4b7ca3a237a0cb340a5b3a Author: Robert Munteanu <[email protected]> AuthorDate: Tue Jan 27 15:45:19 2026 +0100 SLING-13070 - ScriptContextProvider for bundled scripts does not properly set JAKARTA_REQUEST and JAKARTA_REPONSE Added integration tests for bundled JSP and HTL scripts. --- .../starter/webapp/integrationtest/JspScriptingTest.java | 16 ++++++++++++++++ .../webapp/integrationtest/scripting/htl/HtlTest.java | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/main/java/org/apache/sling/starter/webapp/integrationtest/JspScriptingTest.java b/src/main/java/org/apache/sling/starter/webapp/integrationtest/JspScriptingTest.java index dfada8f..bfa85b2 100644 --- a/src/main/java/org/apache/sling/starter/webapp/integrationtest/JspScriptingTest.java +++ b/src/main/java/org/apache/sling/starter/webapp/integrationtest/JspScriptingTest.java @@ -18,7 +18,10 @@ */ package org.apache.sling.starter.webapp.integrationtest; +import java.util.Map; + import org.apache.sling.commons.testing.integration.HttpTest; +import org.apache.sling.commons.testing.integration.HttpTestBase; import org.apache.sling.commons.testing.integration.HttpTestNode; import org.apache.sling.commons.testing.junit.Retry; import org.apache.sling.commons.testing.junit.RetryRule; @@ -29,6 +32,7 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; /** Test JSP scripting @@ -187,6 +191,18 @@ public class JspScriptingTest { } } + @Test + public void testBundledScript() throws Exception { + String resourcePath = testRootUrl + "/bundled-script-resource"; + + H.getTestClient().createNode(resourcePath, Map.of("sling:resourceType", "sling/bundled-scripts/simple")); + + String content = H.getContent(resourcePath + ".html", HttpTestBase.CONTENT_TYPE_HTML) + .trim(); + + assertEquals("bundled script contents", "bundled script", content); + } + private void checkContent(final HttpTestNode tn) throws Exception { final String content = H.getContent(tn.nodeUrl + ".html", HttpTest.CONTENT_TYPE_HTML); assertTrue( diff --git a/src/main/java/org/apache/sling/starter/webapp/integrationtest/scripting/htl/HtlTest.java b/src/main/java/org/apache/sling/starter/webapp/integrationtest/scripting/htl/HtlTest.java index 75cf673..2f60b71 100644 --- a/src/main/java/org/apache/sling/starter/webapp/integrationtest/scripting/htl/HtlTest.java +++ b/src/main/java/org/apache/sling/starter/webapp/integrationtest/scripting/htl/HtlTest.java @@ -126,4 +126,20 @@ public class HtlTest extends HttpTestBase { assertTrue("Expected content to contain 'from-sling-model'", content.contains("from-sling-model")); } + + // enabled once SLING-13070 is fixed + public void testBundledScriptBindingsForRequest() throws IOException { + + testClient.mkdirs(HTTP_BASE_URL, "/content/htl"); + + testClient.createNode( + HTTP_BASE_URL + "/content/htl/bundled-script-with-binding", + Collections.singletonMap("sling:resourceType", "sling/bundled-scripts/expressions")); + + String content = getContent( + HTTP_BASE_URL + "/content/htl/bundled-script-with-binding.html", CONTENT_TYPE_HTML, null, 200).trim(); + + + assertEquals("<p>Included output</p>", content); + } }
