activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r790087 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicPubSubTest.java
Date Wed, 01 Jul 2009 09:28:57 GMT
Author: gtully
Date: Wed Jul  1 09:28:56 2009
New Revision: 790087

URL: http://svn.apache.org/viewvc?rev=790087&view=rev
Log:
basic test case for https://issues.apache.org/activemq/browse/AMQ-1763 - but does not show
the problem atm

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicPubSubTest.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicPubSubTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicPubSubTest.java?rev=790087&r1=790086&r2=790087&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicPubSubTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicPubSubTest.java
Wed Jul  1 09:28:56 2009
@@ -17,10 +17,14 @@
 package org.apache.activemq.broker.virtual;
 
 import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.Message;
 import javax.jms.MessageConsumer;
 import javax.jms.MessageProducer;
 import javax.jms.Session;
 
+import junit.framework.Test;
+
 import org.apache.activemq.EmbeddedBrokerTestSupport;
 import org.apache.activemq.command.ActiveMQQueue;
 import org.apache.activemq.command.ActiveMQTopic;
@@ -33,14 +37,35 @@
 public class VirtualTopicPubSubTest extends EmbeddedBrokerTestSupport {
 
     private Connection connection;
+    public int ackMode = Session.AUTO_ACKNOWLEDGE;
 
+    public static Test suite() {
+        return suite(VirtualTopicPubSubTest.class);
+    }
+    
+    public void initCombosForTestVirtualTopicCreation() {
+        addCombinationValues("ackMode", new Object[] {new Integer(Session.AUTO_ACKNOWLEDGE),
new Integer(Session.CLIENT_ACKNOWLEDGE) });
+    }
+    
     public void testVirtualTopicCreation() throws Exception {
         if (connection == null) {
             connection = createConnection();
         }
         connection.start();
 
-        ConsumerBean messageList = new ConsumerBean();
+        ConsumerBean messageList = new ConsumerBean() {
+            public synchronized void onMessage(Message message) {
+                super.onMessage(message);
+                if (ackMode == Session.CLIENT_ACKNOWLEDGE) {
+                    try {
+                        message.acknowledge();
+                    } catch (JMSException e) {
+                        e.printStackTrace();
+                    }
+                }
+                
+            }
+        };
         messageList.setVerbose(true);
         
         String queueAName = getVirtualTopicConsumerName();
@@ -48,7 +73,7 @@
         ActiveMQQueue queue1 = new ActiveMQQueue(queueAName);
         ActiveMQQueue queue2 = new ActiveMQQueue(queueAName);
 
-        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        Session session = connection.createSession(false, ackMode);
         MessageConsumer c1 = session.createConsumer(queue1);
         MessageConsumer c2 = session.createConsumer(queue2);
 



Mime
View raw message