Fix regression test 068
authorTakuma Hoshiai <hoshiai@sraoss.co.jp>
Fri, 15 Feb 2019 07:20:43 +0000 (16:20 +0900)
committerTakuma Hoshiai <hoshiai@sraoss.co.jp>
Fri, 15 Feb 2019 07:20:43 +0000 (16:20 +0900)
It was not working correctly, because a function of old jdbc and some fixed variable were used by this test case.

And other, typo is fixed.

src/libs/pcp/pcp.c
src/test/regression/tests/068.memqcache_bug/Sample.java
src/test/regression/tests/068.memqcache_bug/test.sh

index 50c5bf7c14fed0ad0e3e6a27dc99393022dff654..a421923d98be3e06d23a96e9b6f9652815e692ee 100644 (file)
@@ -1,5 +1,5 @@
 /*
-FILE * $Header$
+ * $Header$
  *
  * Handles PCP connection, and protocol communication with pgpool-II
  * These are client APIs. Server program should use APIs in pcp_stream.c
@@ -8,7 +8,7 @@ FILE * $Header$
  * pgpool: a language independent connection pool server for PostgreSQL
  * written by Tatsuo Ishii
  *
- * Copyright (c) 2003-2016     PgPool Global Development Group
+ * Copyright (c) 2003-2019     PgPool Global Development Group
  *
  * Permission to use, copy, modify, and distribute this software and
  * its documentation for any purpose and without fee is hereby
index a73154b7dd2e15627755d81134e862a512ae7c1e..bacf9a9c8394cb8d2112e3354d51a5d7af5499f9 100644 (file)
@@ -1,4 +1,5 @@
 import java.io.PrintWriter;
+import java.io.FileInputStream;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.ResultSet;
@@ -14,13 +15,13 @@ public class Sample {
     public static void main(String[] args) throws Exception {
         ResultSet rs;
         Properties props = new Properties();
-        props.setProperty("user", "t-ishii");
-        props.setProperty("password", "");
-        props.setProperty("protocolVersion", "3");
+        props.load(new FileInputStream("javatest.prop"));
+        String url = props.getProperty("jdbc.url");
+        String user = props.getProperty("jdbc.user");
+        String pwd = props.getProperty("jdbc.password");
+
         DriverManager.setLogWriter(new PrintWriter(System.out));
-        Driver.setLogLevel(2);
-        Connection conn = DriverManager.getConnection(
-                "jdbc:postgresql://localhost:11000/test", props);
+        Connection conn = DriverManager.getConnection(url, user, pwd);
         conn.setAutoCommit(true);
         Statement st = conn.createStatement();
         st.setFetchSize(100);
index 7f800c00a8c91d5cbc910aade8a5636201178cab..05746cf7a8917e4c1fe89ed75a2b0124d1dee61d 100755 (executable)
@@ -5,9 +5,10 @@
 # requires Java PostgreSQL JDBC driver.
 
 source $TESTLIBS
+WHOAMI=`whoami`
 TESTDIR=testdir
 PSQL=$PGBIN/psql
-export CLASSPATH=.:/usr/local/pgsql/share/postgresql-9.2-1003.jdbc4.jar
+export CLASSPATH=.:$JDBC_DRIVER
 
 rm -fr $TESTDIR
 mkdir $TESTDIR
@@ -22,18 +23,22 @@ source ./bashrc.ports
 
 export PGPORT=$PGPOOL_PORT
 
+echo "jdbc.url=jdbc:postgresql://localhost:$PGPOOL_PORT/test" > javatest.prop
+echo "jdbc.user=$WHOAMI" >> javatest.prop
+echo "jdbc.password=" >> javatest.prop
+
+
 echo "memory_cache_enabled = on" >> etc/pgpool.conf
 sh startall
 wait_for_pgpool_startup
 
-cd ..
+cp ../Sample.java .
 $PSQL test <<EOF
 DROP TABLE IF EXISTS t1;
 CREATE TABLE t1(i int);
 EOF
 javac Sample.java
 java Sample    # hang here if the bug bites you...
-cd $TESTDIR
 sh shutdownall
 exit 0