Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update versions of JAX-B, Moxy, JSON-B, JSON-P #5008

Merged
merged 2 commits into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -128,17 +128,17 @@ public ValidationEventHandler getEventHandler() throws JAXBException {
}

@Override
public void setAdapter(XmlAdapter adapter) {
public <A extends XmlAdapter<?, ?>> void setAdapter(A adapter) {
jaxbMarshaller.setAdapter(adapter);
}

@Override
public <A extends XmlAdapter> void setAdapter(Class<A> type, A adapter) {
public <A extends XmlAdapter<?, ?>> void setAdapter(Class<A> type, A adapter) {
jaxbMarshaller.setAdapter(type, adapter);
}

@Override
public <A extends XmlAdapter> A getAdapter(Class<A> type) {
public <A extends XmlAdapter<?, ?>> A getAdapter(Class<A> type) {
return jaxbMarshaller.getAdapter(type);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -163,17 +153,17 @@ public Schema getSchema() {
}

@Override
public void setAdapter(XmlAdapter xmlAdapter) {
public <A extends XmlAdapter<?, ?>> void setAdapter(A xmlAdapter) {
this.jaxbUnmarshaller.setAdapter(xmlAdapter);
}

@Override
public <A extends XmlAdapter> void setAdapter(Class<A> type, A adapter) {
public <A extends XmlAdapter<?, ?>> void setAdapter(Class<A> type, A adapter) {
this.jaxbUnmarshaller.setAdapter(type, adapter);
}

@Override
public <A extends XmlAdapter> A getAdapter(Class<A> type) {
public <A extends XmlAdapter<?, ?>> A getAdapter(Class<A> type) {
return this.jaxbUnmarshaller.getAdapter(type);
}

Expand Down
39 changes: 19 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2120,12 +2120,9 @@
<hamcrest.version>1.3</hamcrest.version>
<helidon.version>1.0.3</helidon.version>
<xmlunit.version>1.6</xmlunit.version>
<hk2.osgi.version>org.glassfish.hk2.*;version="[3.0,4)"</hk2.osgi.version>
<hk2.jvnet.osgi.version>org.jvnet.hk2.*;version="[3.0,4)"</hk2.jvnet.osgi.version>
<hk2.config.version>6.0.0</hk2.config.version>
<httpclient.version>4.5.13</httpclient.version>
<jackson.version>2.13.0</jackson.version>
<javassist.version>3.25.0-GA</javassist.version>
<javassist.version>3.28.0-GA</javassist.version>
<jboss.logging.version>3.3.0.Final</jboss.logging.version>
<jersey1.version>1.19.3</jersey1.version>
<jersey1.last.final.version>${jersey1.version}</jersey1.last.final.version>
Expand Down Expand Up @@ -2159,7 +2156,6 @@

<!-- Jakartified, eligible for CQ -->
<weld.version>4.0.2.Final</weld.version>
<weld3.version>3.1.7.SP1</weld3.version>
<validation.impl.version>7.0.1.Final</validation.impl.version>
<!-- END of Jakartified, eligible for CQ -->
<xerces.version>2.11.0</xerces.version>
Expand All @@ -2168,43 +2164,46 @@
<graalvm.version>20.3.2</graalvm.version>

<!-- do not need CQs (below this line till the end of version properties)-->
<gf.impl.version>6.0.0</gf.impl.version>
<gf.impl.version>7.0.0-M2</gf.impl.version>
<!-- Jakartified -->
<cdi.api.version>3.0.0</cdi.api.version>
<ejb.version>4.0.0</ejb.version>
<grizzly2.version>3.0.1</grizzly2.version>
<grizzly.npn.version>2.0.0</grizzly.npn.version>
<hk2.version>3.0.2</hk2.version>
<jsp.version>3.0.0</jsp.version>
<jstl.version>2.0.0</jstl.version>
<hk2.version>3.0.3</hk2.version>
<hk2.osgi.version>org.glassfish.hk2.*;version="[3.0,4)"</hk2.osgi.version>
<hk2.jvnet.osgi.version>org.jvnet.hk2.*;version="[3.0,4)"</hk2.jvnet.osgi.version>
<hk2.config.version>7.0.0-M2</hk2.config.version>
<jsp.version>3.1.0</jsp.version>
<jstl.version>3.0.0</jstl.version>
<jta.api.version>2.0.0</jta.api.version>
<servlet5.version>5.0.0</servlet5.version>
<servlet6.version>6.0.0</servlet6.version>
<servlet.version>5.0.0</servlet.version> <!-- Keep this until Grizzly is Servlet 6 compatible -->
<istack.commons.runtime.version>4.0.0</istack.commons.runtime.version>
<jakarta.activation-api.version>2.0.1</jakarta.activation-api.version>
<jakarta.activation-api.version>2.1.0</jakarta.activation-api.version>
<jakarta.activation.version>2.0.1</jakarta.activation.version>
<jakarta.el.version>4.0.0</jakarta.el.version>
<jakarta.el.impl.version>4.0.2</jakarta.el.impl.version>
<jakarta.annotation.osgi.version>jakarta.annotation.*;version="[2.0,3)"</jakarta.annotation.osgi.version>
<jakarta.annotation.version>2.0.0</jakarta.annotation.version>
<jakarta.annotation.version>2.1.0</jakarta.annotation.version>
<jakarta.inject.version>2.0.1</jakarta.inject.version>
<jakarta.interceptor.version>2.0.0</jakarta.interceptor.version>
<jakarta.interceptor.version>2.1.0</jakarta.interceptor.version>
<jakarta.jsonp.version>2.1.0</jakarta.jsonp.version>
<jakarta.persistence.version>3.0.0</jakarta.persistence.version>
<jakarta.persistence.version>3.1.0</jakarta.persistence.version>
<jakarta.validation.api.version>3.0.1</jakarta.validation.api.version>
<jakarta.jaxb.api.version>3.0.1</jakarta.jaxb.api.version>
<jaxb.ri.version>3.0.2</jaxb.ri.version>
<jakarta.jaxb.api.version>4.0.0</jakarta.jaxb.api.version>
<jaxb.ri.version>4.0.0-M3</jaxb.ri.version>
<jaxrs.api.spec.version>3.1</jaxrs.api.spec.version>
<jaxrs.api.impl.version>3.1.0</jaxrs.api.impl.version>
<jetty.version>11.0.7</jetty.version>
<jetty.plugin.version>11.0.7</jetty.plugin.version>
<jetty.servlet.api.25.version>6.1.14</jetty.servlet.api.25.version>
<jsonb.api.version>2.0.0</jsonb.api.version>
<jsonp.ri.version>1.0.0</jsonp.ri.version>
<jsonp.jaxrs.version>1.0.0</jsonp.jaxrs.version>
<moxy.version>3.0.2</moxy.version>
<yasson.version>2.0.3</yasson.version>
<jsonb.api.version>3.0.0</jsonb.api.version>
<jsonp.ri.version>1.1.0</jsonp.ri.version>
<jsonp.jaxrs.version>1.1.0</jsonp.jaxrs.version>
<moxy.version>4.0.0-M3</moxy.version>
<yasson.version>3.0.0-RC1</yasson.version>
<!-- END of Jakartified -->

<javax.annotation.version>1.3.2</javax.annotation.version> <!--Deprecated, used only for @generated annotation in perf tests -->
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand All @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -289,6 +299,28 @@ public String getNull() {
}
}

/**
* Do not validate the bean by Moxy, validate just by Jersey
*/
public static class MoxyNotValidateContextResolver implements ContextResolver<JAXBContext> {
@Override
public JAXBContext getContext(Class<?> type) {
Map<String, Object> 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);
Expand All @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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(".*<method[^>]+id=\"foo" + i + "\"[^>]*>.*"));
assertTrue(document
.replaceAll("\n", " ")
.replaceAll("\r", "")
.replaceAll("ns0:", "")
.matches(".*<method[^>]+id=\"foo" + i + "\"[^>]*>.*")
);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -183,9 +183,9 @@ public static List<Option> getCommonOsgiOptions(final boolean includeJerseyJaxRs
mavenBundle().groupId("org.glassfish.jersey.core").artifactId("jersey-client").versionAsInProject(),

// Jersey Injection provider
mavenBundle().groupId("org.glassfish.jersey.inject").artifactId("jersey-hk2").versionAsInProject(),
mavenBundle().groupId("org.glassfish.jersey.inject").artifactId("jersey-hk2").versionAsInProject()
// Jaxb - api
getActivationBundle()
// getActivationBundle()
));
}

Expand Down