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 ka...@apache.org on 2012/01/04 12:11:46 UTC

svn commit: r1227121 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/AccessTest.java

Author: kahatlen
Date: Wed Jan  4 11:11:46 2012
New Revision: 1227121

URL: http://svn.apache.org/viewvc?rev=1227121&view=rev
Log:
DERBY-5377: AssertionFailedError in testCaseCS4595B_NonUniqueIndex in AccessTest

Dump the statistics on assert failures to help debugging the problem.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/AccessTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/AccessTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/AccessTest.java?rev=1227121&r1=1227120&r2=1227121&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/AccessTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/AccessTest.java Wed Jan  4 11:11:46 2012
@@ -29,6 +29,7 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.Properties;
 
+import junit.framework.AssertionFailedError;
 import junit.framework.Test;
 
 import org.apache.derbyTesting.functionTests.util.Formatters;
@@ -373,14 +374,14 @@ public final class AccessTest extends Ba
             String expScanType, String expStartPosition, String expStopPosition,
             String expQualifier, String expQualifierInfo)
     throws SQLException {
-        
-        ResultSet rs = null;
-        rs = st.executeQuery(
+        ResultSet rs = st.executeQuery(
             "values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
         rs.next();
-        if(usingEmbedded()){
-            RuntimeStatisticsParser rtsp = new RuntimeStatisticsParser(rs.getString(1));
-            rs.close();
+        RuntimeStatisticsParser rtsp =
+            new RuntimeStatisticsParser(rs.getString(1));
+        rs.close();
+
+        try {
             if (expectedScan.equals("Table"))
                     assertTrue(rtsp.usedTableScan());
             else if (expectedScan.equals("Index"))
@@ -412,6 +413,10 @@ public final class AccessTest extends Ba
                 assertTrue(rtsp.hasEqualsQualifier());
             if (expQualifierInfo !=null)
                 assertTrue(rtsp.findString(expQualifierInfo, 1));
+        } catch (AssertionFailedError e) {
+            // One of the assertions failed. Report the full statistics
+            // to help debugging.
+            fail("Statistics didn't match:\n" + rtsp.toString(), e);
         }
     }