public class MockDriver extends Object implements Driver, MockDriverMBean
| 限定符和类型 | 字段和说明 |
|---|---|
private AtomicLong |
connectCount |
private AtomicLong |
connectionCloseCount |
private AtomicLong |
connectionIdSeed |
private List<MockConnection> |
connections |
static MockExecuteHandler |
DEFAULT_HANDLER |
private MockExecuteHandler |
executeHandler |
private long |
idleTimeCount |
static MockDriver |
instance |
private static Log |
LOG |
private boolean |
logExecuteQueryEnable |
private static String |
MBEAN_NAME |
private String |
mockPrefix |
private String |
prefix |
| 构造器和说明 |
|---|
MockDriver() |
private static Log LOG
public static final MockExecuteHandler DEFAULT_HANDLER
private String prefix
private String mockPrefix
private MockExecuteHandler executeHandler
public static final MockDriver instance
private final AtomicLong connectCount
private final AtomicLong connectionCloseCount
private final AtomicLong connectionIdSeed
private final List<MockConnection> connections
private long idleTimeCount
private boolean logExecuteQueryEnable
public boolean isLogExecuteQueryEnable()
isLogExecuteQueryEnable 在接口中 MockDriverMBeanprivate static Log getLog()
public void setLogExecuteQueryEnable(boolean logExecuteQueryEnable)
setLogExecuteQueryEnable 在接口中 MockDriverMBeanpublic long getIdleTimeCount()
getIdleTimeCount 在接口中 MockDriverMBeanpublic void setIdleTimeCount(long idleTimeCount)
setIdleTimeCount 在接口中 MockDriverMBeanpublic long generateConnectionId()
public void closeAllConnections()
throws SQLException
closeAllConnections 在接口中 MockDriverMBeanSQLExceptionpublic int getConnectionsSize()
getConnectionsSize 在接口中 MockDriverMBeanpublic List<MockConnection> getConnections()
protected void incrementConnectionCloseCount()
public long getConnectionCloseCount()
getConnectionCloseCount 在接口中 MockDriverMBeanprotected void afterConnectionClose(MockConnection conn)
public static boolean registerDriver(Driver driver)
public MockExecuteHandler getExecuteHandler()
public void setExecuteHandler(MockExecuteHandler executeHandler)
public Connection connect(String url, Properties info) throws SQLException
connect 在接口中 DriverSQLExceptionpublic boolean acceptsURL(String url) throws SQLException
acceptsURL 在接口中 MockDriverMBeanacceptsURL 在接口中 DriverSQLExceptionpublic DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException
getPropertyInfo 在接口中 DriverSQLExceptionpublic int getMajorVersion()
getMajorVersion 在接口中 MockDriverMBeangetMajorVersion 在接口中 Driverpublic int getMinorVersion()
getMinorVersion 在接口中 MockDriverMBeangetMinorVersion 在接口中 Driverpublic boolean jdbcCompliant()
jdbcCompliant 在接口中 MockDriverMBeanjdbcCompliant 在接口中 Driverpublic MockResultSet createMockResultSet(MockStatementBase stmt)
public ResultSet executeQuery(MockStatementBase stmt, String sql) throws SQLException
SQLExceptionpublic void handleSleep(MockConnection conn)
public ResultSet createResultSet(MockPreparedStatement stmt)
protected Clob createClob(MockConnection conn) throws SQLException
SQLExceptionprotected Blob createBlob(MockConnection conn) throws SQLException
SQLExceptionprotected NClob createNClob(MockConnection conn) throws SQLException
SQLExceptionprotected SQLXML createSQLXML(MockConnection conn) throws SQLException
SQLExceptionpublic Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger 在接口中 DriverSQLFeatureNotSupportedExceptionpublic MockConnection createMockConnection(MockDriver driver, String url, Properties connectProperties)
public MockPreparedStatement createMockPreparedStatement(MockConnection conn, String sql)
public MockStatement createMockStatement(MockConnection conn)
public MockCallableStatement createMockCallableStatement(MockConnection conn, String sql)
Copyright © 2013–2019 Alibaba Group. All rights reserved.