com.github.smokestack.jdbc
Class MockConnection
java.lang.Object
com.github.smokestack.jdbc.MockConnection
- All Implemented Interfaces:
- Connection
public class MockConnection
- extends Object
- implements Connection
- Author:
- gliptak
Method Summary |
void |
_close()
|
void |
_commit()
|
MockStatement |
_createStatement()
|
MockStatement |
_createStatement(int resultSetType,
int resultSetConcurrency)
|
MockStatement |
_createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
|
boolean |
_getAutoCommit()
|
String |
_getCatalog()
|
int |
_getHoldability()
|
SQLWarning |
_getWarnings()
|
boolean |
_isClosed()
|
boolean |
_isReadOnly()
|
String |
_nativeSQL(String sql)
|
MockPreparedStatement |
_prepareStatement(String sql)
|
MockPreparedStatement |
_prepareStatement(String sql,
int autoGeneratedKeys)
|
MockPreparedStatement |
_prepareStatement(String sql,
int[] columnIndexes)
|
MockPreparedStatement |
_prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency)
|
MockPreparedStatement |
_prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
|
MockPreparedStatement |
_prepareStatement(String sql,
String[] columnNames)
|
void |
_rollback()
|
void |
_rollback(Savepoint savepoint)
|
void |
_setAutoCommit(boolean autoCommit)
|
void |
_setCatalog(String catalog)
|
void |
_setHoldability(int holdability)
|
void |
_setReadOnly(boolean readOnly)
|
void |
_setTransactionIsolation(int level)
|
void |
assertAutoCommit()
Validation |
void |
assertAutoRollback()
Validation |
void |
assertClosed()
Validation
How do you know the order to be validated? Conn closed first, then stmts? |
void |
assertExplicitClose()
Validation
How do you know the order to be validated? Conn closed first, then stmts? |
void |
assertExplicitCommit()
Validation |
void |
assertExplicitRollback()
Validation |
void |
clearWarnings()
|
void |
close()
|
void |
commit()
|
protected void |
completeOtherStatements(MockStatement st)
|
Statement |
createStatement()
|
Statement |
createStatement(int resultSetType,
int resultSetConcurrency)
|
Statement |
createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
|
boolean |
getAutoCommit()
|
String |
getCatalog()
|
int |
getHoldability()
|
Properties |
getInfo()
|
DatabaseMetaData |
getMetaData()
|
protected MockConnection.ConnectionState |
getMockConnectionState()
|
protected List<MockStatement> |
getMockStatements()
|
protected MockConnection.TransactionState |
getMockTransactionState()
|
int |
getTransactionIsolation()
|
Map<String,Class<?>> |
getTypeMap()
|
String |
getUrl()
|
SQLWarning |
getWarnings()
|
boolean |
isClosed()
|
boolean |
isReadOnly()
|
String |
nativeSQL(String sql)
|
CallableStatement |
prepareCall(String sql)
|
CallableStatement |
prepareCall(String sql,
int resultSetType,
int resultSetConcurrency)
|
CallableStatement |
prepareCall(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
|
PreparedStatement |
prepareStatement(String sql)
|
PreparedStatement |
prepareStatement(String sql,
int autoGeneratedKeys)
|
PreparedStatement |
prepareStatement(String sql,
int[] columnIndexes)
|
PreparedStatement |
prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency)
|
PreparedStatement |
prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
|
PreparedStatement |
prepareStatement(String sql,
String[] columnNames)
|
void |
releaseSavepoint(Savepoint savepoint)
|
void |
rollback()
|
void |
rollback(Savepoint savepoint)
|
void |
setAutoCommit(boolean autoCommit)
|
void |
setCatalog(String catalog)
|
void |
setHoldability(int holdability)
|
void |
setReadOnly(boolean readOnly)
|
Savepoint |
setSavepoint()
|
Savepoint |
setSavepoint(String name)
|
void |
setTransactionIsolation(int level)
|
void |
setTypeMap(Map<String,Class<?>> map)
|
String |
toString()
|
mockConnectionState
protected MockConnection.ConnectionState mockConnectionState
autoCommitState
protected MockConnection.AutoCommitState autoCommitState
mockTransactionState
public MockConnection.TransactionState mockTransactionState
MockConnection
public MockConnection(String url,
Properties info)
MockConnection
public MockConnection()
clearWarnings
public void clearWarnings()
throws SQLException
- Specified by:
clearWarnings
in interface Connection
- Throws:
SQLException
close
public void close()
throws SQLException
- Specified by:
close
in interface Connection
- Throws:
SQLException
_close
public void _close()
commit
public void commit()
throws SQLException
- Specified by:
commit
in interface Connection
- Throws:
SQLException
_commit
public void _commit()
throws SQLException
- Throws:
SQLException
createStatement
public Statement createStatement()
throws SQLException
- Specified by:
createStatement
in interface Connection
- Throws:
SQLException
_createStatement
public MockStatement _createStatement()
throws SQLException
- Throws:
SQLException
createStatement
public Statement createStatement(int resultSetType,
int resultSetConcurrency)
throws SQLException
- Specified by:
createStatement
in interface Connection
- Throws:
SQLException
_createStatement
public MockStatement _createStatement(int resultSetType,
int resultSetConcurrency)
throws SQLException
- Throws:
SQLException
createStatement
public Statement createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws SQLException
- Specified by:
createStatement
in interface Connection
- Throws:
SQLException
_createStatement
public MockStatement _createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws SQLException
- Throws:
SQLException
getAutoCommit
public boolean getAutoCommit()
throws SQLException
- Specified by:
getAutoCommit
in interface Connection
- Throws:
SQLException
_getAutoCommit
public boolean _getAutoCommit()
throws SQLException
- Throws:
SQLException
getCatalog
public String getCatalog()
throws SQLException
- Specified by:
getCatalog
in interface Connection
- Throws:
SQLException
_getCatalog
public String _getCatalog()
throws SQLException
- Throws:
SQLException
getHoldability
public int getHoldability()
throws SQLException
- Specified by:
getHoldability
in interface Connection
- Throws:
SQLException
_getHoldability
public int _getHoldability()
throws SQLException
- Throws:
SQLException
getMetaData
public DatabaseMetaData getMetaData()
throws SQLException
- Specified by:
getMetaData
in interface Connection
- Throws:
SQLException
getTransactionIsolation
public int getTransactionIsolation()
throws SQLException
- Specified by:
getTransactionIsolation
in interface Connection
- Throws:
SQLException
getTypeMap
public Map<String,Class<?>> getTypeMap()
throws SQLException
- Specified by:
getTypeMap
in interface Connection
- Throws:
SQLException
getWarnings
public SQLWarning getWarnings()
throws SQLException
- Specified by:
getWarnings
in interface Connection
- Throws:
SQLException
_getWarnings
public SQLWarning _getWarnings()
throws SQLException
- Throws:
SQLException
isClosed
public boolean isClosed()
throws SQLException
- Specified by:
isClosed
in interface Connection
- Throws:
SQLException
_isClosed
public boolean _isClosed()
throws SQLException
- Throws:
SQLException
isReadOnly
public boolean isReadOnly()
throws SQLException
- Specified by:
isReadOnly
in interface Connection
- Throws:
SQLException
_isReadOnly
public boolean _isReadOnly()
throws SQLException
- Throws:
SQLException
nativeSQL
public String nativeSQL(String sql)
throws SQLException
- Specified by:
nativeSQL
in interface Connection
- Throws:
SQLException
_nativeSQL
public String _nativeSQL(String sql)
throws SQLException
- Throws:
SQLException
prepareCall
public CallableStatement prepareCall(String sql)
throws SQLException
- Specified by:
prepareCall
in interface Connection
- Throws:
SQLException
prepareCall
public CallableStatement prepareCall(String sql,
int resultSetType,
int resultSetConcurrency)
throws SQLException
- Specified by:
prepareCall
in interface Connection
- Throws:
SQLException
prepareCall
public CallableStatement prepareCall(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws SQLException
- Specified by:
prepareCall
in interface Connection
- Throws:
SQLException
prepareStatement
public PreparedStatement prepareStatement(String sql)
throws SQLException
- Specified by:
prepareStatement
in interface Connection
- Throws:
SQLException
_prepareStatement
public MockPreparedStatement _prepareStatement(String sql)
throws SQLException
- Throws:
SQLException
prepareStatement
public PreparedStatement prepareStatement(String sql,
int autoGeneratedKeys)
throws SQLException
- Specified by:
prepareStatement
in interface Connection
- Throws:
SQLException
_prepareStatement
public MockPreparedStatement _prepareStatement(String sql,
int autoGeneratedKeys)
throws SQLException
- Throws:
SQLException
prepareStatement
public PreparedStatement prepareStatement(String sql,
int[] columnIndexes)
throws SQLException
- Specified by:
prepareStatement
in interface Connection
- Throws:
SQLException
_prepareStatement
public MockPreparedStatement _prepareStatement(String sql,
int[] columnIndexes)
throws SQLException
- Throws:
SQLException
prepareStatement
public PreparedStatement prepareStatement(String sql,
String[] columnNames)
throws SQLException
- Specified by:
prepareStatement
in interface Connection
- Throws:
SQLException
_prepareStatement
public MockPreparedStatement _prepareStatement(String sql,
String[] columnNames)
throws SQLException
- Throws:
SQLException
prepareStatement
public PreparedStatement prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency)
throws SQLException
- Specified by:
prepareStatement
in interface Connection
- Throws:
SQLException
_prepareStatement
public MockPreparedStatement _prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency)
throws SQLException
- Throws:
SQLException
prepareStatement
public PreparedStatement prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws SQLException
- Specified by:
prepareStatement
in interface Connection
- Throws:
SQLException
_prepareStatement
public MockPreparedStatement _prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws SQLException
- Throws:
SQLException
releaseSavepoint
public void releaseSavepoint(Savepoint savepoint)
throws SQLException
- Specified by:
releaseSavepoint
in interface Connection
- Throws:
SQLException
rollback
public void rollback()
throws SQLException
- Specified by:
rollback
in interface Connection
- Throws:
SQLException
_rollback
public void _rollback()
throws SQLException
- Throws:
SQLException
rollback
public void rollback(Savepoint savepoint)
throws SQLException
- Specified by:
rollback
in interface Connection
- Throws:
SQLException
_rollback
public void _rollback(Savepoint savepoint)
throws SQLException
- Throws:
SQLException
setAutoCommit
public void setAutoCommit(boolean autoCommit)
throws SQLException
- Specified by:
setAutoCommit
in interface Connection
- Throws:
SQLException
_setAutoCommit
public void _setAutoCommit(boolean autoCommit)
throws SQLException
- Throws:
SQLException
setCatalog
public void setCatalog(String catalog)
throws SQLException
- Specified by:
setCatalog
in interface Connection
- Throws:
SQLException
_setCatalog
public void _setCatalog(String catalog)
throws SQLException
- Throws:
SQLException
setHoldability
public void setHoldability(int holdability)
throws SQLException
- Specified by:
setHoldability
in interface Connection
- Throws:
SQLException
_setHoldability
public void _setHoldability(int holdability)
throws SQLException
- Throws:
SQLException
setReadOnly
public void setReadOnly(boolean readOnly)
throws SQLException
- Specified by:
setReadOnly
in interface Connection
- Throws:
SQLException
_setReadOnly
public void _setReadOnly(boolean readOnly)
throws SQLException
- Throws:
SQLException
setSavepoint
public Savepoint setSavepoint()
throws SQLException
- Specified by:
setSavepoint
in interface Connection
- Throws:
SQLException
setSavepoint
public Savepoint setSavepoint(String name)
throws SQLException
- Specified by:
setSavepoint
in interface Connection
- Throws:
SQLException
setTransactionIsolation
public void setTransactionIsolation(int level)
throws SQLException
- Specified by:
setTransactionIsolation
in interface Connection
- Throws:
SQLException
_setTransactionIsolation
public void _setTransactionIsolation(int level)
setTypeMap
public void setTypeMap(Map<String,Class<?>> map)
throws SQLException
- Specified by:
setTypeMap
in interface Connection
- Throws:
SQLException
getUrl
public String getUrl()
- Returns:
- the url
getInfo
public Properties getInfo()
- Returns:
- the info
assertExplicitClose
public void assertExplicitClose()
- Validation
How do you know the order to be validated? Conn closed first, then stmts?
assertClosed
public void assertClosed()
- Validation
How do you know the order to be validated? Conn closed first, then stmts?
assertExplicitCommit
public void assertExplicitCommit()
- Validation
assertAutoCommit
public void assertAutoCommit()
- Validation
assertExplicitRollback
public void assertExplicitRollback()
- Validation
assertAutoRollback
public void assertAutoRollback()
- Validation
getMockStatements
protected List<MockStatement> getMockStatements()
- Returns:
- the mockStatements
getMockConnectionState
protected MockConnection.ConnectionState getMockConnectionState()
- Returns:
- the mockConnectionState
getMockTransactionState
protected MockConnection.TransactionState getMockTransactionState()
- Returns:
- the mockTransactionState
completeOtherStatements
protected void completeOtherStatements(MockStatement st)
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2009-2010 Smokestack. All Rights Reserved.