From 0136e233c8b183444d6d7ad3f20cf5dfd7db147d Mon Sep 17 00:00:00 2001 From: Andriy Redko Date: Wed, 18 Sep 2024 20:31:32 -0400 Subject: [PATCH] CXF-9039: Run Jakarta RESTful Web Services 3.1 TCK (initial commit) --- tck/cxf-tck/README.md | 15 + tck/cxf-tck/j2ee.pass | 16 + tck/cxf-tck/javajoe.pass | 16 + tck/cxf-tck/pom.xml | 500 ++++++++++++++++++ .../tck/CxfApplicationArchiveProcessor.java | 35 ++ .../apache/cxf/tck/CxfLoadableExtension.java | 27 + ...boss.arquillian.core.spi.LoadableExtension | 1 + ..._securitycontext_basic_web.war.sun-web.xml | 31 ++ ...equestcontext_security_web.war.sun-web.xml | 27 + 9 files changed, 668 insertions(+) create mode 100644 tck/cxf-tck/README.md create mode 100644 tck/cxf-tck/j2ee.pass create mode 100644 tck/cxf-tck/javajoe.pass create mode 100644 tck/cxf-tck/pom.xml create mode 100644 tck/cxf-tck/src/main/java/org/apache/cxf/tck/CxfApplicationArchiveProcessor.java create mode 100644 tck/cxf-tck/src/main/java/org/apache/cxf/tck/CxfLoadableExtension.java create mode 100644 tck/cxf-tck/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension create mode 100644 tck/cxf-tck/src/main/resources/jaxrs_ee_core_securitycontext_basic_web.war.sun-web.xml create mode 100644 tck/cxf-tck/src/main/resources/jaxrs_ee_rs_container_requestcontext_security_web.war.sun-web.xml diff --git a/tck/cxf-tck/README.md b/tck/cxf-tck/README.md new file mode 100644 index 00000000000..7e57cf5e2a3 --- /dev/null +++ b/tck/cxf-tck/README.md @@ -0,0 +1,15 @@ +# Jakarta REST TCK + +The **Jakarta REST TCK** is a standalone kit for testing compliance of an implementation with the Jakarta REST specification. + +**Note:** This TCK contains *only* tests being added since Jakarta REST 3.0. To proof compliance as part of a certification review, additional test have to be performed. Those are part of the Jakarta Platform TCK for historic reasons. + +## Performing Test + +* Execute `mvn verify`. +* Find the test result as part of Maven's output on the console or refer to the surefire reports. + +## Source + +* `https://github.com/jakartaee/rest/blob/3.1.0/jersey-tck/` + diff --git a/tck/cxf-tck/j2ee.pass b/tck/cxf-tck/j2ee.pass new file mode 100644 index 00000000000..906340cd6a0 --- /dev/null +++ b/tck/cxf-tck/j2ee.pass @@ -0,0 +1,16 @@ +# +# Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# +AS_ADMIN_USERPASSWORD=j2ee \ No newline at end of file diff --git a/tck/cxf-tck/javajoe.pass b/tck/cxf-tck/javajoe.pass new file mode 100644 index 00000000000..4e595a61687 --- /dev/null +++ b/tck/cxf-tck/javajoe.pass @@ -0,0 +1,16 @@ +# +# Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# +AS_ADMIN_USERPASSWORD=javajoe \ No newline at end of file diff --git a/tck/cxf-tck/pom.xml b/tck/cxf-tck/pom.xml new file mode 100644 index 00000000000..d3a77e769bb --- /dev/null +++ b/tck/cxf-tck/pom.xml @@ -0,0 +1,500 @@ + + + + 4.0.0 + + cxf-rest-tck + jar + + + jakarta.ws.rs + all + 3.1.0 + + + Jakarta RESTful WS Compliance + This test verifies the compliance of Apache CXF with Jakarta REST + + + 11 + 11 + 4.1.0-SNAPSHOT + 7.0.16 + ${project.build.directory}/glassfish7 + 10.0.0 + 5.11.0 + 3.1.0 + jakarta-restful-ws-tck + 1.8.0.Final + + + + + + org.junit + junit-bom + ${junit.jupiter.version} + pom + import + + + org.apache.cxf + cxf-bom + ${cxf.version} + pom + import + + + org.jboss.arquillian + arquillian-bom + ${arquillian.version} + import + pom + + + + + + + org.junit.jupiter + junit-jupiter + test + + + + org.glassfish.hk2 + hk2-locator + 3.0.0 + + + + com.sun.xml.bind + jaxb-impl + 4.0.5 + runtime + + + + com.github.hantsy.arquillian-container-glassfish-jakarta + arquillian-glassfish-managed-jakarta + 7.0.10 + + + + jakarta.ws.rs + ${tck.artifactId} + ${project.version} + test + + + + jakarta.ws.rs + jakarta.ws.rs-api + ${project.version} + test + + + + org.hamcrest + hamcrest + test + + + + org.glassfish.main.common + simple-glassfish-api + ${glassfish.container.version} + test + + + + org.jboss.arquillian.junit5 + arquillian-junit5-container + test + + + + jakarta.platform + jakarta.jakartaee-api + ${jakarta.platform.version} + provided + + + + commons-httpclient + commons-httpclient + 3.1 + + + + org.apache.cxf + cxf-core + test + + + + org.apache.cxf + cxf-rt-transports-http + test + + + + org.apache.cxf + cxf-rt-frontend-jaxrs + test + + + + org.apache.cxf + cxf-rt-rs-sse + test + + + + org.apache.cxf + cxf-rt-rs-client + test + + + + org.netbeans.tools + sigtest-maven-plugin + 1.4 + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.2.0 + + + unpack + pre-integration-test + + unpack + + + + + org.glassfish.main.distributions + glassfish + ${glassfish.container.version} + zip + false + ${project.build.directory} + + + + + + copy + pre-integration-test + + copy + + + + + org.apache.cxf + cxf-rt-rs-client + ${cxf.version} + jar + true + ${glassfish.home}/glassfish/lib + + + org.apache.cxf + cxf-core + ${cxf.version} + jar + true + ${glassfish.home}/glassfish/lib + + + org.apache.cxf + cxf-rt-frontend-jaxrs + ${cxf.version} + jar + true + ${glassfish.home}/glassfish/lib + + + org.apache.cxf + cxf-rt-transports-http + ${cxf.version} + jar + true + ${glassfish.home}/glassfish/lib + + + org.apache.cxf + cxf-rt-rs-sse + ${cxf.version} + jar + true + ${glassfish.home}/glassfish/lib + + + jakarta.ws.rs + jakarta.ws.rs-api + ${jakarta.rest.version} + jar + true + ${glassfish.home}/glassfish/modules + jakarta.ws.rs-api.jar + + + + + + + + org.codehaus.mojo + exec-maven-plugin + 3.4.1 + + + StopDomain1 + pre-integration-test + + exec + + + ${project.build.directory}/glassfish7/glassfish/bin/asadmin + + stop-domain + + + + + UpdateConfigs + pre-integration-test + + exec + + + zip + + -d + ${project.build.directory}/glassfish7/glassfish/modules/jersey-server.jar + META-INF/services/jakarta.ws.rs.ext.RuntimeDelegate + + + + + StartDomain1 + pre-integration-test + + exec + + + ${project.build.directory}/glassfish7/glassfish/bin/asadmin + + start-domain + + + + + Enable Trace requests + pre-integration-test + + exec + + + ${project.build.directory}/glassfish7/glassfish/bin/asadmin + + set + server-config.network-config.protocols.protocol.http-listener-1.http.trace-enabled=true + + + + + Delete User j2ee + pre-integration-test + + exec + + + ${project.build.directory}/glassfish7/glassfish/bin/asadmin + + --passwordfile + ${project.basedir}/j2ee.pass + delete-file-user + j2ee + + + 0 + 1 + + + + + Add User j2ee + pre-integration-test + + exec + + + ${project.build.directory}/glassfish7/glassfish/bin/asadmin + + --passwordfile + ${project.basedir}/j2ee.pass + create-file-user + --groups + staff:mgr + j2ee + + + + + Delete User javajoe + pre-integration-test + + exec + + + ${project.build.directory}/glassfish7/glassfish/bin/asadmin + + --passwordfile + ${project.basedir}/javajoe.pass + delete-file-user + javajoe + + + 0 + 1 + + + + + Add User javajoe + pre-integration-test + + exec + + + ${project.build.directory}/glassfish7/glassfish/bin/asadmin + + --passwordfile + ${project.basedir}/javajoe.pass + create-file-user + --groups + guest + javajoe + + + + + list users + pre-integration-test + + exec + + + ${project.build.directory}/glassfish7/glassfish/bin/asadmin + + list-file-users + + + + + StopDomain + pre-integration-test + + exec + + + ${project.build.directory}/glassfish7/glassfish/bin/asadmin + + stop-domain + + + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + 3.5.0 + + + gf-tests + + integration-test + verify + + + + **/SeBootstrapIT.java + + jakarta.ws.rs:${tck.artifactId} + + ${glassfish.home} + org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet + localhost + 8080 + true + j2ee + j2ee + javajoe + javajoe + ee.jakarta.tck.ws.rs.lib.implementation.sun.common.SunRIURL + ${project.build.directory}/jdk11-bundle + jakarta.xml.bind + ${glassfish.home}/glassfish/modules/jakarta.ws.rs-api.jar:${glassfish.home}/glassfish/modules/jakarta.xml.bind-api.jar:${project.build.directory}/jdk11-bundle/java.base:${project.build.directory}/jdk11-bundle/java.rmi:${project.build.directory}/jdk11-bundle/java.sql:${project.build.directory}/jdk11-bundle/java.naming + + + ${glassfish.home} + + + + + se-tests + + integration-test + verify + + + + **/SeBootstrapIT.java + + jakarta.ws.rs:${tck.artifactId} + + + + + + + + + + central + https://repo.maven.apache.org/maven2 + + + jitpack.io + https://jitpack.io + + + diff --git a/tck/cxf-tck/src/main/java/org/apache/cxf/tck/CxfApplicationArchiveProcessor.java b/tck/cxf-tck/src/main/java/org/apache/cxf/tck/CxfApplicationArchiveProcessor.java new file mode 100644 index 00000000000..8e42d495dcd --- /dev/null +++ b/tck/cxf-tck/src/main/java/org/apache/cxf/tck/CxfApplicationArchiveProcessor.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package org.apache.cxf.tck; + +import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor; +import org.jboss.arquillian.test.spi.TestClass; +import org.jboss.shrinkwrap.api.Archive; +import org.jboss.shrinkwrap.api.spec.WebArchive; + +public class CxfApplicationArchiveProcessor implements ApplicationArchiveProcessor { + @Override + public void process(Archive archive, TestClass testClass) { + if ("jaxrs_ee_rs_container_requestcontext_security_web.war".equals(archive.getName())) { + WebArchive webArchive = (WebArchive) archive; + webArchive.addAsWebInfResource("jaxrs_ee_rs_container_requestcontext_security_web.war.sun-web.xml", "sun-web.xml"); + } else if ("jaxrs_ee_core_securitycontext_basic_web.war".equals(archive.getName())) { + WebArchive webArchive = (WebArchive) archive; + webArchive.addAsWebInfResource("jaxrs_ee_core_securitycontext_basic_web.war.sun-web.xml", "sun-web.xml"); + } + } +} diff --git a/tck/cxf-tck/src/main/java/org/apache/cxf/tck/CxfLoadableExtension.java b/tck/cxf-tck/src/main/java/org/apache/cxf/tck/CxfLoadableExtension.java new file mode 100644 index 00000000000..3dd69ca2469 --- /dev/null +++ b/tck/cxf-tck/src/main/java/org/apache/cxf/tck/CxfLoadableExtension.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package org.apache.cxf.tck; + +import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor; +import org.jboss.arquillian.core.spi.LoadableExtension; + +public class CxfLoadableExtension implements LoadableExtension { + @Override + public void register(ExtensionBuilder extensionBuilder) { + extensionBuilder.service(ApplicationArchiveProcessor.class, CxfApplicationArchiveProcessor.class); + } +} diff --git a/tck/cxf-tck/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension b/tck/cxf-tck/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension new file mode 100644 index 00000000000..c70bb77d8cc --- /dev/null +++ b/tck/cxf-tck/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension @@ -0,0 +1 @@ +org.apache.cxf.tck.CxfLoadableExtension \ No newline at end of file diff --git a/tck/cxf-tck/src/main/resources/jaxrs_ee_core_securitycontext_basic_web.war.sun-web.xml b/tck/cxf-tck/src/main/resources/jaxrs_ee_core_securitycontext_basic_web.war.sun-web.xml new file mode 100644 index 00000000000..84d84bc0ca9 --- /dev/null +++ b/tck/cxf-tck/src/main/resources/jaxrs_ee_core_securitycontext_basic_web.war.sun-web.xml @@ -0,0 +1,31 @@ + + + + + + jaxrs_ee_core_securitycontext_basic_web + + DIRECTOR + j2ee + + + OTHERROLE + javajoe + + diff --git a/tck/cxf-tck/src/main/resources/jaxrs_ee_rs_container_requestcontext_security_web.war.sun-web.xml b/tck/cxf-tck/src/main/resources/jaxrs_ee_rs_container_requestcontext_security_web.war.sun-web.xml new file mode 100644 index 00000000000..1ba5a0796ba --- /dev/null +++ b/tck/cxf-tck/src/main/resources/jaxrs_ee_rs_container_requestcontext_security_web.war.sun-web.xml @@ -0,0 +1,27 @@ + + + + + + jaxrs_ee_rs_container_requestcontext_security_web + + DIRECTOR + j2ee + +