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:
Gary Russell
2014-03-11 10:41:47 -04:00
parent 5d0eafc608
commit c7265d8e4a
4 changed files with 8 additions and 10 deletions

View File

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

View File

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

View File

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

View File

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