![JAR search and dependency download from the Maven repository](/logo.png)
com.mockrunner.mock.connector.cci.ConnectorMockObjectFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mockrunner-jdk1.6-j2ee1.3 Show documentation
Show all versions of mockrunner-jdk1.6-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.connector.cci;
import com.mockrunner.connector.InteractionHandler;
/**
* Used to create all types of JCA mock objects.
* Maintains the necessary dependencies between the mock objects.
* If you use the mock objects returned by this
* factory in your tests you can be sure that they are all
* up to date. If you are using JNDI for obtaining the
* MockConnectionFactory
you have to bind them to
* the mock JNDI context with {@link com.mockrunner.ejb.EJBTestModule#bindToContext}.
*/
public class ConnectorMockObjectFactory
{
private MockConnectionFactory connectionFactory;
private MockConnection connection;
private InteractionHandler interactionHandler;
public ConnectorMockObjectFactory()
{
connectionFactory = createMockConnectionFactory();
connection = createMockConnection();
connectionFactory.setConnection(connection);
interactionHandler = new InteractionHandler();
connection.setInteractionHandler(interactionHandler);
}
/**
* Creates the {@link com.mockrunner.mock.connector.cci.MockConnection} using new
.
* This method can be overridden to return a subclass of {@link com.mockrunner.mock.connector.cci.MockConnection}.
* @return the {@link com.mockrunner.mock.connector.cci.MockConnection}
*/
public MockConnection createMockConnection()
{
return new MockConnection();
}
/**
* Creates the {@link com.mockrunner.mock.connector.cci.MockConnectionFactory} using new
.
* This method can be overridden to return a subclass of {@link com.mockrunner.mock.connector.cci.MockConnectionFactory}.
* @return the {@link com.mockrunner.mock.connector.cci.MockConnectionFactory}
*/
public MockConnectionFactory createMockConnectionFactory()
{
return new MockConnectionFactory();
}
/**
* Returns the {@link com.mockrunner.mock.connector.cci.MockConnection}.
* @return the {@link com.mockrunner.mock.connector.cci.MockConnection}
*/
public MockConnection getMockConnection()
{
return connection;
}
/**
* Returns the {@link com.mockrunner.mock.connector.cci.MockConnectionFactory}.
* @return the {@link com.mockrunner.mock.connector.cci.MockConnectionFactory}
*/
public MockConnectionFactory getMockConnectionFactory()
{
return connectionFactory;
}
/**
* Returns the {@link com.mockrunner.connector.InteractionHandler}.
* @return the {@link com.mockrunner.connector.InteractionHandler}
*/
public InteractionHandler getInteractionHandler()
{
return interactionHandler;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy