Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.mockobjects.sql
Class CommonMockDataSource  view CommonMockDataSource download CommonMockDataSource.java

java.lang.Object
  extended bycom.mockobjects.MockObject
      extended bycom.mockobjects.sql.CommonMockDataSource
All Implemented Interfaces:
javax.sql.DataSource, com.mockobjects.Verifiable
Direct Known Subclasses:
MockDataSource

public abstract class CommonMockDataSource
extends com.mockobjects.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 $

Field Summary
private  com.mockobjects.ExpectationCounter myConnectCalls
           
private  java.sql.Connection myConnection
           
 
Constructor Summary
CommonMockDataSource()
           
 
Method Summary
 java.sql.Connection getConnection()
          Returns connection instance passed by setupConnection, and increments the number of connect calls.
 java.sql.Connection getConnection(java.lang.String username, java.lang.String password)
          Calls notImplemented.
 int getLoginTimeout()
          Calls notImplemented.
 java.io.PrintWriter getLogWriter()
          Calls notImplemented.
 void setExpectedConnectCalls(int callCount)
          Register the number of connections the test should make.
 void setLoginTimeout(int seconds)
          Calls notImplemented.
 void setLogWriter(java.io.PrintWriter out)
          Calls notImplemented.
 void setupConnection(java.sql.Connection aConnection)
          Pass the connection instance for use with tests.
 
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
 

Field Detail

myConnection

private java.sql.Connection myConnection

myConnectCalls

private com.mockobjects.ExpectationCounter myConnectCalls
Constructor Detail

CommonMockDataSource

public CommonMockDataSource()
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:
getConnection in interface javax.sql.DataSource

getConnection

public java.sql.Connection getConnection(java.lang.String username,
                                         java.lang.String password)
Calls notImplemented. Returns null.

Specified by:
getConnection in interface javax.sql.DataSource

getLoginTimeout

public int getLoginTimeout()
Calls notImplemented. Returns 0.

Specified by:
getLoginTimeout in interface javax.sql.DataSource

getLogWriter

public java.io.PrintWriter getLogWriter()
Calls notImplemented. Returns null.

Specified by:
getLogWriter in interface javax.sql.DataSource

setLoginTimeout

public void setLoginTimeout(int seconds)
Calls notImplemented.

Specified by:
setLoginTimeout in interface javax.sql.DataSource

setLogWriter

public void setLogWriter(java.io.PrintWriter out)
Calls notImplemented.

Specified by:
setLogWriter in interface javax.sql.DataSource