Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id BB994632D86 for ; Fri, 1 May 2009 08:06:06 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 44467-05 for ; Fri, 1 May 2009 08:05:56 -0300 (ADT) X-Greylist: delayed 00:09:42.681749 by SQLgrey-1.7.6 Received: from mk-filter-2-a-1.mail.uk.tiscali.com (mk-filter-2-a-1.mail.uk.tiscali.com [212.74.100.53]) by mail.postgresql.org (Postfix) with ESMTP id 11650632576 for ; Fri, 1 May 2009 08:06:02 -0300 (ADT) X-Trace: 191311959/mk-filter-2.mail.uk.tiscali.com/B2C/$b2c-THROTTLED-DYNAMIC/b2c-CUSTOMER-DYNAMIC-IP/62.64.158.120/None/john.lister-ps@kickstone.com X-SBRS: None X-RemoteIP: 62.64.158.120 X-IP-MAIL-FROM: john.lister-ps@kickstone.com X-SMTP-AUTH: X-MUA: Thunderbird 2.0.0.21 (Windows/20090302) X-IP-BHB: Once X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhIDAFty+kk+QJ54/2dsb2JhbAAIv0wIkBSCLxYIgTIF X-IronPort-AV: E=Sophos;i="4.40,277,1238972400"; d="scan'208";a="191311959" Received: from 62-64-158-120.dynamic.dial.as9105.com (HELO [192.168.6.11]) ([62.64.158.120]) by smtp.tiscali.co.uk with ESMTP; 01 May 2009 11:56:15 +0100 Message-ID: <49FAC740.1060607@kickstone.com> Date: Fri, 01 May 2009 10:56:16 +0100 From: John Lister User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Unit test patches Content-Type: multipart/mixed; boundary="------------000107060801000208030909" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.395 tagged_above=0 required=5 tests=AWL=0.395 X-Spam-Level: X-Archive-Number: 200905/2 X-Sequence-Number: 19552 This is a multi-part message in MIME format. --------------000107060801000208030909 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, running the unit tests against the latest cvs, i get 3 failures... Patches attached to correct them. The first occurs in DatabaseMetaDataTest.testTables line 104: It fetches all the columns for any table beginning with test - i happen to have other tables named test... which causes this to fail. I've modified it to look for the testmetadata table, alternatively the docs should be altered to state that the test database should be clean. The second in TimeTest.timeTest : line 269 & 283: The timezone tests fail because the as it happens local daylight savings is in effect, the code tries to test for this by submitting the time being tested, but this actually works out daylight savings for the time at the epoch (1/1/1970). I've modified it to use DST_OFFSET instead (note - this may fail if ran during the switchover period). and finally TimeTest.testGetTimeZone : line 84: Fails because although the timezone offset is added to local_offset, the dst isn't taken into account. If DST is in effect the offset is out. I've corrected this by adding the DST_OFFSET value; Also i did get an error on MiscTest.testSingleThreadCancel - but i can't repeat this... Is this expected? [junit] Testcase: testSingleThreadCancel(org.postgresql.test.jdbc2.MiscTest) : Caused an ERROR [junit] ERROR: canceling statement due to user request [junit] org.postgresql.util.PSQLException: ERROR: canceling statement due to user request [junit] at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse (QueryExecutorImpl.java:1646) [junit] at org.postgresql.core.v3.QueryExecutorImpl.processResults(Query ExecutorImpl.java:1380) ... Thanks JOHN --------------000107060801000208030909 Content-Type: text/plain; name="pgjdbc.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="pgjdbc.patch" Index: DatabaseMetaDataTest.java =================================================================== RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java,v retrieving revision 1.44 diff -u -r1.44 DatabaseMetaDataTest.java --- DatabaseMetaDataTest.java 7 Nov 2008 09:11:37 -0000 1.44 +++ DatabaseMetaDataTest.java 29 Apr 2009 19:44:51 -0000 @@ -99,7 +99,7 @@ assertTrue( "getTables() returned too many rows", rs.next() == false); rs.close(); - rs = dbmd.getColumns("", "", "test%", "%" ); + rs = dbmd.getColumns("", "", "testmetadat%", "%" ); assertTrue( rs.next() ); assertEquals( "testmetadata", rs.getString("TABLE_NAME") ); assertEquals( "id", rs.getString("COLUMN_NAME") ); @@ -498,7 +498,7 @@ assertEquals("b", rs.getString(4)); assertTrue(!rs.next()); - + rs.close(); } Index: TimeTest.java =================================================================== RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/test/jdbc2/TimeTest.java,v retrieving revision 1.18 diff -u -r1.18 TimeTest.java --- TimeTest.java 8 Jan 2008 06:56:31 -0000 1.18 +++ TimeTest.java 30 Apr 2009 10:34:54 -0000 @@ -59,7 +59,7 @@ cal.setTimeZone(TimeZone.getTimeZone("GMT")); - long localOffset = Calendar.getInstance().get(Calendar.ZONE_OFFSET); + long localOffset = Calendar.getInstance().get(Calendar.ZONE_OFFSET) + Calendar.getInstance().get(Calendar.DST_OFFSET); /* set the time to midnight to make this easy */ assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testtime", "'00:00:00','00:00:00'"))); @@ -266,10 +266,8 @@ assertNotNull(t); java.sql.Time tmpTime = java.sql.Time.valueOf("5:1:2"); int localoffset = java.util.Calendar.getInstance().getTimeZone().getRawOffset(); - if (java.util.Calendar.getInstance().getTimeZone().inDaylightTime(tmpTime)) - { - localoffset += 60 * 60 * 1000; - } + localoffset += java.util.Calendar.getInstance().get(Calendar.DST_OFFSET); + int Timeoffset = 3 * 60 * 60 * 1000; tmpTime.setTime(tmpTime.getTime() + Timeoffset + localoffset); assertEquals(makeTime(tmpTime.getHours(), tmpTime.getMinutes(), tmpTime.getSeconds()), t); @@ -279,10 +277,7 @@ assertNotNull(t); tmpTime = java.sql.Time.valueOf("23:59:59"); localoffset = java.util.Calendar.getInstance().getTimeZone().getRawOffset(); - if (java.util.Calendar.getInstance().getTimeZone().inDaylightTime(tmpTime)) - { - localoffset += 60 * 60 * 1000; - } + localoffset += java.util.Calendar.getInstance().get(Calendar.DST_OFFSET); Timeoffset = -11 * 60 * 60 * 1000; tmpTime.setTime(tmpTime.getTime() + Timeoffset + localoffset); assertEquals(makeTime(tmpTime.getHours(), tmpTime.getMinutes(), tmpTime.getSeconds()), t); --------------000107060801000208030909--