This commit is contained in:
Justin Bertram 2021-03-09 12:46:01 -06:00
commit 491d50e42f
8 changed files with 24 additions and 16 deletions

View File

@ -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>

View File

@ -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);

View File

@ -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();

View File

@ -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");

View File

@ -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);

View File

@ -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");

View File

@ -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);

View File

@ -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>