db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1070504 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java
Date Mon, 14 Feb 2011 14:27:50 GMT
Author: rhillegas
Date: Mon Feb 14 14:27:50 2011
New Revision: 1070504

URL: http://svn.apache.org/viewvc?rev=1070504&view=rev
Log:
DERBY-4869: Another attempt to reduce the timeout-related instability in StatementTest.

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=1070504&r1=1070503&r2=1070504&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
Mon Feb 14 14:27:50 2011
@@ -274,40 +274,27 @@ public class StatementTest
     {
         SQLException    se = null;
 
-        // try to force a timeout. try a couple times to reduce the risk
-        // of instability in this test.
-        for ( int i = 0; i < 20; 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() );
-
-            SetQueryTimeoutTest.StatementExecutor   executor =
-                new SetQueryTimeoutTest.StatementExecutor( ps, true, 1 );
-
-            executor.start();
-            executor.join();
-
-            ps.close();
-
-            se = executor.getSQLException();
-
-            if ( se != null ) { break; }
-        }
-        
-        if ( se == null )
-        {
-            println( "Dang! Still can't force a timeout on this platform!" );
-        }
-        else
-        {
-            assertEquals( SQLTimeoutException.class.getName(), se.getClass().getName() );
-        }
+        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 mod( delay_st( 5, c.columnnumber ), 3 ) = 0"
+             );
+        println( "Testing timeout exception for a " + ps.getClass().getName() );
+        
+        SetQueryTimeoutTest.StatementExecutor   executor =
+            new SetQueryTimeoutTest.StatementExecutor( ps, true, 1 );
+        
+        executor.start();
+        executor.join();
+        
+        ps.close();
+        
+        se = executor.getSQLException();
+
+        assertNotNull( se );
+        assertEquals( SQLTimeoutException.class.getName(), se.getClass().getName() );
     }
 
     /**



Mime
View raw message