activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1033468 - in /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store: MessagePriorityTest.java jdbc/JDBCMessagePriorityTest.java
Date Wed, 10 Nov 2010 13:52:40 GMT
Author: dejanb
Date: Wed Nov 10 13:52:40 2010
New Revision: 1033468

URL: http://svn.apache.org/viewvc?rev=1033468&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQ-2980 - modify the test case to show dupliacte
problem

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/MessagePriorityTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/jdbc/JDBCMessagePriorityTest.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/MessagePriorityTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/MessagePriorityTest.java?rev=1033468&r1=1033467&r2=1033468&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/MessagePriorityTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/MessagePriorityTest.java
Wed Nov 10 13:52:40 2010
@@ -45,8 +45,8 @@ abstract public class MessagePriorityTes
     BrokerService broker;
     PersistenceAdapter adapter;
     
-    ActiveMQConnectionFactory factory;
-    Connection conn;
+    protected ActiveMQConnectionFactory factory;
+    protected Connection conn;
     protected Session sess;
     
     public boolean useCache = true;

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/jdbc/JDBCMessagePriorityTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/jdbc/JDBCMessagePriorityTest.java?rev=1033468&r1=1033467&r2=1033468&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/jdbc/JDBCMessagePriorityTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/jdbc/JDBCMessagePriorityTest.java
Wed Nov 10 13:52:40 2010
@@ -21,7 +21,9 @@ import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Vector;
 import java.util.concurrent.atomic.AtomicInteger;
+import javax.jms.Connection;
 import javax.jms.Message;
+import javax.jms.Session;
 import javax.jms.TopicSubscriber;
 import junit.framework.Test;
 import org.apache.activemq.command.ActiveMQTopic;
@@ -101,7 +103,12 @@ public class JDBCMessagePriorityTest ext
     public void testConcurrentDurableSubsReconnectWithXLevels() throws Exception {
         ActiveMQTopic topic = (ActiveMQTopic) sess.createTopic("TEST");
         final String subName = "priorityDisconnect";
-        TopicSubscriber sub = sess.createDurableSubscriber(topic, subName);
+        Connection consumerConn = factory.createConnection();
+        consumerConn.setClientID("priorityDisconnect");
+        consumerConn.start();
+        Session consumerSession = consumerConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+        TopicSubscriber sub = consumerSession.createDurableSubscriber(topic, subName);
         sub.close();
 
         final int maxPriority = 5;
@@ -119,7 +126,7 @@ public class JDBCMessagePriorityTest ext
 
         final int closeFrequency = MSG_NUM/2;
         HashMap dups = new HashMap();
-        sub = sess.createDurableSubscriber(topic, subName);
+        sub = consumerSession.createDurableSubscriber(topic, subName);
         for (int i=0; i < MSG_NUM * maxPriority; i++) {
             Message msg = sub.receive(10000);
             assertNull("no duplicate message", dups.put(msg.getJMSMessageID(), subName));
@@ -131,11 +138,13 @@ public class JDBCMessagePriorityTest ext
             if (i > 0 && i % closeFrequency == 0) {
                 LOG.info("Closing durable sub.. on: " + i + ", counts: " + Arrays.toString(messageCounts));
                 sub.close();
-                sub = sess.createDurableSubscriber(topic, subName);
+                sub = consumerSession.createDurableSubscriber(topic, subName);
             }
         }
         LOG.info("closing on done!");
         sub.close();
+        consumerSession.close();
+        consumerConn.close();
 
         for (ProducerThread producer : producers) {
             producer.join();



Mime
View raw message