com.mockrunner.mock.jms.MockQueueConnection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mockrunner-jms Show documentation
Show all versions of mockrunner-jms Show documentation
Mock classes for Java Messaging System
package com.mockrunner.mock.jms;
import java.util.List;
import javax.jms.ConnectionConsumer;
import javax.jms.JMSException;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueSession;
import javax.jms.ServerSessionPool;
import javax.jms.Session;
import com.mockrunner.jms.ConfigurationManager;
import com.mockrunner.jms.DestinationManager;
/**
* Mock implementation of JMS QueueConnection
.
* Please note: The interfaces ConnectionConsumer
,
* ServerSessionPool
and ServerSession
* are not meant for application use. Mockrunner provides very
* simple mock implementations but usually you won't need them.
*/
public class MockQueueConnection extends MockConnection implements QueueConnection
{
public MockQueueConnection(DestinationManager destinationManager, ConfigurationManager configurationManager)
{
super(destinationManager, configurationManager);
}
public MockQueueConnection(DestinationManager destinationManager, ConfigurationManager configurationManager, String userName, String password)
{
super(destinationManager, configurationManager, userName, password);
}
/**
* Returns the list of {@link MockQueueSession} objects that were created
* with {@link #createQueueSession}.
* @return the list
*/
public List getQueueSessionList()
{
return super.getSessionList();
}
/**
* Returns a {@link MockQueueSession} that was created with
* {@link #createQueueSession}. If there's no such
* {@link MockQueueSession}, null
is returned.
* @param index the index of the session object
* @return the session object
*/
public MockQueueSession getQueueSession(int index)
{
return (MockQueueSession)super.getSession(index);
}
public Session createSession(boolean transacted, int acknowledgeMode) throws JMSException
{
return createQueueSession(transacted, acknowledgeMode);
}
public QueueSession createQueueSession(boolean transacted, int acknowledgeMode) throws JMSException
{
throwJMSException();
MockQueueSession session = new MockQueueSession(this, transacted, acknowledgeMode);
sessions().add(session);
return session;
}
public ConnectionConsumer createConnectionConsumer(Queue queue, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
{
return super.createConnectionConsumer(queue, messageSelector, sessionPool, maxMessages);
}
}