Added durable topic test for master/slave

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@372300 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2006-01-25 20:06:17 +00:00
parent 2b8946f964
commit afcefa0111
2 changed files with 49 additions and 1 deletions

View File

@ -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);
@ -87,6 +90,10 @@ public class JmsTopicSendReceiveWithTwoConnectionsTest extends JmsSendReceiveTes
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");
}

View File

@ -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;
}
}