|
|||||||||
| Home >> All >> com >> mockobjects >> [ sql overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.mockobjects.sql
Class CommonMockConnection

java.lang.Objectcom.mockobjects.MockObject
com.mockobjects.sql.CommonMockConnection
- All Implemented Interfaces:
- java.sql.Connection, com.mockobjects.Verifiable
- Direct Known Subclasses:
- CommonMockConnection2, MockConnection
- abstract class CommonMockConnection
- extends com.mockobjects.MockObject
- implements java.sql.Connection
- extends com.mockobjects.MockObject
| Field Summary | |
private boolean |
autoCommit
|
private com.mockobjects.ExpectationList |
myAutoCommit
|
private com.mockobjects.ExpectationCounter |
myCloseCalls
|
private java.sql.SQLException |
myCloseException
|
private com.mockobjects.ExpectationCounter |
myCommitCalls
|
private com.mockobjects.ExpectationCounter |
myCreateStatementCalls
|
private boolean |
myIsClosed
|
private java.sql.SQLException |
myIsClosedException
|
private java.sql.DatabaseMetaData |
myMetaData
|
private com.mockobjects.ReturnObjectList |
myPreparedStatements
Deprecated. |
private com.mockobjects.ExpectationCollection |
myPreparedStatementStrings
Deprecated. use myPreparedStatementsBag |
private com.mockobjects.ExpectationValue |
myResultSetConcurrency
|
private com.mockobjects.ExpectationValue |
myResultSetType
|
private com.mockobjects.ExpectationCounter |
myRollbackCalls
|
private java.sql.Statement |
myStatement
|
private java.sql.SQLException |
myStatementException
|
| Fields inherited from interface java.sql.Connection |
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
| Constructor Summary | |
CommonMockConnection()
|
|
CommonMockConnection(java.lang.String name)
|
|
| Method Summary | |
void |
addExpectedAutoCommit(boolean autoCommit)
Register the anticipated value for autoCommit during testing. |
void |
addExpectedPreparedStatementString(java.lang.String sql)
Deprecated. Add an SQL string to use with a prepared staement. |
void |
clearWarnings()
Calls notImplemented. |
void |
close()
Will throw the CloseException if it has been set, or otherwise increment the number or close calls. |
void |
commit()
Increments the number of commit calls. |
java.sql.Statement |
createStatement()
Will throw either of the statement exceptions if one has been set, or otherwise return the Statement passed to setupStatement. |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency)
Calls notImplemented. |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
This method creates a new SQL statement with the specified type, concurrency and holdability, instead of using the defaults. |
boolean |
getAutoCommit()
This method tests whether or not auto commit mode is currently enabled. |
java.lang.String |
getCatalog()
Calls notImplemented. |
int |
getHoldability()
Gets the default holdability of ResultSetS that are created
from StatementS using this Connection. |
java.sql.DatabaseMetaData |
getMetaData()
Returns the DatabaseMetaData instance passed to setupMetaData. |
int |
getTransactionIsolation()
Calls notImplemented. |
java.util.Map |
getTypeMap()
Calls notImplemented. |
java.sql.SQLWarning |
getWarnings()
Calls notImplemented. |
boolean |
isClosed()
Throw the isClosedException if it has been set, or otherwise return the value passed to setupIsClosed. |
boolean |
isReadOnly()
Calls notImplemented. |
java.lang.String |
nativeSQL(java.lang.String sql)
Calls notImplemented. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql)
Calls notImplemented. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
Calls notImplemented. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
This method creates a new CallableStatement for the
specified SQL string. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
Throws a statement exception if one has been registered (@see throwStatementExceptionIfAny) or returns the next PreparedStatement instance passed to setupAddPreparedStatement. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int autoGeneratedKeys)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int[] columnIndexes)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
Calls notImplemented. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
This method creates a new PreparedStatement for the specified
SQL string. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
java.lang.String[] columnNames)
|
void |
rollback()
Increments the number of roll back calls. |
void |
setAutoCommit(boolean autoCommit)
Stores the value passed for comparison with the value passed to setupAutoCommit. |
void |
setCatalog(java.lang.String catalog)
Calls notImplemented. |
void |
setExpectedCloseCalls(int callCount)
Register the number of close calls the test should make. |
void |
setExpectedCommitCalls(int callCount)
Register the number of commit calls the test should make. |
void |
setExpectedCreateStatementCalls(int calls)
Register the number of create statement calls the test should make. |
void |
setExpectedResultSetConcurrency(int resultSetConcurrency)
Sets expectations about the possible value of the resultSetConcurrency parameter of
createStatement() 55 calls. |
void |
setExpectedResultSetType(int resultSetType)
Sets expectations about the possible value of the resultSetType parameter of
createStatement() 55 calls. |
void |
setExpectedRollbackCalls(int callCount)
Register the number of roll back calls the test should make. |
void |
setHoldability(int holdability)
Sets the default holdability of ResultSetS that are created
from StatementS using this Connection. |
void |
setReadOnly(boolean readOnly)
Calls notImplemented. |
void |
setTransactionIsolation(int level)
Calls notImplemented. |
void |
setTypeMap(java.util.Map map)
Calls notImplemented. |
void |
setupAddPreparedStatement(java.sql.PreparedStatement prepared)
Deprecated. Adds a PreparedStatement to be return by prepareStatement |
void |
setupAutoCommit(boolean autoCommitToReturn)
|
void |
setupCloseException(java.sql.SQLException aCloseException)
Pass the SQL exception to throw if close is called during a test. |
void |
setupIsClose(boolean aIsClosed)
Deprecated. Use setupIsClosed |
void |
setupIsClosed(boolean aIsClosed)
Pass the value to return if isClosed is called during a test. |
void |
setupIsClosedException(java.sql.SQLException aIsClosedException)
Pass the SQL exception instance to throw if isClosed is called during a test. |
void |
setupMetaData(java.sql.DatabaseMetaData metaData)
Pass the DataBaseMetaData instance for use with tests. |
void |
setupStatement(java.sql.Statement statement)
Pass the Statement instance for use with tests. |
void |
setupThrowExceptionOnPrepareOrCreate(java.sql.SQLException exception)
Pass the SQL exception to throw if preparedStatement or createStatement is called during a test. |
(package private) void |
throwStatementExceptionIfAny()
Throw the Statement instance passed to setupThrowExceptionOnPrepareOrCreate, if any. |
| Methods inherited from class com.mockobjects.MockObject |
assertEquals, assertEquals, assertTrue, fail, notImplemented, notYetImplemented, notYetImplemented, verify |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.sql.Connection |
releaseSavepoint, rollback, setSavepoint, setSavepoint |
| Field Detail |
autoCommit
private boolean autoCommit
myResultSetConcurrency
private final com.mockobjects.ExpectationValue myResultSetConcurrency
myResultSetType
private final com.mockobjects.ExpectationValue myResultSetType
myAutoCommit
private final com.mockobjects.ExpectationList myAutoCommit
myCloseCalls
private final com.mockobjects.ExpectationCounter myCloseCalls
myCommitCalls
private final com.mockobjects.ExpectationCounter myCommitCalls
myCreateStatementCalls
private final com.mockobjects.ExpectationCounter myCreateStatementCalls
myIsClosed
private boolean myIsClosed
myCloseException
private java.sql.SQLException myCloseException
myIsClosedException
private java.sql.SQLException myIsClosedException
myMetaData
private java.sql.DatabaseMetaData myMetaData
myPreparedStatements
private final com.mockobjects.ReturnObjectList myPreparedStatements
- Deprecated.
- See Also:
- CommonMockConnection2
myPreparedStatementStrings
private final com.mockobjects.ExpectationCollection myPreparedStatementStrings
- Deprecated. use myPreparedStatementsBag
- See Also:
- CommonMockConnection2
myRollbackCalls
private final com.mockobjects.ExpectationCounter myRollbackCalls
myStatement
private java.sql.Statement myStatement
myStatementException
private java.sql.SQLException myStatementException
| Constructor Detail |
CommonMockConnection
public CommonMockConnection()
CommonMockConnection
public CommonMockConnection(java.lang.String name)
| Method Detail |
addExpectedPreparedStatementString
public void addExpectedPreparedStatementString(java.lang.String sql)
- Deprecated. Add an SQL string to use with a prepared staement.
addExpectedAutoCommit
public void addExpectedAutoCommit(boolean autoCommit)
- Register the anticipated value for autoCommit during testing.
setExpectedCloseCalls
public void setExpectedCloseCalls(int callCount)
- Register the number of close calls the test should make.
The valid method will report any discrepancy with the
actual count.
setExpectedCommitCalls
public void setExpectedCommitCalls(int callCount)
- Register the number of commit calls the test should make.
The valid method will report any discrepancy with the
actual count.
setExpectedCreateStatementCalls
public void setExpectedCreateStatementCalls(int calls)
- Register the number of create statement calls the test should make.
The valid method will report any discrepancy with the
actual count.
setExpectedRollbackCalls
public void setExpectedRollbackCalls(int callCount)
- Register the number of roll back calls the test should make.
The valid method will report any discrepancy with the
actual count.
setExpectedResultSetConcurrency
public void setExpectedResultSetConcurrency(int resultSetConcurrency)
- Sets expectations about the possible value of the
resultSetConcurrencyparameter of createStatement() 55 calls.
setExpectedResultSetType
public void setExpectedResultSetType(int resultSetType)
- Sets expectations about the possible value of the
resultSetTypeparameter of createStatement() 55 calls.
setupAddPreparedStatement
public void setupAddPreparedStatement(java.sql.PreparedStatement prepared)
- Deprecated. Adds a PreparedStatement to be return by prepareStatement
setupCloseException
public void setupCloseException(java.sql.SQLException aCloseException)
- Pass the SQL exception to throw if close is called
during a test.
setupIsClose
public void setupIsClose(boolean aIsClosed)
- Deprecated. Use setupIsClosed
setupIsClosed
public void setupIsClosed(boolean aIsClosed)
- Pass the value to return if isClosed is called during a test.
This is returned unless an isClosedException has been set.
setupIsClosedException
public void setupIsClosedException(java.sql.SQLException aIsClosedException)
- Pass the SQL exception instance to throw if isClosed
is called during a test.
setupMetaData
public void setupMetaData(java.sql.DatabaseMetaData metaData)
- Pass the DataBaseMetaData instance for use with tests.
setupStatement
public void setupStatement(java.sql.Statement statement)
- Pass the Statement instance for use with tests.
setupThrowExceptionOnPrepareOrCreate
public void setupThrowExceptionOnPrepareOrCreate(java.sql.SQLException exception)
- Pass the SQL exception to throw if preparedStatement or createStatement
is called during a test.
setupAutoCommit
public void setupAutoCommit(boolean autoCommitToReturn)
throwStatementExceptionIfAny
void throwStatementExceptionIfAny()
throws java.sql.SQLException
- Throw the Statement instance passed to
setupThrowExceptionOnPrepareOrCreate, if any.
close
public void close()
throws java.sql.SQLException
- Will throw the CloseException if it has been set,
or otherwise increment the number or close calls.
- Specified by:
closein interfacejava.sql.Connection
commit
public void commit()
throws java.sql.SQLException
- Increments the number of commit calls.
- Specified by:
commitin interfacejava.sql.Connection
createStatement
public java.sql.Statement createStatement() throws java.sql.SQLException
- Will throw either of the statement exceptions if one has been
set,
or otherwise return the Statement passed to
setupStatement.
- Specified by:
createStatementin interfacejava.sql.Connection
getMetaData
public java.sql.DatabaseMetaData getMetaData() throws java.sql.SQLException
- Returns the DatabaseMetaData instance passed to setupMetaData.
- Specified by:
getMetaDatain interfacejava.sql.Connection
isClosed
public boolean isClosed()
throws java.sql.SQLException
- Throw the isClosedException if it has been set,
or otherwise return the value passed to setupIsClosed.
- Specified by:
isClosedin interfacejava.sql.Connection
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException
- Throws a statement exception if one has been registered
(@see throwStatementExceptionIfAny)
or returns the next PreparedStatement instance passed to
setupAddPreparedStatement.
- Specified by:
prepareStatementin interfacejava.sql.Connection
rollback
public void rollback()
throws java.sql.SQLException
- Increments the number of roll back calls.
- Specified by:
rollbackin interfacejava.sql.Connection
setAutoCommit
public void setAutoCommit(boolean autoCommit)
throws java.sql.SQLException
- Stores the value passed for comparison with the value passed
to setupAutoCommit.
The validate method will report any discrepency.
- Specified by:
setAutoCommitin interfacejava.sql.Connection
clearWarnings
public void clearWarnings()
throws java.sql.SQLException
- Calls notImplemented.
- Specified by:
clearWarningsin interfacejava.sql.Connection
createStatement
public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
- Calls notImplemented. Returns null.
- Specified by:
createStatementin interfacejava.sql.Connection
getAutoCommit
public boolean getAutoCommit()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Connection - This method tests whether or not auto commit mode is currently enabled.
In auto commit mode, every SQL statement is committed its own transaction.
Otherwise a transaction must be explicitly committed or rolled back.
- Specified by:
getAutoCommitin interfacejava.sql.Connection
getCatalog
public java.lang.String getCatalog() throws java.sql.SQLException
- Calls notImplemented. Returns null.
- Specified by:
getCatalogin interfacejava.sql.Connection
getTransactionIsolation
public int getTransactionIsolation()
throws java.sql.SQLException
- Calls notImplemented. Returns 0.
- Specified by:
getTransactionIsolationin interfacejava.sql.Connection
getTypeMap
public java.util.Map getTypeMap() throws java.sql.SQLException
- Calls notImplemented. Returns null.
- Specified by:
getTypeMapin interfacejava.sql.Connection
getWarnings
public java.sql.SQLWarning getWarnings() throws java.sql.SQLException
- Calls notImplemented. Returns null.
- Specified by:
getWarningsin interfacejava.sql.Connection
isReadOnly
public boolean isReadOnly()
throws java.sql.SQLException
- Calls notImplemented. Returns false.
- Specified by:
isReadOnlyin interfacejava.sql.Connection
nativeSQL
public java.lang.String nativeSQL(java.lang.String sql) throws java.sql.SQLException
- Calls notImplemented. Returns null.
- Specified by:
nativeSQLin interfacejava.sql.Connection
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql) throws java.sql.SQLException
- Calls notImplemented. Returns null.
- Specified by:
prepareCallin interfacejava.sql.Connection
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
- Calls notImplemented. Returns null.
- Specified by:
prepareCallin interfacejava.sql.Connection
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
- Calls notImplemented. Returns null.
- Specified by:
prepareStatementin interfacejava.sql.Connection
setCatalog
public void setCatalog(java.lang.String catalog) throws java.sql.SQLException
- Calls notImplemented.
- Specified by:
setCatalogin interfacejava.sql.Connection
setReadOnly
public void setReadOnly(boolean readOnly)
throws java.sql.SQLException
- Calls notImplemented.
- Specified by:
setReadOnlyin interfacejava.sql.Connection
setTransactionIsolation
public void setTransactionIsolation(int level)
throws java.sql.SQLException
- Calls notImplemented.
- Specified by:
setTransactionIsolationin interfacejava.sql.Connection
setTypeMap
public void setTypeMap(java.util.Map map) throws java.sql.SQLException
- Calls notImplemented.
- Specified by:
setTypeMapin interfacejava.sql.Connection
setHoldability
public void setHoldability(int holdability)
throws java.sql.SQLException
- Description copied from interface:
java.sql.Connection - Sets the default holdability of
ResultSetS that are created fromStatementS using thisConnection.- Specified by:
setHoldabilityin interfacejava.sql.Connection
getHoldability
public int getHoldability()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Connection - Gets the default holdability of
ResultSetS that are created fromStatementS using thisConnection.- Specified by:
getHoldabilityin interfacejava.sql.Connection
createStatement
public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
- Description copied from interface:
java.sql.Connection - This method creates a new SQL statement with the specified type,
concurrency and holdability, instead of using the defaults. Valid values
for these parameters are specified in the
ResultSetclass.- Specified by:
createStatementin interfacejava.sql.Connection
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
- Description copied from interface:
java.sql.Connection - This method creates a new
PreparedStatementfor the specified SQL string. This method is designed for use with parameterized statements. The specified result set type, concurrency and holdability will be used. Valid values for these parameters are specified in theResultSetclass.- Specified by:
prepareStatementin interfacejava.sql.Connection
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
- Description copied from interface:
java.sql.Connection - This method creates a new
CallableStatementfor the specified SQL string. Thie method is designed to be used with stored procedures. The specified result set type, concurrency and holdability will be used. Valid values for these parameters are specified in theResultSetclass.- Specified by:
prepareCallin interfacejava.sql.Connection
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException
- Specified by:
prepareStatementin interfacejava.sql.Connection
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException
- Specified by:
prepareStatementin interfacejava.sql.Connection
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException
- Specified by:
prepareStatementin interfacejava.sql.Connection
|
|||||||||
| Home >> All >> com >> mockobjects >> [ sql overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC