1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-17 17:02:08 +03:00

The attached patch is my first run-through of the JDBC test suite. A

summary of changes:

 . removal of the tablename property from build.xml

 . addition of a dropTable method in JDBC2Tests and cleanups of many
methods in the same

 . all tests now use non-deprecated assertXYZ methods instead of the
deprecated assert method

 . failure in TimestampTest (testSetTimestamp) fixed. The failure is
because testSetTimestamp was inserting a timestamp with hour 7 but
checkTimeTest was expecting a timestamp with hour 8. AFAICS, there are
no issues wrt daylight savings time and timestamps being pushed in and
pulled out (but more explicit tests should be added in the future)

 . failure in TimeTest (testGetTime) fixed. Times to be inserted were
interpreted in the localtime zone but checking was done with the
assumption that the insertion was done in GMT.

 . formatting changes in a few of the source files (because I found
it convenient to have consistent formatting while working on them). The
formatting is consistent with the new format for java source files in
PostgreSQL.

Liam Stewart
This commit is contained in:
Bruce Momjian
2001-09-23 04:11:14 +00:00
parent c7bc0ddf76
commit b75814aee3
13 changed files with 669 additions and 717 deletions

View File

@ -5,7 +5,7 @@ import junit.framework.TestCase;
import java.sql.*;
/**
* $Id: DriverTest.java,v 1.1 2001/02/07 09:13:20 peter Exp $
* $Id: DriverTest.java,v 1.2 2001/09/23 04:11:14 momjian Exp $
*
* Tests the dynamically created class org.postgresql.Driver
*
@ -25,21 +25,21 @@ public class DriverTest extends TestCase {
// Load the driver (note clients should never do it this way!)
org.postgresql.Driver drv = new org.postgresql.Driver();
assert(drv!=null);
assertNotNull(drv);
// These are always correct
assert(drv.acceptsURL("jdbc:postgresql:test"));
assert(drv.acceptsURL("jdbc:postgresql://localhost/test"));
assert(drv.acceptsURL("jdbc:postgresql://localhost:5432/test"));
assert(drv.acceptsURL("jdbc:postgresql://127.0.0.1/anydbname"));
assert(drv.acceptsURL("jdbc:postgresql://127.0.0.1:5433/hidden"));
assertTrue(drv.acceptsURL("jdbc:postgresql:test"));
assertTrue(drv.acceptsURL("jdbc:postgresql://localhost/test"));
assertTrue(drv.acceptsURL("jdbc:postgresql://localhost:5432/test"));
assertTrue(drv.acceptsURL("jdbc:postgresql://127.0.0.1/anydbname"));
assertTrue(drv.acceptsURL("jdbc:postgresql://127.0.0.1:5433/hidden"));
// Badly formatted url's
assert(!drv.acceptsURL("jdbc:postgres:test"));
assert(!drv.acceptsURL("postgresql:test"));
assertTrue(!drv.acceptsURL("jdbc:postgres:test"));
assertTrue(!drv.acceptsURL("postgresql:test"));
} catch(SQLException ex) {
assert(ex.getMessage(),false);
fail(ex.getMessage());
}
}
@ -56,18 +56,17 @@ public class DriverTest extends TestCase {
// Test with the url, username & password
con = DriverManager.getConnection(JDBC2Tests.getURL(),JDBC2Tests.getUser(),JDBC2Tests.getPassword());
assert(con!=null);
assertNotNull(con);
con.close();
// Test with the username in the url
con = DriverManager.getConnection(JDBC2Tests.getURL()+"?user="+JDBC2Tests.getUser()+"&password="+JDBC2Tests.getPassword());
assert(con!=null);
assertNotNull(con);
con.close();
} catch(ClassNotFoundException ex) {
assert(ex.getMessage(),false);
fail(ex.getMessage());
} catch(SQLException ex) {
assert(ex.getMessage(),false);
fail(ex.getMessage());
}
}
}
}