Mercurial > hg > monetdb-java
changeset 458:333c3752e118
Adjust test BugConcurrent_sequences to check for the version of MonetDB server and accept the post Oct2020 server response as correct.
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Thu, 18 Mar 2021 17:23:53 +0100 (2021-03-18) |
parents | ebda95332d57 |
children | 3379e24f1187 |
files | tests/JDBC_API_Tester.java |
diffstat | 1 files changed, 52 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/JDBC_API_Tester.java +++ b/tests/JDBC_API_Tester.java @@ -3461,11 +3461,14 @@ final public class JDBC_API_Tester { private void BugConcurrent_sequences(String arg0) { sb.setLength(0); // clear the output log buffer + boolean isPostOct2020 = false; Connection con1 = null, con2 = null; Statement stmt1 = null, stmt2 = null; ResultSet rs1 = null, rs2 = null; try { con1 = DriverManager.getConnection(arg0); + DatabaseMetaData dbmd = con1.getMetaData(); + isPostOct2020 = (dbmd.getDatabaseMajorVersion() >=11) && (dbmd.getDatabaseMinorVersion() > 39); con2 = DriverManager.getConnection(arg0); stmt1 = con1.createStatement(); stmt2 = con2.createStatement(); @@ -3493,9 +3496,9 @@ final public class JDBC_API_Tester { try { con2.commit(); - sb.append("transaction client 2 PASSED :(\n"); + sb.append("transaction client 2 passed :)\n"); } catch (SQLException e) { - sb.append("transaction client 2 failed :)\n"); + sb.append("transaction client 2 failed!\n"); } con2.setAutoCommit(true); stmt2.executeUpdate("INSERT INTO tconc_seq(who) VALUES('client2')"); @@ -3525,6 +3528,53 @@ final public class JDBC_API_Tester { sb.append("FAILED: ").append(e.getMessage()).append("\n"); } + compareExpectedOutput("BugConcurrent_sequences", + isPostOct2020 ? + "0. true true\n" + + "0. true true\n" + + "1. create table tconc_seq using client 1... passed :)\n" + + "2. insert into tconc_seq using client 1 and 2... client 1 passed :)\n" + + "transaction on client 2 :)\n" + + "client 1 passed :)\n" + + "transaction client 2 passed :)\n" + + "passed :)\n" + + "2.1. check table status with client 1...\n" + + "1, client1\n" + + "2, client2\n" + + "3, client1\n" + + "4, client2\n" + + "passed :)\n" + + "2.2. check table status with client 2...\n" + + "1, client1\n" + + "2, client2\n" + + "3, client1\n" + + "4, client2\n" + + "passed :)\n" + + "3.1. drop table tconc_seq using client 1... passed :)\n" + + "3.1. recreate tconc_seq using client 1... passed :)\n" + : // behavior of older MonetDB versions (up to Oct2020 release) was different + "0. true true\n" + + "0. true true\n" + + "1. create table tconc_seq using client 1... passed :)\n" + + "2. insert into tconc_seq using client 1 and 2... client 1 passed :)\n" + + "transaction on client 2 :)\n" + + "client 1 passed :)\n" + + "transaction client 2 failed!\n" + + "passed :)\n" + + "2.1. check table status with client 1...\n" + + "1, client1\n" + + "3, client1\n" + + "4, client2\n" + + "passed :)\n" + + "2.2. check table status with client 2...\n" + + "1, client1\n" + + "3, client1\n" + + "4, client2\n" + + "passed :)\n" + + "3.1. drop table tconc_seq using client 1... passed :)\n" + + "3.1. recreate tconc_seq using client 1... passed :)\n"); + sb.setLength(0); // clear the output log buffer + try { // re-establish connection sb.append("x. Reconnecting client 1 and 2... "); @@ -3584,26 +3634,6 @@ final public class JDBC_API_Tester { closeConx(con1); compareExpectedOutput("BugConcurrent_sequences", - "0. true true\n" + - "0. true true\n" + - "1. create table tconc_seq using client 1... passed :)\n" + - "2. insert into tconc_seq using client 1 and 2... client 1 passed :)\n" + - "transaction on client 2 :)\n" + - "client 1 passed :)\n" + - "transaction client 2 failed :)\n" + - "passed :)\n" + - "2.1. check table status with client 1...\n" + - "1, client1\n" + - "3, client1\n" + - "4, client2\n" + - "passed :)\n" + - "2.2. check table status with client 2...\n" + - "1, client1\n" + - "3, client1\n" + - "4, client2\n" + - "passed :)\n" + - "3.1. drop table tconc_seq using client 1... passed :)\n" + - "3.1. recreate tconc_seq using client 1... passed :)\n" + "x. Reconnecting client 1 and 2... passed :)\n" + "4. insert into tconc_seq using client 1 and 2...\n" + "passed :)\n" +