Index: pgjdbc/org/postgresql/test/TestUtil.java =================================================================== --- pgjdbc.orig/org/postgresql/test/TestUtil.java +++ pgjdbc/org/postgresql/test/TestUtil.java @@ -9,6 +9,9 @@ */ package org.postgresql.test; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; import java.sql.*; import java.util.Properties; @@ -49,7 +52,7 @@ public class TestUtil */ public static String getServer() { - return System.getProperty("server"); + return System.getProperty("server", "localhost"); } /* @@ -57,7 +60,7 @@ public class TestUtil */ public static int getPort() { - return Integer.parseInt(System.getProperty("port")); + return Integer.parseInt(System.getProperty("port", System.getProperty("def_pgport"))); } /* @@ -65,12 +68,12 @@ public class TestUtil */ public static int getPrepareThreshold() { - return Integer.parseInt(System.getProperty("preparethreshold")); + return Integer.parseInt(System.getProperty("preparethreshold", "5")); } public static int getProtocolVersion() { - return Integer.parseInt(System.getProperty("protocolVersion")); + return Integer.parseInt(System.getProperty("protocolVersion", "0")); } /* @@ -102,7 +105,7 @@ public class TestUtil */ public static int getLogLevel() { - return Integer.parseInt(System.getProperty("loglevel")); + return Integer.parseInt(System.getProperty("loglevel", "0")); } /* @@ -120,6 +123,16 @@ public class TestUtil if (initialized) return; + Properties p = new Properties(); + try { + p.load(new FileInputStream("build.properties")); + p.load(new FileInputStream("build.local.properties")); + } catch (IOException ex) { + // ignore + } + p.putAll(System.getProperties()); + System.getProperties().putAll(p); + if (getLogLevel() > 0) { // Ant's junit task likes to buffer stdout/stderr and tends to run out of memory. // So we put debugging output to a file instead.