From cbc7b323732c75f59d6d4648e37877bf44b5cd33 Mon Sep 17 00:00:00 2001 From: Alwin Joseph <44426046+alwin-joseph@users.noreply.github.com> Date: Wed, 9 Mar 2022 18:31:48 +0530 Subject: [PATCH 001/305] Add jaxrs tck run module to test Jersey (#5000) * add jaxrs tck run module --- jersey-tck/README.md | 15 + jersey-tck/j2ee.pass | 16 + jersey-tck/javajoe.pass | 16 + jersey-tck/pom.xml | 501 ++++++++++++++++++ .../JerseyApplicationArchiveProcessor.java | 35 ++ .../core/tck/JerseyLoadableExtension.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, 669 insertions(+) create mode 100644 jersey-tck/README.md create mode 100644 jersey-tck/j2ee.pass create mode 100644 jersey-tck/javajoe.pass create mode 100644 jersey-tck/pom.xml create mode 100644 jersey-tck/src/main/java/org/glassfish/jersey/core/tck/JerseyApplicationArchiveProcessor.java create mode 100644 jersey-tck/src/main/java/org/glassfish/jersey/core/tck/JerseyLoadableExtension.java create mode 100644 jersey-tck/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension create mode 100644 jersey-tck/src/main/resources/jaxrs_ee_core_securitycontext_basic_web.war.sun-web.xml create mode 100644 jersey-tck/src/main/resources/jaxrs_ee_rs_container_requestcontext_security_web.war.sun-web.xml diff --git a/jersey-tck/README.md b/jersey-tck/README.md new file mode 100644 index 0000000000..2457e01cbc --- /dev/null +++ b/jersey-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. + + +## Performing Test + +While the test kit *is not dependent* of Maven, the most easy way to perform the tests is to create a copy of the sample Maven project found in the `jersey-tck` folder and adjust it to the actual needs of the implementation to be actually tested: +* Replace the dependency to Jersey by a dependency to the implementation to be actually tested. +* Execute `mvn verify`. +* Find the test result as part of Maven's output on the console or refer to the surefire reports. + +**Note:** Certainly the same can be performed using *other* build tools, like Gradle, or even by running a standalone Jupiter API compatible test runner (e. g. JUnit 5 Console Runner), as long as the Jakarta REST TCK JAR file and the implementation to test are both found on the classpath. + +**Hint:** The test project can safely get stored as part of the implementation, so it can be easily executed as part of the QA process. diff --git a/jersey-tck/j2ee.pass b/jersey-tck/j2ee.pass new file mode 100644 index 0000000000..7cd0e34f04 --- /dev/null +++ b/jersey-tck/j2ee.pass @@ -0,0 +1,16 @@ +# +# Copyright (c) 2022 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/jersey-tck/javajoe.pass b/jersey-tck/javajoe.pass new file mode 100644 index 0000000000..f06be725d7 --- /dev/null +++ b/jersey-tck/javajoe.pass @@ -0,0 +1,16 @@ +# +# Copyright (c) 2022 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/jersey-tck/pom.xml b/jersey-tck/pom.xml new file mode 100644 index 0000000000..e0fc24e1b6 --- /dev/null +++ b/jersey-tck/pom.xml @@ -0,0 +1,501 @@ + + + + 4.0.0 + + org.glassfish.jersey.core + jersey-tck + 3.1.0 + jar + + Jakarta RESTful WS Compliance for Jersey + This test verifies the compliance of Eclipse Jersey with Jakarta REST + + + 11 + 11 + 3.1.0-M3 + 6.2.5 + ${project.build.directory}/glassfish6 + 10.0.0-RC1 + 5.7.2 + 3.1.0 + jakarta-restful-ws-tck + + + + + + org.junit + junit-bom + ${junit.jupiter.version} + pom + import + + + org.glassfish.jersey + jersey-bom + ${jersey.version} + pom + import + + + + + + + jakarta-snapshots + https://jakarta.oss.sonatype.org/content/repositories/staging/ + + + + + + org.junit.jupiter + junit-jupiter + ${junit.jupiter.version} + + + + org.glassfish.hk2 + hk2-locator + 3.0.0 + + + + com.sun.xml.bind + jaxb-impl + 3.0.0 + runtime + + + + org.jboss.arquillian.container + arquillian-glassfish-managed-6 + 1.0.0.Alpha1 + + + + jakarta.ws.rs + ${tck.artifactId} + ${project.version} + test + + + + jakarta.ws.rs + jakarta.ws.rs-api + ${project.version} + test + + + + org.hamcrest + hamcrest + 2.2 + test + + + + org.glassfish.main.common + simple-glassfish-api + ${glassfish.container.version} + + + + org.jboss.arquillian.junit5 + arquillian-junit5-container + 1.7.0.Alpha10 + + + + jakarta.platform + jakarta.jakartaee-api + ${jakarta.platform.version} + provided + + + + commons-httpclient + commons-httpclient + 3.1 + + + + org.glassfish.jersey.core + jersey-server + ${jersey.version} + test + + + org.glassfish.jersey.containers + jersey-container-grizzly2-http + ${jersey.version} + test + + + org.netbeans.tools + sigtest-maven-plugin + 1.4 + + + org.glassfish.jersey.media + jersey-media-json-binding + ${jersey.version} + test + + + org.glassfish.jersey.media + jersey-media-jaxb + ${jersey.version} + test + + + org.glassfish.jersey.media + jersey-media-sse + ${jersey.version} + test + + + + + + + + + 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.glassfish.jersey.core + jersey-client + ${jersey.version} + jar + true + ${glassfish.home}/glassfish/modules + jersey-client.jar + + + org.glassfish.jersey.core + jersey-server + ${jersey.version} + jar + true + ${glassfish.home}/glassfish/modules + jersey-server.jar + + + org.glassfish.jersey.core + jersey-common + ${jersey.version} + jar + true + ${glassfish.home}/glassfish/modules + jersey-common.jar + + + org.glassfish.jersey.containers + jersey-container-grizzly2-http + ${jersey.version} + jar + true + ${glassfish.home}/glassfish/modules + jersey-container-grizzly2-http.jar + + + org.glassfish.jersey.containers + jersey-container-servlet-core + ${jersey.version} + jar + true + ${glassfish.home}/glassfish/modules + jersey-container-servlet-core.jar + + + org.glassfish.jersey.containers + jersey-container-servlet + ${jersey.version} + jar + true + ${glassfish.home}/glassfish/modules + jersey-container-servlet.jar + + + org.glassfish.jersey.media + jersey-media-sse + ${jersey.version} + jar + true + ${glassfish.home}/glassfish/modules + jersey-media-sse.jar + + + org.glassfish.jersey.media + jersey-media-json-binding + ${jersey.version} + jar + true + ${glassfish.home}/glassfish/modules + jersey-media-json-binding.jar + + + jakarta.ws.rs + jakarta.ws.rs-api + ${jakarta.rest.version} + jar + true + ${glassfish.home}/glassfish/modules + jakarta.ws.rs-api.jar + + + + + + + + exec-maven-plugin + org.codehaus.mojo + + + StopDomain1 + pre-integration-test + + exec + + + ${project.build.directory}/glassfish6/glassfish/bin/asadmin + + stop-domain + + + + + StartDomain1 + pre-integration-test + + exec + + + ${project.build.directory}/glassfish6/glassfish/bin/asadmin + + start-domain + + + + + Enable Trace requests + pre-integration-test + + exec + + + ${project.build.directory}/glassfish6/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}/glassfish6/glassfish/bin/asadmin + + --passwordfile + ${project.basedir}/j2ee.pass + delete-file-user + j2ee + + + 0 + 1 + + + + + Add User j2ee + pre-integration-test + + exec + + + ${project.build.directory}/glassfish6/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}/glassfish6/glassfish/bin/asadmin + + --passwordfile + ${project.basedir}/javajoe.pass + delete-file-user + javajoe + + + 0 + 1 + + + + + Add User javajoe + pre-integration-test + + exec + + + ${project.build.directory}/glassfish6/glassfish/bin/asadmin + + --passwordfile + ${project.basedir}/javajoe.pass + create-file-user + --groups + guest + javajoe + + + + + list users + pre-integration-test + + exec + + + ${project.build.directory}/glassfish6/glassfish/bin/asadmin + + list-file-users + + + + + StopDomain + pre-integration-test + + exec + + + ${project.build.directory}/glassfish6/glassfish/bin/asadmin + + stop-domain + + + + + + + + maven-failsafe-plugin + 3.0.0-M5 + + + gf-tests + + integration-test + verify + + + + **/SeBootstrapIT.java + + jakarta.ws.rs:${tck.artifactId} + + ${glassfish.home} + org.glassfish.jersey.servlet.ServletContainer + 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} + + + + + + + diff --git a/jersey-tck/src/main/java/org/glassfish/jersey/core/tck/JerseyApplicationArchiveProcessor.java b/jersey-tck/src/main/java/org/glassfish/jersey/core/tck/JerseyApplicationArchiveProcessor.java new file mode 100644 index 0000000000..c5597e5da8 --- /dev/null +++ b/jersey-tck/src/main/java/org/glassfish/jersey/core/tck/JerseyApplicationArchiveProcessor.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2022 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.glassfish.jersey.core.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 JerseyApplicationArchiveProcessor 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/jersey-tck/src/main/java/org/glassfish/jersey/core/tck/JerseyLoadableExtension.java b/jersey-tck/src/main/java/org/glassfish/jersey/core/tck/JerseyLoadableExtension.java new file mode 100644 index 0000000000..d4da355f25 --- /dev/null +++ b/jersey-tck/src/main/java/org/glassfish/jersey/core/tck/JerseyLoadableExtension.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2022 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.glassfish.jersey.core.tck; + +import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor; +import org.jboss.arquillian.core.spi.LoadableExtension; + +public class JerseyLoadableExtension implements LoadableExtension { + @Override + public void register(ExtensionBuilder extensionBuilder) { + extensionBuilder.service(ApplicationArchiveProcessor.class, JerseyApplicationArchiveProcessor.class); + } +} diff --git a/jersey-tck/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension b/jersey-tck/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension new file mode 100644 index 0000000000..577c00f53e --- /dev/null +++ b/jersey-tck/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension @@ -0,0 +1 @@ +org.glassfish.jersey.core.tck.JerseyLoadableExtension \ No newline at end of file diff --git a/jersey-tck/src/main/resources/jaxrs_ee_core_securitycontext_basic_web.war.sun-web.xml b/jersey-tck/src/main/resources/jaxrs_ee_core_securitycontext_basic_web.war.sun-web.xml new file mode 100644 index 0000000000..8e2a2519e4 --- /dev/null +++ b/jersey-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/jersey-tck/src/main/resources/jaxrs_ee_rs_container_requestcontext_security_web.war.sun-web.xml b/jersey-tck/src/main/resources/jaxrs_ee_rs_container_requestcontext_security_web.war.sun-web.xml new file mode 100644 index 0000000000..a5efdc5a21 --- /dev/null +++ b/jersey-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 + + From fe9829bb5abc89f09c92bbce1613d31331939eae Mon Sep 17 00:00:00 2001 From: hs536 Date: Thu, 17 Mar 2022 20:23:33 +0100 Subject: [PATCH 002/305] Bump JAXB from 3.0.X to 4.0.X --- .../jersey/jettison/JettisonJaxbContext.java | 14 +------------- .../internal/JettisonJaxbMarshaller.java | 8 ++++---- .../internal/JettisonJaxbUnmarshaller.java | 18 ++++-------------- 3 files changed, 9 insertions(+), 31 deletions(-) diff --git a/media/json-jettison/src/main/java/org/glassfish/jersey/jettison/JettisonJaxbContext.java b/media/json-jettison/src/main/java/org/glassfish/jersey/jettison/JettisonJaxbContext.java index f76ab53b5d..6d6b039a4e 100644 --- a/media/json-jettison/src/main/java/org/glassfish/jersey/jettison/JettisonJaxbContext.java +++ b/media/json-jettison/src/main/java/org/glassfish/jersey/jettison/JettisonJaxbContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2022 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 @@ -22,7 +22,6 @@ import jakarta.xml.bind.JAXBException; import jakarta.xml.bind.Marshaller; import jakarta.xml.bind.Unmarshaller; -import jakarta.xml.bind.Validator; import org.glassfish.jersey.jettison.internal.BaseJsonMarshaller; import org.glassfish.jersey.jettison.internal.BaseJsonUnmarshaller; @@ -300,15 +299,4 @@ public Unmarshaller createUnmarshaller() throws JAXBException { public Marshaller createMarshaller() throws JAXBException { return new JettisonJaxbMarshaller(jaxbContext, getJSONConfiguration()); } - - /** - * Simply delegates to underlying JAXBContext implementation. - * - * @return what underlying JAXBContext returns - * @throws jakarta.xml.bind.JAXBException - */ - @Override - public Validator createValidator() throws JAXBException { - return jaxbContext.createValidator(); - } } diff --git a/media/json-jettison/src/main/java/org/glassfish/jersey/jettison/internal/JettisonJaxbMarshaller.java b/media/json-jettison/src/main/java/org/glassfish/jersey/jettison/internal/JettisonJaxbMarshaller.java index cd78fc9d44..4603572ae0 100644 --- a/media/json-jettison/src/main/java/org/glassfish/jersey/jettison/internal/JettisonJaxbMarshaller.java +++ b/media/json-jettison/src/main/java/org/glassfish/jersey/jettison/internal/JettisonJaxbMarshaller.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2022 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 @@ -128,17 +128,17 @@ public ValidationEventHandler getEventHandler() throws JAXBException { } @Override - public void setAdapter(XmlAdapter adapter) { + public > void setAdapter(A adapter) { jaxbMarshaller.setAdapter(adapter); } @Override - public void setAdapter(Class type, A adapter) { + public > void setAdapter(Class type, A adapter) { jaxbMarshaller.setAdapter(type, adapter); } @Override - public A getAdapter(Class type) { + public > A getAdapter(Class type) { return jaxbMarshaller.getAdapter(type); } diff --git a/media/json-jettison/src/main/java/org/glassfish/jersey/jettison/internal/JettisonJaxbUnmarshaller.java b/media/json-jettison/src/main/java/org/glassfish/jersey/jettison/internal/JettisonJaxbUnmarshaller.java index 3d24d5032e..377e37ae59 100644 --- a/media/json-jettison/src/main/java/org/glassfish/jersey/jettison/internal/JettisonJaxbUnmarshaller.java +++ b/media/json-jettison/src/main/java/org/glassfish/jersey/jettison/internal/JettisonJaxbUnmarshaller.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2022 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 @@ -122,16 +122,6 @@ public UnmarshallerHandler getUnmarshallerHandler() { return this.jaxbUnmarshaller.getUnmarshallerHandler(); } - @Override - public void setValidating(boolean validating) throws JAXBException { - this.jaxbUnmarshaller.setValidating(validating); - } - - @Override - public boolean isValidating() throws JAXBException { - return this.jaxbUnmarshaller.isValidating(); - } - @Override public void setEventHandler(ValidationEventHandler validationEventHandler) throws JAXBException { this.jaxbUnmarshaller.setEventHandler(validationEventHandler); @@ -163,17 +153,17 @@ public Schema getSchema() { } @Override - public void setAdapter(XmlAdapter xmlAdapter) { + public > void setAdapter(A xmlAdapter) { this.jaxbUnmarshaller.setAdapter(xmlAdapter); } @Override - public void setAdapter(Class type, A adapter) { + public > void setAdapter(Class type, A adapter) { this.jaxbUnmarshaller.setAdapter(type, adapter); } @Override - public A getAdapter(Class type) { + public > A getAdapter(Class type) { return this.jaxbUnmarshaller.getAdapter(type); } From 44d62202133097bae57ee98e5fd3c4c7a0c0fdba Mon Sep 17 00:00:00 2001 From: jansupol Date: Fri, 18 Mar 2022 12:58:04 +0100 Subject: [PATCH 003/305] Update versions of JAX-B, Moxy, JSON-B, JSON-P Signed-off-by: jansupol --- pom.xml | 39 +++++++++---------- .../AnotherContactBean.java | 7 ++-- .../ValidateOnExecutionBasicTest.java | 37 +++++++++++++++++- .../e2e/server/wadl/WadlBeanParamTest.java | 12 ++++-- .../e2e/server/wadl/WadlResourceTest.java | 9 ++++- .../osgi/test/basic/JsonJacksonTest.java | 3 ++ .../jersey/osgi/test/basic/JsonMoxyTest.java | 4 +- .../osgi/test/basic/PackageScanningTest.java | 2 +- .../jersey/osgi/test/util/Helper.java | 6 +-- 9 files changed, 82 insertions(+), 37 deletions(-) diff --git a/pom.xml b/pom.xml index 39b9360f6c..e37eba9579 100644 --- a/pom.xml +++ b/pom.xml @@ -2120,12 +2120,9 @@ 1.3 1.0.3 1.6 - org.glassfish.hk2.*;version="[3.0,4)" - org.jvnet.hk2.*;version="[3.0,4)" - 6.0.0 4.5.13 2.13.0 - 3.25.0-GA + 3.28.0-GA 3.3.0.Final 1.19.3 ${jersey1.version} @@ -2159,7 +2156,6 @@ 4.0.2.Final - 3.1.7.SP1 7.0.1.Final 2.11.0 @@ -2168,43 +2164,46 @@ 20.3.2 - 6.0.0 + 7.0.0-M2 3.0.0 4.0.0 3.0.1 2.0.0 - 3.0.2 - 3.0.0 - 2.0.0 + 3.0.3 + org.glassfish.hk2.*;version="[3.0,4)" + org.jvnet.hk2.*;version="[3.0,4)" + 7.0.0-M2 + 3.1.0 + 3.0.0 2.0.0 5.0.0 6.0.0 5.0.0 4.0.0 - 2.0.1 + 2.1.0 2.0.1 4.0.0 4.0.2 jakarta.annotation.*;version="[2.0,3)" - 2.0.0 + 2.1.0 2.0.1 - 2.0.0 + 2.1.0 2.1.0 - 3.0.0 + 3.1.0 3.0.1 - 3.0.1 - 3.0.2 + 4.0.0 + 4.0.0-M3 3.1 3.1.0 11.0.7 11.0.7 6.1.14 - 2.0.0 - 1.0.0 - 1.0.0 - 3.0.2 - 2.0.3 + 3.0.0 + 1.1.0 + 1.1.0 + 4.0.0-M3 + 3.0.0-RC1 1.3.2 diff --git a/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/validation/validateonexecution/AnotherContactBean.java b/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/validation/validateonexecution/AnotherContactBean.java index fa65eae744..2d88b34ad0 100644 --- a/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/validation/validateonexecution/AnotherContactBean.java +++ b/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/validation/validateonexecution/AnotherContactBean.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 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 @@ -18,6 +18,8 @@ import java.io.Serializable; +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Pattern; import jakarta.validation.executable.ExecutableType; @@ -26,9 +28,6 @@ import org.glassfish.jersey.tests.e2e.server.validation.Extended; -import org.hibernate.validator.constraints.Email; -import org.hibernate.validator.constraints.NotBlank; - /** * @author Michal Gajdos */ diff --git a/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/validation/validateonexecution/ValidateOnExecutionBasicTest.java b/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/validation/validateonexecution/ValidateOnExecutionBasicTest.java index 3c3c946340..f3ecf18de9 100644 --- a/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/validation/validateonexecution/ValidateOnExecutionBasicTest.java +++ b/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/validation/validateonexecution/ValidateOnExecutionBasicTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 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 @@ -32,12 +32,22 @@ import jakarta.validation.executable.ExecutableType; import jakarta.validation.executable.ValidateOnExecution; +import jakarta.ws.rs.ext.ContextResolver; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; +import org.eclipse.persistence.jaxb.BeanValidationMode; +import org.eclipse.persistence.jaxb.MarshallerProperties; +import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.server.ServerProperties; import org.glassfish.jersey.test.TestProperties; import org.glassfish.jersey.test.util.runner.RunSeparately; import org.junit.Test; + +import java.util.HashMap; +import java.util.Map; + import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertThat; @@ -289,6 +299,28 @@ public String getNull() { } } + /** + * Do not validate the bean by Moxy, validate just by Jersey + */ + public static class MoxyNotValidateContextResolver implements ContextResolver { + @Override + public JAXBContext getContext(Class type) { + Map properties = new HashMap<>(); + properties.put(MarshallerProperties.BEAN_VALIDATION_MODE, BeanValidationMode.NONE); + try { + return JAXBContext.newInstance(new Class[]{type}, properties); + } catch (JAXBException e) { + throw new RuntimeException(e); + } + } + } + + @Override + protected void configureClient(ClientConfig config) { + config.register(MoxyNotValidateContextResolver.class); + super.configureClient(config); + } + @Override protected Application configure() { enable(TestProperties.LOG_TRAFFIC); @@ -309,7 +341,8 @@ protected Application configure() { ValidateGetterExecutableOnTypeMatch.class, ValidateGetterExecutableOnBeans.class, ValidateGetterResourceMethod.class, - ValidateExecutableResource.class) + ValidateExecutableResource.class, + MoxyNotValidateContextResolver.class) .property(ServerProperties.BV_DISABLE_VALIDATE_ON_EXECUTABLE_OVERRIDE_CHECK, true); } diff --git a/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/wadl/WadlBeanParamTest.java b/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/wadl/WadlBeanParamTest.java index 195c6755aa..481c20c3b7 100644 --- a/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/wadl/WadlBeanParamTest.java +++ b/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/wadl/WadlBeanParamTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022 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 @@ -22,6 +22,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import java.util.Properties; import jakarta.ws.rs.BeanParam; import jakarta.ws.rs.CookieParam; @@ -38,9 +39,13 @@ import jakarta.ws.rs.core.Request; import jakarta.ws.rs.core.Response; +import javax.xml.transform.ErrorListener; +import javax.xml.transform.Result; +import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; +import javax.xml.transform.URIResolver; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import javax.xml.xpath.XPath; @@ -89,8 +94,9 @@ public class WadlBeanParamTest extends JerseyTest { */ @Override public boolean qualifyForComparison(final Element control, final Element test) { - if (test != null && !"param".equals(test.getNodeName())) { - return super.qualifyForComparison(control, test); + if (test != null && !"param".equals(test.getNodeName()) && !"ns0:param".equals(test.getNodeName())) { + boolean spr = super.qualifyForComparison(control, test); + return spr; } if (!(control != null && test != null && equalsNamespace(control, test) diff --git a/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/wadl/WadlResourceTest.java b/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/wadl/WadlResourceTest.java index 72371288ed..da2d78749a 100644 --- a/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/wadl/WadlResourceTest.java +++ b/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/wadl/WadlResourceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2022 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 @@ -1009,7 +1009,12 @@ public void testGetWithPathAndLeadingSlash() throws Exception { final String document = response.readEntity(String.class); // check that the resulting document contains a method element with id="fooX" - assertTrue(document.replaceAll("\n", " ").matches(".*]+id=\"foo" + i + "\"[^>]*>.*")); + assertTrue(document + .replaceAll("\n", " ") + .replaceAll("\r", "") + .replaceAll("ns0:", "") + .matches(".*]+id=\"foo" + i + "\"[^>]*>.*") + ); } } } diff --git a/tests/osgi/functional/src/test/java/org/glassfish/jersey/osgi/test/basic/JsonJacksonTest.java b/tests/osgi/functional/src/test/java/org/glassfish/jersey/osgi/test/basic/JsonJacksonTest.java index 7d06f02d48..7aebd55951 100644 --- a/tests/osgi/functional/src/test/java/org/glassfish/jersey/osgi/test/basic/JsonJacksonTest.java +++ b/tests/osgi/functional/src/test/java/org/glassfish/jersey/osgi/test/basic/JsonJacksonTest.java @@ -41,6 +41,9 @@ public static Option[] configuration() { options.addAll(Helper.expandedList( // vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"), + // TODO - remove when jackson-module-jakarta-xmlbind-annotations supports JAX-B/4 + mavenBundle().groupId("jakarta.xml.bind").artifactId("jakarta.xml.bind-api").version("3.0.1"), + mavenBundle().groupId("org.glassfish.jersey.media").artifactId("jersey-media-json-jackson").versionAsInProject(), mavenBundle().groupId("org.glassfish.jersey.ext").artifactId("jersey-entity-filtering").versionAsInProject(), diff --git a/tests/osgi/functional/src/test/java/org/glassfish/jersey/osgi/test/basic/JsonMoxyTest.java b/tests/osgi/functional/src/test/java/org/glassfish/jersey/osgi/test/basic/JsonMoxyTest.java index 0f7eb6f968..c4558a8c4c 100644 --- a/tests/osgi/functional/src/test/java/org/glassfish/jersey/osgi/test/basic/JsonMoxyTest.java +++ b/tests/osgi/functional/src/test/java/org/glassfish/jersey/osgi/test/basic/JsonMoxyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2022 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 @@ -57,7 +57,7 @@ public static Option[] configuration() { mavenBundle().groupId("org.eclipse.persistence").artifactId("org.eclipse.persistence.moxy").versionAsInProject(), mavenBundle().groupId("org.eclipse.persistence").artifactId("org.eclipse.persistence.core").versionAsInProject(), mavenBundle().groupId("org.eclipse.persistence").artifactId("org.eclipse.persistence.asm").versionAsInProject(), - mavenBundle().groupId("org.glassfish").artifactId("jakarta.json").versionAsInProject(), + mavenBundle().groupId("jakarta.json").artifactId("jakarta.json-api").versionAsInProject(), // validation mavenBundle().groupId("org.hibernate.validator").artifactId("hibernate-validator").versionAsInProject(), diff --git a/tests/osgi/functional/src/test/java/org/glassfish/jersey/osgi/test/basic/PackageScanningTest.java b/tests/osgi/functional/src/test/java/org/glassfish/jersey/osgi/test/basic/PackageScanningTest.java index 424b1babfb..c3a2fcaef7 100644 --- a/tests/osgi/functional/src/test/java/org/glassfish/jersey/osgi/test/basic/PackageScanningTest.java +++ b/tests/osgi/functional/src/test/java/org/glassfish/jersey/osgi/test/basic/PackageScanningTest.java @@ -79,7 +79,7 @@ public static Option[] configuration() { .versionAsInProject(), // MBR/MBW for JSON-P is on the classpath. - mavenBundle().groupId("org.glassfish").artifactId("jakarta.json").versionAsInProject() + mavenBundle().groupId("jakarta.json").artifactId("jakarta.json-api").versionAsInProject() )); options = Helper.addPaxExamMavenLocalRepositoryProperty(options); diff --git a/tests/osgi/functional/src/test/java/org/glassfish/jersey/osgi/test/util/Helper.java b/tests/osgi/functional/src/test/java/org/glassfish/jersey/osgi/test/util/Helper.java index 76a1515b0a..4be49dd0e3 100644 --- a/tests/osgi/functional/src/test/java/org/glassfish/jersey/osgi/test/util/Helper.java +++ b/tests/osgi/functional/src/test/java/org/glassfish/jersey/osgi/test/util/Helper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2022 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 @@ -183,9 +183,9 @@ public static List