FileDocCategorySizeDatePackage
SuppliedConnectionTest.javaAPI DocHibernate 3.2.53021Thu Mar 22 11:35:22 GMT 2007org.hibernate.test.connections

SuppliedConnectionTest

public class SuppliedConnectionTest extends ConnectionManagementTestCase
Implementation of SuppliedConnectionTest.
author
Steve Ebersole

Fields Summary
private org.hibernate.connection.ConnectionProvider
cp
private Connection
connectionUnderTest
Constructors Summary
public SuppliedConnectionTest(String name)


	   
		super( name );
	
Methods Summary
protected voidcleanupTest()

		Connection conn = cp.getConnection();
		try {
			new SchemaExport( getCfg(), conn ).drop( false, true );
		}
		finally {
			if ( conn != null ) {
				try {
					cp.closeConnection( conn );
				}
				catch( Throwable ignore ) {
				}
			}
		}
		try {
			cp.close();
		}
		catch( Throwable ignore ) {
		}
		super.cleanupTest();
	
public voidconfigure(org.hibernate.cfg.Configuration cfg)

		super.configure( cfg );
		cfg.setProperty( Environment.RELEASE_CONNECTIONS, ConnectionReleaseMode.ON_CLOSE.toString() );
		cfg.setProperty( Environment.CONNECTION_PROVIDER, UserSuppliedConnectionProvider.class.getName() );
		boolean supportsScroll = true;
		Connection conn = null;
		try {
			conn = cp.getConnection();
			supportsScroll = conn.getMetaData().supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE);
		}
		catch( Throwable ignore ) {
		}
		finally {
			if ( conn != null ) {
				try {
					conn.close();
				}
				catch( Throwable ignore ) {
					// ignore it...
				}
			}
		}
		cfg.setProperty( Environment.USE_SCROLLABLE_RESULTSET, "" + supportsScroll );
	
public booleancreateSchema()

		return false;
	
protected voiddone()

		cp.closeConnection( connectionUnderTest );
	
protected org.hibernate.SessiongetSessionUnderTest()

		connectionUnderTest = cp.getConnection();
		return getSessions().openSession( connectionUnderTest );
	
protected voidprepareTest()

		super.prepareTest();
		Connection conn = cp.getConnection();
		try {
			new SchemaExport( getCfg(), conn ).create( false, true );
		}
		finally {
			if ( conn != null ) {
				try {
					cp.closeConnection( conn );
				}
				catch( Throwable ignore ) {
				}
			}
		}
	
protected voidreconnect(org.hibernate.Session session)

		session.reconnect( connectionUnderTest );
	
public booleanrecreateSchemaAfterFailure()

		return false;
	
public static junit.framework.Testsuite()

		return new FunctionalTestClassTestSuite( SuppliedConnectionTest.class );