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-jdk1.3-j2ee1.3 Show documentation
Show all versions of mockrunner-jdk1.3-j2ee1.3 Show documentation
Mockrunner is a lightweight framework for unit testing applications
in the J2EE environment. It supports servlets, filters, tag classes
and Struts actions. It includes a JDBC a JMS and a JCA test
framework and can be used to test EJB based applications.
The newest version!
package com.mockrunner.mock.jms;
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
{
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;
}
}