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

com.mockrunner.mock.jdbc.MockDriver 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.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];
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy