org.apache.derbyTesting.junit
Class BaseJDBCTestSetup

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.extensions.TestDecorator
          extended by junit.extensions.TestSetup
              extended by org.apache.derbyTesting.junit.BaseTestSetup
                  extended by org.apache.derbyTesting.junit.BaseJDBCTestSetup
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
BlobClobTestSetup, BLOBDataModelSetup, CallableStatementTestSetup, CleanDatabaseTestSetup, ClobTest.ClobTestSetup, DatabasePropertyTestSetup, StatementTestSetup, SURDataModelSetup, XMLBindingTest.XBindTestSetup, XMLTypeAndOpsTest.XMLTestSetup

public abstract class BaseJDBCTestSetup
extends BaseTestSetup

Base class for JDBC JUnit test decorators.


Field Summary
private  java.sql.Connection conn
          Maintain a single connection to the default database, opened at the first call to getConnection.
 
Fields inherited from class junit.extensions.TestDecorator
fTest
 
Constructor Summary
BaseJDBCTestSetup(junit.framework.Test test)
           
 
Method Summary
 java.sql.Connection getConnection()
          Obtain the connection to the default database.
 TestConfiguration getTestConfiguration()
          Return the current configuration for the test.
 void println(java.lang.String text)
          Print debug string.
protected  void tearDown()
          Tear down this fixture, sub-classes should call super.tearDown().
 
Methods inherited from class org.apache.derbyTesting.junit.BaseTestSetup
run
 
Methods inherited from class junit.extensions.TestSetup
setUp
 
Methods inherited from class junit.extensions.TestDecorator
basicRun, countTestCases, getTest, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

conn

private java.sql.Connection conn
Maintain a single connection to the default database, opened at the first call to getConnection. Typical setup will just require a single connection.

See Also:
getConnection()
Constructor Detail

BaseJDBCTestSetup

public BaseJDBCTestSetup(junit.framework.Test test)
Method Detail

getTestConfiguration

public final TestConfiguration getTestConfiguration()
Return the current configuration for the test.


getConnection

public final java.sql.Connection getConnection()
                                        throws java.sql.SQLException
Obtain the connection to the default database. This class maintains a single connection returned by this class, it is opened on the first call to this method. Subsequent calls will return the same connection object unless it has been closed. In that case a new connection object will be returned.

The tearDown method will close the connection if it is open.

Throws:
java.sql.SQLException
See Also:
TestConfiguration.openDefaultConnection()

println

public void println(java.lang.String text)
Print debug string.

Parameters:
text - String to print

tearDown

protected void tearDown()
                 throws java.lang.Exception
Tear down this fixture, sub-classes should call super.tearDown(). This cleanups & closes the connection if it is open.

Overrides:
tearDown in class junit.extensions.TestSetup
Throws:
java.lang.Exception

Built on Thu 2009-11-26 18:42:53-0800, from revision 884739

Apache Derby V10.6 Internals - Copyright © 2004,2008 The Apache Software Foundation. All Rights Reserved.