db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1455238 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/LoginTimeoutTest.java
Date Mon, 11 Mar 2013 17:07:25 GMT
Author: rhillegas
Date: Mon Mar 11 17:07:25 2013
New Revision: 1455238

URL: http://svn.apache.org/r1455238
Log:
DERBY-6094: Further cleanup of LoginTimeoutTest.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/LoginTimeoutTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/LoginTimeoutTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/LoginTimeoutTest.java?rev=1455238&r1=1455237&r2=1455238&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/LoginTimeoutTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/LoginTimeoutTest.java
Mon Mar 11 17:07:25 2013
@@ -270,7 +270,8 @@ public class LoginTimeoutTest extends Ba
 
         // make sure the database is created in order to eliminate asymmetries
         // in running the tests
-        openDefaultConnection( RUTH, RUTH_PASSWORD );
+        Connection  conn = openDefaultConnection( RUTH, RUTH_PASSWORD );
+        conn.close();
         
         vetConnector( new DriverManagerConnector( this ), true );
         vetConnector( new DataSourceConnector( JDBCDataSource.getDataSource() ), true );
@@ -307,11 +308,12 @@ public class LoginTimeoutTest extends Ba
         try {
             Connection  conn = connector.getConnection( RUTH, RUTH_PASSWORD );
             println( "    Got a " + conn.getClass().getName() );
+            conn.close();
             if ( !shouldSucceed )   { fail( "Should not have been able to connect!" ); }
         }
         catch (SQLException se)
         {
-            if ( shouldSucceed ) { failWithTrace( se, "Should have been able to connect!"
); }
+            if ( shouldSucceed ) { fail( "Should have been able to connect!", se ); }
 
             assertTrue( "Didn't expect to see a " + se.getClass().getName(), (se instanceof
SQLTimeoutException) );
             assertSQLState( LOGIN_TIMEOUT, se );
@@ -332,7 +334,8 @@ public class LoginTimeoutTest extends Ba
             SluggishAuthenticator.returnValue = false;
 
             try {
-                openDefaultConnection( RUTH, RUTH_PASSWORD );
+                Connection conn = openDefaultConnection( RUTH, RUTH_PASSWORD );
+                conn.close();
                 fail( "Didn't expect to get a connection!" );
             }
             catch (SQLException se) { assertSQLState( LOGIN_FAILED, se ); }
@@ -365,6 +368,7 @@ public class LoginTimeoutTest extends Ba
 
         // reset server timeout to default
         setServerTimeout( controlConnection, 0 );
+        controlConnection.close();
     }
     private void    vetServerTimeout
         ( Connection controlConnection, Connector connector, int serverTimeout, boolean shouldSucceed
)
@@ -399,11 +403,4 @@ public class LoginTimeoutTest extends Ba
     //
     ///////////////////////////////////////////////////////////////////////////////////
 
-    /** Fail and print a stack trace */
-    private static void    failWithTrace( Throwable t, String message )
-    {
-        printStackTrace( t );
-        fail( message );
-    }
-
 }



Mime
View raw message