mirror of
https://github.com/postgres/postgres.git
synced 2025-08-30 06:01:21 +03:00
Added support for JDBC3. The driver will now build under JDBC3 (i.e. Java 1.4).
This concludes my changes that restructured the code to support JDBC3. The jdbc unit tests were also resturctured to allow different tests between jdbc2 and jdbc3, although currently make check (aka ant test) for JDBC3 just runs the JDBC2 tests. Of special note the largeobject/PGblob and PGclob classes have been moved under the jdbc2/jdbc3 specific directories as they now differ by jdbc version. Also note that this checkin removes the PostgresqlDataSource and files in the xa directory. A recent checkin has added new datasource support that replaces the functionality provided by these classes. Modified Files: jdbc/build.xml jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSetMetaData.java jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java jdbc/org/postgresql/jdbc2/AbstractJdbc2Connection.java jdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java jdbc/org/postgresql/jdbc2/Array.java jdbc/org/postgresql/jdbc2/Jdbc2CallableStatement.java jdbc/org/postgresql/jdbc2/Jdbc2Connection.java jdbc/org/postgresql/jdbc2/Jdbc2DatabaseMetaData.java jdbc/org/postgresql/jdbc2/Jdbc2PreparedStatement.java jdbc/org/postgresql/jdbc2/Jdbc2ResultSet.java jdbc/org/postgresql/jdbc2/Jdbc2ResultSetMetaData.java jdbc/org/postgresql/jdbc2/Jdbc2Statement.java jdbc/org/postgresql/test/jdbc2/BatchExecuteTest.java jdbc/org/postgresql/test/jdbc2/BlobTest.java jdbc/org/postgresql/test/jdbc2/CallableStmtTest.java jdbc/org/postgresql/test/jdbc2/ConnectionTest.java jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java jdbc/org/postgresql/test/jdbc2/DateTest.java jdbc/org/postgresql/test/jdbc2/DriverTest.java jdbc/org/postgresql/test/jdbc2/JBuilderTest.java jdbc/org/postgresql/test/jdbc2/MiscTest.java jdbc/org/postgresql/test/jdbc2/ResultSetTest.java jdbc/org/postgresql/test/jdbc2/TimeTest.java jdbc/org/postgresql/test/jdbc2/TimestampTest.java jdbc/org/postgresql/test/jdbc2/UpdateableResultTest.java Added Files: jdbc/org/postgresql/jdbc2/AbstractJdbc2Blob.java jdbc/org/postgresql/jdbc2/AbstractJdbc2Clob.java jdbc/org/postgresql/jdbc2/Jdbc2Blob.java jdbc/org/postgresql/jdbc2/Jdbc2Clob.java jdbc/org/postgresql/jdbc3/AbstractJdbc3Blob.java jdbc/org/postgresql/jdbc3/AbstractJdbc3Clob.java jdbc/org/postgresql/jdbc3/AbstractJdbc3Connection.java jdbc/org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.java jdbc/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java jdbc/org/postgresql/jdbc3/AbstractJdbc3Statement.java jdbc/org/postgresql/jdbc3/Jdbc3Blob.java jdbc/org/postgresql/jdbc3/Jdbc3CallableStatement.java jdbc/org/postgresql/jdbc3/Jdbc3Clob.java jdbc/org/postgresql/jdbc3/Jdbc3Connection.java jdbc/org/postgresql/jdbc3/Jdbc3DatabaseMetaData.java jdbc/org/postgresql/jdbc3/Jdbc3PreparedStatement.java jdbc/org/postgresql/jdbc3/Jdbc3ResultSet.java jdbc/org/postgresql/jdbc3/Jdbc3ResultSetMetaData.java jdbc/org/postgresql/jdbc3/Jdbc3Statement.java jdbc/org/postgresql/test/TestUtil.java jdbc/org/postgresql/test/jdbc2/Jdbc2TestSuite.java jdbc/org/postgresql/test/jdbc3/Jdbc3TestSuite.java Removed Files: jdbc/org/postgresql/PostgresqlDataSource.java jdbc/org/postgresql/largeobject/PGblob.java jdbc/org/postgresql/largeobject/PGclob.java jdbc/org/postgresql/test/JDBC2Tests.java jdbc/org/postgresql/xa/ClientConnection.java jdbc/org/postgresql/xa/TwoPhaseConnection.java jdbc/org/postgresql/xa/TxConnection.java jdbc/org/postgresql/xa/XAConnectionImpl.java jdbc/org/postgresql/xa/XADataSourceImpl.java
This commit is contained in:
@@ -1,17 +1,12 @@
|
||||
package org.postgresql.test;
|
||||
|
||||
import junit.framework.TestSuite;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.postgresql.test.jdbc2.*;
|
||||
import java.sql.*;
|
||||
import java.lang.reflect.Method;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/*
|
||||
* Executes all known tests for JDBC2 and includes some utility methods.
|
||||
* Utility class for JDBC tests
|
||||
*/
|
||||
public class JDBC2Tests extends TestSuite
|
||||
public class TestUtil
|
||||
{
|
||||
/*
|
||||
* Returns the Test database JDBC URL
|
||||
@@ -45,7 +40,7 @@ public class JDBC2Tests extends TestSuite
|
||||
try
|
||||
{
|
||||
Class.forName("org.postgresql.Driver");
|
||||
return java.sql.DriverManager.getConnection(JDBC2Tests.getURL(), JDBC2Tests.getUser(), JDBC2Tests.getPassword());
|
||||
return java.sql.DriverManager.getConnection(getURL(), getUser(), getPassword());
|
||||
}
|
||||
catch (ClassNotFoundException ex)
|
||||
{
|
||||
@@ -180,68 +175,4 @@ public class JDBC2Tests extends TestSuite
|
||||
String s = "0000000000".substring(0, l) + Integer.toString(v);
|
||||
return s.substring(s.length() - l);
|
||||
}
|
||||
|
||||
/*
|
||||
* The main entry point for JUnit
|
||||
*/
|
||||
public static TestSuite suite()
|
||||
{
|
||||
TestSuite suite = new TestSuite();
|
||||
|
||||
//
|
||||
// Add one line per class in our test cases. These should be in order of
|
||||
// complexity.
|
||||
|
||||
// ANTTest should be first as it ensures that test parameters are
|
||||
// being sent to the suite. It also initialises the database (if required)
|
||||
// with some simple global tables (will make each testcase use its own later).
|
||||
//
|
||||
suite.addTestSuite(ANTTest.class);
|
||||
|
||||
// Basic Driver internals
|
||||
suite.addTestSuite(DriverTest.class);
|
||||
suite.addTestSuite(ConnectionTest.class);
|
||||
suite.addTestSuite(DatabaseMetaDataTest.class);
|
||||
suite.addTestSuite(EncodingTest.class);
|
||||
|
||||
// Connectivity/Protocols
|
||||
|
||||
// ResultSet
|
||||
suite.addTestSuite(ResultSetTest.class);
|
||||
|
||||
// Time, Date, Timestamp
|
||||
suite.addTestSuite(DateTest.class);
|
||||
suite.addTestSuite(TimeTest.class);
|
||||
suite.addTestSuite(TimestampTest.class);
|
||||
|
||||
// PreparedStatement
|
||||
|
||||
// BatchExecute
|
||||
suite.addTestSuite(BatchExecuteTest.class);
|
||||
|
||||
// MetaData
|
||||
|
||||
// Other misc tests, based on previous problems users have had or specific
|
||||
// features some applications require.
|
||||
suite.addTestSuite(JBuilderTest.class);
|
||||
suite.addTestSuite(MiscTest.class);
|
||||
|
||||
// Fastpath/LargeObject
|
||||
suite.addTestSuite(BlobTest.class);
|
||||
suite.addTestSuite( UpdateableResultTest.class );
|
||||
|
||||
suite.addTestSuite( CallableStmtTest.class );
|
||||
|
||||
// try to load the optional test classes
|
||||
try {
|
||||
Class cls = Class.forName("org.postgresql.test.jdbc2.optional.OptionalTestSuite");
|
||||
Method meth = cls.getMethod("suite", new Class[0]);
|
||||
suite.addTest((Test)meth.invoke(null, new Object[0]));
|
||||
} catch (Exception e) {
|
||||
System.err.println("Excluding JDBC 2 Optional Package (DataSource) tests");
|
||||
}
|
||||
|
||||
// That's all folks
|
||||
return suite;
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
package org.postgresql.test.jdbc2;
|
||||
|
||||
import org.postgresql.test.JDBC2Tests;
|
||||
import org.postgresql.test.TestUtil;
|
||||
import junit.framework.TestCase;
|
||||
import java.sql.*;
|
||||
|
||||
@@ -26,12 +26,12 @@ public class BatchExecuteTest extends TestCase
|
||||
// a table for this test.
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
con = JDBC2Tests.openDB();
|
||||
con = TestUtil.openDB();
|
||||
Statement stmt = con.createStatement();
|
||||
|
||||
// Drop the test table if it already exists for some reason. It is
|
||||
// not an error if it doesn't exist.
|
||||
JDBC2Tests.createTable(con, "testbatch", "pk INTEGER, col1 INTEGER");
|
||||
TestUtil.createTable(con, "testbatch", "pk INTEGER, col1 INTEGER");
|
||||
|
||||
stmt.executeUpdate("INSERT INTO testbatch VALUES (1, 0)");
|
||||
|
||||
@@ -45,8 +45,8 @@ public class BatchExecuteTest extends TestCase
|
||||
{
|
||||
con.setAutoCommit(true);
|
||||
|
||||
JDBC2Tests.dropTable(con, "testbatch");
|
||||
JDBC2Tests.closeDB(con);
|
||||
TestUtil.dropTable(con, "testbatch");
|
||||
TestUtil.closeDB(con);
|
||||
}
|
||||
|
||||
public void testSupportsBatchUpdates() throws Exception
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package org.postgresql.test.jdbc2;
|
||||
|
||||
import org.postgresql.test.JDBC2Tests;
|
||||
import org.postgresql.test.TestUtil;
|
||||
import junit.framework.TestCase;
|
||||
import java.io.*;
|
||||
import java.sql.*;
|
||||
@@ -8,7 +8,7 @@ import java.sql.*;
|
||||
import org.postgresql.largeobject.*;
|
||||
|
||||
/*
|
||||
* $Id: BlobTest.java,v 1.6 2002/07/23 03:59:55 barry Exp $
|
||||
* $Id: BlobTest.java,v 1.7 2002/08/14 20:35:40 barry Exp $
|
||||
*
|
||||
* Some simple tests based on problems reported by users. Hopefully these will
|
||||
* help prevent previous problems from re-occuring ;-)
|
||||
@@ -30,14 +30,14 @@ public class BlobTest extends TestCase
|
||||
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
con = JDBC2Tests.openDB();
|
||||
JDBC2Tests.createTable(con, "testblob", "id name,lo oid");
|
||||
con = TestUtil.openDB();
|
||||
TestUtil.createTable(con, "testblob", "id name,lo oid");
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
JDBC2Tests.dropTable(con, "testblob");
|
||||
JDBC2Tests.closeDB(con);
|
||||
TestUtil.dropTable(con, "testblob");
|
||||
TestUtil.closeDB(con);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -131,7 +131,7 @@ public class BlobTest extends TestCase
|
||||
|
||||
case JDBC_STREAM:
|
||||
File f = new File(file);
|
||||
PreparedStatement ps = con.prepareStatement(JDBC2Tests.insertSQL("testblob", "?"));
|
||||
PreparedStatement ps = con.prepareStatement(TestUtil.insertSQL("testblob", "?"));
|
||||
ps.setBinaryStream(1, fis, (int) f.length());
|
||||
ps.execute();
|
||||
break;
|
||||
@@ -145,7 +145,7 @@ public class BlobTest extends TestCase
|
||||
|
||||
// Insert into the table
|
||||
Statement st = con.createStatement();
|
||||
st.executeUpdate(JDBC2Tests.insertSQL("testblob", "id,lo", "'" + file + "'," + oid));
|
||||
st.executeUpdate(TestUtil.insertSQL("testblob", "id,lo", "'" + file + "'," + oid));
|
||||
con.commit();
|
||||
st.close();
|
||||
|
||||
@@ -163,7 +163,7 @@ public class BlobTest extends TestCase
|
||||
LargeObjectManager lom = ((org.postgresql.PGConnection)con).getLargeObjectAPI();
|
||||
|
||||
Statement st = con.createStatement();
|
||||
ResultSet rs = st.executeQuery(JDBC2Tests.selectSQL("testblob", "id,lo"));
|
||||
ResultSet rs = st.executeQuery(TestUtil.selectSQL("testblob", "id,lo"));
|
||||
assertNotNull(rs);
|
||||
|
||||
while (rs.next())
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package org.postgresql.test.jdbc2;
|
||||
|
||||
import org.postgresql.test.JDBC2Tests;
|
||||
import org.postgresql.test.TestUtil;
|
||||
import junit.framework.TestCase;
|
||||
import java.io.*;
|
||||
import java.sql.*;
|
||||
@@ -20,7 +20,7 @@ public class CallableStmtTest extends TestCase
|
||||
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
con = JDBC2Tests.openDB();
|
||||
con = TestUtil.openDB();
|
||||
Statement stmt = con.createStatement ();
|
||||
stmt.execute ("CREATE OR REPLACE FUNCTION testspg__getString (varchar) " +
|
||||
"RETURNS varchar AS ' DECLARE inString alias for $1; begin "+
|
||||
@@ -44,7 +44,7 @@ public class CallableStmtTest extends TestCase
|
||||
stmt.execute ("drop FUNCTION testspg__getDouble (float);");
|
||||
stmt.execute ("drop FUNCTION testspg__getInt (int);");
|
||||
stmt.execute ("drop FUNCTION testspg__getNumeric (numeric);");
|
||||
JDBC2Tests.closeDB(con);
|
||||
TestUtil.closeDB(con);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package org.postgresql.test.jdbc2;
|
||||
|
||||
import org.postgresql.test.JDBC2Tests;
|
||||
import org.postgresql.test.TestUtil;
|
||||
import junit.framework.TestCase;
|
||||
import java.sql.*;
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.sql.*;
|
||||
*
|
||||
* PS: Do you know how difficult it is to type on a train? ;-)
|
||||
*
|
||||
* $Id: ConnectionTest.java,v 1.8 2002/07/23 03:59:55 barry Exp $
|
||||
* $Id: ConnectionTest.java,v 1.9 2002/08/14 20:35:40 barry Exp $
|
||||
*/
|
||||
|
||||
public class ConnectionTest extends TestCase
|
||||
@@ -27,23 +27,23 @@ public class ConnectionTest extends TestCase
|
||||
// Set up the fixture for this testcase: the tables for this test.
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
Connection con = JDBC2Tests.openDB();
|
||||
Connection con = TestUtil.openDB();
|
||||
|
||||
JDBC2Tests.createTable(con, "test_a", "imagename name,image oid,id int4");
|
||||
JDBC2Tests.createTable(con, "test_c", "source text,cost money,imageid int4");
|
||||
TestUtil.createTable(con, "test_a", "imagename name,image oid,id int4");
|
||||
TestUtil.createTable(con, "test_c", "source text,cost money,imageid int4");
|
||||
|
||||
JDBC2Tests.closeDB(con);
|
||||
TestUtil.closeDB(con);
|
||||
}
|
||||
|
||||
// Tear down the fixture for this test case.
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
Connection con = JDBC2Tests.openDB();
|
||||
Connection con = TestUtil.openDB();
|
||||
|
||||
JDBC2Tests.dropTable(con, "test_a");
|
||||
JDBC2Tests.dropTable(con, "test_c");
|
||||
TestUtil.dropTable(con, "test_a");
|
||||
TestUtil.dropTable(con, "test_c");
|
||||
|
||||
JDBC2Tests.closeDB(con);
|
||||
TestUtil.closeDB(con);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -53,7 +53,7 @@ public class ConnectionTest extends TestCase
|
||||
{
|
||||
try
|
||||
{
|
||||
java.sql.Connection conn = JDBC2Tests.openDB();
|
||||
java.sql.Connection conn = TestUtil.openDB();
|
||||
|
||||
// A standard Statement
|
||||
java.sql.Statement stat = conn.createStatement();
|
||||
@@ -79,7 +79,7 @@ public class ConnectionTest extends TestCase
|
||||
{
|
||||
try
|
||||
{
|
||||
java.sql.Connection conn = JDBC2Tests.openDB();
|
||||
java.sql.Connection conn = TestUtil.openDB();
|
||||
|
||||
String sql = "select source,cost,imageid from test_c";
|
||||
|
||||
@@ -121,7 +121,7 @@ public class ConnectionTest extends TestCase
|
||||
{
|
||||
try
|
||||
{
|
||||
java.sql.Connection con = JDBC2Tests.openDB();
|
||||
java.sql.Connection con = TestUtil.openDB();
|
||||
java.sql.Statement st;
|
||||
java.sql.ResultSet rs;
|
||||
|
||||
@@ -155,7 +155,7 @@ public class ConnectionTest extends TestCase
|
||||
assertEquals(9876, rs.getInt(1)); // Should not change!
|
||||
rs.close();
|
||||
|
||||
JDBC2Tests.closeDB(con);
|
||||
TestUtil.closeDB(con);
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
@@ -170,12 +170,12 @@ public class ConnectionTest extends TestCase
|
||||
{
|
||||
try
|
||||
{
|
||||
Connection con = JDBC2Tests.openDB();
|
||||
Connection con = TestUtil.openDB();
|
||||
|
||||
// Should not say closed
|
||||
assertTrue(!con.isClosed());
|
||||
|
||||
JDBC2Tests.closeDB(con);
|
||||
TestUtil.closeDB(con);
|
||||
|
||||
// Should now say closed
|
||||
assertTrue(con.isClosed());
|
||||
@@ -194,7 +194,7 @@ public class ConnectionTest extends TestCase
|
||||
{
|
||||
try
|
||||
{
|
||||
Connection con = JDBC2Tests.openDB();
|
||||
Connection con = TestUtil.openDB();
|
||||
|
||||
String testStr = "This Is OuR TeSt message";
|
||||
|
||||
@@ -216,7 +216,7 @@ public class ConnectionTest extends TestCase
|
||||
con.clearWarnings();
|
||||
assertTrue(con.getWarnings() == null);
|
||||
|
||||
JDBC2Tests.closeDB(con);
|
||||
TestUtil.closeDB(con);
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
@@ -231,7 +231,7 @@ public class ConnectionTest extends TestCase
|
||||
{
|
||||
try
|
||||
{
|
||||
Connection con = JDBC2Tests.openDB();
|
||||
Connection con = TestUtil.openDB();
|
||||
|
||||
// PostgreSQL defaults to READ COMMITTED
|
||||
assertEquals(Connection.TRANSACTION_READ_COMMITTED,
|
||||
@@ -301,7 +301,7 @@ public class ConnectionTest extends TestCase
|
||||
assertEquals(Connection.TRANSACTION_READ_COMMITTED,
|
||||
con.getTransactionIsolation());
|
||||
|
||||
JDBC2Tests.closeDB(con);
|
||||
TestUtil.closeDB(con);
|
||||
}
|
||||
catch ( SQLException ex )
|
||||
{
|
||||
@@ -316,7 +316,7 @@ public class ConnectionTest extends TestCase
|
||||
{
|
||||
try
|
||||
{
|
||||
Connection con = JDBC2Tests.openDB();
|
||||
Connection con = TestUtil.openDB();
|
||||
|
||||
// preserve the current map
|
||||
java.util.Map oldmap = con.getTypeMap();
|
||||
@@ -330,7 +330,7 @@ public class ConnectionTest extends TestCase
|
||||
con.setTypeMap(oldmap);
|
||||
assertEquals(oldmap, con.getTypeMap());
|
||||
|
||||
JDBC2Tests.closeDB(con);
|
||||
TestUtil.closeDB(con);
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package org.postgresql.test.jdbc2;
|
||||
|
||||
import org.postgresql.test.JDBC2Tests;
|
||||
import org.postgresql.test.TestUtil;
|
||||
import junit.framework.TestCase;
|
||||
import java.sql.*;
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.sql.*;
|
||||
*
|
||||
* PS: Do you know how difficult it is to type on a train? ;-)
|
||||
*
|
||||
* $Id: DatabaseMetaDataTest.java,v 1.10 2002/07/30 13:22:38 davec Exp $
|
||||
* $Id: DatabaseMetaDataTest.java,v 1.11 2002/08/14 20:35:40 barry Exp $
|
||||
*/
|
||||
|
||||
public class DatabaseMetaDataTest extends TestCase
|
||||
@@ -26,14 +26,14 @@ public class DatabaseMetaDataTest extends TestCase
|
||||
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
con = JDBC2Tests.openDB();
|
||||
JDBC2Tests.createTable( con, "testmetadata", "id int4, name text, updated timestamp" );
|
||||
con = TestUtil.openDB();
|
||||
TestUtil.createTable( con, "testmetadata", "id int4, name text, updated timestamp" );
|
||||
}
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
JDBC2Tests.dropTable( con, "testmetadata" );
|
||||
TestUtil.dropTable( con, "testmetadata" );
|
||||
|
||||
JDBC2Tests.closeDB( con );
|
||||
TestUtil.closeDB( con );
|
||||
}
|
||||
/*
|
||||
* The spec says this may return null, but we always do!
|
||||
@@ -233,11 +233,11 @@ public class DatabaseMetaDataTest extends TestCase
|
||||
{
|
||||
try
|
||||
{
|
||||
Connection con1 = JDBC2Tests.openDB();
|
||||
Connection con1 = TestUtil.openDB();
|
||||
|
||||
JDBC2Tests.createTable( con1, "vv", "a int not null, b int not null, primary key ( a, b )" );
|
||||
TestUtil.createTable( con1, "vv", "a int not null, b int not null, primary key ( a, b )" );
|
||||
|
||||
JDBC2Tests.createTable( con1, "ww", "m int not null, n int not null, primary key ( m, n ), foreign key ( m, n ) references vv ( a, b )" );
|
||||
TestUtil.createTable( con1, "ww", "m int not null, n int not null, primary key ( m, n ), foreign key ( m, n ) references vv ( a, b )" );
|
||||
|
||||
|
||||
DatabaseMetaData dbmd = con.getMetaData();
|
||||
@@ -271,8 +271,8 @@ public class DatabaseMetaDataTest extends TestCase
|
||||
}
|
||||
|
||||
|
||||
JDBC2Tests.dropTable( con1, "vv" );
|
||||
JDBC2Tests.dropTable( con1, "ww" );
|
||||
TestUtil.dropTable( con1, "vv" );
|
||||
TestUtil.dropTable( con1, "ww" );
|
||||
|
||||
}
|
||||
catch (SQLException ex)
|
||||
@@ -284,11 +284,11 @@ public class DatabaseMetaDataTest extends TestCase
|
||||
{
|
||||
try
|
||||
{
|
||||
Connection con1 = JDBC2Tests.openDB();
|
||||
JDBC2Tests.createTable( con1, "people", "id int4 primary key, name text" );
|
||||
JDBC2Tests.createTable( con1, "policy", "id int4 primary key, name text" );
|
||||
Connection con1 = TestUtil.openDB();
|
||||
TestUtil.createTable( con1, "people", "id int4 primary key, name text" );
|
||||
TestUtil.createTable( con1, "policy", "id int4 primary key, name text" );
|
||||
|
||||
JDBC2Tests.createTable( con1, "users", "id int4 primary key, people_id int4, policy_id int4,"+
|
||||
TestUtil.createTable( con1, "users", "id int4 primary key, people_id int4, policy_id int4,"+
|
||||
"CONSTRAINT people FOREIGN KEY (people_id) references people(id),"+
|
||||
"constraint policy FOREIGN KEY (policy_id) references policy(id)" );
|
||||
|
||||
@@ -337,9 +337,9 @@ public class DatabaseMetaDataTest extends TestCase
|
||||
assertTrue( rs.getString( "FK_NAME" ).equals( "people" ) );
|
||||
|
||||
|
||||
JDBC2Tests.dropTable( con1, "users" );
|
||||
JDBC2Tests.dropTable( con1, "people" );
|
||||
JDBC2Tests.dropTable( con1, "policy" );
|
||||
TestUtil.dropTable( con1, "users" );
|
||||
TestUtil.dropTable( con1, "people" );
|
||||
TestUtil.dropTable( con1, "policy" );
|
||||
|
||||
}
|
||||
catch (SQLException ex)
|
||||
@@ -405,8 +405,8 @@ public class DatabaseMetaDataTest extends TestCase
|
||||
DatabaseMetaData dbmd = con.getMetaData();
|
||||
assertNotNull(dbmd);
|
||||
|
||||
assertTrue(dbmd.getURL().equals(JDBC2Tests.getURL()));
|
||||
assertTrue(dbmd.getUserName().equals(JDBC2Tests.getUser()));
|
||||
assertTrue(dbmd.getURL().equals(TestUtil.getURL()));
|
||||
assertTrue(dbmd.getUserName().equals(TestUtil.getUser()));
|
||||
|
||||
}
|
||||
catch (SQLException ex)
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package org.postgresql.test.jdbc2;
|
||||
|
||||
import org.postgresql.test.JDBC2Tests;
|
||||
import org.postgresql.test.TestUtil;
|
||||
import junit.framework.TestCase;
|
||||
import java.sql.*;
|
||||
|
||||
/*
|
||||
* $Id: DateTest.java,v 1.4 2001/11/19 22:33:39 momjian Exp $
|
||||
* $Id: DateTest.java,v 1.5 2002/08/14 20:35:40 barry Exp $
|
||||
*
|
||||
* Some simple tests based on problems reported by users. Hopefully these will
|
||||
* help prevent previous problems from re-occuring ;-)
|
||||
@@ -23,14 +23,14 @@ public class DateTest extends TestCase
|
||||
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
con = JDBC2Tests.openDB();
|
||||
JDBC2Tests.createTable(con, "testdate", "dt date");
|
||||
con = TestUtil.openDB();
|
||||
TestUtil.createTable(con, "testdate", "dt date");
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
JDBC2Tests.dropTable(con, "testdate");
|
||||
JDBC2Tests.closeDB(con);
|
||||
TestUtil.dropTable(con, "testdate");
|
||||
TestUtil.closeDB(con);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -42,10 +42,10 @@ public class DateTest extends TestCase
|
||||
{
|
||||
Statement stmt = con.createStatement();
|
||||
|
||||
assertEquals(1, stmt.executeUpdate(JDBC2Tests.insertSQL("testdate", "'1950-02-07'")));
|
||||
assertEquals(1, stmt.executeUpdate(JDBC2Tests.insertSQL("testdate", "'1970-06-02'")));
|
||||
assertEquals(1, stmt.executeUpdate(JDBC2Tests.insertSQL("testdate", "'1999-08-11'")));
|
||||
assertEquals(1, stmt.executeUpdate(JDBC2Tests.insertSQL("testdate", "'2001-02-13'")));
|
||||
assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'1950-02-07'")));
|
||||
assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'1970-06-02'")));
|
||||
assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'1999-08-11'")));
|
||||
assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'2001-02-13'")));
|
||||
|
||||
/* dateTest() contains all of the tests */
|
||||
dateTest();
|
||||
@@ -67,7 +67,7 @@ public class DateTest extends TestCase
|
||||
try
|
||||
{
|
||||
Statement stmt = con.createStatement();
|
||||
PreparedStatement ps = con.prepareStatement(JDBC2Tests.insertSQL("testdate", "?"));
|
||||
PreparedStatement ps = con.prepareStatement(TestUtil.insertSQL("testdate", "?"));
|
||||
|
||||
ps.setDate(1, makeDate(1950, 2, 7));
|
||||
assertEquals(1, ps.executeUpdate());
|
||||
@@ -104,7 +104,7 @@ public class DateTest extends TestCase
|
||||
ResultSet rs;
|
||||
java.sql.Date d;
|
||||
|
||||
rs = st.executeQuery(JDBC2Tests.selectSQL("testdate", "dt"));
|
||||
rs = st.executeQuery(TestUtil.selectSQL("testdate", "dt"));
|
||||
assertNotNull(rs);
|
||||
|
||||
assertTrue(rs.next());
|
||||
@@ -135,8 +135,8 @@ public class DateTest extends TestCase
|
||||
|
||||
private java.sql.Date makeDate(int y, int m, int d)
|
||||
{
|
||||
return java.sql.Date.valueOf(JDBC2Tests.fix(y, 4) + "-" +
|
||||
JDBC2Tests.fix(m, 2) + "-" +
|
||||
JDBC2Tests.fix(d, 2));
|
||||
return java.sql.Date.valueOf(TestUtil.fix(y, 4) + "-" +
|
||||
TestUtil.fix(m, 2) + "-" +
|
||||
TestUtil.fix(d, 2));
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package org.postgresql.test.jdbc2;
|
||||
|
||||
import org.postgresql.test.JDBC2Tests;
|
||||
import org.postgresql.test.TestUtil;
|
||||
import junit.framework.TestCase;
|
||||
import java.sql.*;
|
||||
|
||||
/*
|
||||
* $Id: DriverTest.java,v 1.4 2001/11/19 22:33:39 momjian Exp $
|
||||
* $Id: DriverTest.java,v 1.5 2002/08/14 20:35:40 barry Exp $
|
||||
*
|
||||
* Tests the dynamically created class org.postgresql.Driver
|
||||
*
|
||||
@@ -63,12 +63,12 @@ public class DriverTest extends TestCase
|
||||
Class.forName("org.postgresql.Driver");
|
||||
|
||||
// Test with the url, username & password
|
||||
con = DriverManager.getConnection(JDBC2Tests.getURL(), JDBC2Tests.getUser(), JDBC2Tests.getPassword());
|
||||
con = DriverManager.getConnection(TestUtil.getURL(), TestUtil.getUser(), TestUtil.getPassword());
|
||||
assertNotNull(con);
|
||||
con.close();
|
||||
|
||||
// Test with the username in the url
|
||||
con = DriverManager.getConnection(JDBC2Tests.getURL() + "?user=" + JDBC2Tests.getUser() + "&password=" + JDBC2Tests.getPassword());
|
||||
con = DriverManager.getConnection(TestUtil.getURL() + "?user=" + TestUtil.getUser() + "&password=" + TestUtil.getPassword());
|
||||
assertNotNull(con);
|
||||
con.close();
|
||||
}
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package org.postgresql.test.jdbc2;
|
||||
|
||||
import org.postgresql.test.JDBC2Tests;
|
||||
import org.postgresql.test.TestUtil;
|
||||
import junit.framework.TestCase;
|
||||
import java.sql.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/*
|
||||
* $Id: JBuilderTest.java,v 1.5 2001/11/19 22:33:39 momjian Exp $
|
||||
* $Id: JBuilderTest.java,v 1.6 2002/08/14 20:35:40 barry Exp $
|
||||
*
|
||||
* Some simple tests to check that the required components needed for JBuilder
|
||||
* stay working
|
||||
@@ -23,20 +23,20 @@ public class JBuilderTest extends TestCase
|
||||
// Set up the fixture for this testcase: the tables for this test.
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
Connection con = JDBC2Tests.openDB();
|
||||
Connection con = TestUtil.openDB();
|
||||
|
||||
JDBC2Tests.createTable( con, "test_c",
|
||||
TestUtil.createTable( con, "test_c",
|
||||
"source text,cost money,imageid int4" );
|
||||
|
||||
JDBC2Tests.closeDB(con);
|
||||
TestUtil.closeDB(con);
|
||||
}
|
||||
|
||||
// Tear down the fixture for this test case.
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
Connection con = JDBC2Tests.openDB();
|
||||
JDBC2Tests.dropTable(con, "test_c");
|
||||
JDBC2Tests.closeDB(con);
|
||||
Connection con = TestUtil.openDB();
|
||||
TestUtil.dropTable(con, "test_c");
|
||||
TestUtil.closeDB(con);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -46,7 +46,7 @@ public class JBuilderTest extends TestCase
|
||||
{
|
||||
try
|
||||
{
|
||||
Connection con = JDBC2Tests.openDB();
|
||||
Connection con = TestUtil.openDB();
|
||||
|
||||
Statement st = con.createStatement();
|
||||
ResultSet rs = st.executeQuery("select cost from test_c");
|
||||
@@ -60,7 +60,7 @@ public class JBuilderTest extends TestCase
|
||||
rs.close();
|
||||
st.close();
|
||||
|
||||
JDBC2Tests.closeDB(con);
|
||||
TestUtil.closeDB(con);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@@ -0,0 +1,70 @@
|
||||
package org.postgresql.test.jdbc2;
|
||||
|
||||
import junit.framework.TestSuite;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.Test;
|
||||
|
||||
import java.sql.*;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/*
|
||||
* Executes all known tests for JDBC2 and includes some utility methods.
|
||||
*/
|
||||
public class Jdbc2TestSuite extends TestSuite
|
||||
{
|
||||
|
||||
/*
|
||||
* The main entry point for JUnit
|
||||
*/
|
||||
public static TestSuite suite()
|
||||
{
|
||||
TestSuite suite = new TestSuite();
|
||||
|
||||
//
|
||||
// Add one line per class in our test cases. These should be in order of
|
||||
// complexity.
|
||||
|
||||
// ANTTest should be first as it ensures that test parameters are
|
||||
// being sent to the suite. It also initialises the database (if required)
|
||||
// with some simple global tables (will make each testcase use its own later).
|
||||
//
|
||||
suite.addTestSuite(ANTTest.class);
|
||||
|
||||
// Basic Driver internals
|
||||
suite.addTestSuite(DriverTest.class);
|
||||
suite.addTestSuite(ConnectionTest.class);
|
||||
suite.addTestSuite(DatabaseMetaDataTest.class);
|
||||
suite.addTestSuite(EncodingTest.class);
|
||||
|
||||
// Connectivity/Protocols
|
||||
|
||||
// ResultSet
|
||||
suite.addTestSuite(ResultSetTest.class);
|
||||
|
||||
// Time, Date, Timestamp
|
||||
suite.addTestSuite(DateTest.class);
|
||||
suite.addTestSuite(TimeTest.class);
|
||||
suite.addTestSuite(TimestampTest.class);
|
||||
|
||||
// PreparedStatement
|
||||
|
||||
// BatchExecute
|
||||
suite.addTestSuite(BatchExecuteTest.class);
|
||||
|
||||
// MetaData
|
||||
|
||||
// Other misc tests, based on previous problems users have had or specific
|
||||
// features some applications require.
|
||||
suite.addTestSuite(JBuilderTest.class);
|
||||
suite.addTestSuite(MiscTest.class);
|
||||
|
||||
// Fastpath/LargeObject
|
||||
suite.addTestSuite(BlobTest.class);
|
||||
suite.addTestSuite( UpdateableResultTest.class );
|
||||
|
||||
suite.addTestSuite( CallableStmtTest.class );
|
||||
|
||||
// That's all folks
|
||||
return suite;
|
||||
}
|
||||
}
|
@@ -1,11 +1,11 @@
|
||||
package org.postgresql.test.jdbc2;
|
||||
|
||||
import org.postgresql.test.JDBC2Tests;
|
||||
import org.postgresql.test.TestUtil;
|
||||
import junit.framework.TestCase;
|
||||
import java.sql.*;
|
||||
|
||||
/*
|
||||
* $Id: MiscTest.java,v 1.6 2002/06/14 10:56:13 davec Exp $
|
||||
* $Id: MiscTest.java,v 1.7 2002/08/14 20:35:40 barry Exp $
|
||||
*
|
||||
* Some simple tests based on problems reported by users. Hopefully these will
|
||||
* help prevent previous problems from re-occuring ;-)
|
||||
@@ -30,7 +30,7 @@ public class MiscTest extends TestCase
|
||||
{
|
||||
try
|
||||
{
|
||||
Connection con = JDBC2Tests.openDB();
|
||||
Connection con = TestUtil.openDB();
|
||||
|
||||
Statement st = con.createStatement();
|
||||
ResultSet rs = st.executeQuery("select datname from pg_database");
|
||||
@@ -44,7 +44,7 @@ public class MiscTest extends TestCase
|
||||
rs.close();
|
||||
st.close();
|
||||
|
||||
JDBC2Tests.closeDB(con);
|
||||
TestUtil.closeDB(con);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -54,7 +54,7 @@ public class MiscTest extends TestCase
|
||||
|
||||
public void testError()
|
||||
{
|
||||
Connection con = JDBC2Tests.openDB();
|
||||
Connection con = TestUtil.openDB();
|
||||
try
|
||||
{
|
||||
|
||||
@@ -81,17 +81,17 @@ public class MiscTest extends TestCase
|
||||
System.out.println("testing lock");
|
||||
try
|
||||
{
|
||||
Connection con = JDBC2Tests.openDB();
|
||||
Connection con2 = JDBC2Tests.openDB();
|
||||
Connection con = TestUtil.openDB();
|
||||
Connection con2 = TestUtil.openDB();
|
||||
|
||||
JDBC2Tests.createTable(con, "test_lock", "name text");
|
||||
TestUtil.createTable(con, "test_lock", "name text");
|
||||
Statement st = con.createStatement();
|
||||
Statement st2 = con2.createStatement();
|
||||
con.setAutoCommit(false);
|
||||
st.execute("lock table test_lock");
|
||||
st2.executeUpdate( "insert into test_lock ( name ) values ('hello')" );
|
||||
con.commit();
|
||||
JDBC2Tests.dropTable(con, "test_lock");
|
||||
TestUtil.dropTable(con, "test_lock");
|
||||
con.close();
|
||||
}
|
||||
catch ( Exception ex )
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package org.postgresql.test.jdbc2;
|
||||
|
||||
import org.postgresql.test.JDBC2Tests;
|
||||
import org.postgresql.test.TestUtil;
|
||||
import junit.framework.TestCase;
|
||||
import java.io.*;
|
||||
import java.sql.*;
|
||||
@@ -19,10 +19,10 @@ public class ResultSetTest extends TestCase
|
||||
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
con = JDBC2Tests.openDB();
|
||||
con = TestUtil.openDB();
|
||||
Statement stmt = con.createStatement();
|
||||
|
||||
JDBC2Tests.createTable(con, "testrs", "id integer");
|
||||
TestUtil.createTable(con, "testrs", "id integer");
|
||||
|
||||
stmt.executeUpdate("INSERT INTO testrs VALUES (1)");
|
||||
stmt.executeUpdate("INSERT INTO testrs VALUES (2)");
|
||||
@@ -36,8 +36,8 @@ public class ResultSetTest extends TestCase
|
||||
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
JDBC2Tests.dropTable(con, "testrs");
|
||||
JDBC2Tests.closeDB(con);
|
||||
TestUtil.dropTable(con, "testrs");
|
||||
TestUtil.closeDB(con);
|
||||
}
|
||||
|
||||
public void testAbsolute() throws Exception
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package org.postgresql.test.jdbc2;
|
||||
|
||||
import org.postgresql.test.JDBC2Tests;
|
||||
import org.postgresql.test.TestUtil;
|
||||
import junit.framework.TestCase;
|
||||
import java.sql.*;
|
||||
|
||||
/*
|
||||
* $Id: TimeTest.java,v 1.4 2001/11/19 22:33:39 momjian Exp $
|
||||
* $Id: TimeTest.java,v 1.5 2002/08/14 20:35:40 barry Exp $
|
||||
*
|
||||
* Some simple tests based on problems reported by users. Hopefully these will
|
||||
* help prevent previous problems from re-occuring ;-)
|
||||
@@ -23,14 +23,14 @@ public class TimeTest extends TestCase
|
||||
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
con = JDBC2Tests.openDB();
|
||||
JDBC2Tests.createTable(con, "testtime", "tm time");
|
||||
con = TestUtil.openDB();
|
||||
TestUtil.createTable(con, "testtime", "tm time");
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
JDBC2Tests.dropTable(con, "testtime");
|
||||
JDBC2Tests.closeDB(con);
|
||||
TestUtil.dropTable(con, "testtime");
|
||||
TestUtil.closeDB(con);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -42,8 +42,8 @@ public class TimeTest extends TestCase
|
||||
{
|
||||
Statement stmt = con.createStatement();
|
||||
|
||||
assertEquals(1, stmt.executeUpdate(JDBC2Tests.insertSQL("testtime", "'01:02:03'")));
|
||||
assertEquals(1, stmt.executeUpdate(JDBC2Tests.insertSQL("testtime", "'23:59:59'")));
|
||||
assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testtime", "'01:02:03'")));
|
||||
assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testtime", "'23:59:59'")));
|
||||
|
||||
// Fall through helper
|
||||
timeTest();
|
||||
@@ -64,7 +64,7 @@ public class TimeTest extends TestCase
|
||||
{
|
||||
try
|
||||
{
|
||||
PreparedStatement ps = con.prepareStatement(JDBC2Tests.insertSQL("testtime", "?"));
|
||||
PreparedStatement ps = con.prepareStatement(TestUtil.insertSQL("testtime", "?"));
|
||||
Statement stmt = con.createStatement();
|
||||
|
||||
ps.setTime(1, makeTime(1, 2, 3));
|
||||
@@ -95,7 +95,7 @@ public class TimeTest extends TestCase
|
||||
ResultSet rs;
|
||||
java.sql.Time t;
|
||||
|
||||
rs = st.executeQuery(JDBC2Tests.selectSQL("testtime", "tm"));
|
||||
rs = st.executeQuery(TestUtil.selectSQL("testtime", "tm"));
|
||||
assertNotNull(rs);
|
||||
|
||||
assertTrue(rs.next());
|
||||
@@ -115,8 +115,8 @@ public class TimeTest extends TestCase
|
||||
|
||||
private java.sql.Time makeTime(int h, int m, int s)
|
||||
{
|
||||
return java.sql.Time.valueOf(JDBC2Tests.fix(h, 2) + ":" +
|
||||
JDBC2Tests.fix(m, 2) + ":" +
|
||||
JDBC2Tests.fix(s, 2));
|
||||
return java.sql.Time.valueOf(TestUtil.fix(h, 2) + ":" +
|
||||
TestUtil.fix(m, 2) + ":" +
|
||||
TestUtil.fix(s, 2));
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package org.postgresql.test.jdbc2;
|
||||
|
||||
import org.postgresql.test.JDBC2Tests;
|
||||
import org.postgresql.test.TestUtil;
|
||||
import junit.framework.TestCase;
|
||||
import java.sql.*;
|
||||
|
||||
/*
|
||||
* $Id: TimestampTest.java,v 1.7 2002/07/23 03:59:55 barry Exp $
|
||||
* $Id: TimestampTest.java,v 1.8 2002/08/14 20:35:40 barry Exp $
|
||||
*
|
||||
* Test get/setTimestamp for both timestamp with time zone and
|
||||
* timestamp without time zone datatypes
|
||||
@@ -23,18 +23,18 @@ public class TimestampTest extends TestCase
|
||||
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
con = JDBC2Tests.openDB();
|
||||
con = TestUtil.openDB();
|
||||
Statement stmt = con.createStatement();
|
||||
|
||||
JDBC2Tests.createTable(con, TSWTZ_TABLE, "ts timestamp with time zone");
|
||||
JDBC2Tests.createTable(con, TSWOTZ_TABLE, "ts timestamp without time zone");
|
||||
TestUtil.createTable(con, TSWTZ_TABLE, "ts timestamp with time zone");
|
||||
TestUtil.createTable(con, TSWOTZ_TABLE, "ts timestamp without time zone");
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
JDBC2Tests.dropTable(con, TSWTZ_TABLE);
|
||||
JDBC2Tests.dropTable(con, TSWOTZ_TABLE);
|
||||
JDBC2Tests.closeDB(con);
|
||||
TestUtil.dropTable(con, TSWTZ_TABLE);
|
||||
TestUtil.dropTable(con, TSWOTZ_TABLE);
|
||||
TestUtil.closeDB(con);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -49,9 +49,9 @@ public class TimestampTest extends TestCase
|
||||
Statement stmt = con.createStatement();
|
||||
|
||||
//Insert the three timestamp values in raw pg format
|
||||
assertEquals(1, stmt.executeUpdate(JDBC2Tests.insertSQL(TSWTZ_TABLE,"'" + TS1WTZ_PGFORMAT + "'")));
|
||||
assertEquals(1, stmt.executeUpdate(JDBC2Tests.insertSQL(TSWTZ_TABLE,"'" + TS2WTZ_PGFORMAT + "'")));
|
||||
assertEquals(1, stmt.executeUpdate(JDBC2Tests.insertSQL(TSWTZ_TABLE,"'" + TS3WTZ_PGFORMAT + "'")));
|
||||
assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE,"'" + TS1WTZ_PGFORMAT + "'")));
|
||||
assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE,"'" + TS2WTZ_PGFORMAT + "'")));
|
||||
assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE,"'" + TS3WTZ_PGFORMAT + "'")));
|
||||
|
||||
// Fall through helper
|
||||
timestampTestWTZ();
|
||||
@@ -77,7 +77,7 @@ public class TimestampTest extends TestCase
|
||||
try
|
||||
{
|
||||
Statement stmt = con.createStatement();
|
||||
PreparedStatement pstmt = con.prepareStatement(JDBC2Tests.insertSQL(TSWTZ_TABLE, "?"));
|
||||
PreparedStatement pstmt = con.prepareStatement(TestUtil.insertSQL(TSWTZ_TABLE, "?"));
|
||||
|
||||
pstmt.setTimestamp(1, TS1WTZ);
|
||||
assertEquals(1, pstmt.executeUpdate());
|
||||
@@ -114,9 +114,9 @@ public class TimestampTest extends TestCase
|
||||
Statement stmt = con.createStatement();
|
||||
|
||||
//Insert the three timestamp values in raw pg format
|
||||
assertEquals(1, stmt.executeUpdate(JDBC2Tests.insertSQL(TSWOTZ_TABLE,"'" + TS1WOTZ_PGFORMAT + "'")));
|
||||
assertEquals(1, stmt.executeUpdate(JDBC2Tests.insertSQL(TSWOTZ_TABLE,"'" + TS2WOTZ_PGFORMAT + "'")));
|
||||
assertEquals(1, stmt.executeUpdate(JDBC2Tests.insertSQL(TSWOTZ_TABLE,"'" + TS3WOTZ_PGFORMAT + "'")));
|
||||
assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE,"'" + TS1WOTZ_PGFORMAT + "'")));
|
||||
assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE,"'" + TS2WOTZ_PGFORMAT + "'")));
|
||||
assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE,"'" + TS3WOTZ_PGFORMAT + "'")));
|
||||
|
||||
// Fall through helper
|
||||
timestampTestWOTZ();
|
||||
@@ -143,7 +143,7 @@ public class TimestampTest extends TestCase
|
||||
try
|
||||
{
|
||||
Statement stmt = con.createStatement();
|
||||
PreparedStatement pstmt = con.prepareStatement(JDBC2Tests.insertSQL(TSWOTZ_TABLE, "?"));
|
||||
PreparedStatement pstmt = con.prepareStatement(TestUtil.insertSQL(TSWOTZ_TABLE, "?"));
|
||||
|
||||
pstmt.setTimestamp(1, TS1WOTZ);
|
||||
assertEquals(1, pstmt.executeUpdate());
|
||||
@@ -240,12 +240,12 @@ public class TimestampTest extends TestCase
|
||||
java.text.DateFormat l_df;
|
||||
try {
|
||||
String l_ts;
|
||||
l_ts = JDBC2Tests.fix(y, 4) + "-" +
|
||||
JDBC2Tests.fix(m, 2) + "-" +
|
||||
JDBC2Tests.fix(d, 2) + " " +
|
||||
JDBC2Tests.fix(h, 2) + ":" +
|
||||
JDBC2Tests.fix(mn, 2) + ":" +
|
||||
JDBC2Tests.fix(se, 2) + " ";
|
||||
l_ts = TestUtil.fix(y, 4) + "-" +
|
||||
TestUtil.fix(m, 2) + "-" +
|
||||
TestUtil.fix(d, 2) + " " +
|
||||
TestUtil.fix(h, 2) + ":" +
|
||||
TestUtil.fix(mn, 2) + ":" +
|
||||
TestUtil.fix(se, 2) + " ";
|
||||
|
||||
if (tz == null) {
|
||||
l_df = new java.text.SimpleDateFormat("y-M-d H:m:s");
|
||||
|
@@ -3,7 +3,7 @@ package org.postgresql.test.jdbc2;
|
||||
import java.sql.*;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.postgresql.test.JDBC2Tests;
|
||||
import org.postgresql.test.TestUtil;
|
||||
/**
|
||||
* <p>Title: </p>
|
||||
* <p>Description: </p>
|
||||
@@ -25,12 +25,12 @@ public class UpdateableResultTest extends TestCase
|
||||
{
|
||||
try
|
||||
{
|
||||
Connection con = JDBC2Tests.openDB();
|
||||
JDBC2Tests.createTable(con, "updateable","id int primary key, name text, notselected text");
|
||||
JDBC2Tests.createTable(con, "second","id1 int primary key, name1 text");
|
||||
Connection con = TestUtil.openDB();
|
||||
TestUtil.createTable(con, "updateable","id int primary key, name text, notselected text");
|
||||
TestUtil.createTable(con, "second","id1 int primary key, name1 text");
|
||||
Statement st1 = con.createStatement();
|
||||
boolean retVal = st1.execute( "insert into updateable ( id, name, notselected ) values (1, 'jake', 'avalue')" );
|
||||
assert( retVal== false );
|
||||
assertTrue(!retVal);
|
||||
|
||||
retVal = st1.execute( "insert into second (id1, name1) values (1, 'jake')" );
|
||||
assertTrue( !retVal );
|
||||
@@ -121,8 +121,8 @@ public class UpdateableResultTest extends TestCase
|
||||
|
||||
st.close();
|
||||
|
||||
JDBC2Tests.dropTable( con,"updateable" );
|
||||
JDBC2Tests.closeDB( con );
|
||||
TestUtil.dropTable( con,"updateable" );
|
||||
TestUtil.closeDB( con );
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@@ -0,0 +1,23 @@
|
||||
package org.postgresql.test.jdbc3;
|
||||
|
||||
import junit.framework.TestSuite;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.Test;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
/*
|
||||
* Executes all known tests for JDBC3
|
||||
*/
|
||||
public class Jdbc3TestSuite extends TestSuite
|
||||
{
|
||||
|
||||
/*
|
||||
* The main entry point for JUnit
|
||||
*/
|
||||
public static TestSuite suite()
|
||||
{
|
||||
//Currently there are no specific jdbc3 tests so just run the jdbc2 tests
|
||||
return org.postgresql.test.jdbc2.Jdbc2TestSuite.suite();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user