
com.mockrunner.mock.jms.MockQueueConnectionFactory 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.Connection;
import javax.jms.JMSException;
import com.mockrunner.jms.ConfigurationManager;
import com.mockrunner.jms.DestinationManager;
/**
* Mock implementation of JMS QueueConnectionFactory
.
*/
public class MockQueueConnectionFactory extends MockConnectionFactory
{
public MockQueueConnectionFactory(DestinationManager destinationManager, ConfigurationManager configurationManager)
{
super(destinationManager, configurationManager);
}
public Connection createConnection() throws JMSException
{
return createQueueConnection();
}
public Connection createConnection(String name, String password) throws JMSException
{
return createQueueConnection();
}
/**
* Returns the connection with the specified index
* or null
if no such connection
* exists.
* @param index the index
* @return the connection
*/
public MockQueueConnection getQueueConnection(int index)
{
if(connections().size() <= index) return null;
return (MockQueueConnection)connections().get(index);
}
/**
* Returns the latest created connection
* or null
if no such connection
* exists.
* @return the connection
*/
public MockQueueConnection getLatestQueueConnection()
{
if(connections().size() == 0) return null;
return (MockQueueConnection)connections().get(connections().size() - 1);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy