Package com.mockobjects.sql
Class CommonMockDataSource
- java.lang.Object
-
- com.mockobjects.MockObject
-
- com.mockobjects.sql.CommonMockDataSource
-
- All Implemented Interfaces:
Verifiable,java.sql.Wrapper,javax.sql.CommonDataSource,javax.sql.DataSource
- Direct Known Subclasses:
MockDataSource
public abstract class CommonMockDataSource extends MockObject implements javax.sql.DataSource
Abstract DataSource for use with mock testing. Only the connection methods have been implemented here. If testing of the log methods is needed, please submit a patch.- Version:
- $Revision: 1.1 $ $Date: 2002/08/27 16:34:04 $
- Author:
- Ted Husted
- See Also:
- javax.sql.DataSource
-
-
Constructor Summary
Constructors Constructor Description CommonMockDataSource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.sql.ConnectiongetConnection()Returns connection instance passed by setupConnection, and increments the number of connect calls.java.sql.ConnectiongetConnection(java.lang.String username, java.lang.String password)Calls notImplemented.intgetLoginTimeout()Calls notImplemented.java.io.PrintWritergetLogWriter()Calls notImplemented.voidsetExpectedConnectCalls(int callCount)Register the number of connections the test should make.voidsetLoginTimeout(int seconds)Calls notImplemented.voidsetLogWriter(java.io.PrintWriter out)Calls notImplemented.voidsetupConnection(java.sql.Connection aConnection)Pass the connection instance for use with tests.-
Methods inherited from class com.mockobjects.MockObject
notImplemented, notYetImplemented, verify
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Method Detail
-
setExpectedConnectCalls
public void setExpectedConnectCalls(int callCount)
Register the number of connections the test should make. The valid method will report any discrepancy with the actual count.
-
setupConnection
public void setupConnection(java.sql.Connection aConnection)
Pass the connection instance for use with tests. This instance will be returned until replaced with another.
-
getConnection
public java.sql.Connection getConnection()
Returns connection instance passed by setupConnection, and increments the number of connect calls.- Specified by:
getConnectionin interfacejavax.sql.DataSource
-
getConnection
public java.sql.Connection getConnection(java.lang.String username, java.lang.String password)Calls notImplemented. Returns null.- Specified by:
getConnectionin interfacejavax.sql.DataSource
-
getLoginTimeout
public int getLoginTimeout()
Calls notImplemented. Returns 0.- Specified by:
getLoginTimeoutin interfacejavax.sql.CommonDataSource- Specified by:
getLoginTimeoutin interfacejavax.sql.DataSource
-
getLogWriter
public java.io.PrintWriter getLogWriter()
Calls notImplemented. Returns null.- Specified by:
getLogWriterin interfacejavax.sql.CommonDataSource- Specified by:
getLogWriterin interfacejavax.sql.DataSource
-
setLoginTimeout
public void setLoginTimeout(int seconds)
Calls notImplemented.- Specified by:
setLoginTimeoutin interfacejavax.sql.CommonDataSource- Specified by:
setLoginTimeoutin interfacejavax.sql.DataSource
-
setLogWriter
public void setLogWriter(java.io.PrintWriter out)
Calls notImplemented.- Specified by:
setLogWriterin interfacejavax.sql.CommonDataSource- Specified by:
setLogWriterin interfacejavax.sql.DataSource
-
-