Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 55544 invoked from network); 5 Oct 2010 10:51:47 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 5 Oct 2010 10:51:47 -0000 Received: (qmail 2168 invoked by uid 500); 5 Oct 2010 10:51:47 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 2102 invoked by uid 500); 5 Oct 2010 10:51:45 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 2091 invoked by uid 99); 5 Oct 2010 10:51:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Oct 2010 10:51:44 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Oct 2010 10:51:43 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9725323889BB; Tue, 5 Oct 2010 10:51:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1004609 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LargeDataLocksTest.java Date: Tue, 05 Oct 2010 10:51:23 -0000 To: derby-commits@db.apache.org From: kahatlen@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101005105123.9725323889BB@eris.apache.org> Author: kahatlen Date: Tue Oct 5 10:51:23 2010 New Revision: 1004609 URL: http://svn.apache.org/viewvc?rev=1004609&view=rev Log: Don't compress tables in CleanDatabaseTestSetup. SYSCS_INPLACE_COMPRESS_TABLE is not supported yet. Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LargeDataLocksTest.java Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LargeDataLocksTest.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LargeDataLocksTest.java?rev=1004609&r1=1004608&r2=1004609&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LargeDataLocksTest.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/LargeDataLocksTest.java Tue Oct 5 10:51:23 2010 @@ -27,6 +27,7 @@ import java.io.UnsupportedEncodingExcept import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; @@ -69,7 +70,7 @@ public class LargeDataLocksTest extends } assertEquals(38000, numChars); rs.close(); - assertEquals(0, countLocks()); + assertLockCount(0); commit(); } @@ -87,7 +88,7 @@ public class LargeDataLocksTest extends byte[] value = rs.getBytes(1); assertEquals(38000, value.length); rs.close(); - assertEquals(0, countLocks()); + assertLockCount(0); commit(); } @@ -113,7 +114,7 @@ public class LargeDataLocksTest extends } assertEquals(38000, numBytes); rs.close(); - assertEquals(0, countLocks()); + assertLockCount(0); commit(); } @@ -133,30 +134,45 @@ public class LargeDataLocksTest extends String value = rs.getString(1); assertEquals(38000, value.length()); rs.close(); - assertEquals(0, countLocks()); + assertLockCount(0); commit(); } /** - * Create a new connection and count the number of locks held. - * - * @return number of locks held - * - * @throws SQLException + * Assert that the lock table contains a certain number of locks. Fail and + * dump the contents of the lock table if the lock table does not contain + * the expected number of locks. + * + * @param expected the expected number of locks */ - public int countLocks() throws SQLException { + private void assertLockCount(int expected) throws SQLException { + // Count the locks in a new connection so that we don't accidentally + // make the default connection auto-commit and release locks. Connection conn = openDefaultConnection(); - String sql; Statement stmt = conn.createStatement(); + ResultSet rs = stmt.executeQuery("select * from syscs_diag.lock_table"); + ResultSetMetaData meta = rs.getMetaData(); + + // Build an error message with the contents of the lock table as + // we walk through it. + StringBuffer msg = new StringBuffer( + "Unexpected lock count. Contents of lock table:\n"); + int count; + for (count = 0; rs.next(); count++) { + msg.append(count + 1).append(": "); + for (int col = 1; col <= meta.getColumnCount(); col++) { + String name = meta.getColumnName(col); + Object val = rs.getObject(col); + msg.append(name).append('=').append(val).append(' '); + } + msg.append('\n'); + } - sql = "Select count(*) from new org.apache.derby.diag.LockTable() as LT"; - ResultSet lockrs = stmt.executeQuery(sql); - lockrs.next(); - int count = lockrs.getInt(1); - lockrs.close(); + rs.close(); stmt.close(); conn.close(); - return count; + + assertEquals(msg.toString(), expected, count); } public static Test baseSuite(String name) {