Package com.alibaba.druid.mock
Class MockDriver
- java.lang.Object
-
- com.alibaba.druid.mock.MockDriver
-
- All Implemented Interfaces:
MockDriverMBean,Driver
public class MockDriver extends Object implements Driver, MockDriverMBean
-
-
Field Summary
Fields Modifier and Type Field Description static MockExecuteHandlerDEFAULT_HANDLERstatic MockDriverinstance
-
Constructor Summary
Constructors Constructor Description MockDriver()
-
Method Summary
-
-
-
Field Detail
-
DEFAULT_HANDLER
public static final MockExecuteHandler DEFAULT_HANDLER
-
instance
public static final MockDriver instance
-
-
Method Detail
-
isLogExecuteQueryEnable
public boolean isLogExecuteQueryEnable()
- Specified by:
isLogExecuteQueryEnablein interfaceMockDriverMBean
-
setLogExecuteQueryEnable
public void setLogExecuteQueryEnable(boolean logExecuteQueryEnable)
- Specified by:
setLogExecuteQueryEnablein interfaceMockDriverMBean
-
getIdleTimeCount
public long getIdleTimeCount()
- Specified by:
getIdleTimeCountin interfaceMockDriverMBean
-
setIdleTimeCount
public void setIdleTimeCount(long idleTimeCount)
- Specified by:
setIdleTimeCountin interfaceMockDriverMBean
-
generateConnectionId
public long generateConnectionId()
-
closeAllConnections
public void closeAllConnections() throws SQLException- Specified by:
closeAllConnectionsin interfaceMockDriverMBean- Throws:
SQLException
-
getConnectionsSize
public int getConnectionsSize()
- Specified by:
getConnectionsSizein interfaceMockDriverMBean
-
getConnections
public List<MockConnection> getConnections()
-
incrementConnectionCloseCount
protected void incrementConnectionCloseCount()
-
getConnectionCloseCount
public long getConnectionCloseCount()
- Specified by:
getConnectionCloseCountin interfaceMockDriverMBean
-
afterConnectionClose
protected void afterConnectionClose(MockConnection conn)
-
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:
connectin interfaceDriver- Throws:
SQLException
-
acceptsURL
public boolean acceptsURL(String url) throws SQLException
- Specified by:
acceptsURLin interfaceDriver- Specified by:
acceptsURLin interfaceMockDriverMBean- Throws:
SQLException
-
getPropertyInfo
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException
- Specified by:
getPropertyInfoin interfaceDriver- Throws:
SQLException
-
getMajorVersion
public int getMajorVersion()
- Specified by:
getMajorVersionin interfaceDriver- Specified by:
getMajorVersionin interfaceMockDriverMBean
-
getMinorVersion
public int getMinorVersion()
- Specified by:
getMinorVersionin interfaceDriver- Specified by:
getMinorVersionin interfaceMockDriverMBean
-
jdbcCompliant
public boolean jdbcCompliant()
- Specified by:
jdbcCompliantin interfaceDriver- Specified by:
jdbcCompliantin interfaceMockDriverMBean
-
createMockResultSet
public MockResultSet createMockResultSet(MockStatementBase stmt)
-
executeQuery
public ResultSet executeQuery(MockStatementBase stmt, String sql) throws SQLException
- Throws:
SQLException
-
handleSleep
public void handleSleep(MockConnection conn)
-
createResultSet
public ResultSet createResultSet(MockPreparedStatement stmt)
-
createClob
protected Clob createClob(MockConnection conn) throws SQLException
- Throws:
SQLException
-
createBlob
protected Blob createBlob(MockConnection conn) throws SQLException
- Throws:
SQLException
-
createNClob
protected NClob createNClob(MockConnection conn) throws SQLException
- Throws:
SQLException
-
createSQLXML
protected SQLXML createSQLXML(MockConnection conn) throws SQLException
- Throws:
SQLException
-
getParentLogger
public Logger getParentLogger() throws SQLFeatureNotSupportedException
- Specified by:
getParentLoggerin interfaceDriver- 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)
-
-