Mercurial > hg > monetdb-java
comparison tests/JDBC_API_Tester.java @ 452:64789c018991
Avoid using table names called t1 in tests, make them more unique.
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Thu, 04 Mar 2021 19:17:27 +0100 (2021-03-04) |
parents | b9f82064fe0c |
children | 33756aa67a40 |
comparison
equal
deleted
inserted
replaced
451:3dfcd06fd8ba | 452:64789c018991 |
---|---|
3158 sb.append("0. true\t").append(con1.getAutoCommit()).append("\n"); | 3158 sb.append("0. true\t").append(con1.getAutoCommit()).append("\n"); |
3159 sb.append("0. true\t").append(con2.getAutoCommit()).append("\n"); | 3159 sb.append("0. true\t").append(con2.getAutoCommit()).append("\n"); |
3160 sb.append("0. true\t").append(con3.getAutoCommit()).append("\n"); | 3160 sb.append("0. true\t").append(con3.getAutoCommit()).append("\n"); |
3161 | 3161 |
3162 // test the creation of a table with concurrent clients | 3162 // test the creation of a table with concurrent clients |
3163 sb.append("1.1. create table t1 using client 1...\n"); | 3163 sb.append("1.1. create table t1504657 using client 1...\n"); |
3164 stmt1.executeUpdate("CREATE TABLE t1 ( id int, name varchar(1024) )"); | 3164 stmt1.executeUpdate("CREATE TABLE t1504657 ( id int, name varchar(1024) )"); |
3165 sb.append("passed :)\n"); | 3165 sb.append("passed :)\n"); |
3166 | 3166 |
3167 sb.append("1.2. check table existence in client 2...\n"); | 3167 sb.append("1.2. check table existence in client 2...\n"); |
3168 rs2 = stmt2.executeQuery("SELECT name FROM tables where name LIKE 't1'"); | 3168 rs2 = stmt2.executeQuery("SELECT name FROM tables where name LIKE 't1504657'"); |
3169 while (rs2.next()) | 3169 while (rs2.next()) |
3170 sb.append(rs2.getString("name")).append("\n"); | 3170 sb.append(rs2.getString("name")).append("\n"); |
3171 sb.append("passed :)\n"); | 3171 sb.append("passed :)\n"); |
3172 | 3172 |
3173 sb.append("1.3. check table existence in client 3...\n"); | 3173 sb.append("1.3. check table existence in client 3...\n"); |
3174 rs3 = stmt3.executeQuery("SELECT name FROM tables where name LIKE 't1'"); | 3174 rs3 = stmt3.executeQuery("SELECT name FROM tables where name LIKE 't1504657'"); |
3175 while (rs3.next()) | 3175 while (rs3.next()) |
3176 sb.append(rs3.getString("name")).append("\n"); | 3176 sb.append(rs3.getString("name")).append("\n"); |
3177 sb.append("passed :)\n"); | 3177 sb.append("passed :)\n"); |
3178 | 3178 |
3179 // test the insertion of values with concurrent clients | 3179 // test the insertion of values with concurrent clients |
3180 sb.append("2 insert into t1 using client 1...\n"); | 3180 sb.append("2 insert into t1504657 using client 1...\n"); |
3181 stmt1.executeUpdate("INSERT INTO t1 values( 1, 'monetdb' )"); | 3181 stmt1.executeUpdate("INSERT INTO t1504657 values( 1, 'monetdb' )"); |
3182 sb.append("passed :)\n"); | 3182 sb.append("passed :)\n"); |
3183 stmt1.executeUpdate("INSERT INTO t1 values( 2, 'monet' )"); | 3183 stmt1.executeUpdate("INSERT INTO t1504657 values( 2, 'monet' )"); |
3184 sb.append("passed :)\n"); | 3184 sb.append("passed :)\n"); |
3185 stmt1.executeUpdate("INSERT INTO t1 values( 3, 'mon' )"); | 3185 stmt1.executeUpdate("INSERT INTO t1504657 values( 3, 'mon' )"); |
3186 sb.append("passed :)\n"); | 3186 sb.append("passed :)\n"); |
3187 | 3187 |
3188 sb.append("2.1. check table status with client 1...\n"); | 3188 sb.append("2.1. check table status with client 1...\n"); |
3189 rs1 = stmt1.executeQuery("SELECT * FROM t1"); | 3189 rs1 = stmt1.executeQuery("SELECT * FROM t1504657"); |
3190 while (rs1.next()) | 3190 while (rs1.next()) |
3191 sb.append(rs1.getInt("id")).append(", ").append(rs1.getString("name")).append("\n"); | 3191 sb.append(rs1.getInt("id")).append(", ").append(rs1.getString("name")).append("\n"); |
3192 sb.append("passed :)\n"); | 3192 sb.append("passed :)\n"); |
3193 | 3193 |
3194 sb.append("2.2. check table status with client 2...\n"); | 3194 sb.append("2.2. check table status with client 2...\n"); |
3195 rs2 = stmt2.executeQuery("SELECT * FROM t1"); | 3195 rs2 = stmt2.executeQuery("SELECT * FROM t1504657"); |
3196 while (rs2.next()) | 3196 while (rs2.next()) |
3197 sb.append(rs2.getInt("id")).append(", ").append(rs2.getString("name")).append("\n"); | 3197 sb.append(rs2.getInt("id")).append(", ").append(rs2.getString("name")).append("\n"); |
3198 sb.append("passed :)\n"); | 3198 sb.append("passed :)\n"); |
3199 | 3199 |
3200 sb.append("2.3. check table status with client 3...\n"); | 3200 sb.append("2.3. check table status with client 3...\n"); |
3201 rs3 = stmt3.executeQuery("SELECT * FROM t1"); | 3201 rs3 = stmt3.executeQuery("SELECT * FROM t1504657"); |
3202 while (rs3.next()) | 3202 while (rs3.next()) |
3203 sb.append(rs3.getInt("id")).append(", ").append(rs3.getString("name")).append("\n"); | 3203 sb.append(rs3.getInt("id")).append(", ").append(rs3.getString("name")).append("\n"); |
3204 sb.append("passed :)\n"); | 3204 sb.append("passed :)\n"); |
3205 | 3205 |
3206 // test the insertion of values with concurrent clients | 3206 // test the insertion of values with concurrent clients |
3207 sb.append("3 insert into t1 using client 2...\n"); | 3207 sb.append("3 insert into t1504657 using client 2...\n"); |
3208 stmt2.executeUpdate("INSERT INTO t1 values( 4, 'monetdb' )"); | 3208 stmt2.executeUpdate("INSERT INTO t1504657 values( 4, 'monetdb' )"); |
3209 sb.append("passed :)\n"); | 3209 sb.append("passed :)\n"); |
3210 stmt2.executeUpdate("INSERT INTO t1 values( 5, 'monet' )"); | 3210 stmt2.executeUpdate("INSERT INTO t1504657 values( 5, 'monet' )"); |
3211 sb.append("passed :)\n"); | 3211 sb.append("passed :)\n"); |
3212 stmt2.executeUpdate("INSERT INTO t1 values( 6, 'mon' )"); | 3212 stmt2.executeUpdate("INSERT INTO t1504657 values( 6, 'mon' )"); |
3213 sb.append("passed :)\n"); | 3213 sb.append("passed :)\n"); |
3214 | 3214 |
3215 sb.append("3.1. check table status with client 1...\n"); | 3215 sb.append("3.1. check table status with client 1...\n"); |
3216 rs1 = stmt1.executeQuery("SELECT * FROM t1"); | 3216 rs1 = stmt1.executeQuery("SELECT * FROM t1504657"); |
3217 while (rs1.next()) | 3217 while (rs1.next()) |
3218 sb.append(rs1.getInt("id")).append(", ").append(rs1.getString("name")).append("\n"); | 3218 sb.append(rs1.getInt("id")).append(", ").append(rs1.getString("name")).append("\n"); |
3219 sb.append("passed :)\n"); | 3219 sb.append("passed :)\n"); |
3220 | 3220 |
3221 sb.append("3.2. check table status with client 2...\n"); | 3221 sb.append("3.2. check table status with client 2...\n"); |
3222 rs2 = stmt2.executeQuery("SELECT * FROM t1"); | 3222 rs2 = stmt2.executeQuery("SELECT * FROM t1504657"); |
3223 while (rs2.next()) | 3223 while (rs2.next()) |
3224 sb.append(rs2.getInt("id")).append(", ").append(rs2.getString("name")).append("\n"); | 3224 sb.append(rs2.getInt("id")).append(", ").append(rs2.getString("name")).append("\n"); |
3225 sb.append("passed :)\n"); | 3225 sb.append("passed :)\n"); |
3226 | 3226 |
3227 sb.append("3.3. check table status with client 3...\n"); | 3227 sb.append("3.3. check table status with client 3...\n"); |
3228 rs3 = stmt3.executeQuery("SELECT * FROM t1"); | 3228 rs3 = stmt3.executeQuery("SELECT * FROM t1504657"); |
3229 while (rs3.next()) | 3229 while (rs3.next()) |
3230 sb.append(rs3.getInt("id")).append(", ").append(rs3.getString("name")).append("\n"); | 3230 sb.append(rs3.getInt("id")).append(", ").append(rs3.getString("name")).append("\n"); |
3231 sb.append("passed :)\n"); | 3231 sb.append("passed :)\n"); |
3232 | 3232 |
3233 // test the insertion of values with concurrent clients | 3233 // test the insertion of values with concurrent clients |
3234 sb.append("4 insert into t1 using client 3...\n"); | 3234 sb.append("4 insert into t1504657 using client 3...\n"); |
3235 stmt3.executeUpdate("INSERT INTO t1 values( 7, 'monetdb' )"); | 3235 stmt3.executeUpdate("INSERT INTO t1504657 values( 7, 'monetdb' )"); |
3236 sb.append("passed :)\n"); | 3236 sb.append("passed :)\n"); |
3237 stmt3.executeUpdate("INSERT INTO t1 values( 8, 'monet' )"); | 3237 stmt3.executeUpdate("INSERT INTO t1504657 values( 8, 'monet' )"); |
3238 sb.append("passed :)\n"); | 3238 sb.append("passed :)\n"); |
3239 stmt3.executeUpdate("INSERT INTO t1 values( 9, 'mon' )"); | 3239 stmt3.executeUpdate("INSERT INTO t1504657 values( 9, 'mon' )"); |
3240 sb.append("passed :)\n"); | 3240 sb.append("passed :)\n"); |
3241 | 3241 |
3242 sb.append("4.1. check table status with client 1...\n"); | 3242 sb.append("4.1. check table status with client 1...\n"); |
3243 rs1 = stmt1.executeQuery("SELECT * FROM t1"); | 3243 rs1 = stmt1.executeQuery("SELECT * FROM t1504657"); |
3244 while (rs1.next()) | 3244 while (rs1.next()) |
3245 sb.append(rs1.getInt("id")).append(", ").append(rs1.getString("name")).append("\n"); | 3245 sb.append(rs1.getInt("id")).append(", ").append(rs1.getString("name")).append("\n"); |
3246 sb.append("passed :)\n"); | 3246 sb.append("passed :)\n"); |
3247 | 3247 |
3248 sb.append("4.2. check table status with client 2...\n"); | 3248 sb.append("4.2. check table status with client 2...\n"); |
3249 rs2 = stmt2.executeQuery("SELECT * FROM t1"); | 3249 rs2 = stmt2.executeQuery("SELECT * FROM t1504657"); |
3250 while (rs2.next()) | 3250 while (rs2.next()) |
3251 sb.append(rs2.getInt("id")).append(", ").append(rs2.getString("name")).append("\n"); | 3251 sb.append(rs2.getInt("id")).append(", ").append(rs2.getString("name")).append("\n"); |
3252 sb.append("passed :)\n"); | 3252 sb.append("passed :)\n"); |
3253 | 3253 |
3254 sb.append("4.3. check table status with client 3...\n"); | 3254 sb.append("4.3. check table status with client 3...\n"); |
3255 rs3 = stmt3.executeQuery("SELECT * FROM t1"); | 3255 rs3 = stmt3.executeQuery("SELECT * FROM t1504657"); |
3256 while (rs3.next()) | 3256 while (rs3.next()) |
3257 sb.append(rs3.getInt("id")).append(", ").append(rs3.getString("name")).append("\n"); | 3257 sb.append(rs3.getInt("id")).append(", ").append(rs3.getString("name")).append("\n"); |
3258 sb.append("passed :)\n"); | 3258 sb.append("passed :)\n"); |
3259 } catch (SQLException e) { | 3259 } catch (SQLException e) { |
3260 sb.append("FAILED: ").append(e.getMessage()).append("\n"); | 3260 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
3261 } | 3261 } |
3262 | 3262 |
3263 // cleanup | 3263 // cleanup |
3264 try { | 3264 try { |
3265 sb.append("Cleanup TABLE t1\n"); | 3265 sb.append("Cleanup TABLE t1504657\n"); |
3266 stmt3.executeUpdate("DROP TABLE t1"); | 3266 stmt3.executeUpdate("DROP TABLE t1504657"); |
3267 } catch (SQLException e) { | 3267 } catch (SQLException e) { |
3268 sb.append("FAILED: ").append(e.getMessage()).append("\n"); | 3268 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
3269 } | 3269 } |
3270 | 3270 |
3271 closeStmtResSet(stmt3, rs3); | 3271 closeStmtResSet(stmt3, rs3); |
3278 | 3278 |
3279 compareExpectedOutput("BugConcurrent_clients_SF_1504657", | 3279 compareExpectedOutput("BugConcurrent_clients_SF_1504657", |
3280 "0. true true\n" + | 3280 "0. true true\n" + |
3281 "0. true true\n" + | 3281 "0. true true\n" + |
3282 "0. true true\n" + | 3282 "0. true true\n" + |
3283 "1.1. create table t1 using client 1...\n" + | 3283 "1.1. create table t1504657 using client 1...\n" + |
3284 "passed :)\n" + | 3284 "passed :)\n" + |
3285 "1.2. check table existence in client 2...\n" + | 3285 "1.2. check table existence in client 2...\n" + |
3286 "t1\n" + | 3286 "t1504657\n" + |
3287 "passed :)\n" + | 3287 "passed :)\n" + |
3288 "1.3. check table existence in client 3...\n" + | 3288 "1.3. check table existence in client 3...\n" + |
3289 "t1\n" + | 3289 "t1504657\n" + |
3290 "passed :)\n" + | 3290 "passed :)\n" + |
3291 "2 insert into t1 using client 1...\n" + | 3291 "2 insert into t1504657 using client 1...\n" + |
3292 "passed :)\n" + | 3292 "passed :)\n" + |
3293 "passed :)\n" + | 3293 "passed :)\n" + |
3294 "passed :)\n" + | 3294 "passed :)\n" + |
3295 "2.1. check table status with client 1...\n" + | 3295 "2.1. check table status with client 1...\n" + |
3296 "1, monetdb\n" + | 3296 "1, monetdb\n" + |
3305 "2.3. check table status with client 3...\n" + | 3305 "2.3. check table status with client 3...\n" + |
3306 "1, monetdb\n" + | 3306 "1, monetdb\n" + |
3307 "2, monet\n" + | 3307 "2, monet\n" + |
3308 "3, mon\n" + | 3308 "3, mon\n" + |
3309 "passed :)\n" + | 3309 "passed :)\n" + |
3310 "3 insert into t1 using client 2...\n" + | 3310 "3 insert into t1504657 using client 2...\n" + |
3311 "passed :)\n" + | 3311 "passed :)\n" + |
3312 "passed :)\n" + | 3312 "passed :)\n" + |
3313 "passed :)\n" + | 3313 "passed :)\n" + |
3314 "3.1. check table status with client 1...\n" + | 3314 "3.1. check table status with client 1...\n" + |
3315 "1, monetdb\n" + | 3315 "1, monetdb\n" + |
3333 "3, mon\n" + | 3333 "3, mon\n" + |
3334 "4, monetdb\n" + | 3334 "4, monetdb\n" + |
3335 "5, monet\n" + | 3335 "5, monet\n" + |
3336 "6, mon\n" + | 3336 "6, mon\n" + |
3337 "passed :)\n" + | 3337 "passed :)\n" + |
3338 "4 insert into t1 using client 3...\n" + | 3338 "4 insert into t1504657 using client 3...\n" + |
3339 "passed :)\n" + | 3339 "passed :)\n" + |
3340 "passed :)\n" + | 3340 "passed :)\n" + |
3341 "passed :)\n" + | 3341 "passed :)\n" + |
3342 "4.1. check table status with client 1...\n" + | 3342 "4.1. check table status with client 1...\n" + |
3343 "1, monetdb\n" + | 3343 "1, monetdb\n" + |
3370 "6, mon\n" + | 3370 "6, mon\n" + |
3371 "7, monetdb\n" + | 3371 "7, monetdb\n" + |
3372 "8, monet\n" + | 3372 "8, monet\n" + |
3373 "9, mon\n" + | 3373 "9, mon\n" + |
3374 "passed :)\n" + | 3374 "passed :)\n" + |
3375 "Cleanup TABLE t1\n"); | 3375 "Cleanup TABLE t1504657\n"); |
3376 } | 3376 } |
3377 | 3377 |
3378 private void BugConcurrent_sequences(String arg0) { | 3378 private void BugConcurrent_sequences(String arg0) { |
3379 sb.setLength(0); // clear the output log buffer | 3379 sb.setLength(0); // clear the output log buffer |
3380 | 3380 |
3390 // >> true: auto commit should be on by default | 3390 // >> true: auto commit should be on by default |
3391 sb.append("0. true\t").append(con1.getAutoCommit()).append("\n"); | 3391 sb.append("0. true\t").append(con1.getAutoCommit()).append("\n"); |
3392 sb.append("0. true\t").append(con2.getAutoCommit()).append("\n"); | 3392 sb.append("0. true\t").append(con2.getAutoCommit()).append("\n"); |
3393 | 3393 |
3394 // create a table | 3394 // create a table |
3395 sb.append("1. create table t1 using client 1... "); | 3395 sb.append("1. create table tconc_seq using client 1... "); |
3396 stmt1.executeUpdate("CREATE TABLE t1 ( id serial, who varchar(12) )"); | 3396 stmt1.executeUpdate("CREATE TABLE tconc_seq ( id serial, who varchar(12) )"); |
3397 sb.append("passed :)\n"); | 3397 sb.append("passed :)\n"); |
3398 | 3398 |
3399 // test the insertion of values with concurrent clients | 3399 // test the insertion of values with concurrent clients |
3400 sb.append("2. insert into t1 using client 1 and 2... "); | 3400 sb.append("2. insert into tconc_seq using client 1 and 2... "); |
3401 stmt1.executeUpdate("INSERT INTO t1(who) VALUES('client1')"); | 3401 stmt1.executeUpdate("INSERT INTO tconc_seq(who) VALUES('client1')"); |
3402 sb.append("client 1 passed :)\n"); | 3402 sb.append("client 1 passed :)\n"); |
3403 | 3403 |
3404 con2.setAutoCommit(false); | 3404 con2.setAutoCommit(false); |
3405 stmt2.executeUpdate("INSERT INTO t1(who) VALUES('client2')"); | 3405 stmt2.executeUpdate("INSERT INTO tconc_seq(who) VALUES('client2')"); |
3406 sb.append("transaction on client 2 :)\n"); | 3406 sb.append("transaction on client 2 :)\n"); |
3407 | 3407 |
3408 stmt1.executeUpdate("INSERT INTO t1(who) VALUES('client1')"); | 3408 stmt1.executeUpdate("INSERT INTO tconc_seq(who) VALUES('client1')"); |
3409 sb.append("client 1 passed :)\n"); | 3409 sb.append("client 1 passed :)\n"); |
3410 | 3410 |
3411 try { | 3411 try { |
3412 con2.commit(); | 3412 con2.commit(); |
3413 sb.append("transaction client 2 PASSED :(\n"); | 3413 sb.append("transaction client 2 PASSED :(\n"); |
3414 } catch (SQLException e) { | 3414 } catch (SQLException e) { |
3415 sb.append("transaction client 2 failed :)\n"); | 3415 sb.append("transaction client 2 failed :)\n"); |
3416 } | 3416 } |
3417 con2.setAutoCommit(true); | 3417 con2.setAutoCommit(true); |
3418 stmt2.executeUpdate("INSERT INTO t1(who) VALUES('client2')"); | 3418 stmt2.executeUpdate("INSERT INTO tconc_seq(who) VALUES('client2')"); |
3419 sb.append("passed :)\n"); | 3419 sb.append("passed :)\n"); |
3420 | 3420 |
3421 sb.append("2.1. check table status with client 1...\n"); | 3421 sb.append("2.1. check table status with client 1...\n"); |
3422 rs1 = stmt1.executeQuery("SELECT * FROM t1"); | 3422 rs1 = stmt1.executeQuery("SELECT * FROM tconc_seq"); |
3423 while (rs1.next()) | 3423 while (rs1.next()) |
3424 sb.append(rs1.getInt("id")).append(", ").append(rs1.getString("who")).append("\n"); | 3424 sb.append(rs1.getInt("id")).append(", ").append(rs1.getString("who")).append("\n"); |
3425 sb.append("passed :)\n"); | 3425 sb.append("passed :)\n"); |
3426 | 3426 |
3427 sb.append("2.2. check table status with client 2...\n"); | 3427 sb.append("2.2. check table status with client 2...\n"); |
3428 rs2 = stmt2.executeQuery("SELECT * FROM t1"); | 3428 rs2 = stmt2.executeQuery("SELECT * FROM tconc_seq"); |
3429 while (rs2.next()) | 3429 while (rs2.next()) |
3430 sb.append(rs2.getInt("id")).append(", ").append(rs2.getString("who")).append("\n"); | 3430 sb.append(rs2.getInt("id")).append(", ").append(rs2.getString("who")).append("\n"); |
3431 sb.append("passed :)\n"); | 3431 sb.append("passed :)\n"); |
3432 | 3432 |
3433 // drop the table (not dropping the sequence) from client 1 | 3433 // drop the table (not dropping the sequence) from client 1 |
3434 sb.append("3.1. drop table t1 using client 1... "); | 3434 sb.append("3.1. drop table tconc_seq using client 1... "); |
3435 stmt1.executeUpdate("DROP TABLE t1"); | 3435 stmt1.executeUpdate("DROP TABLE tconc_seq"); |
3436 sb.append("passed :)\n"); | 3436 sb.append("passed :)\n"); |
3437 | 3437 |
3438 sb.append("3.1. recreate t1 using client 1... "); | 3438 sb.append("3.1. recreate tconc_seq using client 1... "); |
3439 stmt1.executeUpdate("CREATE TABLE t1 ( id serial, who varchar(12) )"); | 3439 stmt1.executeUpdate("CREATE TABLE tconc_seq ( id serial, who varchar(12) )"); |
3440 sb.append("passed :)\n"); | 3440 sb.append("passed :)\n"); |
3441 } catch (SQLException e) { | 3441 } catch (SQLException e) { |
3442 sb.append("FAILED: ").append(e.getMessage()).append("\n"); | 3442 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
3443 } | 3443 } |
3444 | 3444 |
3452 stmt1 = con1.createStatement(); | 3452 stmt1 = con1.createStatement(); |
3453 stmt2 = con2.createStatement(); | 3453 stmt2 = con2.createStatement(); |
3454 sb.append("passed :)\n"); | 3454 sb.append("passed :)\n"); |
3455 | 3455 |
3456 // insert and print, should get 1,2 | 3456 // insert and print, should get 1,2 |
3457 sb.append("4. insert into t1 using client 1 and 2...\n"); | 3457 sb.append("4. insert into tconc_seq using client 1 and 2...\n"); |
3458 stmt1.executeUpdate("INSERT INTO t1(who) VALUES('client1')"); | 3458 stmt1.executeUpdate("INSERT INTO tconc_seq(who) VALUES('client1')"); |
3459 sb.append("passed :)\n"); | 3459 sb.append("passed :)\n"); |
3460 con2.setAutoCommit(false); | 3460 con2.setAutoCommit(false); |
3461 stmt2.executeUpdate("INSERT INTO t1(who) VALUES('client2')"); | 3461 stmt2.executeUpdate("INSERT INTO tconc_seq(who) VALUES('client2')"); |
3462 con2.commit(); | 3462 con2.commit(); |
3463 con2.setAutoCommit(true); | 3463 con2.setAutoCommit(true); |
3464 sb.append("passed :)\n"); | 3464 sb.append("passed :)\n"); |
3465 | 3465 |
3466 sb.append("4.1. check table status with client 1...\n"); | 3466 sb.append("4.1. check table status with client 1...\n"); |
3467 rs1 = stmt1.executeQuery("SELECT * FROM t1 ORDER BY who"); | 3467 rs1 = stmt1.executeQuery("SELECT * FROM tconc_seq ORDER BY who"); |
3468 for (int cntr = 1; rs1.next(); cntr++) { | 3468 for (int cntr = 1; rs1.next(); cntr++) { |
3469 int id = rs1.getInt("id"); | 3469 int id = rs1.getInt("id"); |
3470 sb.append(id).append(", ").append(rs1.getString("who")).append("\n"); | 3470 sb.append(id).append(", ").append(rs1.getString("who")).append("\n"); |
3471 if (id != cntr) | 3471 if (id != cntr) |
3472 sb.append("!! expected ").append(cntr).append(", got ").append(id); | 3472 sb.append("!! expected ").append(cntr).append(", got ").append(id); |
3473 } | 3473 } |
3474 sb.append("passed :)\n"); | 3474 sb.append("passed :)\n"); |
3475 | 3475 |
3476 sb.append("4.2. check table status with client 2...\n"); | 3476 sb.append("4.2. check table status with client 2...\n"); |
3477 rs2 = stmt2.executeQuery("SELECT * FROM t1 ORDER BY who"); | 3477 rs2 = stmt2.executeQuery("SELECT * FROM tconc_seq ORDER BY who"); |
3478 for (int cntr = 1; rs2.next(); cntr++) { | 3478 for (int cntr = 1; rs2.next(); cntr++) { |
3479 int id = rs2.getInt("id"); | 3479 int id = rs2.getInt("id"); |
3480 sb.append(id).append(", ").append(rs2.getString("who")).append("\n"); | 3480 sb.append(id).append(", ").append(rs2.getString("who")).append("\n"); |
3481 if (id != cntr) | 3481 if (id != cntr) |
3482 sb.append("!! expected ").append(cntr).append(", got ").append(id); | 3482 sb.append("!! expected ").append(cntr).append(", got ").append(id); |
3486 sb.append("FAILED: ").append(e.getMessage()).append("\n"); | 3486 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
3487 } | 3487 } |
3488 | 3488 |
3489 // cleanup | 3489 // cleanup |
3490 try { | 3490 try { |
3491 sb.append("Cleanup TABLE t1\n"); | 3491 sb.append("Cleanup TABLE tconc_seq\n"); |
3492 stmt2.executeUpdate("DROP TABLE t1"); | 3492 stmt2.executeUpdate("DROP TABLE tconc_seq"); |
3493 } catch (SQLException e) { | 3493 } catch (SQLException e) { |
3494 sb.append("FAILED: ").append(e.getMessage()).append("\n"); | 3494 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
3495 } | 3495 } |
3496 | 3496 |
3497 closeStmtResSet(stmt1, rs1); | 3497 closeStmtResSet(stmt1, rs1); |
3501 closeConx(con1); | 3501 closeConx(con1); |
3502 | 3502 |
3503 compareExpectedOutput("BugConcurrent_sequences", | 3503 compareExpectedOutput("BugConcurrent_sequences", |
3504 "0. true true\n" + | 3504 "0. true true\n" + |
3505 "0. true true\n" + | 3505 "0. true true\n" + |
3506 "1. create table t1 using client 1... passed :)\n" + | 3506 "1. create table tconc_seq using client 1... passed :)\n" + |
3507 "2. insert into t1 using client 1 and 2... client 1 passed :)\n" + | 3507 "2. insert into tconc_seq using client 1 and 2... client 1 passed :)\n" + |
3508 "transaction on client 2 :)\n" + | 3508 "transaction on client 2 :)\n" + |
3509 "client 1 passed :)\n" + | 3509 "client 1 passed :)\n" + |
3510 "transaction client 2 failed :)\n" + | 3510 "transaction client 2 failed :)\n" + |
3511 "passed :)\n" + | 3511 "passed :)\n" + |
3512 "2.1. check table status with client 1...\n" + | 3512 "2.1. check table status with client 1...\n" + |
3517 "2.2. check table status with client 2...\n" + | 3517 "2.2. check table status with client 2...\n" + |
3518 "1, client1\n" + | 3518 "1, client1\n" + |
3519 "3, client1\n" + | 3519 "3, client1\n" + |
3520 "4, client2\n" + | 3520 "4, client2\n" + |
3521 "passed :)\n" + | 3521 "passed :)\n" + |
3522 "3.1. drop table t1 using client 1... passed :)\n" + | 3522 "3.1. drop table tconc_seq using client 1... passed :)\n" + |
3523 "3.1. recreate t1 using client 1... passed :)\n" + | 3523 "3.1. recreate tconc_seq using client 1... passed :)\n" + |
3524 "x. Reconnecting client 1 and 2... passed :)\n" + | 3524 "x. Reconnecting client 1 and 2... passed :)\n" + |
3525 "4. insert into t1 using client 1 and 2...\n" + | 3525 "4. insert into tconc_seq using client 1 and 2...\n" + |
3526 "passed :)\n" + | 3526 "passed :)\n" + |
3527 "passed :)\n" + | 3527 "passed :)\n" + |
3528 "4.1. check table status with client 1...\n" + | 3528 "4.1. check table status with client 1...\n" + |
3529 "1, client1\n" + | 3529 "1, client1\n" + |
3530 "2, client2\n" + | 3530 "2, client2\n" + |
3531 "passed :)\n" + | 3531 "passed :)\n" + |
3532 "4.2. check table status with client 2...\n" + | 3532 "4.2. check table status with client 2...\n" + |
3533 "1, client1\n" + | 3533 "1, client1\n" + |
3534 "2, client2\n" + | 3534 "2, client2\n" + |
3535 "passed :)\n" + | 3535 "passed :)\n" + |
3536 "Cleanup TABLE t1\n"); | 3536 "Cleanup TABLE tconc_seq\n"); |
3537 } | 3537 } |
3538 | 3538 |
3539 private void Bug_Connect_as_voc_getMetaData_Failure_Bug_6388(String arg0) { | 3539 private void Bug_Connect_as_voc_getMetaData_Failure_Bug_6388(String arg0) { |
3540 sb.setLength(0); // clear the output log buffer | 3540 sb.setLength(0); // clear the output log buffer |
3541 | 3541 |