diff --git a/jaxrs-api/pom.xml b/jaxrs-api/pom.xml index ac9d90c06..55749c1f4 100644 --- a/jaxrs-api/pom.xml +++ b/jaxrs-api/pom.xml @@ -94,73 +94,11 @@ jakarta.enterprise jakarta.enterprise.cdi-api - - jakarta.xml.bind - jakarta.xml.bind-api - org.junit.jupiter junit-jupiter-api test - - - org.glassfish.jaxb - codemodel - test - - - org.glassfish.jaxb - jaxb-core - test - - - org.glassfish.jaxb - jaxb-jxc - test - - - org.glassfish.jaxb - jaxb-runtime - test - - - org.glassfish.jaxb - txw2 - test - - - org.glassfish.jaxb - jaxb-xjc - test - - - org.glassfish.jaxb - xsom - test - - - - com.sun.istack - istack-commons-runtime - test - - - com.sun.istack - istack-commons-tools - test - - - com.sun.xml.bind.external - relaxng-datatype - test - - - com.sun.xml.bind.external - rngom - test - - org.hamcrest hamcrest diff --git a/jaxrs-api/src/main/java/jakarta/ws/rs/core/Link.java b/jaxrs-api/src/main/java/jakarta/ws/rs/core/Link.java index 6f03b86a9..9b505c30f 100644 --- a/jaxrs-api/src/main/java/jakarta/ws/rs/core/Link.java +++ b/jaxrs-api/src/main/java/jakarta/ws/rs/core/Link.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024 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 @@ -16,18 +16,11 @@ package jakarta.ws.rs.core; -import javax.xml.namespace.QName; import java.net.URI; -import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; -import java.util.Map.Entry; import jakarta.ws.rs.ext.RuntimeDelegate; -import jakarta.xml.bind.annotation.XmlAnyAttribute; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.adapters.XmlAdapter; /** *

@@ -402,187 +395,4 @@ public interface Builder { */ public Link buildRelativized(URI uri, Object... values); } - - /** - * Value type for {@link jakarta.ws.rs.core.Link} that can be marshalled and - * unmarshalled by JAXB. - * - * Note that usage of this class requires the Jakarta XML Binding API and an implementation. The Jakarta RESTful Web - * Services implementation is not required to provide these dependencies. - * - * @see jakarta.ws.rs.core.Link.JaxbAdapter - * @since 2.0 - * @deprecated - */ - @Deprecated - public static class JaxbLink { - - private URI uri; - private Map params; - - /** - * Default constructor needed during unmarshalling. - */ - public JaxbLink() { - } - - /** - * Construct an instance from a URI and no parameters. - * - * @param uri underlying URI. - */ - public JaxbLink(final URI uri) { - this.uri = uri; - } - - /** - * Construct an instance from a URI and some parameters. - * - * @param uri underlying URI. - * @param params parameters of this link. - */ - public JaxbLink(final URI uri, final Map params) { - this.uri = uri; - this.params = params; - } - - /** - * Get the underlying URI for this link. - * - * @return underlying URI. - */ - @XmlAttribute(name = "href") - public URI getUri() { - return uri; - } - - /** - * Get the parameter map for this link. - * - * @return parameter map. - */ - @XmlAnyAttribute - public Map getParams() { - if (params == null) { - params = new HashMap(); - } - return params; - } - - /** - * Set the underlying URI for this link. - * - * This setter is needed for JAXB unmarshalling. - */ - void setUri(final URI uri) { - this.uri = uri; - } - - /** - * Set the parameter map for this link. - * - * This setter is needed for JAXB unmarshalling. - */ - void setParams(final Map params) { - this.params = params; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof JaxbLink)) { - return false; - } - - JaxbLink jaxbLink = (JaxbLink) o; - - if (uri != null ? !uri.equals(jaxbLink.uri) : jaxbLink.uri != null) { - return false; - } - - if (params == jaxbLink.params) { - return true; - } - if (params == null) { - // if this.params is 'null', consider other.params equal to empty - return jaxbLink.params.isEmpty(); - } - if (jaxbLink.params == null) { - // if other.params is 'null', consider this.params equal to empty - return params.isEmpty(); - } - - return params.equals(jaxbLink.params); - } - - @Override - public int hashCode() { - return Objects.hash(uri, params); - } - - } - - /** - * An implementation of JAXB {@link jakarta.xml.bind.annotation.adapters.XmlAdapter} that maps the JAX-RS - * {@link jakarta.ws.rs.core.Link} type to a value that can be marshalled and unmarshalled by JAXB. The following example - * shows how to use this adapter on a JAXB bean class: - * - *

-     * @XmlRootElement
-     * public class MyModel {
-     *
-     *   private Link link;
-     *
-     *   @XmlElement(name="link")
-     *   @XmlJavaTypeAdapter(JaxbAdapter.class)
-     *   public Link getLink() {
-     *     return link;
-     *   }
-     *   ...
-     * }
-     * 
- * - * Note that usage of this class requires the Jakarta XML Binding API and an implementation. The Jakarta RESTful Web - * Services implementation is not required to provide these dependencies. - * - * @see jakarta.ws.rs.core.Link.JaxbLink - * @since 2.0 - * @deprecated - */ - @Deprecated - public static class JaxbAdapter extends XmlAdapter { - - /** - * Convert a {@link JaxbLink} into a {@link Link}. - * - * @param v instance of type {@link JaxbLink}. - * @return mapped instance of type {@link JaxbLink} - */ - @Override - public Link unmarshal(final JaxbLink v) { - Link.Builder lb = Link.fromUri(v.getUri()); - for (Entry e : v.getParams().entrySet()) { - lb.param(e.getKey().getLocalPart(), e.getValue().toString()); - } - return lb.build(); - } - - /** - * Convert a {@link Link} into a {@link JaxbLink}. - * - * @param v instance of type {@link Link}. - * @return mapped instance of type {@link JaxbLink}. - */ - @Override - public JaxbLink marshal(final Link v) { - JaxbLink jl = new JaxbLink(v.getUri()); - for (Entry e : v.getParams().entrySet()) { - final String name = e.getKey(); - jl.getParams().put(new QName("", name), e.getValue()); - } - return jl; - } - } } diff --git a/jaxrs-api/src/main/java/module-info.java b/jaxrs-api/src/main/java/module-info.java index aa24390e0..1a94f2490 100644 --- a/jaxrs-api/src/main/java/module-info.java +++ b/jaxrs-api/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024 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 @@ -19,8 +19,6 @@ */ module jakarta.ws.rs { - requires static jakarta.xml.bind; - requires java.logging; exports jakarta.ws.rs; @@ -33,6 +31,4 @@ uses jakarta.ws.rs.client.ClientBuilder; uses jakarta.ws.rs.ext.RuntimeDelegate; uses jakarta.ws.rs.sse.SseEventSource.Builder; - - opens jakarta.ws.rs.core to jakarta.xml.bind; } diff --git a/jaxrs-api/src/test/java/jakarta/ws/rs/core/JaxbLinkTest.java b/jaxrs-api/src/test/java/jakarta/ws/rs/core/JaxbLinkTest.java deleted file mode 100644 index 99af1e7ca..000000000 --- a/jaxrs-api/src/test/java/jakarta/ws/rs/core/JaxbLinkTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2014, 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 jakarta.ws.rs.core; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; - -import java.io.StringReader; -import java.io.StringWriter; -import java.net.URI; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; -import javax.xml.transform.stream.StreamSource; - -import org.junit.jupiter.api.Test; - -import jakarta.xml.bind.JAXBContext; -import jakarta.xml.bind.JAXBElement; -import jakarta.xml.bind.Marshaller; -import jakarta.xml.bind.Unmarshaller; - -/** - * Unit test for JAX-RS Link marshalling and unmarshalling via JAXB. - * - * @author Marek Potociar (marek.potociar at oracle.com) - */ -public class JaxbLinkTest { - - @Test - public void testSerializationOfJaxbLink() throws Exception { - JAXBContext jaxbContext = JAXBContext.newInstance(Link.JaxbLink.class); - final Marshaller marshaller = jaxbContext.createMarshaller(); - final Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); - - Map expectedParams = new HashMap(); - final QName qName = new QName("http://example.ns", "foo"); - expectedParams.put(qName, "test"); - final URI expectedUri = URI.create("/foo/bar"); - Link.JaxbLink expected = new Link.JaxbLink(expectedUri, expectedParams); - - final StringWriter writer = new StringWriter(); - - JAXBElement jaxbLinkJAXBElement = new JAXBElement(new QName("", "link"), Link.JaxbLink.class, expected); - marshaller.marshal(jaxbLinkJAXBElement, writer); - - final Link.JaxbLink actual = unmarshaller.unmarshal(new StreamSource( - new StringReader(writer.toString())), Link.JaxbLink.class).getValue(); - - assertEquals(expected, actual, "Unmarshalled JaxbLink instance not equal to the marshalled one."); - assertEquals(expectedUri, actual.getUri(), "Unmarshalled JaxbLink instance URI not equal to original."); - assertEquals(expectedParams, actual.getParams(), "Unmarshalled JaxbLink instance params not equal to original."); - } - - @Test - public void testEqualsHashCode() throws Exception { - Link.JaxbLink first = new Link.JaxbLink(); - Link.JaxbLink second = new Link.JaxbLink(); - - // trigger lazy initialization on first - first.getParams(); - - assertThat(first, equalTo(second)); - assertThat(second, equalTo(first)); - assertThat(first.hashCode(), equalTo(second.hashCode())); - } -} diff --git a/jaxrs-tck/pom.xml b/jaxrs-tck/pom.xml index db55d4b57..c4604679b 100644 --- a/jaxrs-tck/pom.xml +++ b/jaxrs-tck/pom.xml @@ -34,6 +34,15 @@ 4.0.0-SNAPSHOT + + 2.0.1 + 2.0.0 + 4.0.0 + 6.0.0 + 3.1 + 1.8.0.Final + + jakarta.ws.rs @@ -44,13 +53,13 @@ jakarta.json.bind jakarta.json.bind-api - 2.0.0 + ${json.bind.api.version} jakarta.json jakarta.json-api - 2.0.1 + ${json.api.version} @@ -61,7 +70,7 @@ commons-httpclient commons-httpclient - 3.1 + ${common.httpclient.version} @@ -72,7 +81,7 @@ org.jboss.arquillian.junit5 arquillian-junit5-container - 1.8.0.Final + ${arquillian.version} @@ -83,6 +92,7 @@ jakarta.xml.bind jakarta.xml.bind-api + ${xml.bind.api.version} @@ -93,7 +103,7 @@ jakarta.servlet jakarta.servlet-api - 6.0.0 + ${servlet.api.version} provided diff --git a/jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/api/rs/core/linkjaxbadapter/JAXRSClientIT.java b/jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/api/rs/core/linkjaxbadapter/JAXRSClientIT.java deleted file mode 100644 index 6b4d33ebd..000000000 --- a/jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/api/rs/core/linkjaxbadapter/JAXRSClientIT.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2014, 2020 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 ee.jakarta.tck.ws.rs.api.rs.core.linkjaxbadapter; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.nio.charset.Charset; - -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestInfo; - -import jakarta.ws.rs.core.Link; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.ext.RuntimeDelegate; -import ee.jakarta.tck.ws.rs.common.JAXRSCommonClient; -import ee.jakarta.tck.ws.rs.lib.util.TestUtil; -import jakarta.xml.bind.JAXBContext; -import jakarta.xml.bind.JAXBException; -import jakarta.xml.bind.Marshaller; -import jakarta.xml.bind.Unmarshaller; - -import org.junit.jupiter.api.Tag; - -/* - * @class.setup_props: webServerHost; - * webServerPort; - * ts_home; - */ -public class JAXRSClientIT extends JAXRSCommonClient { - - private static final long serialVersionUID = -5902280515880564932L; - - protected static final String url = "some://where.at:port/"; - - protected static final String rel = "Relation"; - - protected static final String media = MediaType.APPLICATION_SVG_XML; - - protected static final String title = "XTitleX"; - - protected static final String[] param_names = { "name1", "name2" }; - - protected static final String[] param_vals = { "val1", "val2" }; - - @BeforeEach - void logStartTest(TestInfo testInfo) { - TestUtil.logMsg("STARTING TEST : " + testInfo.getDisplayName()); - } - - @AfterEach - void logFinishTest(TestInfo testInfo) { - TestUtil.logMsg("FINISHED TEST : " + testInfo.getDisplayName()); - } - - /* - * @testName: marshallTest - * - * @assertion_ids: JAXRS:JAVADOC:815; JAXRS:JAVADOC:816; - * - * @test_Strategy: - */ - @Test - @Tag("xml_binding") - public void marshallTest() throws Fault { - Link link = RuntimeDelegate.getInstance().createLinkBuilder().uri(url).title(title).rel(rel).type(media) - .param(param_names[0], param_vals[0]).param(param_names[1], param_vals[1]).build(); - Model model = new Model(link); - - ByteArrayOutputStream ostream = new ByteArrayOutputStream(1000); - JAXBContext jc = null; - Marshaller marshaller = null; - byte[] array = null; - try { - jc = JAXBContext.newInstance(Model.class); - marshaller = jc.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - marshaller.marshal(model, ostream); - - array = ostream.toByteArray(); - String string = new String(array, Charset.defaultCharset()); - assertContains(string, "link href=", "Marshalled Link", string, - "does not contain expected uri reference field"); - assertContains(string, url, "Marshalled Link", string, " does not contain expected uri reference", url); - assertContains(string, media, "MediaType has not been marshalled in", string); - assertContains(string, title, "Title has not been marshalled in", string); - assertContains(string, rel, "Relation has not been marshalled in", string); - assertContains(string, param_names[0], "parameter name", param_names[0], "has not been marshalled in", - string); - assertContains(string, param_names[1], "parameter name", param_names[1], "has not been marshalled in", - string); - assertContains(string, param_vals[0], "parameter value", param_vals[0], "has not been marshalled in", - string); - assertContains(string, param_vals[1], "parameter value", param_vals[1], "has not been marshalled in", - string); - logMsg("Marshalled Link contains expected", string); - } catch (JAXBException e) { - throw new Fault(e); - } - //return array; - } - - /* - * @testName: unmarshallTest - * - * @assertion_ids: JAXRS:JAVADOC:815; JAXRS:JAVADOC:816; JAXRS:JAVADOC:818; - * - * @test_Strategy: Test whether a class with Link can be unmarshalled fine - */ - @Test - @Tag("xml_binding") - public void unmarshallTest() throws Fault { - - Link link = RuntimeDelegate.getInstance().createLinkBuilder().uri(url).title(title).rel(rel).type(media) - .param(param_names[0], param_vals[0]).param(param_names[1], param_vals[1]).build(); - Model model = new Model(link); - - ByteArrayOutputStream ostream = new ByteArrayOutputStream(1000); - JAXBContext jc = null; - Marshaller marshaller = null; - byte[] array = null; - - - Unmarshaller unmarshaller = null; - ByteArrayInputStream istream = null; - Model unmarshalledModel = null; - try { - - jc = JAXBContext.newInstance(Model.class); - marshaller = jc.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - marshaller.marshal(model, ostream); - array = ostream.toByteArray(); - - istream = new ByteArrayInputStream(array); - - jc = JAXBContext.newInstance(Model.class); - unmarshaller = jc.createUnmarshaller(); - unmarshalledModel = (Model) unmarshaller.unmarshal(istream); - link = unmarshalledModel.getLink(); - - assertContains(link.toString(), url, "unmarshalled link", link, "does not contain expected url", url); - assertContains(link.getRel(), rel, "unmarshalled link", link, "does not contain expected relation", rel); - assertContains(link.getTitle(), title, "unmarshalled link", link, "does not contain expected title", title); - assertContains(link.getType(), media, "unmarshalled link", link, "does not contain expected media type", - media); - assertTrue(link.getParams().size() > 2, - "unmarshalled link " + link + " does not contain expected parameters"); - assertContains(link.getParams().get(param_names[0]), param_vals[0], "unmarshalled link", link, - "does not contain expected parameter", param_names[0], "=", param_vals[0]); - assertContains(link.getParams().get(param_names[1]), param_vals[1], "unmarshalled link", link, - "does not contain expected parameter", param_names[1], "=", param_vals[1]); - logMsg("unmarshalled Link contains expected url, title, media type, and parameters", link); - } catch (JAXBException e) { - throw new Fault(e); - } - } -} diff --git a/jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/api/rs/core/linkjaxbadapter/JaxbAdapterEx.java b/jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/api/rs/core/linkjaxbadapter/JaxbAdapterEx.java deleted file mode 100644 index a8b91923b..000000000 --- a/jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/api/rs/core/linkjaxbadapter/JaxbAdapterEx.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2014, 2020 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 ee.jakarta.tck.ws.rs.api.rs.core.linkjaxbadapter; - -import jakarta.ws.rs.core.Link; -import jakarta.ws.rs.core.Link.JaxbAdapter; -import jakarta.ws.rs.core.Link.JaxbLink; -import jakarta.xml.bind.annotation.adapters.XmlAdapter; - -public class JaxbAdapterEx extends XmlAdapter { - - /** - * Convert a {@link JaxbLink} into a {@link Link}. - * - * @param v instance of type {@link JaxbLink}. - * @return mapped instance of type {@link JaxbLink} - */ - @Override - public Link unmarshal(JaxbLinkEx ex) { - JaxbLink link = new JaxbLink(ex.getUri(), ex.getParams()); - return new JaxbAdapter().unmarshal(link); - } - - /** - * Convert a {@link Link} into a {@link JaxbLink}. - * - * @param v instance of type {@link Link}. - * @return mapped instance of type {@link JaxbLink}. - */ - @Override - public JaxbLinkEx marshal(Link v) { - JaxbLink link = new JaxbAdapter().marshal(v); - JaxbLinkEx jle = new JaxbLinkEx(link.getUri(), link.getParams()); - return jle; - } -} diff --git a/jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/api/rs/core/linkjaxbadapter/JaxbLinkEx.java b/jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/api/rs/core/linkjaxbadapter/JaxbLinkEx.java deleted file mode 100644 index c22a258dd..000000000 --- a/jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/api/rs/core/linkjaxbadapter/JaxbLinkEx.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2014, 2020 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 ee.jakarta.tck.ws.rs.api.rs.core.linkjaxbadapter; - -import java.net.URI; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -import jakarta.xml.bind.annotation.XmlAnyAttribute; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlRootElement; - -/** - * JaxbLink with setters and xml annotations - */ -@XmlRootElement -public class JaxbLinkEx { - - protected URI uri; - - protected Map params; - - /** - * Default constructor needed during unmarshalling. - */ - public JaxbLinkEx() { - } - - /** - * Construct an instance from a URI and no parameters. - * - * @param uri underlying URI. - */ - public JaxbLinkEx(URI uri) { - this.uri = uri; - } - - /** - * Construct an instance from a URI and some parameters. - * - * @param uri underlying URI. - * @param params parameters of this link. - */ - public JaxbLinkEx(URI uri, Map params) { - this.uri = uri; - this.params = params; - } - - /** - * Get the underlying URI for this link. - * - * @return underlying URI. - */ - @XmlAttribute(name = "href") - public URI getUri() { - return uri; - } - - /** - * Get the parameter map for this link. - * - * @return parameter map. - */ - @XmlAnyAttribute - public Map getParams() { - if (params == null) { - params = new HashMap(); - } - return params; - } - - public void setUri(final URI uri) { - this.uri = uri; - } - - public void setParams(final Map params) { - this.params = params; - } -} diff --git a/jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/api/rs/core/linkjaxbadapter/Model.java b/jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/api/rs/core/linkjaxbadapter/Model.java deleted file mode 100644 index f1f11bbdc..000000000 --- a/jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/api/rs/core/linkjaxbadapter/Model.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2014, 2020 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 ee.jakarta.tck.ws.rs.api.rs.core.linkjaxbadapter; - -import jakarta.ws.rs.core.Link; -import jakarta.ws.rs.ext.RuntimeDelegate; -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; -import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -public class Model { - - public Model(Link link) { - super(); - this.link = link; - } - - public Model() { - link = RuntimeDelegate.getInstance().createLinkBuilder().uri("default://constructor.model/was/used").build(); - } - - @XmlElement - @XmlJavaTypeAdapter(JaxbAdapterEx.class) - Link link; - - public Link getLink() { - return link; - } - - public void setLink(Link lnk) { - link = lnk; - } -} diff --git a/jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/api/rs/core/linkjaxblink/JAXRSClientIT.java b/jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/api/rs/core/linkjaxblink/JAXRSClientIT.java deleted file mode 100644 index d4735bb24..000000000 --- a/jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/api/rs/core/linkjaxblink/JAXRSClientIT.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2014, 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 ee.jakarta.tck.ws.rs.api.rs.core.linkjaxblink; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.net.URI; -import java.net.URISyntaxException; -import java.util.HashMap; - -import javax.xml.namespace.QName; - -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestInfo; - -import jakarta.ws.rs.core.Link; -import ee.jakarta.tck.ws.rs.common.JAXRSCommonClient; -import ee.jakarta.tck.ws.rs.lib.util.TestUtil; - -/* - * @class.setup_props: webServerHost; - * webServerPort; - * ts_home; - */ -public class JAXRSClientIT extends JAXRSCommonClient { - - private static final long serialVersionUID = -6053007016837644641L; - - @BeforeEach - void logStartTest(TestInfo testInfo) { - TestUtil.logMsg("STARTING TEST : " + testInfo.getDisplayName()); - } - - @AfterEach - void logFinishTest(TestInfo testInfo) { - TestUtil.logMsg("FINISHED TEST : " + testInfo.getDisplayName()); - } - - /* - * @testName: defaultConstructorTest - * - * @assertion_ids: JAXRS:JAVADOC:822; JAXRS:JAVADOC:820; JAXRS:JAVADOC:821; - * - * @test_Strategy: Default constructor needed during unmarshalling. - * JaxbLink.getParams; JaxbLink.getUri - */ - @Test - public void defaultConstructorTest() throws Fault { - Link.JaxbLink jaxbLink = new Link.JaxbLink(); - boolean getUri = jaxbLink.getUri() == null || jaxbLink.getUri().toASCIIString() == null - || jaxbLink.getUri().toASCIIString().isEmpty(); - assertTrue(getUri, "JaxbLink.getUri() is unexpectedly preset to " + jaxbLink.getUri()); - logMsg("Link.JaxbLink.getUri() is empty as expected"); - boolean params = jaxbLink.getParams() == null || jaxbLink.getParams().isEmpty(); - assertTrue(params, "JaxbLink.getParams() is unexpectedly preset to " + jaxbLink.getParams()); - logMsg("Link.JaxbLink.getParams() is empty as expected"); - } - - /* - * @testName: uriConstructorTest - * - * @assertion_ids: JAXRS:JAVADOC:823; JAXRS:JAVADOC:820; JAXRS:JAVADOC:821; - * - * @test_Strategy: Construct an instance from a URI and no parameters. - * JaxbLink.getParams; JaxbLink.getUri - */ - @Test - public void uriConstructorTest() throws Fault { - String uri = "protocol://domain2.domain1:port"; - URI fromString = uriFromString(uri); - Link.JaxbLink jaxbLink = new Link.JaxbLink(fromString); - - boolean getUri = jaxbLink.getUri().equals(fromString); - assertTrue(getUri, "JaxbLink.getUri() is unexpectedly preset to " + jaxbLink.getUri()); - logMsg("Link.JaxbLink.getUri() is", uri, "as expected"); - - boolean params = jaxbLink.getParams() == null || jaxbLink.getParams().isEmpty(); - assertTrue(params, "JaxbLink.getParams() is unexpectedly preset to " + jaxbLink.getParams()); - logMsg("Link.JaxbLink.getParams() is empty as expected"); - } - - /* - * @testName: uriParamsConstructorTest - * - * @assertion_ids: JAXRS:JAVADOC:824; JAXRS:JAVADOC:820; JAXRS:JAVADOC:821; - * - * @test_Strategy: Construct an instance from a URI and some parameters. - * JaxbLink.getParams; JaxbLink.getUri - */ - @Test - public void uriParamsConstructorTest() throws Fault { - String uri = "protocol://domain2.domain1:port"; - String q = "qName"; - QName qName = new QName(q); - URI fromString = uriFromString(uri); - java.util.Map map; - map = new HashMap(); - map.put(qName, q); - Link.JaxbLink jaxbLink = new Link.JaxbLink(fromString, map); - - boolean getUri = jaxbLink.getUri().equals(fromString); - assertTrue(getUri, "JaxbLink.getUri() is unexpectedly preset to " + jaxbLink.getUri()); - logMsg("Link.JaxbLink.getUri() is", uri, "as expected"); - - boolean params = jaxbLink.getParams().containsKey(qName) && jaxbLink.getParams().get(qName).equals(q); - assertTrue(params, "JaxbLink.getParams() is unexpectedly set to " + jaxbLink.getParams()); - logMsg("Link.JaxbLink.getParams() contains", q, "as expected"); - } - - // ////////////////////////////////////////////////////////////////////// - private static URI uriFromString(String uri) throws Fault { - URI fromString = null; - try { - fromString = new URI(uri); - } catch (URISyntaxException e) { - throw new Fault(e); - } - return fromString; - } -} diff --git a/pom.xml b/pom.xml index a6d524836..89297d485 100644 --- a/pom.xml +++ b/pom.xml @@ -110,7 +110,6 @@ 2.0.0 3.0.0 2.0.0 - 4.0.0 3.0.0 5.10.2 4.0.3 @@ -170,133 +169,6 @@ jakarta.enterprise.concurrent-api ${concurrent.api.version} - - jakarta.xml.bind - jakarta.xml.bind-api - ${xml.binding.api.version} - - - - org.glassfish.jaxb - codemodel - ${org.glassfish.jaxb.version} - - - * - * - - - - - org.glassfish.jaxb - jaxb-core - ${org.glassfish.jaxb.version} - - - * - * - - - - - org.glassfish.jaxb - jaxb-jxc - ${org.glassfish.jaxb.version} - - - * - * - - - - - org.glassfish.jaxb - jaxb-runtime - ${org.glassfish.jaxb.version} - - - * - * - - - - - org.glassfish.jaxb - txw2 - ${org.glassfish.jaxb.version} - - - * - * - - - - - org.glassfish.jaxb - jaxb-xjc - ${org.glassfish.jaxb.version} - - - * - * - - - - - org.glassfish.jaxb - xsom - ${org.glassfish.jaxb.version} - - - * - * - - - - - - com.sun.istack - istack-commons-runtime - ${com.sun.istack.version} - - - * - * - - - - - com.sun.istack - istack-commons-tools - ${com.sun.istack.version} - - - * - * - - - - - com.sun.xml.bind.external - relaxng-datatype - ${org.glassfish.jaxb.version} - - - com.sun.xml.bind.external - rngom - ${org.glassfish.jaxb.version} - - - relaxngDatatype - relaxngDatatype - - - com.sun.xml.bind.external - relaxng-datatype - - - - org.hamcrest hamcrest