All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mockrunner.mock.jms.MockServerSession Maven / Gradle / Ivy

Go to download

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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy