INT-3288 Use Unique Queues for Tests
JIRA: https://jira.spring.io/browse/INT-3288 Possible crosstalk between in inbound and outbound channel adapter tests - they used the same queue (foo). The outbound test leaves a message in the queue.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd">
|
||||
|
||||
<int-jms:inbound-channel-adapter channel="out" session-transacted="true"
|
||||
connection-factory="connectionFactory" destination-name="foo"
|
||||
connection-factory="connectionFactory" destination-name="incatQ"
|
||||
receive-timeout="500">
|
||||
<int:poller fixed-delay="500"/>
|
||||
</int-jms:inbound-channel-adapter>
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
package org.springframework.integration.jms;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import javax.jms.ConnectionFactory;
|
||||
|
||||
@@ -50,13 +49,12 @@ public class JmsInboundChannelAdapterTests extends ActiveMQMultiContextTests {
|
||||
@Test
|
||||
public void testTransactionalReceive() {
|
||||
JmsTemplate template = new JmsTemplate(connectionFactory);
|
||||
template.convertAndSend("foo", "bar");
|
||||
template.convertAndSend("incatQ", "bar");
|
||||
assertNotNull(out.receive(20000));
|
||||
/*
|
||||
* INT-3288 - previously acknowledge="transacted"
|
||||
* Caused by: javax.jms.JMSException: acknowledgeMode SESSION_TRANSACTED cannot be used for an non-transacted Session
|
||||
*/
|
||||
assertNull(out.receive(1000));
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
<int-jms:message-driven-channel-adapter channel="toOut"
|
||||
connection-factory="connectionFactory"
|
||||
acknowledge="transacted"
|
||||
destination-name="foo"/>
|
||||
destination-name="outcatQ1"/>
|
||||
|
||||
<int:publish-subscribe-channel id="toOut" />
|
||||
|
||||
<int-jms:outbound-channel-adapter channel="toOut" order="1"
|
||||
connection-factory="connectionFactory"
|
||||
destination-name="bar"
|
||||
destination-name="outcatQ2"
|
||||
session-transacted="true" />
|
||||
|
||||
<int:service-activator input-channel="toOut" order="2" ref="aborter"/>
|
||||
|
||||
@@ -56,14 +56,14 @@ public class JmsOutboundChannelAdapterTests extends ActiveMQMultiContextTests {
|
||||
@Test
|
||||
public void testTransactionalSend() {
|
||||
JmsTemplate template = new JmsTemplate(connectionFactory);
|
||||
template.convertAndSend("foo", "Hello, world!");
|
||||
template.convertAndSend("outcatQ1", "Hello, world!");
|
||||
template.setReceiveTimeout(20000);
|
||||
assertNotNull(template.receive("bar"));
|
||||
assertNotNull(template.receive("outcatQ2"));
|
||||
|
||||
this.aborter.abort = true;
|
||||
template.convertAndSend("foo", "Hello, world!");
|
||||
template.convertAndSend("outcatQ1", "Hello, world!");
|
||||
template.setReceiveTimeout(1000);
|
||||
assertNull(template.receive("bar"));
|
||||
assertNull(template.receive("outcatQ2"));
|
||||
endpoint.stop();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user