org.apache.derbyTesting.functionTests.tests.jdbcapi
Class ClosedObjectTest.DataSourceDecorator

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.extensions.TestDecorator
          extended by junit.extensions.TestSetup
              extended by org.apache.derbyTesting.functionTests.tests.jdbcapi.ClosedObjectTest.DataSourceDecorator
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
ClosedObjectTest.PoolDataSourceDecorator, ClosedObjectTest.XADataSourceDecorator
Enclosing class:
ClosedObjectTest

private static class ClosedObjectTest.DataSourceDecorator
extends junit.extensions.TestSetup

Decorator class used for obtaining connections through a DataSource.


Field Summary
private  java.sql.Connection connection_
          Connection shared by many tests.
 
Fields inherited from class junit.extensions.TestDecorator
fTest
 
Constructor Summary
ClosedObjectTest.DataSourceDecorator(junit.framework.Test test)
          Creates a new DataSourceDecorator instance.
 
Method Summary
 java.sql.Connection getConnection()
          Gets the connection created when the test was set up.
protected  java.sql.Connection newConnection_()
          Creates a new connection using a DataSource.
 java.sql.Connection newConnection()
          Creates a new connection with auto-commit set to false.
 void setUp()
          Sets up the test by creating a connection.
 void tearDown()
          Tears down the test and closes the connection.
 
Methods inherited from class junit.extensions.TestSetup
run
 
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

connection_

private java.sql.Connection connection_
Connection shared by many tests.

Constructor Detail

ClosedObjectTest.DataSourceDecorator

public ClosedObjectTest.DataSourceDecorator(junit.framework.Test test)
Creates a new DataSourceDecorator instance.

Parameters:
test - the test to decorate
Method Detail

setUp

public final void setUp()
                 throws java.sql.SQLException
Sets up the test by creating a connection.

Overrides:
setUp in class junit.extensions.TestSetup
Throws:
java.sql.SQLException - if an error occurs

getConnection

public final java.sql.Connection getConnection()
Gets the connection created when the test was set up.

Returns:
a Connection value

newConnection

public final java.sql.Connection newConnection()
                                        throws java.sql.SQLException
Creates a new connection with auto-commit set to false.

Returns:
a Connection value
Throws:
java.sql.SQLException - if an error occurs

tearDown

public final void tearDown()
                    throws java.sql.SQLException
Tears down the test and closes the connection.

Overrides:
tearDown in class junit.extensions.TestSetup
Throws:
java.sql.SQLException - if an error occurs

newConnection_

protected java.sql.Connection newConnection_()
                                      throws java.sql.SQLException
Creates a new connection using a DataSource.

Returns:
a Connection value
Throws:
java.sql.SQLException - if an error occurs

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.