You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by my...@apache.org on 2014/02/06 20:16:34 UTC

svn commit: r1565415 - in /db/derby/code/branches/10.10: ./ java/testing/org/apache/derbyTesting/functionTests/master/ java/testing/org/apache/derbyTesting/functionTests/tests/store/

Author: myrnavl
Date: Thu Feb  6 19:16:34 2014
New Revision: 1565415

URL: http://svn.apache.org/r1565415
Log:
DERBY-5630; intermittent test failure in store/lockTableVTI.sql
  backport of revisions 1564608 and 1564635 from trunk, converting the test to junit for better control

Added:
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/LockTableVtiTest.java
      - copied, changed from r1564608, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/LockTableVtiTest.java
Removed:
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/master/lockTableVti.out
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/lockTableVti.sql
Modified:
    db/derby/code/branches/10.10/   (props changed)
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/StoreScriptsTest.java
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java

Propchange: db/derby/code/branches/10.10/
------------------------------------------------------------------------------
  Merged /db/derby/code/trunk:r1564608,1564635

Copied: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/LockTableVtiTest.java (from r1564608, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/LockTableVtiTest.java)
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/LockTableVtiTest.java?p2=db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/LockTableVtiTest.java&p1=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/LockTableVtiTest.java&r1=1564608&r2=1565415&rev=1565415&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/LockTableVtiTest.java (original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/LockTableVtiTest.java Thu Feb  6 19:16:34 2014
@@ -31,6 +31,7 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import java.sql.Connection;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
 
@@ -44,14 +45,14 @@ import org.apache.derbyTesting.junit.JDB
 import org.apache.derbyTesting.junit.TestConfiguration;
 
 /**
- * Tests the LOCK TABLE in various modes.
+ * Tests the printing of the WAIT state in the LOCK TABLE.
  */
 public class LockTableVtiTest extends BaseJDBCTestCase {
 
     /**
      * List of threads (AsyncThread objects) to wait for after running the test.
      */
-    private List<AsyncThread> threads = new ArrayList<AsyncThread>();
+    private List threads = new ArrayList();
     
     public LockTableVtiTest(String name) {
         super(name);
@@ -59,7 +60,7 @@ public class LockTableVtiTest extends Ba
 
     /**
      * Construct top level suite in this JUnit test
-     * The suite is wrapped in a DatabasePropertyTestSetup set
+     * The suite is wrapped in a DatabasePropertyTestSetup to set
      * the lock wait timeout.
      *
      * @return A suite containing embedded fixtures
@@ -102,7 +103,10 @@ public class LockTableVtiTest extends Ba
         // Rollback all uncommitted operations so that we don't hold any
         // locks that may block the other threads.
         rollback();
-        for (AsyncThread thread : threads) {
+        // Go through all the threads and call waitFor() so that we
+        // detect errors that happened in another thread.
+        for (Iterator it = threads.iterator(); it.hasNext();) {
+            AsyncThread thread = (AsyncThread) it.next();
             thread.waitFor();
         }
         threads = null;
@@ -133,9 +137,9 @@ public class LockTableVtiTest extends Ba
      * Tests to make sure that WAIT state is displayed in lock
      * table output
      * 
-     * @exception SQLException
+     * @exception Exception
      */
-    public void testDisplayWaitState() throws Throwable {
+    public void testDisplayWaitState() throws Exception {
         Statement s = createStatement();
         setAutoCommit(false);
         // setting to -1 (wait for ever) to improve timing control
@@ -208,11 +212,11 @@ public class LockTableVtiTest extends Ba
     }
     
     /**
-     * Get the number of locks in the lock table
-     * @return number of locks
+     * See if there is a 'WAIT' lock
+     * @return true if there was a WAIT lock, false if not
      * @throws SQLException
      */
-    private boolean getWaitState() throws Exception {
+    private boolean getWaitState() throws SQLException {
         Statement s = createStatement();
         ResultSet rs = s.executeQuery(
                 "SELECT state from syscs_diag.lock_table " +

Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/StoreScriptsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/StoreScriptsTest.java?rev=1565415&r1=1565414&r2=1565415&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/StoreScriptsTest.java (original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/StoreScriptsTest.java Thu Feb  6 19:16:34 2014
@@ -88,7 +88,6 @@ public class StoreScriptsTest extends Sc
         #derby.debug.true=enableRowLocking,DeadlockTrace
         derby.debug.true=verbose_heap_post_commit */
         "removeStubs",
-        "lockTableVti", 
         //"rollForwardBackup", has a _sed.properties file; connects to 
         // multiple databases - needs to be fully converted.
         // "rollForwardRecovery", original uses useextdirs=true, which

Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java?rev=1565415&r1=1565414&r2=1565415&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java (original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java Thu Feb  6 19:16:34 2014
@@ -83,6 +83,7 @@ public class _Suite extends BaseTestCase
         suite.addTest(ServicePropertiesFileTest.suite());
         suite.addTest(Derby5234Test.suite());
         suite.addTest(KeepDisposableStatsPropertyTest.suite());
+        suite.addTest(LockTableVtiTest.suite());
         suite.addTest(StoreScriptsTest.suite());
         suite.addTest(Derby4923Test.suite());