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

com.mockrunner.mock.connector.cci.MockInteraction 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.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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy