diff --git a/artemis-rest/pom.xml b/artemis-rest/pom.xml index a34c5b5911..81953418f3 100644 --- a/artemis-rest/pom.xml +++ b/artemis-rest/pom.xml @@ -92,7 +92,7 @@ </dependency> <dependency> <groupId>org.jboss.resteasy</groupId> - <artifactId>resteasy-jackson-provider</artifactId> + <artifactId>resteasy-jackson2-provider</artifactId> </dependency> <dependency> <groupId>org.jboss.resteasy</groupId> @@ -136,8 +136,8 @@ </dependency> <dependency> <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-jaxrs_2.0_spec</artifactId> - <version>1.0-alpha-1</version> + <artifactId>geronimo-jaxrs_2.1_spec</artifactId> + <version>1.1</version> </dependency> <dependency> <groupId>javax.xml.bind</groupId> @@ -160,6 +160,11 @@ <artifactId>httpclient</artifactId> <version>4.5.13</version> </dependency> + <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + <version>1.13</version> + </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/integration/RestMessagingBootstrapListener.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/integration/RestMessagingBootstrapListener.java index c68feaf007..d8db6656b9 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/integration/RestMessagingBootstrapListener.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/integration/RestMessagingBootstrapListener.java @@ -24,6 +24,7 @@ import org.apache.activemq.artemis.jms.client.ConnectionFactoryOptions; import org.apache.activemq.artemis.rest.MessageServiceManager; import org.apache.activemq.artemis.utils.ObjectInputStreamWithClassLoader; import org.jboss.resteasy.spi.Registry; +import org.jboss.resteasy.spi.ResteasyDeployment; public class RestMessagingBootstrapListener implements ServletContextListener, ConnectionFactoryOptions { @@ -34,10 +35,11 @@ public class RestMessagingBootstrapListener implements ServletContextListener, C @Override public void contextInitialized(ServletContextEvent contextEvent) { ServletContext context = contextEvent.getServletContext(); - Registry registry = (Registry) context.getAttribute(Registry.class.getName()); - if (registry == null) { + ResteasyDeployment resteasyDeployment = (ResteasyDeployment) context.getAttribute(ResteasyDeployment.class.getName()); + if (resteasyDeployment == null) { throw new RuntimeException("You must install RESTEasy as a Bootstrap Listener and it must be listed before this class"); } + Registry registry = resteasyDeployment.getRegistry(); String configfile = context.getInitParameter("rest.messaging.config.file"); deserializationBlackList = context.getInitParameter(ObjectInputStreamWithClassLoader.BLACKLIST_PROPERTY); deserializationWhiteList = context.getInitParameter(ObjectInputStreamWithClassLoader.WHITELIST_PROPERTY); diff --git a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/integration/EmbeddedRestActiveMQJMSTest.java b/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/integration/EmbeddedRestActiveMQJMSTest.java index dfea8b9f35..ede303c1e2 100644 --- a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/integration/EmbeddedRestActiveMQJMSTest.java +++ b/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/integration/EmbeddedRestActiveMQJMSTest.java @@ -37,6 +37,7 @@ import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.spi.Link; import org.jboss.resteasy.test.TestPortProvider; import org.junit.AfterClass; +import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; @@ -125,7 +126,7 @@ public class EmbeddedRestActiveMQJMSTest { ClientResponse<?> res = consumeNext.request().header("Accept-Wait", "2").accept("application/xml").post(String.class); - assertEquals("application/xml", res.getHeaders().getFirst("Content-Type").toString().toLowerCase()); + Assert.assertTrue(res.getHeaders().getFirst("Content-Type").toString().toLowerCase().contains("application/xml")); consumeNext = res.getLinkHeader().getLinkByTitle("consume-next"); res.releaseConnection(); @@ -139,7 +140,7 @@ public class EmbeddedRestActiveMQJMSTest { ClientResponse<?> res = consumeNext.request().header("Accept-Wait", "2").post(String.class); - assertEquals("application/xml", res.getHeaders().getFirst("Content-Type").toString().toLowerCase()); + Assert.assertTrue(res.getHeaders().getFirst("Content-Type").toString().toLowerCase().contains("application/xml")); consumeNext = res.getLinkHeader().getLinkByTitle("consume-next"); res.releaseConnection(); diff --git a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/EmbeddedTest.java b/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/EmbeddedTest.java index 9900b17432..744701c62a 100644 --- a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/EmbeddedTest.java +++ b/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/EmbeddedTest.java @@ -111,7 +111,7 @@ public class EmbeddedTest { ClientResponse<?> res = consumeNext.request().header("Accept-Wait", "2").accept("application/xml").post(String.class); Assert.assertEquals(200, res.getStatus()); - Assert.assertEquals("application/xml", res.getHeaders().getFirst("Content-Type").toString().toLowerCase()); + Assert.assertTrue(res.getHeaders().getFirst("Content-Type").toString().toLowerCase().contains("application/xml")); TransformTest.Order order2 = res.getEntity(TransformTest.Order.class); Assert.assertEquals(order, order2); consumeNext = res.getLinkHeader().getLinkByTitle("consume-next"); @@ -145,7 +145,7 @@ public class EmbeddedTest { ClientResponse<?> res = consumeNext.request().header("Accept-Wait", "2").post(String.class); Assert.assertEquals(200, res.getStatus()); - Assert.assertEquals("application/xml", res.getHeaders().getFirst("Content-Type").toString().toLowerCase()); + Assert.assertTrue(res.getHeaders().getFirst("Content-Type").toString().toLowerCase().contains("application/xml")); TransformTest.Order order2 = res.getEntity(TransformTest.Order.class); Assert.assertEquals(order, order2); consumeNext = res.getLinkHeader().getLinkByTitle("consume-next"); diff --git a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/JMSTest.java b/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/JMSTest.java index 8e64a9bbcd..e6c79e79cd 100644 --- a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/JMSTest.java +++ b/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/JMSTest.java @@ -229,7 +229,7 @@ public class JMSTest extends MessageTestBase { ClientResponse<?> res = consumeNext.request().header("Accept-Wait", "2").accept("application/xml").post(String.class); Assert.assertEquals(200, res.getStatus()); - Assert.assertEquals("application/xml", res.getHeaders().getFirst("Content-Type").toString().toLowerCase()); + Assert.assertTrue(res.getHeaders().getFirst("Content-Type").toString().toLowerCase().contains("application/xml")); Order order2 = res.getEntity(Order.class); res.releaseConnection(); Assert.assertEquals(order, order2); @@ -263,7 +263,7 @@ public class JMSTest extends MessageTestBase { ClientResponse<?> res = consumeNext.request().header("Accept-Wait", "2").post(String.class); Assert.assertEquals(200, res.getStatus()); - Assert.assertEquals("application/xml", res.getHeaders().getFirst("Content-Type").toString().toLowerCase()); + Assert.assertTrue(res.getHeaders().getFirst("Content-Type").toString().toLowerCase().contains("application/xml")); Order order2 = res.getEntity(Order.class); res.releaseConnection(); Assert.assertEquals(order, order2); diff --git a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/SelectorTest.java b/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/SelectorTest.java index babf9950d1..852c41e555 100644 --- a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/SelectorTest.java +++ b/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/SelectorTest.java @@ -292,7 +292,7 @@ public class SelectorTest extends MessageTestBase { private Link consumeOrder(Order order, Link consumeNext) throws Exception { ClientResponse<?> response = consumeNext.request().header("Accept-Wait", "4").accept("application/xml").post(String.class); Assert.assertEquals(200, response.getStatus()); - Assert.assertEquals("application/xml", response.getHeaders().getFirst("Content-Type").toString().toLowerCase()); + Assert.assertTrue(response.getHeaders().getFirst("Content-Type").toString().toLowerCase().contains("application/xml")); Order order2 = response.getEntity(Order.class); Assert.assertEquals(order, order2); consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next"); diff --git a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/TransformTest.java b/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/TransformTest.java index 3ccac8d47e..4177361349 100644 --- a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/TransformTest.java +++ b/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/TransformTest.java @@ -140,7 +140,7 @@ public class TransformTest extends MessageTestBase { response = consumeNext.request().accept("application/xml").post(String.class); Assert.assertEquals(200, response.getStatus()); - Assert.assertEquals("application/xml", response.getHeaders().getFirst("Content-Type").toString().toLowerCase()); + Assert.assertTrue(response.getHeaders().getFirst("Content-Type").toString().toLowerCase().contains("application/xml")); Order order2 = response.getEntity(Order.class); response.releaseConnection(); Assert.assertEquals(order, order2); @@ -174,7 +174,7 @@ public class TransformTest extends MessageTestBase { response = consumeNext.request().post(String.class); Assert.assertEquals(200, response.getStatus()); - Assert.assertEquals("application/xml", response.getHeaders().getFirst("Content-Type").toString().toLowerCase()); + Assert.assertTrue(response.getHeaders().getFirst("Content-Type").toString().toLowerCase().contains("application/xml")); Order order2 = response.getEntity(Order.class); response.releaseConnection(); Assert.assertEquals(order, order2); diff --git a/pom.xml b/pom.xml index c48f8ab20e..354096eb68 100644 --- a/pom.xml +++ b/pom.xml @@ -108,7 +108,7 @@ <!-- this is basically for tests --> <netty-tcnative-version>2.0.33.Final</netty-tcnative-version> <proton.version>0.33.8</proton.version> - <resteasy.version>3.0.19.Final</resteasy.version> + <resteasy.version>3.15.0.Final</resteasy.version> <slf4j.version>1.7.21</slf4j.version> <qpid.jms.version>0.55.0</qpid.jms.version> <johnzon.version>0.9.5</johnzon.version> @@ -702,7 +702,7 @@ </dependency> <dependency> <groupId>org.jboss.resteasy</groupId> - <artifactId>resteasy-jackson-provider</artifactId> + <artifactId>resteasy-jackson2-provider</artifactId> <version>${resteasy.version}</version> <exclusions> <exclusion>