com.mockrunner.mock.connector.cci.MockInteraction 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.connector.cci;
import javax.resource.ResourceException;
import javax.resource.cci.Connection;
import javax.resource.cci.Interaction;
import javax.resource.cci.InteractionSpec;
import javax.resource.cci.Record;
import javax.resource.cci.ResourceWarning;
/**
* Mock implementation of Interaction
.
* The execute
calls are delegated to
* {@link com.mockrunner.connector.InteractionHandler}.
*/
public class MockInteraction implements Interaction
{
private MockConnection mockConnection;
private boolean closed;
public MockInteraction(MockConnection mockConnection)
{
this.mockConnection = mockConnection;
closed = false;
}
public void clearWarnings() throws ResourceException
{
}
public void close() throws ResourceException
{
closed = true;
}
/**
* Calls {@link com.mockrunner.connector.InteractionHandler#execute(InteractionSpec, Record)}.
*/
public Record execute(InteractionSpec is, Record record) throws ResourceException
{
return mockConnection.getInteractionHandler().execute(is, record);
}
/**
* Calls {@link com.mockrunner.connector.InteractionHandler#execute(InteractionSpec, Record, Record)}.
*/
public boolean execute(InteractionSpec is, Record request, Record response) throws ResourceException
{
return mockConnection.getInteractionHandler().execute(is, request, response);
}
public Connection getConnection()
{
return mockConnection;
}
/**
* Returns if this Interaction
is closed.
* @return true
if this Interaction
is closed,
* false
otherwise
*/
public boolean isClosed()
{
return closed;
}
/**
* Returns null
, warnings not supported yet.
*/
public ResourceWarning getWarnings() throws ResourceException
{
return null;
}
}