com.alibaba.druid.mock
Class MockDriver

java.lang.Object
  extended by com.alibaba.druid.mock.MockDriver
All Implemented Interfaces:
MockDriverMBean, Driver

public class MockDriver
extends Object
implements Driver, MockDriverMBean


Field Summary
static MockExecuteHandler DEFAULT_HANDLER
           
static MockDriver instance
           
 
Constructor Summary
MockDriver()
           
 
Method Summary
 boolean acceptsURL(String url)
           
 void closeAllConnections()
           
 Connection connect(String url, Properties info)
           
 MockCallableStatement createMockCallableStatement(MockConnection conn, String sql)
           
 MockConnection createMockConnection(MockDriver driver, String url, Properties connectProperties)
           
 MockPreparedStatement createMockPreparedStatement(MockConnection conn, String sql)
           
 MockStatement createMockStatement(MockConnection conn)
           
 ResultSet createResultSet(MockPreparedStatement stmt)
           
 ResultSet executeQuery(MockStatementBase stmt, String sql)
           
 long generateConnectionId()
           
 long getConnectionCloseCount()
           
 List<MockConnection> getConnections()
           
 int getConnectionsSize()
           
 MockExecuteHandler getExecuteHandler()
           
 long getIdleTimeCount()
           
 int getMajorVersion()
           
 int getMinorVersion()
           
 Logger getParentLogger()
           
 DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
           
 void handleSleep(MockConnection conn)
           
 boolean isLogExecuteQueryEnable()
           
 boolean jdbcCompliant()
           
static boolean registerDriver(Driver driver)
           
 void setExecuteHandler(MockExecuteHandler executeHandler)
           
 void setIdleTimeCount(long idleTimeCount)
           
 void setLogExecuteQueryEnable(boolean logExecuteQueryEnable)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_HANDLER

public static final MockExecuteHandler DEFAULT_HANDLER

instance

public static final MockDriver instance
Constructor Detail

MockDriver

public MockDriver()
Method Detail

isLogExecuteQueryEnable

public boolean isLogExecuteQueryEnable()
Specified by:
isLogExecuteQueryEnable in interface MockDriverMBean

setLogExecuteQueryEnable

public void setLogExecuteQueryEnable(boolean logExecuteQueryEnable)
Specified by:
setLogExecuteQueryEnable in interface MockDriverMBean

getIdleTimeCount

public long getIdleTimeCount()
Specified by:
getIdleTimeCount in interface MockDriverMBean

setIdleTimeCount

public void setIdleTimeCount(long idleTimeCount)
Specified by:
setIdleTimeCount in interface MockDriverMBean

generateConnectionId

public long generateConnectionId()

closeAllConnections

public void closeAllConnections()
                         throws SQLException
Specified by:
closeAllConnections in interface MockDriverMBean
Throws:
SQLException

getConnectionsSize

public int getConnectionsSize()
Specified by:
getConnectionsSize in interface MockDriverMBean

getConnections

public List<MockConnection> getConnections()

getConnectionCloseCount

public long getConnectionCloseCount()
Specified by:
getConnectionCloseCount in interface MockDriverMBean

registerDriver

public static boolean registerDriver(Driver driver)

getExecuteHandler

public MockExecuteHandler getExecuteHandler()

setExecuteHandler

public void setExecuteHandler(MockExecuteHandler executeHandler)

connect

public Connection connect(String url,
                          Properties info)
                   throws SQLException
Specified by:
connect in interface Driver
Throws:
SQLException

acceptsURL

public boolean acceptsURL(String url)
                   throws SQLException
Specified by:
acceptsURL in interface MockDriverMBean
Specified by:
acceptsURL in interface Driver
Throws:
SQLException

getPropertyInfo

public DriverPropertyInfo[] getPropertyInfo(String url,
                                            Properties info)
                                     throws SQLException
Specified by:
getPropertyInfo in interface Driver
Throws:
SQLException

getMajorVersion

public int getMajorVersion()
Specified by:
getMajorVersion in interface MockDriverMBean
Specified by:
getMajorVersion in interface Driver

getMinorVersion

public int getMinorVersion()
Specified by:
getMinorVersion in interface MockDriverMBean
Specified by:
getMinorVersion in interface Driver

jdbcCompliant

public boolean jdbcCompliant()
Specified by:
jdbcCompliant in interface MockDriverMBean
Specified by:
jdbcCompliant in interface Driver

executeQuery

public ResultSet executeQuery(MockStatementBase stmt,
                              String sql)
                       throws SQLException
Throws:
SQLException

handleSleep

public void handleSleep(MockConnection conn)

createResultSet

public ResultSet createResultSet(MockPreparedStatement stmt)

getParentLogger

public Logger getParentLogger()
                       throws SQLFeatureNotSupportedException
Throws:
SQLFeatureNotSupportedException

createMockConnection

public MockConnection createMockConnection(MockDriver driver,
                                           String url,
                                           Properties connectProperties)

createMockPreparedStatement

public MockPreparedStatement createMockPreparedStatement(MockConnection conn,
                                                         String sql)

createMockStatement

public MockStatement createMockStatement(MockConnection conn)

createMockCallableStatement

public MockCallableStatement createMockCallableStatement(MockConnection conn,
                                                         String sql)


Copyright © 2012 Alibaba Group. All Rights Reserved.