[libpostgresql-jdbc-java] 01/19: patch from Kris Jurka to allow the server end port to be specified when running regression tests, this is a backpatch to 7.4

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:19:06 UTC 2017


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to tag REL7_4_1
in repository libpostgresql-jdbc-java.

commit 3cdae4f7bb42eac510744def74c773aa44e3efc9
Author: Dave Cramer <davec at fastcrypt.com>
Date:   Fri Dec 5 21:06:12 2003 +0000

    patch from Kris Jurka to allow the server end port to be specified when running
    regression tests, this is a backpatch to 7.4
---
 org/postgresql/test/TestUtil.java                  | 24 ++++++++++++++++++++++
 .../test/jdbc2/optional/ConnectionPoolTest.java    | 13 +++---------
 .../test/jdbc2/optional/PoolingDataSourceTest.java | 13 +++---------
 .../test/jdbc2/optional/SimpleDataSourceTest.java  | 13 +++---------
 .../test/jdbc3/Jdbc3ConnectionPoolTest.java        | 13 +++---------
 .../test/jdbc3/Jdbc3PoolingDataSourceTest.java     | 12 +++--------
 .../test/jdbc3/Jdbc3SimpleDataSourceTest.java      | 13 +++---------
 7 files changed, 42 insertions(+), 59 deletions(-)

diff --git a/org/postgresql/test/TestUtil.java b/org/postgresql/test/TestUtil.java
index 930215e..6b13943 100644
--- a/org/postgresql/test/TestUtil.java
+++ b/org/postgresql/test/TestUtil.java
@@ -13,6 +13,30 @@ public class TestUtil
 	 */
 	public static String getURL()
 	{
+		return "jdbc:postgresql://"+getServer()+":"+getPort()+"/"+getDatabase();
+	}
+
+	/*
+	 * Returns the Test server
+	 */
+	public static String getServer()
+	{
+		return System.getProperty("server");
+	}
+
+	/*
+	 * Returns the Test port
+	 */
+	public static int getPort()
+	{
+		return Integer.parseInt(System.getProperty("port"));
+	}
+
+	/*
+	 * Returns the Test database
+	 */
+	public static String getDatabase()
+	{
 		return System.getProperty("database");
 	}
 
diff --git a/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java b/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java
index 4d9afe1..5cd92db 100644
--- a/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java
+++ b/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java
@@ -31,16 +31,9 @@ public class ConnectionPoolTest extends BaseDataSourceTest
 		if (bds == null)
 		{
 			bds = new ConnectionPool();
-			String db = TestUtil.getURL();
-			if (db.indexOf('/') > -1)
-			{
-				db = db.substring(db.lastIndexOf('/') + 1);
-			}
-			else if (db.indexOf(':') > -1)
-			{
-				db = db.substring(db.lastIndexOf(':') + 1);
-			}
-			bds.setDatabaseName(db);
+			bds.setServerName(TestUtil.getServer());
+			bds.setPortNumber(TestUtil.getPort());
+			bds.setDatabaseName(TestUtil.getDatabase());
 			bds.setUser(TestUtil.getUser());
 			bds.setPassword(TestUtil.getPassword());
 		}
diff --git a/org/postgresql/test/jdbc2/optional/PoolingDataSourceTest.java b/org/postgresql/test/jdbc2/optional/PoolingDataSourceTest.java
index 1a3e800..c595ebb 100644
--- a/org/postgresql/test/jdbc2/optional/PoolingDataSourceTest.java
+++ b/org/postgresql/test/jdbc2/optional/PoolingDataSourceTest.java
@@ -40,16 +40,9 @@ public class PoolingDataSourceTest extends BaseDataSourceTest
         if (bds == null)
         {
             bds = new PoolingDataSource();
-            String db = TestUtil.getURL();
-            if (db.indexOf('/') > -1)
-            {
-                db = db.substring(db.lastIndexOf('/') + 1);
-            }
-            else if (db.indexOf(':') > -1)
-            {
-                db = db.substring(db.lastIndexOf(':') + 1);
-            }
-            bds.setDatabaseName(db);
+            bds.setServerName(TestUtil.getServer());
+            bds.setPortNumber(TestUtil.getPort());
+            bds.setDatabaseName(TestUtil.getDatabase());
             bds.setUser(TestUtil.getUser());
             bds.setPassword(TestUtil.getPassword());
             ((PoolingDataSource) bds).setDataSourceName(DS_NAME);
diff --git a/org/postgresql/test/jdbc2/optional/SimpleDataSourceTest.java b/org/postgresql/test/jdbc2/optional/SimpleDataSourceTest.java
index 29c022d..6b64219 100644
--- a/org/postgresql/test/jdbc2/optional/SimpleDataSourceTest.java
+++ b/org/postgresql/test/jdbc2/optional/SimpleDataSourceTest.java
@@ -28,16 +28,9 @@ public class SimpleDataSourceTest extends BaseDataSourceTest
 		if (bds == null)
 		{
 			bds = new SimpleDataSource();
-			String db = TestUtil.getURL();
-			if (db.indexOf('/') > -1)
-			{
-				db = db.substring(db.lastIndexOf('/') + 1);
-			}
-			else if (db.indexOf(':') > -1)
-			{
-				db = db.substring(db.lastIndexOf(':') + 1);
-			}
-			bds.setDatabaseName(db);
+			bds.setServerName(TestUtil.getServer());
+			bds.setPortNumber(TestUtil.getPort());
+			bds.setDatabaseName(TestUtil.getDatabase());
 			bds.setUser(TestUtil.getUser());
 			bds.setPassword(TestUtil.getPassword());
 		}
diff --git a/org/postgresql/test/jdbc3/Jdbc3ConnectionPoolTest.java b/org/postgresql/test/jdbc3/Jdbc3ConnectionPoolTest.java
index b224134..c6698cc 100644
--- a/org/postgresql/test/jdbc3/Jdbc3ConnectionPoolTest.java
+++ b/org/postgresql/test/jdbc3/Jdbc3ConnectionPoolTest.java
@@ -29,16 +29,9 @@ public class Jdbc3ConnectionPoolTest extends ConnectionPoolTest
         if (bds == null)
         {
             bds = new Jdbc3ConnectionPool();
-            String db = TestUtil.getURL();
-            if (db.indexOf('/') > -1)
-            {
-                db = db.substring(db.lastIndexOf('/') + 1);
-            }
-            else if (db.indexOf(':') > -1)
-            {
-                db = db.substring(db.lastIndexOf(':') + 1);
-            }
-            bds.setDatabaseName(db);
+            bds.setServerName(TestUtil.getServer());
+            bds.setPortNumber(TestUtil.getPort());
+            bds.setDatabaseName(TestUtil.getDatabase());
             bds.setUser(TestUtil.getUser());
             bds.setPassword(TestUtil.getPassword());
         }
diff --git a/org/postgresql/test/jdbc3/Jdbc3PoolingDataSourceTest.java b/org/postgresql/test/jdbc3/Jdbc3PoolingDataSourceTest.java
index 196d36d..b9e2dad 100644
--- a/org/postgresql/test/jdbc3/Jdbc3PoolingDataSourceTest.java
+++ b/org/postgresql/test/jdbc3/Jdbc3PoolingDataSourceTest.java
@@ -42,15 +42,9 @@ public class Jdbc3PoolingDataSourceTest extends PoolingDataSourceTest
     private void configureDataSource(PoolingDataSource source)
     {
         String db = TestUtil.getURL();
-        if (db.indexOf('/') > -1)
-        {
-            db = db.substring(db.lastIndexOf('/') + 1);
-        }
-        else if (db.indexOf(':') > -1)
-        {
-            db = db.substring(db.lastIndexOf(':') + 1);
-        }
-        source.setDatabaseName(db);
+        source.setServerName(TestUtil.getServer());
+        source.setPortNumber(TestUtil.getPort());
+        source.setDatabaseName(TestUtil.getDatabase());
         source.setUser(TestUtil.getUser());
         source.setPassword(TestUtil.getPassword());
         source.setDataSourceName(DS_NAME);
diff --git a/org/postgresql/test/jdbc3/Jdbc3SimpleDataSourceTest.java b/org/postgresql/test/jdbc3/Jdbc3SimpleDataSourceTest.java
index bb0fa00..c0760d3 100644
--- a/org/postgresql/test/jdbc3/Jdbc3SimpleDataSourceTest.java
+++ b/org/postgresql/test/jdbc3/Jdbc3SimpleDataSourceTest.java
@@ -29,16 +29,9 @@ public class Jdbc3SimpleDataSourceTest extends SimpleDataSourceTest {
         if (bds == null)
         {
             bds = new Jdbc3SimpleDataSource();
-            String db = TestUtil.getURL();
-            if (db.indexOf('/') > -1)
-            {
-                db = db.substring(db.lastIndexOf('/') + 1);
-            }
-            else if (db.indexOf(':') > -1)
-            {
-                db = db.substring(db.lastIndexOf(':') + 1);
-            }
-            bds.setDatabaseName(db);
+            bds.setServerName(TestUtil.getServer());
+            bds.setPortNumber(TestUtil.getPort());
+            bds.setDatabaseName(TestUtil.getDatabase());
             bds.setUser(TestUtil.getUser());
             bds.setPassword(TestUtil.getPassword());
         }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git



More information about the pkg-java-commits mailing list