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 17AD1E0E2 for ; Tue, 19 Feb 2013 10:59:52 +0000 (UTC) Received: (qmail 23164 invoked by uid 500); 19 Feb 2013 10:59:52 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 23033 invoked by uid 500); 19 Feb 2013 10:59:48 -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 22994 invoked by uid 99); 19 Feb 2013 10:59:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Feb 2013 10:59:47 +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; Tue, 19 Feb 2013 10:59:43 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B824B23889CB; Tue, 19 Feb 2013 10:59:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1447667 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting: functionTests/tests/jdbcapi/StatementPoolingTest.java junit/ConnectionPoolDataSourceConnector.java Date: Tue, 19 Feb 2013 10:59:23 -0000 To: derby-commits@db.apache.org From: kahatlen@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130219105923.B824B23889CB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kahatlen Date: Tue Feb 19 10:59:23 2013 New Revision: 1447667 URL: http://svn.apache.org/r1447667 Log: DERBY-6073: Test ordering instability in StatementPoolingTest ConnectionPoolDataSourceConnector should enable statement pooling also if the database doesn't already exist. Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/StatementPoolingTest.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/ConnectionPoolDataSourceConnector.java Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/StatementPoolingTest.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/StatementPoolingTest.java?rev=1447667&r1=1447666&r2=1447667&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/StatementPoolingTest.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/StatementPoolingTest.java Tue Feb 19 10:59:23 2013 @@ -53,7 +53,7 @@ public class StatementPoolingTest * * @throws SQLException if something goes wrong... */ - public void t01_testCacheOverflow() + public void testCacheOverflow() throws SQLException { final int stmtCount = 150; ConnectionPoolDataSource cpDs = @@ -79,7 +79,7 @@ public class StatementPoolingTest * * @throws SQLException if creating the JDBC objects fail */ - public void t02_testPoolingEnabledByCheckingImplementationDetails() + public void testPoolingEnabledByCheckingImplementationDetails() throws SQLException { final String conClass = "CachingLogicalConnection"; final String psClass = "LogicalPreparedStatement"; @@ -159,7 +159,7 @@ public class StatementPoolingTest * * @throws SQLException if creating the prepared statement fails */ - public void t03_testPrepareStatementPath() + public void testPrepareStatementPath() throws SQLException { PreparedStatement ps = prepareStatement("values 9708"); ps.close(); @@ -171,7 +171,7 @@ public class StatementPoolingTest * * @throws SQLException if creating the callable statement fails */ - public void t04_testPrepareCallPath() + public void testPrepareCallPath() throws SQLException { CallableStatement cs = prepareCall( "CALL SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(0)"); @@ -184,7 +184,7 @@ public class StatementPoolingTest * * @throws SQLException if creating the callable statement fails */ - public void t05_testPrepareCallWithNoCallPath() + public void testPrepareCallWithNoCallPath() throws SQLException { CallableStatement cs = prepareCall("values 1"); cs.close(); @@ -195,7 +195,7 @@ public class StatementPoolingTest * * @throws SQLException if something goes wrong... */ - public void t06_testClosingPSClosesRS() + public void testClosingPSClosesRS() throws SQLException { PreparedStatement ps = prepareStatement("values 99"); ResultSet rs = ps.executeQuery(); @@ -214,7 +214,7 @@ public class StatementPoolingTest * * @throws SQLException if something goes wrong... */ - public void t07_testHoldabilityIsResetExplicitClose() + public void testHoldabilityIsResetExplicitClose() throws SQLException { doTestHoldabilityIsReset(true); } @@ -226,7 +226,7 @@ public class StatementPoolingTest * * @throws SQLException if something goes wrong... */ - public void t08_testHoldabilityIsResetNoExplicitClose() + public void testHoldabilityIsResetNoExplicitClose() throws SQLException { doTestHoldabilityIsReset(false); } @@ -263,22 +263,22 @@ public class StatementPoolingTest pc.close(); } - public void t09_testIsolationLevelIsResetExplicitCloseQuery() + public void testIsolationLevelIsResetExplicitCloseQuery() throws SQLException { doTestIsolationLevelIsReset(true, true); } - public void t11_testIsolationLevelIsResetExplicitCloseNoQuery() + public void testIsolationLevelIsResetExplicitCloseNoQuery() throws SQLException { doTestIsolationLevelIsReset(true, false); } - public void t12_testIsolationLevelIsResetNoExplicitCloseNoQuery() + public void testIsolationLevelIsResetNoExplicitCloseNoQuery() throws SQLException { doTestIsolationLevelIsReset(false, false); } - public void t13_testIsolationLevelIsResetNoExplicitCloseQuery() + public void testIsolationLevelIsResetNoExplicitCloseQuery() throws SQLException { doTestIsolationLevelIsReset(false, true); } @@ -351,7 +351,7 @@ public class StatementPoolingTest * * @throws SQLException if something goes wrong... */ - public void t14_testCachingLogicalConnectionCloseLeavesPhysicalStatementsOpen() + public void testCachingLogicalConnectionCloseLeavesPhysicalStatementsOpen() throws SQLException { final String SELECT_SQL = "select * from clcclso"; ConnectionPoolDataSource cpDs = @@ -456,7 +456,7 @@ public class StatementPoolingTest * * @throws SQLException if something goes wrong... */ - public void t15_testDeleteReferringTableWhenOpen() + public void testDeleteReferringTableWhenOpen() throws SQLException { getConnection().setAutoCommit(false); // Create a table, insert a row, then create a statement selecting it. @@ -492,7 +492,7 @@ public class StatementPoolingTest * * @throws SQLException if something goes wrong... */ - public void t16_testDeleteReferringTableWhenInCache() + public void testDeleteReferringTableWhenInCache() throws SQLException { getConnection().setAutoCommit(false); // Create a table, insert a row, then create a statement selecting it. @@ -536,7 +536,7 @@ public class StatementPoolingTest * * @throws SQLException if the test fails for some reason */ - public void t17_testTemporaryTablesAreDeletedInNewLogicalConnection() + public void testTemporaryTablesAreDeletedInNewLogicalConnection() throws SQLException { ConnectionPoolDataSource cpds = J2EEDataSource.getConnectionPoolDataSource(); @@ -609,7 +609,7 @@ public class StatementPoolingTest * Make sure {@link ResultSet#getStatement} returns the same object as the * one that created the result set. */ - public void t18_testGetStatementCallable() + public void testGetStatementCallable() throws SQLException { doTestGetStatement(prepareCall("values 7653")); } @@ -618,7 +618,7 @@ public class StatementPoolingTest * Make sure {@link ResultSet#getStatement} returns the same object as the * one that created the result set. */ - public void t19_testGetStatementPrepared() + public void testGetStatementPrepared() throws SQLException { doTestGetStatement(prepareStatement("values 7652")); } @@ -817,28 +817,6 @@ public class StatementPoolingTest } } - public void testAll() throws Exception - { - t01_testCacheOverflow(); - t02_testPoolingEnabledByCheckingImplementationDetails(); - t03_testPrepareStatementPath(); - t04_testPrepareCallPath(); - t05_testPrepareCallWithNoCallPath(); - t06_testClosingPSClosesRS(); - t07_testHoldabilityIsResetExplicitClose(); - t08_testHoldabilityIsResetNoExplicitClose(); - t09_testIsolationLevelIsResetExplicitCloseQuery(); - t11_testIsolationLevelIsResetExplicitCloseNoQuery(); - t12_testIsolationLevelIsResetNoExplicitCloseNoQuery(); - t13_testIsolationLevelIsResetNoExplicitCloseQuery(); - t14_testCachingLogicalConnectionCloseLeavesPhysicalStatementsOpen(); - t15_testDeleteReferringTableWhenOpen(); - t16_testDeleteReferringTableWhenInCache(); - t17_testTemporaryTablesAreDeletedInNewLogicalConnection(); - t18_testGetStatementCallable(); - t19_testGetStatementPrepared(); - } - public static Test suite() { TestSuite suite = new TestSuite("StatementPoolingTest suite"); TestSuite baseSuite = new TestSuite(StatementPoolingTest.class); Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/ConnectionPoolDataSourceConnector.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/ConnectionPoolDataSourceConnector.java?rev=1447667&r1=1447666&r2=1447667&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/ConnectionPoolDataSourceConnector.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/ConnectionPoolDataSourceConnector.java Tue Feb 19 10:59:23 2013 @@ -51,7 +51,21 @@ public class ConnectionPoolDataSourceCon this.config = config; ds = J2EEDataSource.getConnectionPoolDataSource(config, (HashMap) null); + // Enable statement pooling by default. + enableStatementPooling(ds); + + // NOTE: Any other setup of the data source that gets added here, + // probably also needs to be added to singleUseDS(). Otherwise, that + // setup won't be performed on data sources that are used to create + // or shut down a database. + + } + + /** + * Enable statement pooling on the specified data source. + */ + private static void enableStatementPooling(ConnectionPoolDataSource ds) { // Note that this does not automatically test the pooling itself, but it // should test basic JDBC operations on the logical wrapper classes. try { @@ -184,6 +198,12 @@ public class ConnectionPoolDataSourceCon { ConnectionPoolDataSource sds = J2EEDataSource.getConnectionPoolDataSource(config, hm); + + // Enable statement pooling by default for single-use data sources + // too, just like it's enabled for the default data source in + // setConfiguration(). + enableStatementPooling(sds); + return sds; }