From f66a5dae37e794754e59738e8f3e70409a3eb65e Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Sat, 23 Jan 2016 10:14:21 -0500 Subject: [PATCH] Downgrade to ActiveMQ-5.12.2 for IO compatibility **Cherry-pick to 4.2.x** --- build.gradle | 2 +- .../jms/PollableJmsChannelTests.java | 32 ++++--------------- .../jms/SubscribableJmsChannelTests.java | 15 ++++----- ...xtractRequestReplyPayloadTests-context.xml | 1 + .../ExtractRequestReplyPayloadTests.java | 5 --- .../config/JmsChannelHistoryTests-context.xml | 9 +++--- .../jms/config/JmsChannelHistoryTests.java | 14 +++----- 7 files changed, 24 insertions(+), 54 deletions(-) diff --git a/build.gradle b/build.gradle index ed38d9737f..fc6bda9ff5 100644 --- a/build.gradle +++ b/build.gradle @@ -82,7 +82,7 @@ subprojects { subproject -> ext { - activeMqVersion = '5.13.0' + activeMqVersion = '5.12.2' aspectjVersion = '1.8.7' apacheSshdVersion = '0.14.0' boonVersion = '0.33' diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/PollableJmsChannelTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/PollableJmsChannelTests.java index 7859c0bc91..280164c006 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/PollableJmsChannelTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/PollableJmsChannelTests.java @@ -38,7 +38,7 @@ import javax.jms.TextMessage; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.command.ActiveMQQueue; -import org.junit.BeforeClass; +import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; @@ -67,16 +67,16 @@ public class PollableJmsChannelTests { private Destination queue; - @BeforeClass - public static void setup() { - System.setProperty("org.apache.activemq.SERIALIZABLE_PACKAGES", "*"); + @Before + public void setup() { + ActiveMqTestUtils.prepare(); + this.connectionFactory = new ActiveMQConnectionFactory(); + this.connectionFactory.setBrokerURL("vm://localhost?broker.persistent=false"); + this.connectionFactory.setTrustAllPackages(true); } @Test public void queueReference() throws Exception { - ActiveMqTestUtils.prepare(); - this.connectionFactory = new ActiveMQConnectionFactory(); - this.connectionFactory.setBrokerURL("vm://localhost?broker.persistent=false"); this.queue = new ActiveMQQueue("pollableJmsChannelTestQueue"); JmsChannelFactoryBean factoryBean = new JmsChannelFactoryBean(false); @@ -101,10 +101,6 @@ public class PollableJmsChannelTests { @Test public void queueName() throws Exception { - ActiveMqTestUtils.prepare(); - this.connectionFactory = new ActiveMQConnectionFactory(); - this.connectionFactory.setBrokerURL("vm://localhost?broker.persistent=false"); - JmsChannelFactoryBean factoryBean = new JmsChannelFactoryBean(false); CachingConnectionFactory ccf = new CachingConnectionFactory(this.connectionFactory); ccf.setCacheConsumers(false); @@ -128,10 +124,6 @@ public class PollableJmsChannelTests { @Test public void queueNameWithFalsePreReceiveInterceptors() throws Exception { - ActiveMqTestUtils.prepare(); - this.connectionFactory = new ActiveMQConnectionFactory(); - this.connectionFactory.setBrokerURL("vm://localhost?broker.persistent=false"); - JmsChannelFactoryBean factoryBean = new JmsChannelFactoryBean(false); CachingConnectionFactory ccf = new CachingConnectionFactory(this.connectionFactory); ccf.setCacheConsumers(false); @@ -155,10 +147,6 @@ public class PollableJmsChannelTests { @Test public void queueNameWithTruePreReceiveInterceptors() throws Exception { - ActiveMqTestUtils.prepare(); - this.connectionFactory = new ActiveMQConnectionFactory(); - this.connectionFactory.setBrokerURL("vm://localhost?broker.persistent=false"); - JmsChannelFactoryBean factoryBean = new JmsChannelFactoryBean(false); CachingConnectionFactory ccf = new CachingConnectionFactory(this.connectionFactory); ccf.setCacheConsumers(false); @@ -182,9 +170,6 @@ public class PollableJmsChannelTests { @Test public void qos() throws Exception { - ActiveMqTestUtils.prepare(); - this.connectionFactory = new ActiveMQConnectionFactory(); - this.connectionFactory.setBrokerURL("vm://localhost?broker.persistent=false"); this.queue = new ActiveMQQueue("pollableJmsChannelTestQueue"); CachingConnectionFactory ccf = new CachingConnectionFactory(connectionFactory); ccf.setCacheConsumers(false); @@ -241,9 +226,6 @@ public class PollableJmsChannelTests { @Test public void selector() throws Exception { - ActiveMqTestUtils.prepare(); - this.connectionFactory = new ActiveMQConnectionFactory(); - this.connectionFactory.setBrokerURL("vm://localhost?broker.persistent=false"); this.queue = new ActiveMQQueue("pollableJmsChannelSelectorTestQueue"); JmsChannelFactoryBean factoryBean = new JmsChannelFactoryBean(false); diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/SubscribableJmsChannelTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/SubscribableJmsChannelTests.java index df2a2f53a8..7fd007a12e 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/SubscribableJmsChannelTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/SubscribableJmsChannelTests.java @@ -34,7 +34,6 @@ import java.util.Collections; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; - import javax.jms.Destination; import javax.jms.MessageListener; @@ -44,7 +43,6 @@ import org.apache.activemq.command.ActiveMQTopic; import org.apache.commons.logging.Log; import org.junit.After; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; @@ -53,6 +51,7 @@ import org.springframework.beans.DirectFieldAccessor; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.context.support.StaticApplicationContext; +import org.springframework.integration.jms.config.ActiveMqTestUtils; import org.springframework.integration.jms.config.JmsChannelFactoryBean; import org.springframework.integration.test.util.TestUtils; import org.springframework.jms.connection.CachingConnectionFactory; @@ -67,6 +66,7 @@ import org.springframework.messaging.support.GenericMessage; * @author Mark Fisher * @author Gary Russell * @author Gunnar Hillert + * @author Artem Bilan * @since 2.0 */ public class SubscribableJmsChannelTests { @@ -79,16 +79,13 @@ public class SubscribableJmsChannelTests { private Destination queue; - @BeforeClass - public static void beforeClass() { - System.setProperty("org.apache.activemq.SERIALIZABLE_PACKAGES", "*"); - } - @Before - public void setup() throws Exception { + public void setup() { + ActiveMqTestUtils.prepare(); ActiveMQConnectionFactory targetConnectionFactory = new ActiveMQConnectionFactory(); - this.connectionFactory = new CachingConnectionFactory(targetConnectionFactory); targetConnectionFactory.setBrokerURL("vm://localhost?broker.persistent=false"); + targetConnectionFactory.setTrustAllPackages(true); + this.connectionFactory = new CachingConnectionFactory(targetConnectionFactory); this.topic = new ActiveMQTopic("testTopic"); this.queue = new ActiveMQQueue("testQueue"); } diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExtractRequestReplyPayloadTests-context.xml b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExtractRequestReplyPayloadTests-context.xml index f45f091fec..a5a8bc71f7 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExtractRequestReplyPayloadTests-context.xml +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExtractRequestReplyPayloadTests-context.xml @@ -36,6 +36,7 @@ + diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExtractRequestReplyPayloadTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExtractRequestReplyPayloadTests.java index cd006bbcaf..27443b4a02 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExtractRequestReplyPayloadTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExtractRequestReplyPayloadTests.java @@ -77,11 +77,6 @@ public class ExtractRequestReplyPayloadTests { @Autowired ChannelPublishingJmsMessageListener inboundGateway; - @BeforeClass - public static void setup() { - System.setProperty("org.apache.activemq.SERIALIZABLE_PACKAGES", "*"); - } - @Test public void testOutboundInboundDefault() { this.outboundGateway.setExtractRequestPayload(true); diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests-context.xml b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests-context.xml index b401bfa089..d6bc25e33e 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests-context.xml +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests-context.xml @@ -10,13 +10,13 @@ - + - + - - + + @@ -25,6 +25,7 @@ + diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests.java index 474bf99697..95866d1474 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests.java @@ -21,7 +21,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import org.junit.BeforeClass; import org.junit.Test; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; @@ -29,14 +28,14 @@ import org.mockito.stubbing.Answer; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.integration.history.MessageHistory; +import org.springframework.integration.jms.SubscribableJmsChannel; +import org.springframework.jms.core.JmsTemplate; +import org.springframework.jms.listener.AbstractMessageListenerContainer; import org.springframework.messaging.Message; import org.springframework.messaging.PollableChannel; import org.springframework.messaging.SubscribableChannel; -import org.springframework.integration.history.MessageHistory; -import org.springframework.integration.jms.SubscribableJmsChannel; import org.springframework.messaging.support.GenericMessage; -import org.springframework.jms.core.JmsTemplate; -import org.springframework.jms.listener.AbstractMessageListenerContainer; /** * @author Oleg Zhurakousky @@ -45,11 +44,6 @@ import org.springframework.jms.listener.AbstractMessageListenerContainer; */ public class JmsChannelHistoryTests { - @BeforeClass - public static void setup() { - System.setProperty("org.apache.activemq.SERIALIZABLE_PACKAGES", "*"); - } - @SuppressWarnings("rawtypes") @Test public void testMessageHistory() throws Exception{