pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
[PATCH] Stop test cases from leaking connections
2+ messages / 2 participants
[nested] [flat]

* [PATCH] Stop test cases from leaking connections
@ 2007-07-20 19:14 Mikko Tiihonen <mikko.tiihonen@iki.fi>
  2007-10-07 23:33 ` Re: [PATCH] Stop test cases from leaking connections Kris Jurka <books@ejurka.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Mikko Tiihonen @ 2007-07-20 19:14 UTC (permalink / raw)
  To: pgsql-jdbc

Hi,

The following patch fixes connection leaks in the current unit test
cases. The patch allows passing the tests with under 10 connections in
the server.

inline patch 1: org/postgresql/test/jdbc2/TimezoneTest.java, org/postgresql/test/jdbc2/optional/BaseDataSourceTest.java, org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java and 2 more (+9/-7 lines) download inline-1.patchIndex: org/postgresql/test/jdbc2/TimezoneTest.java =================================================================== RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/test/jdbc2/TimezoneTest.java,v retrieving revision 1.4 diff -u -r1.4 TimezoneTest.java --- org/postgresql/test/jdbc2/TimezoneTest.java 16 Apr 2007 18:31:38 -0000 1.4 +++ org/postgresql/test/jdbc2/TimezoneTest.java 20 Jul 2007 19:04:12 -0000 @@ -97,6 +97,7 @@ TimeZone.setDefault(saveTZ); TestUtil.dropTable(con, "testtimezone"); + TestUtil.closeDB(con); } public void testGetTimestamp() throws Exception Index: org/postgresql/test/jdbc2/optional/BaseDataSourceTest.java =================================================================== RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/test/jdbc2/optional/BaseDataSourceTest.java,v retrieving revision 1.11 diff -u -r1.11 BaseDataSourceTest.java --- org/postgresql/test/jdbc2/optional/BaseDataSourceTest.java 11 Jan 2005 08:25:48 -0000 1.11 +++ org/postgresql/test/jdbc2/optional/BaseDataSourceTest.java 20 Jul 2007 19:04:12 -0000 @@ -62,6 +62,7 @@ */ protected void tearDown() throws Exception { + TestUtil.closeDB(con); con = TestUtil.openDB(); TestUtil.dropTable(con, "poolingtest"); TestUtil.closeDB(con); Index: org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java =================================================================== RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java,v retrieving revision 1.15 diff -u -r1.15 ConnectionPoolTest.java --- org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java 11 Jan 2005 08:25:48 -0000 1.15 +++ org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java 20 Jul 2007 19:04:12 -0000 @@ -320,7 +320,7 @@ try { PooledConnection pc = getPooledConnection(); - Connection con = pc.getConnection(); + con = pc.getConnection(); assertTrue(!con.isClosed()); con.close(); assertTrue(con.isClosed()); @@ -346,7 +346,7 @@ try { PooledConnection pc = getPooledConnection(); - Connection con = pc.getConnection(); + con = pc.getConnection(); Statement s = con.createStatement(); Connection conRetrieved = s.getConnection(); @@ -368,7 +368,7 @@ try { PooledConnection pc = getPooledConnection(); - Connection con = pc.getConnection(); + con = pc.getConnection(); s = con.createStatement(); } catch (SQLException e) @@ -400,7 +400,7 @@ try { PooledConnection pc = getPooledConnection(); - Connection con = pc.getConnection(); + con = pc.getConnection(); PreparedStatement s = con.prepareStatement("select 'x'"); Connection conRetrieved = s.getConnection(); @@ -422,7 +422,7 @@ try { PooledConnection pc = getPooledConnection(); - Connection con = pc.getConnection(); + con = pc.getConnection(); CallableStatement s = con.prepareCall("select 'x'"); Connection conRetrieved = s.getConnection(); Index: org/postgresql/test/jdbc2/optional/PoolingDataSourceTest.java =================================================================== RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/test/jdbc2/optional/PoolingDataSourceTest.java,v retrieving revision 1.7 diff -u -r1.7 PoolingDataSourceTest.java --- org/postgresql/test/jdbc2/optional/PoolingDataSourceTest.java 11 Jan 2005 08:25:48 -0000 1.7 +++ org/postgresql/test/jdbc2/optional/PoolingDataSourceTest.java 20 Jul 2007 19:04:13 -0000 @@ -34,11 +34,11 @@ protected void tearDown() throws Exception { - super.tearDown(); if (bds instanceof PoolingDataSource) { ((PoolingDataSource) bds).close(); } + super.tearDown(); } /** Index: org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java =================================================================== RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java,v retrieving revision 1.3 diff -u -r1.3 Jdbc3CallableStatementTest.java --- org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java 15 Jul 2007 15:03:31 -0000 1.3 +++ org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java 20 Jul 2007 19:04:13 -0000 @@ -94,7 +94,7 @@ stmt.execute("drop function myiofunc(a INOUT int, b OUT int) "); stmt.execute("drop function myif(a INOUT int, b IN int)"); stmt.close(); - + TestUtil.closeDB(con); } public void testSomeInOut() throws Throwable {
^ permalink raw reply [nested|flat] 2+ messages in thread

* Re: [PATCH] Stop test cases from leaking connections
  2007-07-20 19:14 [PATCH] Stop test cases from leaking connections Mikko Tiihonen <mikko.tiihonen@iki.fi>
@ 2007-10-07 23:33 ` Kris Jurka <books@ejurka.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Kris Jurka @ 2007-10-07 23:33 UTC (permalink / raw)
  To: Mikko Tiihonen <mikko.tiihonen@iki.fi>; +Cc: pgsql-jdbc



On Fri, 20 Jul 2007, Mikko Tiihonen wrote:

> The following patch fixes connection leaks in the current unit test
> cases. The patch allows passing the tests with under 10 connections in
> the server.
>

I've applied this and the two later patches in this series.

Kris Jurka




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-10-07 23:33 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-07-20 19:14 [PATCH] Stop test cases from leaking connections Mikko Tiihonen <mikko.tiihonen@iki.fi>
2007-10-07 23:33 ` Kris Jurka <books@ejurka.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox