com.mockrunner.mock.jdbc.MockDriver 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.jdbc;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.util.Properties;
/**
* Mock implementation of a JDBC Driver
.
*/
public class MockDriver implements Driver
{
private Connection connection;
public void setupConnection(Connection connection)
{
this.connection = connection;
}
public int getMajorVersion()
{
return 1;
}
public int getMinorVersion()
{
return 0;
}
public boolean jdbcCompliant()
{
return true;
}
public boolean acceptsURL(String url) throws SQLException
{
return true;
}
public Connection connect(String url, Properties info) throws SQLException
{
return connection;
}
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException
{
return new DriverPropertyInfo[0];
}
}