Commit b720fa96 authored by Dave Cramer's avatar Dave Cramer

patch for rs.previous and test case as well as patch for allowing server and...

patch for rs.previous and test case as well as patch for allowing server and port to be specified in test cases
parent efea5da4
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
This file now requires Ant 1.4.1. 2002-04-18 This file now requires Ant 1.4.1. 2002-04-18
$Header: /cvsroot/pgsql/src/interfaces/jdbc/Attic/build.xml,v 1.36 2003/08/24 22:10:09 barry Exp $ $Header: /cvsroot/pgsql/src/interfaces/jdbc/Attic/build.xml,v 1.37 2003/11/03 15:28:26 davec Exp $
--> -->
...@@ -305,7 +305,9 @@ ...@@ -305,7 +305,9 @@
<!-- This compiles and executes the JUnit tests --> <!-- This compiles and executes the JUnit tests -->
<!-- defaults for the tests - override these if required --> <!-- defaults for the tests - override these if required -->
<property name="database" value="jdbc:postgresql:test" /> <property name="server" value="localhost" />
<property name="port" value="${def_pgport}" />
<property name="database" value="test" />
<property name="username" value="test" /> <property name="username" value="test" />
<!-- Password must be something. Doesn't matter if trust is used! --> <!-- Password must be something. Doesn't matter if trust is used! -->
<property name="password" value="password" /> <property name="password" value="password" />
...@@ -337,6 +339,8 @@ ...@@ -337,6 +339,8 @@
<junit> <junit>
<formatter type="brief" usefile="false"/> <formatter type="brief" usefile="false"/>
<sysproperty key="server" value="${server}" />
<sysproperty key="port" value="${port}" />
<sysproperty key="database" value="${database}" /> <sysproperty key="database" value="${database}" />
<sysproperty key="username" value="${username}" /> <sysproperty key="username" value="${username}" />
<sysproperty key="password" value="${password}" /> <sysproperty key="password" value="${password}" />
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Copyright (c) 2003, PostgreSQL Global Development Group * Copyright (c) 2003, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.25 2003/10/29 02:39:09 davec Exp $ * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.26 2003/11/03 15:28:26 davec Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -493,6 +493,7 @@ public abstract class AbstractJdbc2ResultSet extends org.postgresql.jdbc1.Abstra ...@@ -493,6 +493,7 @@ public abstract class AbstractJdbc2ResultSet extends org.postgresql.jdbc1.Abstra
if (--current_row < 0) if (--current_row < 0)
return false; return false;
this_row = (byte[][]) rows.elementAt(current_row); this_row = (byte[][]) rows.elementAt(current_row);
rowBuffer = new byte[this_row.length][];
System.arraycopy(this_row, 0, rowBuffer, 0, this_row.length); System.arraycopy(this_row, 0, rowBuffer, 0, this_row.length);
return true; return true;
} }
......
...@@ -83,6 +83,16 @@ public class ResultSetTest extends TestCase ...@@ -83,6 +83,16 @@ public class ResultSetTest extends TestCase
TestUtil.closeDB(con); TestUtil.closeDB(con);
} }
public void testBackward() throws Exception
{
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM testrs");
rs.afterLast();
assertTrue(rs.previous());
rs.close();
stmt.close();
}
public void testAbsolute() throws Exception public void testAbsolute() throws Exception
{ {
Statement stmt = con.createStatement(); Statement stmt = con.createStatement();
......
...@@ -11,7 +11,7 @@ import java.sql.*; ...@@ -11,7 +11,7 @@ import java.sql.*;
* interface to the PooledConnection is through the CPDS. * interface to the PooledConnection is through the CPDS.
* *
* @author Aaron Mulder (ammulder@chariotsolutions.com) * @author Aaron Mulder (ammulder@chariotsolutions.com)
* @version $Revision: 1.6 $ * @version $Revision: 1.7 $
*/ */
public class ConnectionPoolTest extends BaseDataSourceTest public class ConnectionPoolTest extends BaseDataSourceTest
{ {
...@@ -31,16 +31,9 @@ public class ConnectionPoolTest extends BaseDataSourceTest ...@@ -31,16 +31,9 @@ public class ConnectionPoolTest extends BaseDataSourceTest
if (bds == null) if (bds == null)
{ {
bds = new ConnectionPool(); bds = new ConnectionPool();
String db = TestUtil.getURL(); bds.setServerName(TestUtil.getServer());
if (db.indexOf('/') > -1) bds.setPortNumber(TestUtil.getPort());
{ bds.setDatabaseName(TestUtil.getDatabase());
db = db.substring(db.lastIndexOf('/') + 1);
}
else if (db.indexOf(':') > -1)
{
db = db.substring(db.lastIndexOf(':') + 1);
}
bds.setDatabaseName(db);
bds.setUser(TestUtil.getUser()); bds.setUser(TestUtil.getUser());
bds.setPassword(TestUtil.getPassword()); bds.setPassword(TestUtil.getPassword());
} }
......
...@@ -9,7 +9,7 @@ import org.postgresql.jdbc2.optional.BaseDataSource; ...@@ -9,7 +9,7 @@ import org.postgresql.jdbc2.optional.BaseDataSource;
* Minimal tests for pooling DataSource. Needs many more. * Minimal tests for pooling DataSource. Needs many more.
* *
* @author Aaron Mulder (ammulder@chariotsolutions.com) * @author Aaron Mulder (ammulder@chariotsolutions.com)
* @version $Revision: 1.1 $ * @version $Revision: 1.2 $
*/ */
public class PoolingDataSourceTest extends BaseDataSourceTest public class PoolingDataSourceTest extends BaseDataSourceTest
{ {
...@@ -40,16 +40,9 @@ public class PoolingDataSourceTest extends BaseDataSourceTest ...@@ -40,16 +40,9 @@ public class PoolingDataSourceTest extends BaseDataSourceTest
if (bds == null) if (bds == null)
{ {
bds = new PoolingDataSource(); bds = new PoolingDataSource();
String db = TestUtil.getURL(); bds.setServerName(TestUtil.getServer());
if (db.indexOf('/') > -1) bds.setPortNumber(TestUtil.getPort());
{ bds.setDatabaseName(TestUtil.getDatabase());
db = db.substring(db.lastIndexOf('/') + 1);
}
else if (db.indexOf(':') > -1)
{
db = db.substring(db.lastIndexOf(':') + 1);
}
bds.setDatabaseName(db);
bds.setUser(TestUtil.getUser()); bds.setUser(TestUtil.getUser());
bds.setPassword(TestUtil.getPassword()); bds.setPassword(TestUtil.getPassword());
((PoolingDataSource) bds).setDataSourceName(DS_NAME); ((PoolingDataSource) bds).setDataSourceName(DS_NAME);
......
...@@ -8,7 +8,7 @@ import org.postgresql.jdbc2.optional.SimpleDataSource; ...@@ -8,7 +8,7 @@ import org.postgresql.jdbc2.optional.SimpleDataSource;
* configuration logic. * configuration logic.
* *
* @author Aaron Mulder (ammulder@chariotsolutions.com) * @author Aaron Mulder (ammulder@chariotsolutions.com)
* @version $Revision: 1.3 $ * @version $Revision: 1.4 $
*/ */
public class SimpleDataSourceTest extends BaseDataSourceTest public class SimpleDataSourceTest extends BaseDataSourceTest
{ {
...@@ -28,16 +28,9 @@ public class SimpleDataSourceTest extends BaseDataSourceTest ...@@ -28,16 +28,9 @@ public class SimpleDataSourceTest extends BaseDataSourceTest
if (bds == null) if (bds == null)
{ {
bds = new SimpleDataSource(); bds = new SimpleDataSource();
String db = TestUtil.getURL(); bds.setServerName(TestUtil.getServer());
if (db.indexOf('/') > -1) bds.setPortNumber(TestUtil.getPort());
{ bds.setDatabaseName(TestUtil.getDatabase());
db = db.substring(db.lastIndexOf('/') + 1);
}
else if (db.indexOf(':') > -1)
{
db = db.substring(db.lastIndexOf(':') + 1);
}
bds.setDatabaseName(db);
bds.setUser(TestUtil.getUser()); bds.setUser(TestUtil.getUser());
bds.setPassword(TestUtil.getPassword()); bds.setPassword(TestUtil.getPassword());
} }
......
...@@ -12,7 +12,7 @@ import javax.sql.PooledConnection; ...@@ -12,7 +12,7 @@ import javax.sql.PooledConnection;
* Tests JDBC3 implementation of ConnectionPoolDataSource. * Tests JDBC3 implementation of ConnectionPoolDataSource.
* *
* @author Aaron Mulder (ammulder@chariotsolutions.com) * @author Aaron Mulder (ammulder@chariotsolutions.com)
* @version $Revision: 1.2 $ * @version $Revision: 1.3 $
*/ */
public class Jdbc3ConnectionPoolTest extends ConnectionPoolTest public class Jdbc3ConnectionPoolTest extends ConnectionPoolTest
{ {
...@@ -29,16 +29,9 @@ public class Jdbc3ConnectionPoolTest extends ConnectionPoolTest ...@@ -29,16 +29,9 @@ public class Jdbc3ConnectionPoolTest extends ConnectionPoolTest
if (bds == null) if (bds == null)
{ {
bds = new Jdbc3ConnectionPool(); bds = new Jdbc3ConnectionPool();
String db = TestUtil.getURL(); bds.setServerName(TestUtil.getServer());
if (db.indexOf('/') > -1) bds.setPortNumber(TestUtil.getPort());
{ bds.setDatabaseName(TestUtil.getDatabase());
db = db.substring(db.lastIndexOf('/') + 1);
}
else if (db.indexOf(':') > -1)
{
db = db.substring(db.lastIndexOf(':') + 1);
}
bds.setDatabaseName(db);
bds.setUser(TestUtil.getUser()); bds.setUser(TestUtil.getUser());
bds.setPassword(TestUtil.getPassword()); bds.setPassword(TestUtil.getPassword());
} }
......
...@@ -13,7 +13,7 @@ import org.postgresql.jdbc2.optional.PoolingDataSource; ...@@ -13,7 +13,7 @@ import org.postgresql.jdbc2.optional.PoolingDataSource;
* Minimal tests for JDBC3 pooling DataSource. Needs many more. * Minimal tests for JDBC3 pooling DataSource. Needs many more.
* *
* @author Aaron Mulder (ammulder@chariotsolutions.com) * @author Aaron Mulder (ammulder@chariotsolutions.com)
* @version $Revision: 1.1 $ * @version $Revision: 1.2 $
*/ */
public class Jdbc3PoolingDataSourceTest extends PoolingDataSourceTest public class Jdbc3PoolingDataSourceTest extends PoolingDataSourceTest
{ {
...@@ -42,15 +42,9 @@ public class Jdbc3PoolingDataSourceTest extends PoolingDataSourceTest ...@@ -42,15 +42,9 @@ public class Jdbc3PoolingDataSourceTest extends PoolingDataSourceTest
private void configureDataSource(PoolingDataSource source) private void configureDataSource(PoolingDataSource source)
{ {
String db = TestUtil.getURL(); String db = TestUtil.getURL();
if (db.indexOf('/') > -1) source.setServerName(TestUtil.getServer());
{ source.setPortNumber(TestUtil.getPort());
db = db.substring(db.lastIndexOf('/') + 1); source.setDatabaseName(TestUtil.getDatabase());
}
else if (db.indexOf(':') > -1)
{
db = db.substring(db.lastIndexOf(':') + 1);
}
source.setDatabaseName(db);
source.setUser(TestUtil.getUser()); source.setUser(TestUtil.getUser());
source.setPassword(TestUtil.getPassword()); source.setPassword(TestUtil.getPassword());
source.setDataSourceName(DS_NAME); source.setDataSourceName(DS_NAME);
......
...@@ -10,7 +10,7 @@ import org.postgresql.jdbc3.*; ...@@ -10,7 +10,7 @@ import org.postgresql.jdbc3.*;
* Tests JDBC3 non-pooling DataSource. * Tests JDBC3 non-pooling DataSource.
* *
* @author Aaron Mulder (ammulder@chariotsolutions.com) * @author Aaron Mulder (ammulder@chariotsolutions.com)
* @version $Revision: 1.1 $ * @version $Revision: 1.2 $
*/ */
public class Jdbc3SimpleDataSourceTest extends SimpleDataSourceTest { public class Jdbc3SimpleDataSourceTest extends SimpleDataSourceTest {
/** /**
...@@ -29,16 +29,9 @@ public class Jdbc3SimpleDataSourceTest extends SimpleDataSourceTest { ...@@ -29,16 +29,9 @@ public class Jdbc3SimpleDataSourceTest extends SimpleDataSourceTest {
if (bds == null) if (bds == null)
{ {
bds = new Jdbc3SimpleDataSource(); bds = new Jdbc3SimpleDataSource();
String db = TestUtil.getURL(); bds.setServerName(TestUtil.getServer());
if (db.indexOf('/') > -1) bds.setPortNumber(TestUtil.getPort());
{ bds.setDatabaseName(TestUtil.getDatabase());
db = db.substring(db.lastIndexOf('/') + 1);
}
else if (db.indexOf(':') > -1)
{
db = db.substring(db.lastIndexOf(':') + 1);
}
bds.setDatabaseName(db);
bds.setUser(TestUtil.getUser()); bds.setUser(TestUtil.getUser());
bds.setPassword(TestUtil.getPassword()); bds.setPassword(TestUtil.getPassword());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment