001 package com.mockrunner.mock.jdbc; 002 003 import java.sql.Connection; 004 import java.sql.Driver; 005 import java.sql.DriverPropertyInfo; 006 import java.sql.SQLException; 007 import java.util.Properties; 008 009 /** 010 * Mock implementation of a JDBC <code>Driver</code>. 011 */ 012 public class MockDriver implements Driver 013 { 014 private Connection connection; 015 016 public void setupConnection(Connection connection) 017 { 018 this.connection = connection; 019 } 020 021 public int getMajorVersion() 022 { 023 return 1; 024 } 025 026 public int getMinorVersion() 027 { 028 return 0; 029 } 030 031 public boolean jdbcCompliant() 032 { 033 return true; 034 } 035 036 public boolean acceptsURL(String url) throws SQLException 037 { 038 return true; 039 } 040 041 public Connection connect(String url, Properties info) throws SQLException 042 { 043 return connection; 044 } 045 046 public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException 047 { 048 return new DriverPropertyInfo[0]; 049 } 050 }