Return-Path: X-Original-To: apmail-db-derby-commits-archive@www.apache.org Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 07B166F3C for ; Thu, 16 Jun 2011 22:42:29 +0000 (UTC) Received: (qmail 19864 invoked by uid 500); 16 Jun 2011 22:42:28 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 19843 invoked by uid 500); 16 Jun 2011 22:42:28 -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 19836 invoked by uid 99); 16 Jun 2011 22:42:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jun 2011 22:42:28 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.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; Thu, 16 Jun 2011 22:42:26 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id DB73B23889C5; Thu, 16 Jun 2011 22:42:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1136717 - in /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting: functionTests/tests/memory/TriggerTests.java junit/BaseJDBCTestCase.java Date: Thu, 16 Jun 2011 22:42:04 -0000 To: derby-commits@db.apache.org From: mamta@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110616224204.DB73B23889C5@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mamta Date: Thu Jun 16 22:42:04 2011 New Revision: 1136717 URL: http://svn.apache.org/viewvc?rev=1136717&view=rev Log: DERBY-5279 Adding following code to catch any exception other than table does not exist. If the caught error is derby lock time out then we want to know what is the lock out property set to. It should be set to default which is 60 but it is possible that some other test has changed that setting and forgot to revert it back to default before that test finished. The information about lock timeout will help us resolve DERBY-5279 Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java?rev=1136717&r1=1136716&r2=1136717&view=diff ============================================================================== --- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java (original) +++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java Thu Jun 16 22:42:04 2011 @@ -241,9 +241,27 @@ public class TriggerTests extends BaseJD * @throws SQLException */ public void basicSetup() throws SQLException{ - dropTable("TABLE1"); - dropTable("TABLE2"); - dropTable("TABLE3"); + try { + dropTable("TABLE1"); + dropTable("TABLE2"); + dropTable("TABLE3"); + } catch (SQLException sqle) { + //DERBY-5279 Adding following code to catch any exception other + // than table does not exist. If the caught error is derby + // lock time out then we want to know what is the lock out + // property set to. It should be set to default which is + // 60 but it is possible that some other test has changed + // that setting and forgot to revert it back to default + // before that test finished. The information about + // lock timeout will help us resolve DERBY-5279 + assertSQLState("40XL1", sqle); + //if we come here, then it means that we got lock timeout error + // In such a case, we want to see what is the current lock timeout + // setting when this test is getting run. The assetEquals following + // will always fails because we are comparing 1=2. We are doing + // this so that the lock out property will get printed. + assertEquals("lock timeout is set to " + getDatabaseProperty("derby.locks.deadlockTimeout"), "1", "2"); + } Statement s = createStatement(); try { Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java?rev=1136717&r1=1136716&r2=1136717&view=diff ============================================================================== --- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java (original) +++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java Thu Jun 16 22:42:04 2011 @@ -502,6 +502,26 @@ public abstract class BaseJDBCTestCase public static boolean usingDerbyNet() { return TestConfiguration.getCurrent().getJDBCClient().isDB2Client(); } + + /** + * Get the value of a database property using the default connection + * @param propertyName Property key + * @return null if the property is not set at the database level, + * otherwise the value of the property. + * @throws SQLException + */ + public String getDatabaseProperty(String propertyName) throws SQLException + { + PreparedStatement ps = prepareStatement( + "VALUES SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY(?)"); + + ps.setString(1, propertyName); + ResultSet rs = ps.executeQuery(); + + rs.next(); + + return rs.getString(1); + } /** * Assert equality between two Blob objects.