1
1
/*
2
- * Copyright (C) 2020 IBM Corporation
2
+ * Copyright (c) 2011-2021 Contributors to the Eclipse Foundation
3
3
*
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
7
+ * which is available at https://www.apache.org/licenses/LICENSE-2.0.
7
8
*
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
9
+ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
15
10
*/
16
11
package io .vertx .sqlclient .tck ;
17
12
18
- import java .util .concurrent .atomic .AtomicReference ;
19
- import java .util .function .Consumer ;
20
-
21
- import io .vertx .core .Future ;
22
- import io .vertx .sqlclient .SqlClient ;
23
- import io .vertx .sqlclient .SqlConnection ;
24
- import io .vertx .sqlclient .TransactionRollbackException ;
25
- import org .junit .After ;
26
- import org .junit .Before ;
27
- import org .junit .Test ;
28
-
29
13
import io .vertx .core .AsyncResult ;
14
+ import io .vertx .core .Future ;
30
15
import io .vertx .core .Handler ;
31
16
import io .vertx .core .Vertx ;
32
17
import io .vertx .ext .unit .Async ;
33
18
import io .vertx .ext .unit .TestContext ;
34
- import io .vertx .sqlclient .Pool ;
35
- import io .vertx .sqlclient .Row ;
36
- import io .vertx .sqlclient .Transaction ;
37
- import io .vertx .sqlclient .Tuple ;
19
+ import io .vertx .sqlclient .*;
20
+ import org .junit .After ;
21
+ import org .junit .Before ;
22
+ import org .junit .Test ;
23
+
24
+ import java .util .concurrent .atomic .AtomicReference ;
25
+ import java .util .function .Consumer ;
38
26
39
27
public abstract class TransactionTestBase {
40
28
@@ -102,7 +90,7 @@ public void tearDown(TestContext ctx) {
102
90
103
91
protected void cleanTestTable (TestContext ctx ) {
104
92
connector .accept (ctx .asyncAssertSuccess (res -> {
105
- res .client .query ("TRUNCATE TABLE mutable; " ).execute (ctx .asyncAssertSuccess (result -> {
93
+ res .client .query ("TRUNCATE TABLE mutable" ).execute (ctx .asyncAssertSuccess (result -> {
106
94
res .tx .commit (ctx .asyncAssertSuccess ());
107
95
}));
108
96
}));
@@ -145,7 +133,7 @@ public void testReleaseConnectionOnRollback(TestContext ctx) {
145
133
public void testCommitWithPreparedQuery (TestContext ctx ) {
146
134
Async async = ctx .async ();
147
135
connector .accept (ctx .asyncAssertSuccess (res -> {
148
- res .client .preparedQuery (statement ("INSERT INTO mutable (id, val) VALUES (" , "," , "); " ))
136
+ res .client .preparedQuery (statement ("INSERT INTO mutable (id, val) VALUES (" , "," , ")" ))
149
137
.execute (Tuple .of (13 , "test message1" ), ctx .asyncAssertSuccess (result -> {
150
138
ctx .assertEquals (1 , result .rowCount ());
151
139
res .tx .commit (ctx .asyncAssertSuccess (v1 -> {
@@ -165,7 +153,7 @@ public void testCommitWithPreparedQuery(TestContext ctx) {
165
153
public void testCommitWithQuery (TestContext ctx ) {
166
154
Async async = ctx .async ();
167
155
connector .accept (ctx .asyncAssertSuccess (res -> {
168
- res .client .query ("INSERT INTO mutable (id, val) VALUES (14, 'test message2'); " )
156
+ res .client .query ("INSERT INTO mutable (id, val) VALUES (14, 'test message2')" )
169
157
.execute (ctx .asyncAssertSuccess (result -> {
170
158
ctx .assertEquals (1 , result .rowCount ());
171
159
res .tx .commit (ctx .asyncAssertSuccess (v1 -> {
0 commit comments