From 3eed7793786109831b932127ce57148ce47d8585 Mon Sep 17 00:00:00 2001 From: "Timothy A. Bish" Date: Tue, 31 Jul 2012 15:50:36 +0000 Subject: [PATCH] apply patch for: https://issues.apache.org/jira/browse/AMQ-3954 git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1367622 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/activemq/JMSUsecaseTest.java | 9 +++++++-- .../java/org/apache/activemq/JmsTestSupport.java | 14 +++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/activemq-core/src/test/java/org/apache/activemq/JMSUsecaseTest.java b/activemq-core/src/test/java/org/apache/activemq/JMSUsecaseTest.java index ab4b00b77a..d22907a95a 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JMSUsecaseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JMSUsecaseTest.java @@ -59,10 +59,13 @@ public class JMSUsecaseTest extends JmsTestSupport { connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); destination = createDestination(session, destinationType); - sendMessages(session, destination, 5); + MessageProducer producer = session.createProducer(destination); + producer.setDeliveryMode(this.deliveryMode); + sendMessages(session, producer, 5); + producer.close(); QueueBrowser browser = session.createBrowser((Queue)destination); - Enumeration enumeration = browser.getEnumeration(); + Enumeration enumeration = browser.getEnumeration(); for (int i = 0; i < 5; i++) { Thread.sleep(100); assertTrue(enumeration.hasMoreElements()); @@ -85,6 +88,7 @@ public class JMSUsecaseTest extends JmsTestSupport { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); destination = createDestination(session, destinationType); MessageProducer producer = session.createProducer(destination); + producer.setDeliveryMode(this.deliveryMode); MessageConsumer consumer = session.createConsumer(destination); ActiveMQMessage message = new ActiveMQMessage(); producer.send(message); @@ -106,6 +110,7 @@ public class JMSUsecaseTest extends JmsTestSupport { Session session = connection.createSession(true, Session.SESSION_TRANSACTED); destination = createDestination(session, destinationType); MessageProducer producer = session.createProducer(destination); + producer.setDeliveryMode(this.deliveryMode); MessageConsumer consumer = session.createConsumer(destination); producer.send(session.createTextMessage("test")); diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/JmsTestSupport.java index 8c24ad0dde..5531410779 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsTestSupport.java @@ -39,8 +39,8 @@ import org.apache.activemq.command.ActiveMQDestination; /** * Test cases used to test the JMS message consumer. - * - * + * + * */ public class JmsTestSupport extends CombinationTestSupport { @@ -96,10 +96,14 @@ public class JmsTestSupport extends CombinationTestSupport { protected void sendMessages(Session session, Destination destination, int count) throws JMSException { MessageProducer producer = session.createProducer(destination); + sendMessages(session, producer, count); + producer.close(); + } + + protected void sendMessages(Session session, MessageProducer producer, int count) throws JMSException { for (int i = 0; i < count; i++) { producer.send(session.createTextMessage(messageTextPrefix + i)); } - producer.close(); } protected ConnectionFactory createConnectionFactory() throws Exception { @@ -126,8 +130,8 @@ public class JmsTestSupport extends CombinationTestSupport { } protected void tearDown() throws Exception { - for (Iterator iter = connections.iterator(); iter.hasNext();) { - Connection conn = (Connection)iter.next(); + for (Iterator iter = connections.iterator(); iter.hasNext();) { + Connection conn = iter.next(); try { conn.close(); } catch (Throwable e) {