diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveWithTwoConnectionsTest.java b/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveWithTwoConnectionsTest.java index 53c1fb3ede..cc20abc5ce 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveWithTwoConnectionsTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveWithTwoConnectionsTest.java @@ -18,6 +18,9 @@ package org.apache.activemq; 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 @@ public class JmsTopicSendReceiveWithTwoConnectionsTest extends JmsSendReceiveTes 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); @@ -86,6 +89,10 @@ public class JmsTopicSendReceiveWithTwoConnectionsTest extends JmsSendReceiveTes 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 { return new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false"); diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/ft/TopicMasterSlaveTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/ft/TopicMasterSlaveTest.java new file mode 100644 index 0000000000..5a1f511515 --- /dev/null +++ b/activemq-core/src/test/java/org/apache/activemq/broker/ft/TopicMasterSlaveTest.java @@ -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; + } +}