Upgrade to ActiveMQ-5.13.0

Since Spring IO 2.0.2 has been upgraded to Spring Boot 1.3.2
and that one has been upgraded to ActiveMQ-5.12.2, where this one
has a Java Serialization Vulnerability fix (https://issues.apache.org/jira/browse/AMQ-6013),
we are forced to back port such an upgrade fix from `master`.
This commit is contained in:
Artem Bilan
2015-12-14 19:33:26 -05:00
parent aa06f7b2e3
commit 6ce7a0da7a
5 changed files with 46 additions and 14 deletions

View File

@@ -82,9 +82,9 @@ subprojects { subproject ->
ext { ext {
activeMqVersion = '5.11.1' activeMqVersion = '5.13.0'
aspectjVersion = '1.8.4' aspectjVersion = '1.8.7'
apacheSshdVersion = '0.13.0' apacheSshdVersion = '0.14.0'
boonVersion = '0.33' boonVersion = '0.33'
chronicleVersion = '3.4.3' chronicleVersion = '3.4.3'
commonsDbcpVersion = '1.4' commonsDbcpVersion = '1.4'

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -31,7 +31,6 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import javax.jms.Destination; import javax.jms.Destination;
import javax.jms.JMSException; import javax.jms.JMSException;
import javax.jms.Session; import javax.jms.Session;
@@ -39,6 +38,7 @@ import javax.jms.TextMessage;
import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.command.ActiveMQQueue; import org.apache.activemq.command.ActiveMQQueue;
import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.mockito.Mockito; import org.mockito.Mockito;
@@ -59,6 +59,7 @@ import org.springframework.messaging.support.GenericMessage;
* @author Mark Fisher * @author Mark Fisher
* @author Gary Russell * @author Gary Russell
* @author Gunnar Hillert * @author Gunnar Hillert
* @author Artem Bilan
*/ */
public class PollableJmsChannelTests { public class PollableJmsChannelTests {
@@ -66,6 +67,11 @@ public class PollableJmsChannelTests {
private Destination queue; private Destination queue;
@BeforeClass
public static void setup() {
System.setProperty("org.apache.activemq.SERIALIZABLE_PACKAGES", "*");
}
@Test @Test
public void queueReference() throws Exception { public void queueReference() throws Exception {
ActiveMqTestUtils.prepare(); ActiveMqTestUtils.prepare();
@@ -85,10 +91,10 @@ public class PollableJmsChannelTests {
assertTrue(sent1); assertTrue(sent1);
boolean sent2 = channel.send(new GenericMessage<String>("bar")); boolean sent2 = channel.send(new GenericMessage<String>("bar"));
assertTrue(sent2); assertTrue(sent2);
Message<?> result1 = channel.receive(1000); Message<?> result1 = channel.receive(10000);
assertNotNull(result1); assertNotNull(result1);
assertEquals("foo", result1.getPayload()); assertEquals("foo", result1.getPayload());
Message<?> result2 = channel.receive(1000); Message<?> result2 = channel.receive(10000);
assertNotNull(result2); assertNotNull(result2);
assertEquals("bar", result2.getPayload()); assertEquals("bar", result2.getPayload());
} }
@@ -115,7 +121,7 @@ public class PollableJmsChannelTests {
Message<?> result1 = channel.receive(10000); Message<?> result1 = channel.receive(10000);
assertNotNull(result1); assertNotNull(result1);
assertEquals("foo", result1.getPayload()); assertEquals("foo", result1.getPayload());
Message<?> result2 = channel.receive(1000); Message<?> result2 = channel.receive(10000);
assertNotNull(result2); assertNotNull(result2);
assertEquals("bar", result2.getPayload()); assertEquals("bar", result2.getPayload());
} }
@@ -200,11 +206,14 @@ public class PollableJmsChannelTests {
final AtomicReference<javax.jms.Message> message = new AtomicReference<javax.jms.Message>(); final AtomicReference<javax.jms.Message> message = new AtomicReference<javax.jms.Message>();
final CountDownLatch latch1 = new CountDownLatch(1); final CountDownLatch latch1 = new CountDownLatch(1);
Executors.newSingleThreadExecutor().execute(new Runnable() { Executors.newSingleThreadExecutor().execute(new Runnable() {
@Override @Override
public void run() { public void run() {
message.set(receiver.receive(queue)); message.set(receiver.receive(queue));
latch1.countDown(); latch1.countDown();
}}); }
});
assertTrue(latch1.await(10, TimeUnit.SECONDS)); assertTrue(latch1.await(10, TimeUnit.SECONDS));
assertNotNull(message.get()); assertNotNull(message.get());
assertEquals(5, message.get().getJMSPriority()); assertEquals(5, message.get().getJMSPriority());
@@ -215,11 +224,14 @@ public class PollableJmsChannelTests {
boolean sent2 = channel.send(MessageBuilder.withPayload("foo").setPriority(6).build()); boolean sent2 = channel.send(MessageBuilder.withPayload("foo").setPriority(6).build());
assertTrue(sent2); assertTrue(sent2);
Executors.newSingleThreadExecutor().execute(new Runnable() { Executors.newSingleThreadExecutor().execute(new Runnable() {
@Override @Override
public void run() { public void run() {
message.set(receiver.receive(queue)); message.set(receiver.receive(queue));
latch2.countDown(); latch2.countDown();
}}); }
});
assertTrue(latch2.await(10, TimeUnit.SECONDS)); assertTrue(latch2.await(10, TimeUnit.SECONDS));
assertNotNull(message.get()); assertNotNull(message.get());
assertEquals(6, message.get().getJMSPriority()); assertEquals(6, message.get().getJMSPriority());
@@ -260,9 +272,10 @@ public class PollableJmsChannelTests {
message.setStringProperty("baz", "qux"); message.setStringProperty("baz", "qux");
return message; return message;
} }
}); });
Message<?> result2 = channel.receive(1000); Message<?> result2 = channel.receive(10000);
assertNotNull(result2); assertNotNull(result2);
assertEquals("bar", result2.getPayload()); assertEquals("bar", result2.getPayload());
} }
@@ -296,4 +309,5 @@ public class PollableJmsChannelTests {
} }
} }
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -44,6 +44,7 @@ import org.apache.activemq.command.ActiveMQTopic;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.mockito.invocation.InvocationOnMock; import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer; import org.mockito.stubbing.Answer;
@@ -78,6 +79,11 @@ public class SubscribableJmsChannelTests {
private Destination queue; private Destination queue;
@BeforeClass
public static void beforeClass() {
System.setProperty("org.apache.activemq.SERIALIZABLE_PACKAGES", "*");
}
@Before @Before
public void setup() throws Exception { public void setup() throws Exception {
ActiveMQConnectionFactory targetConnectionFactory = new ActiveMQConnectionFactory(); ActiveMQConnectionFactory targetConnectionFactory = new ActiveMQConnectionFactory();

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2015 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
@@ -23,6 +23,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import javax.jms.JMSException; import javax.jms.JMSException;
import org.apache.log4j.Level; import org.apache.log4j.Level;
import org.junit.BeforeClass;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName; import org.junit.rules.TestName;
@@ -76,6 +77,11 @@ public class ExtractRequestReplyPayloadTests {
@Autowired @Autowired
ChannelPublishingJmsMessageListener inboundGateway; ChannelPublishingJmsMessageListener inboundGateway;
@BeforeClass
public static void setup() {
System.setProperty("org.apache.activemq.SERIALIZABLE_PACKAGES", "*");
}
@Test @Test
public void testOutboundInboundDefault() { public void testOutboundInboundDefault() {
this.outboundGateway.setExtractRequestPayload(true); this.outboundGateway.setExtractRequestPayload(true);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times; import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock; import org.mockito.invocation.InvocationOnMock;
@@ -44,6 +45,11 @@ import org.springframework.jms.listener.AbstractMessageListenerContainer;
*/ */
public class JmsChannelHistoryTests { public class JmsChannelHistoryTests {
@BeforeClass
public static void setup() {
System.setProperty("org.apache.activemq.SERIALIZABLE_PACKAGES", "*");
}
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@Test @Test
public void testMessageHistory() throws Exception{ public void testMessageHistory() throws Exception{