diff --git a/arquillian/managed/src/main/java/cloud/piranha/arquillian/managed/ManagedPiranhaContainer.java b/arquillian/managed/src/main/java/cloud/piranha/arquillian/managed/ManagedPiranhaContainer.java
index 76cbc2227..e127470cf 100644
--- a/arquillian/managed/src/main/java/cloud/piranha/arquillian/managed/ManagedPiranhaContainer.java
+++ b/arquillian/managed/src/main/java/cloud/piranha/arquillian/managed/ManagedPiranhaContainer.java
@@ -233,14 +233,14 @@ private String toAppName(Archive> archive) {
private File getPiranhaJarFile(String version) throws IOException {
URL downloadUrl = createMavenCentralArtifactUrl(
"cloud.piranha.dist",
- "piranha-dist-coreprofile",
+ "piranha-dist-" + configuration.getDistribution(),
version,
"jar"
);
String artifactPath = createArtifactPath(
"cloud.piranha.dist",
- "piranha-dist-coreprofile",
+ "piranha-dist-" + configuration.getDistribution(),
version,
"jar"
);
@@ -348,11 +348,16 @@ private void startPiranha(File runtimeDirectory, File warFile) throws IOExceptio
if (classpath.isEmpty()) {
commands.add("-jar");
- commands.add("piranha-dist-coreprofile.jar");
+ commands.add("piranha-" + configuration.getDistribution() + ".jar");
} else {
commands.add("-cp");
- commands.add(classpath.toString() + "piranha-dist-coreprofile.jar");
- commands.add("cloud.piranha.dist.coreprofile.CoreProfilePiranhaMain");
+ commands.add(classpath.toString() + "piranha-" + configuration.getDistribution() + ".jar");
+ if (configuration.getDistribution().equals("coreprofile")) {
+ commands.add("cloud.piranha.dist.coreprofile.CoreProfilePiranhaMain");
+ }
+ if (configuration.getDistribution().equals("webprofile")) {
+ commands.add("cloud.piranha.dist.webprofile.WebProfilePiranhaMain");
+ }
}
commands.add("--http-port");
commands.add(Integer.toString(configuration.getHttpPort()));
@@ -370,13 +375,15 @@ private void startPiranha(File runtimeDirectory, File warFile) throws IOExceptio
Starting Piranha
- Directory: {0}
- Log: {1}
- URL: {2}
+ Classpath: {0}
+ Directory: {1}
+ Log: {2}
+ URL: {3}
""",
+ classpath.toString(),
runtimeDirectory,
logFile.getAbsolutePath(),
appURL);
@@ -443,7 +450,7 @@ private void copyPiranhaJarFile(File runtimeDirectory, File zipFile) throws IOEx
}
Files.copy(zipFile.toPath(),
- Path.of(runtimeDirectory + "/piranha-dist-coreprofile.jar"),
+ Path.of(runtimeDirectory + "/piranha-" + configuration.getDistribution() + ".jar"),
REPLACE_EXISTING);
}
diff --git a/arquillian/managed/src/main/java/cloud/piranha/arquillian/managed/ManagedPiranhaContainerConfiguration.java b/arquillian/managed/src/main/java/cloud/piranha/arquillian/managed/ManagedPiranhaContainerConfiguration.java
index 8ae5307c1..422d3ef41 100644
--- a/arquillian/managed/src/main/java/cloud/piranha/arquillian/managed/ManagedPiranhaContainerConfiguration.java
+++ b/arquillian/managed/src/main/java/cloud/piranha/arquillian/managed/ManagedPiranhaContainerConfiguration.java
@@ -52,6 +52,11 @@
*
not enabled by default |
*
*
+ * piranha.distribution |
+ * The Piranha distribution to use |
+ * coreprofile by default |
+ *
+ *
* piranha.httpPort |
* The integer to select the HTTP port to use for the Piranha process |
* if not set an unused port will be automatically chosen |
@@ -83,6 +88,11 @@ public class ManagedPiranhaContainerConfiguration implements ContainerConfigurat
*/
private static final System.Logger LOGGER = System.getLogger(ManagedPiranhaContainerConfiguration.class.getName());
+ /**
+ * Stores the distribution to use.
+ */
+ private String distribution = System.getProperty("piranha.distribution", "coreprofile");
+
/**
* Stores the debug flag.
*/
@@ -113,6 +123,15 @@ public class ManagedPiranhaContainerConfiguration implements ContainerConfigurat
*/
public ManagedPiranhaContainerConfiguration() {
}
+
+ /**
+ * Get the distribution.
+ *
+ * @return the distribution.
+ */
+ public String getDistribution() {
+ return distribution;
+ }
/**
* Get the HTTP port.
@@ -171,6 +190,15 @@ public void setDebug(boolean debug) {
this.debug = debug;
}
+ /**
+ * Set the distribution.
+ *
+ * @param distribution the distribution.
+ */
+ public void setDistribution(String distribution) {
+ this.distribution = distribution;
+ }
+
/**
* Set the HTTP port.
*
diff --git a/test/webprofile/integration/pom.xml b/test/webprofile/integration/pom.xml
new file mode 100644
index 000000000..09990ddc2
--- /dev/null
+++ b/test/webprofile/integration/pom.xml
@@ -0,0 +1,85 @@
+
+
+
+ 4.0.0
+
+ cloud.piranha.test.webprofile
+ project
+ 24.11.0-SNAPSHOT
+
+ piranha-test-webprofile-integration
+ war
+ Piranha - Test - Web Profile - Distribution Integration Tests
+
+ UTF-8
+
+
+
+
+ jakarta.platform
+ jakarta.jakartaee-web-api
+ provided
+
+
+
+ cloud.piranha.arquillian
+ piranha-arquillian-managed
+ ${project.version}
+ test
+
+
+ org.jboss.arquillian.junit5
+ arquillian-junit5-container
+ ${arquillian.version}
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-params
+ test
+
+
+
+ piranha-test-webprofile-integration
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+
+
+
+ integration-test
+ verify
+
+
+
+
+ 10
+
+ webprofile
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+
+ false
+
+
+
+
+
diff --git a/test/webprofile/integration/src/main/java/integration/DependencyInjectionBean.java b/test/webprofile/integration/src/main/java/integration/DependencyInjectionBean.java
new file mode 100644
index 000000000..2d0d295ac
--- /dev/null
+++ b/test/webprofile/integration/src/main/java/integration/DependencyInjectionBean.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2002-2024 Manorrock.com. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package integration;
+
+import jakarta.enterprise.context.ApplicationScoped;
+
+/**
+ * The one and only Dependency Injection bean.
+ *
+ * @author Manfred Riem (mriem@manorrock.com)
+ */
+@ApplicationScoped
+public class DependencyInjectionBean {
+
+ /**
+ * Get the string to validate dependency injection works.
+ *
+ * @return the string.
+ */
+ public String dependencyInjection() {
+ return "Dependency Injection works!";
+ }
+}
diff --git a/test/webprofile/integration/src/main/java/integration/ExpressionBean.java b/test/webprofile/integration/src/main/java/integration/ExpressionBean.java
new file mode 100644
index 000000000..941f07c2c
--- /dev/null
+++ b/test/webprofile/integration/src/main/java/integration/ExpressionBean.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2002-2024 Manorrock.com. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package integration;
+
+import jakarta.inject.Named;
+import jakarta.enterprise.context.ApplicationScoped;
+
+/**
+ * The Expression bean.
+ *
+ * @author Manfred Riem (mriem@manorrock.com)
+ */
+@Named(value = "expressionBean")
+@ApplicationScoped
+public class ExpressionBean {
+
+ /**
+ * Get the message.
+ *
+ * @return the message.
+ */
+ public String getMessage() {
+ return "Expression Language works!";
+ }
+}
diff --git a/test/webprofile/integration/src/main/java/integration/FacesBean.java b/test/webprofile/integration/src/main/java/integration/FacesBean.java
new file mode 100644
index 000000000..68f3417ac
--- /dev/null
+++ b/test/webprofile/integration/src/main/java/integration/FacesBean.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2002-2024 Manorrock.com. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package integration;
+
+import jakarta.inject.Named;
+import jakarta.enterprise.context.ApplicationScoped;
+
+/**
+ * The Faces bean.
+ *
+ * @author Manfred Riem (mriem@manorrock.com)
+ */
+@Named(value = "facesBean")
+@ApplicationScoped
+public class FacesBean {
+
+ /**
+ * Get the message.
+ *
+ * @return the message.
+ */
+ public String getMessage() {
+ return "Faces works!";
+ }
+}
diff --git a/test/webprofile/integration/src/main/java/integration/IntegrationApplication.java b/test/webprofile/integration/src/main/java/integration/IntegrationApplication.java
new file mode 100644
index 000000000..f0fb099cd
--- /dev/null
+++ b/test/webprofile/integration/src/main/java/integration/IntegrationApplication.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2002-2024 Manorrock.com. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package integration;
+
+import jakarta.ws.rs.ApplicationPath;
+import jakarta.ws.rs.core.Application;
+
+/**
+ * The HelloWorld application.
+ *
+ * @author Manfred Riem (mriem@manorrock.com)
+ */
+@ApplicationPath("rest")
+public class IntegrationApplication extends Application {
+}
diff --git a/test/webprofile/integration/src/main/java/integration/IntegrationBean.java b/test/webprofile/integration/src/main/java/integration/IntegrationBean.java
new file mode 100644
index 000000000..a1d99fd82
--- /dev/null
+++ b/test/webprofile/integration/src/main/java/integration/IntegrationBean.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2002-2024 Manorrock.com. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package integration;
+
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import jakarta.json.Json;
+import jakarta.json.stream.JsonParser;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.Produces;
+import java.io.StringReader;
+
+/**
+ * The Integration bean.
+ *
+ * @author Manfred Riem (mriem@manorrock.com)
+ */
+@Path("")
+@RequestScoped
+public class IntegrationBean {
+
+ /**
+ * Stores the DependencyInjectionBean.
+ */
+ @Inject
+ private DependencyInjectionBean dependencyInjection;
+
+ /**
+ * Stores the intercept bean.
+ */
+ @Inject
+ private InterceptBean interceptBean;
+
+ /**
+ * Validate the correct string is returned using the bean injected using the
+ * Inject annotation.
+ *
+ * @return 'Dependency Injection works!'.
+ */
+ @GET
+ @Path("/dependencyInjection")
+ public String dependencyInjection() {
+ return dependencyInjection.dependencyInjection();
+ }
+
+ /**
+ * Validate the correct string is returned using an interceptor.
+ *
+ * @return 'Interceptor work!'.
+ */
+ @GET
+ @Path("/intercept")
+ public String intercept() {
+ return interceptBean.intercept();
+ }
+
+ /**
+ * Validate JSON Binding works.
+ *
+ * @return 'JSON Binding works!' in JSON format.
+ */
+ @GET
+ @Produces("application/json")
+ @Path("/jsonb")
+ public Jsonb jsonb() {
+ return new Jsonb();
+ }
+
+ /**
+ * Validate JSON Processing works.
+ *
+ * @param jsonString a JSON string.
+ * @return 'JSON processing works!' in JSON format.
+ */
+ @POST
+ @Produces("application/json")
+ @Consumes("application/json")
+ @Path("/jsonp")
+ public Jsonb jsonp(String jsonString) {
+ Jsonb jsonb = new Jsonb();
+ try ( JsonParser parser = Json.createParser(new StringReader(jsonString));) {
+ parser.next();
+ String string = parser.getString();
+ jsonb.setString(string);
+ }
+ return jsonb;
+ }
+
+ /**
+ * Say 'REST works!'.
+ *
+ * @return 'Hello World!'.
+ */
+ @GET
+ @Path("/rest")
+ public String rest() {
+ return "REST works!";
+ }
+}
diff --git a/test/webprofile/integration/src/main/java/integration/IntegrationServlet.java b/test/webprofile/integration/src/main/java/integration/IntegrationServlet.java
new file mode 100644
index 000000000..2f59a262d
--- /dev/null
+++ b/test/webprofile/integration/src/main/java/integration/IntegrationServlet.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2002-2024 Manorrock.com. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package integration;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.annotation.WebServlet;
+import jakarta.servlet.http.HttpServlet;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+
+/**
+ * The Servlet testing Jakarta Servlet integration.
+ *
+ * @author Manfred Riem (mriem@manorrock.com)
+ */
+@WebServlet(name = "IntegrationServlet", urlPatterns = {"/integrationServlet"})
+public class IntegrationServlet extends HttpServlet {
+
+ /**
+ * Handles the HTTP GET
method.
+ *
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ response.setContentType("text/html;charset=UTF-8");
+ try (PrintWriter out = response.getWriter()) {
+ out.println("");
+ out.println("");
+ out.println("");
+ out.println("Servlet works!");
+ out.println("");
+ out.println("");
+ out.println("Servlet works!
");
+ out.println("");
+ out.println("");
+ }
+ }
+}
diff --git a/test/webprofile/integration/src/main/java/integration/InterceptBean.java b/test/webprofile/integration/src/main/java/integration/InterceptBean.java
new file mode 100644
index 000000000..2f7a3d642
--- /dev/null
+++ b/test/webprofile/integration/src/main/java/integration/InterceptBean.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2002-2024 Manorrock.com. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package integration;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.interceptor.Interceptors;
+
+/**
+ * The Intercept bean.
+ *
+ * @author Manfred Riem (mriem@manorrock.com)
+ */
+@ApplicationScoped
+@Interceptors(InterceptInterceptor.class)
+public class InterceptBean {
+
+ /**
+ * Get the string to validate the interceptor works.
+ *
+ * @return the string.
+ */
+ public String intercept() {
+ return "Inceptor does NOT work!";
+ }
+}
diff --git a/test/webprofile/integration/src/main/java/integration/InterceptInterceptor.java b/test/webprofile/integration/src/main/java/integration/InterceptInterceptor.java
new file mode 100644
index 000000000..c65a3fe3e
--- /dev/null
+++ b/test/webprofile/integration/src/main/java/integration/InterceptInterceptor.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2002-2024 Manorrock.com. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package integration;
+
+import jakarta.interceptor.AroundInvoke;
+import jakarta.interceptor.Interceptor;
+import jakarta.interceptor.InvocationContext;
+
+/**
+ * The intercept interceptor.
+ *
+ * @author Manfred Riem (mriem@manorrock.com)
+ */
+@Interceptor
+public class InterceptInterceptor {
+
+ /**
+ * Intercept the call and return 'Interceptor works!'.
+ *
+ * @param context the invocation context.
+ * @return 'Interceptor works!'.
+ */
+ @AroundInvoke
+ public Object intercepted(InvocationContext context) {
+ return "Interceptor works!";
+ }
+}
diff --git a/test/webprofile/integration/src/main/java/integration/Jsonb.java b/test/webprofile/integration/src/main/java/integration/Jsonb.java
new file mode 100644
index 000000000..8aca68e9f
--- /dev/null
+++ b/test/webprofile/integration/src/main/java/integration/Jsonb.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2002-2024 Manorrock.com. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package integration;
+
+/**
+ * The JSON Binding POJO.
+ *
+ * @author Manfred Riem (mriem@manorrock.com)
+ */
+public class Jsonb {
+
+ /**
+ * Stores the string.
+ */
+ private String string = "JSON Binding works!";
+
+ /**
+ * Get the string.
+ *
+ * @return the string.
+ */
+ public String getString() {
+ return string;
+ }
+
+ /**
+ * Set the string.
+ *
+ * @param string the string.
+ */
+ public void setString(String string) {
+ this.string = string;
+ }
+}
diff --git a/test/webprofile/integration/src/main/webapp/WEB-INF/beans.xml b/test/webprofile/integration/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 000000000..3561611ae
--- /dev/null
+++ b/test/webprofile/integration/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/test/webprofile/integration/src/main/webapp/WEB-INF/web.xml b/test/webprofile/integration/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 000000000..543ff0c68
--- /dev/null
+++ b/test/webprofile/integration/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ Faces Servlet
+ jakarta.faces.webapp.FacesServlet
+ 1
+
+
+ Faces Servlet
+ *.xhtml
+
+
+ 30
+
+
+ index.xhtml
+
+
diff --git a/test/webprofile/integration/src/main/webapp/expression.jsp b/test/webprofile/integration/src/main/webapp/expression.jsp
new file mode 100644
index 000000000..31726235f
--- /dev/null
+++ b/test/webprofile/integration/src/main/webapp/expression.jsp
@@ -0,0 +1,12 @@
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+
+
+
+
+
+ ${expressionBean.message}
+
+
+ ${expressionBean.message}
+
+
diff --git a/test/webprofile/integration/src/main/webapp/faces.xhtml b/test/webprofile/integration/src/main/webapp/faces.xhtml
new file mode 100644
index 000000000..888c6cd35
--- /dev/null
+++ b/test/webprofile/integration/src/main/webapp/faces.xhtml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+ #{facesBean.message}
+
+
+ #{facesBean.message}
+
+
diff --git a/test/webprofile/integration/src/main/webapp/pages.jsp b/test/webprofile/integration/src/main/webapp/pages.jsp
new file mode 100644
index 000000000..556fd3121
--- /dev/null
+++ b/test/webprofile/integration/src/main/webapp/pages.jsp
@@ -0,0 +1,12 @@
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+
+
+
+
+
+ Pages works!
+
+
+ Pages works!
+
+
diff --git a/test/webprofile/integration/src/test/java/integration/IntegrationIT.java b/test/webprofile/integration/src/test/java/integration/IntegrationIT.java
new file mode 100644
index 000000000..94f347b43
--- /dev/null
+++ b/test/webprofile/integration/src/test/java/integration/IntegrationIT.java
@@ -0,0 +1,235 @@
+/*
+ * Copyright (c) 2002-2024 Manorrock.com. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package integration;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.net.http.HttpResponse.BodyHandlers;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit5.ArquillianExtension;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import static org.jboss.shrinkwrap.api.ShrinkWrap.create;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+/**
+ * The Piranha Web Profile distribution integration tests.
+ *
+ *
+ * - testDependencyInjection validates Jakarta Dependency Injection works
+ * - testExpression validates Jakarta Expression Language works
+ * - testFaces validates Jakarta Faces works
+ * - testInterceptor validates Jakarta Interceptors works
+ * - testJsonBinding validates Jakarta JSON binding works
+ * - testJsonProcessing validates Jakarta JSON processing works
+ * - testPages validates Jakarta Pages works
+ * - testServlet validates Jakarta Servlet works
+ * - testREST validates Jakarta REST works
+ *
+ *
+ * @author Manfred Riem (mriem@manorrock.com)
+ */
+@ExtendWith(ArquillianExtension.class)
+class IntegrationIT {
+
+ @ArquillianResource
+ private URL baseUrl;
+
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ return create(WebArchive.class)
+ .addClass(DependencyInjectionBean.class)
+ .addClass(ExpressionBean.class)
+ .addClass(FacesBean.class)
+ .addClass(IntegrationApplication.class)
+ .addClass(IntegrationBean.class)
+ .addClass(IntegrationServlet.class)
+ .addClass(InterceptBean.class)
+ .addClass(InterceptInterceptor.class)
+ .addClass(Jsonb.class)
+ .addAsWebInfResource(new File("src/main/webapp/WEB-INF/beans.xml"))
+ .addAsWebInfResource(new File("src/main/webapp/WEB-INF/web.xml"))
+ .addAsWebResource(new File("src/main/webapp/expression.jsp"))
+ .addAsWebResource(new File("src/main/webapp/faces.xhtml"))
+ .addAsWebResource(new File("src/main/webapp/pages.jsp"));
+ }
+
+ /**
+ * Test dependency injection.
+ *
+ * @throws Exception when a serious error occurs.
+ */
+ @Test
+ @RunAsClient
+ void testDependencyInjection() throws Exception {
+ HttpClient client = HttpClient.newHttpClient();
+ HttpRequest request = HttpRequest
+ .newBuilder(new URI(baseUrl + "/rest/dependencyInjection"))
+ .build();
+ HttpResponse response = client.send(request, BodyHandlers.ofString());
+ assertTrue(response.body().contains("Dependency Injection works!"));
+ }
+
+ /**
+ * Test Expression Language.
+ *
+ * @throws Exception when a serious error occurs.
+ */
+ @Test
+ @RunAsClient
+ void testExpressionLanguage() throws Exception {
+ HttpClient client = HttpClient.newHttpClient();
+ HttpRequest request = HttpRequest
+ .newBuilder(new URI(baseUrl + "/expression.jsp"))
+ .build();
+ HttpResponse response = client.send(request, BodyHandlers.ofString());
+ assertTrue(response.body().contains("Expression Language works!"));
+ }
+
+ /**
+ * Test Faces.
+ *
+ * @throws Exception when a serious error occurs.
+ */
+ @Test
+ @RunAsClient
+ @Disabled
+ void testFaces() throws Exception {
+ HttpClient client = HttpClient.newHttpClient();
+ HttpRequest request = HttpRequest
+ .newBuilder(new URI(baseUrl + "/faces.xhtml"))
+ .build();
+ HttpResponse response = client.send(request, BodyHandlers.ofString());
+ assertTrue(response.body().contains("Faces works!"));
+ }
+
+ /**
+ * Test interceptors.
+ *
+ * @throws Exception when a serious error occurs.
+ */
+ @Test
+ @RunAsClient
+ void testInterceptor() throws Exception {
+ HttpClient client = HttpClient.newHttpClient();
+ HttpRequest request = HttpRequest
+ .newBuilder(new URI(baseUrl + "/rest/intercept"))
+ .build();
+ HttpResponse response = client.send(request, BodyHandlers.ofString());
+ assertTrue(response.body().contains("Interceptor works!"));
+ }
+
+ /**
+ * Test JSON binding.
+ *
+ * @throws Exception when a serious error occurs.
+ */
+ @Test
+ @RunAsClient
+ void testJsonBinding() throws Exception {
+ HttpClient client = HttpClient.newHttpClient();
+ HttpRequest request = HttpRequest
+ .newBuilder(new URI(baseUrl + "/rest/jsonb"))
+ .build();
+ HttpResponse response = client.send(request, BodyHandlers.ofString());
+ assertTrue(response.body().contains("{\"string\":\"JSON Binding works!\"}"));
+ }
+
+ /**
+ * Test JSON Processing.
+ *
+ * @throws Exception when a serious error occurs.
+ */
+ @Test
+ @RunAsClient
+ void testJsonProcessing() throws Exception {
+ HttpClient client = HttpClient.newHttpClient();
+ HttpRequest request = HttpRequest
+ .newBuilder(new URI(baseUrl + "/rest/jsonp"))
+ .POST(HttpRequest.BodyPublishers.ofString("\"JSON Processing works!\""))
+ .build();
+ HttpResponse response = client.send(request, BodyHandlers.ofString());
+ assertTrue(response.body().contains("{\"string\":\"JSON Processing works!\"}"));
+ }
+
+ /**
+ * Test Pages.
+ *
+ * @throws Exception when a serious error occurs.
+ */
+ @Test
+ @RunAsClient
+ void testPages() throws Exception {
+ HttpClient client = HttpClient.newHttpClient();
+ HttpRequest request = HttpRequest
+ .newBuilder(new URI(baseUrl + "/pages.jsp"))
+ .build();
+ HttpResponse response = client.send(request, BodyHandlers.ofString());
+ assertTrue(response.body().contains("Pages works!"));
+ }
+
+ /**
+ * Test Servlet.
+ *
+ * @throws Exception when a serious error occurs.
+ */
+ @Test
+ @RunAsClient
+ void testServlet() throws Exception {
+ HttpClient client = HttpClient.newHttpClient();
+ HttpRequest request = HttpRequest
+ .newBuilder(new URI(baseUrl + "/integrationServlet"))
+ .build();
+ HttpResponse response = client.send(request, BodyHandlers.ofString());
+ assertTrue(response.body().contains("Servlet works!"));
+ }
+
+ /**
+ * Test REST.
+ *
+ * @throws Exception when a serious error occurs.
+ */
+ @Test
+ @RunAsClient
+ void testREST() throws Exception {
+ HttpClient client = HttpClient.newHttpClient();
+ HttpRequest request = HttpRequest
+ .newBuilder(new URI(baseUrl + "/rest/rest"))
+ .build();
+ HttpResponse response = client.send(request, BodyHandlers.ofString());
+ assertTrue(response.body().contains("REST works!"));
+ }
+}
diff --git a/test/webprofile/pom.xml b/test/webprofile/pom.xml
index 6962a2625..5f8910d03 100644
--- a/test/webprofile/pom.xml
+++ b/test/webprofile/pom.xml
@@ -2,20 +2,32 @@
4.0.0
-
cloud.piranha.test
project
24.11.0-SNAPSHOT
-
cloud.piranha.test.webprofile
project
pom
-
Piranha - Test - Web Profile - Project
-
+
+
+
+ cloud.piranha.dist
+ piranha-dist-webprofile
+ ${project.version}
+ provided
+ pom
+
+
helloworld
+ integration