You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ra...@apache.org on 2006/01/25 21:06:22 UTC

svn commit: r372300 - in /incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq: JmsTopicSendReceiveWithTwoConnectionsTest.java broker/ft/TopicMasterSlaveTest.java

Author: rajdavies
Date: Wed Jan 25 12:06:17 2006
New Revision: 372300

URL: http://svn.apache.org/viewcvs?rev=372300&view=rev
Log:
Added durable topic test for master/slave

Added:
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/TopicMasterSlaveTest.java
Modified:
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveWithTwoConnectionsTest.java

Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveWithTwoConnectionsTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveWithTwoConnectionsTest.java?rev=372300&r1=372299&r2=372300&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveWithTwoConnectionsTest.java (original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveWithTwoConnectionsTest.java Wed Jan 25 12:06:17 2006
@@ -18,6 +18,9 @@
 
 import javax.jms.Connection;
 import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
 import javax.jms.Session;
 
 import org.apache.activemq.ActiveMQConnectionFactory;
@@ -72,7 +75,7 @@
         log.info("Created  consumer destination: " + consumerDestination + " of type: " + consumerDestination.getClass());
         log.info("Created  producer destination: " + producerDestination + " of type: " + producerDestination.getClass());
 
-        consumer = receiveSession.createConsumer(consumerDestination);
+        consumer = createConsumer(receiveSession,consumerDestination);
         consumer.setMessageListener(this);
 
 
@@ -85,6 +88,10 @@
 
     protected Connection createSendConnection() throws Exception {
         return createConnection();
+    }
+    
+    protected MessageConsumer createConsumer(Session session, Destination dest) throws JMSException{
+        return session.createConsumer(dest);
     }
 
     protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {

Added: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/TopicMasterSlaveTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/TopicMasterSlaveTest.java?rev=372300&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/TopicMasterSlaveTest.java (added)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/TopicMasterSlaveTest.java Wed Jan 25 12:06:17 2006
@@ -0,0 +1,41 @@
+/**
+ * 
+ * Copyright 2005-2006 The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.activemq.broker.ft;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+import javax.jms.Topic;
+/**
+ * Test failover for Queues
+ * 
+ */
+public class TopicMasterSlaveTest extends QueueMasterSlaveTest{
+    
+    protected boolean isTopic(){
+        return true;
+    }
+
+    protected MessageConsumer createConsumer(Session session,Destination dest) throws JMSException{
+        return session.createDurableSubscriber((Topic) dest,dest.toString());
+    }
+
+    protected Connection createReceiveConnection() throws Exception{
+        Connection result=super.createReceiveConnection();
+        result.setClientID(getClass().getName());
+        return result;
+    }
+}