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