com.mockrunner.mock.jms.MockServerSession 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.io.Serializable;
import javax.jms.JMSException;
import javax.jms.QueueSession;
import javax.jms.ServerSession;
import javax.jms.Session;
/**
* Mock implementation of JMS ServerSession
.
* The ServerSession
is not meant for application
* use.
*/
public class MockServerSession implements ServerSession, Serializable
{
private MockConnection connection;
private Session session;
private boolean started;
public MockServerSession(MockConnection connection)
{
this.connection = connection;
session = new MockSession(connection, false, QueueSession.AUTO_ACKNOWLEDGE);
started = false;
}
/**
* Returns if this server session was started.
* @return true
if this server session is started
*/
public boolean isStarted()
{
return started;
}
public void setSession(Session session)
{
this.session = session;
}
public Session getSession() throws JMSException
{
connection.throwJMSException();
return session;
}
public void start() throws JMSException
{
connection.throwJMSException();
started = true;
}
}