activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1367622 - in /activemq/trunk/activemq-core/src/test/java/org/apache/activemq: JMSUsecaseTest.java JmsTestSupport.java
Date Tue, 31 Jul 2012 15:50:37 GMT
Author: tabish
Date: Tue Jul 31 15:50:36 2012
New Revision: 1367622

URL: http://svn.apache.org/viewvc?rev=1367622&view=rev
Log:
apply patch for: https://issues.apache.org/jira/browse/AMQ-3954

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSUsecaseTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTestSupport.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSUsecaseTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSUsecaseTest.java?rev=1367622&r1=1367621&r2=1367622&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSUsecaseTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSUsecaseTest.java Tue
Jul 31 15:50:36 2012
@@ -59,10 +59,13 @@ public class JMSUsecaseTest extends JmsT
         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 JmsT
         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 JmsT
         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"));
 

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTestSupport.java?rev=1367622&r1=1367621&r2=1367622&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTestSupport.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTestSupport.java Tue
Jul 31 15:50:36 2012
@@ -39,8 +39,8 @@ import org.apache.activemq.command.Activ
 
 /**
  * Test cases used to test the JMS message consumer.
- * 
- * 
+ *
+ *
  */
 public class JmsTestSupport extends CombinationTestSupport {
 
@@ -96,10 +96,14 @@ public class JmsTestSupport extends Comb
 
     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 Comb
     }
 
     protected void tearDown() throws Exception {
-        for (Iterator iter = connections.iterator(); iter.hasNext();) {
-            Connection conn = (Connection)iter.next();
+        for (Iterator<Connection> iter = connections.iterator(); iter.hasNext();) {
+            Connection conn = iter.next();
             try {
                 conn.close();
             } catch (Throwable e) {



Mime
View raw message