001 package com.mockrunner.mock.jms;
002
003 import javax.jms.JMSException;
004 import javax.jms.MessageProducer;
005 import javax.jms.Session;
006 import javax.jms.Topic;
007 import javax.jms.TopicPublisher;
008 import javax.jms.TopicSession;
009 import javax.jms.TopicSubscriber;
010
011 /**
012 * Mock implementation of JMS <code>TopicSession</code>.
013 */
014 public class MockTopicSession extends MockSession implements TopicSession
015 {
016 public MockTopicSession(MockTopicConnection connection)
017 {
018 this(connection, false, Session.AUTO_ACKNOWLEDGE);
019 }
020
021 public MockTopicSession(MockTopicConnection connection, boolean transacted, int acknowledgeMode)
022 {
023 super(connection, transacted, acknowledgeMode);
024 }
025
026 public TopicPublisher createPublisher(Topic topic) throws JMSException
027 {
028 return (TopicPublisher)createProducer(topic);
029 }
030
031 public TopicSubscriber createSubscriber(Topic topic) throws JMSException
032 {
033 return (TopicSubscriber)createConsumer(topic);
034 }
035
036 public TopicSubscriber createSubscriber(Topic topic, String messageSelector, boolean noLocal) throws JMSException
037 {
038 return (TopicSubscriber)createConsumer(topic, messageSelector, noLocal);
039 }
040
041 protected MessageProducer createProducerForNullDestination()
042 {
043 return getGenericTransmissionManager().createTopicPublisher();
044 }
045 }