db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1064281 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java
Date Thu, 27 Jan 2011 19:49:30 GMT
Author: rhillegas
Date: Thu Jan 27 19:49:30 2011
New Revision: 1064281

URL: http://svn.apache.org/viewvc?rev=1064281&view=rev
Log:
DERBY-4869: Attempt to reduce instability in StatementTest.test_jdbc4_1_queryTimeoutException().

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

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java?rev=1064281&r1=1064280&r2=1064281&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java
Thu Jan 27 19:49:30 2011
@@ -271,24 +271,34 @@ public class StatementTest
      */
     public  void    test_jdbc4_1_queryTimeoutException() throws Exception
     {
-        PreparedStatement ps = prepareStatement
-            (
-             "select columnnumber from sys.syscolumns c, sys.systables t\n" +
-             "where t.tablename = 'SYSTABLES'\n" +
-             "and t.tableid = c.referenceid\n" +
-             "and c.columnnumber = delay_st( 5, 1 )"
-             );
-        println( "Testing timeout exception for a " + ps.getClass().getName() );
-
-        SetQueryTimeoutTest.StatementExecutor   executor =
-            new SetQueryTimeoutTest.StatementExecutor( ps, true, 1 );
+        SQLException    se = null;
 
-        executor.start();
-        executor.join();
+        // try to force a timeout. try a couple times to reduce the risk
+        // of instability in this test.
+        for ( int i = 0; i < 10; i++ )
+        {
+            PreparedStatement ps = prepareStatement
+                (
+                 "select columnnumber from sys.syscolumns c, sys.systables t\n" +
+                 "where t.tablename = 'SYSTABLES'\n" +
+                 "and t.tableid = c.referenceid\n" +
+                 "and c.columnnumber = delay_st( 5, 1 )"
+                 );
+            println( "Testing timeout exception for a " + ps.getClass().getName() );
 
-        ps.close();
+            SetQueryTimeoutTest.StatementExecutor   executor =
+                new SetQueryTimeoutTest.StatementExecutor( ps, true, 1 );
 
-        SQLException    se = executor.getSQLException();
+            executor.start();
+            executor.join();
+
+            ps.close();
+
+            se = executor.getSQLException();
+
+            if ( se != null ) { break; }
+        }
+        
         assertNotNull( se );
         assertEquals( SQLTimeoutException.class.getName(), se.getClass().getName() );
     }



Mime
View raw message