Skip to content

Commit 6f19c7f

Browse files
committed
Implement OracleTransactionTest
Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
1 parent a145594 commit 6f19c7f

File tree

2 files changed

+84
-29
lines changed

2 files changed

+84
-29
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright (c) 2011-2021 Contributors to the Eclipse Foundation
3+
*
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.
8+
*
9+
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
10+
*/
11+
package io.vertx.oracleclient.test.tck;
12+
13+
import io.vertx.ext.unit.TestContext;
14+
import io.vertx.ext.unit.junit.VertxUnitRunner;
15+
import io.vertx.oracleclient.OraclePool;
16+
import io.vertx.oracleclient.test.junit.OracleRule;
17+
import io.vertx.sqlclient.Pool;
18+
import io.vertx.sqlclient.PoolOptions;
19+
import io.vertx.sqlclient.tck.TransactionTestBase;
20+
import org.junit.ClassRule;
21+
import org.junit.Ignore;
22+
import org.junit.Test;
23+
import org.junit.runner.RunWith;
24+
25+
@RunWith(VertxUnitRunner.class)
26+
public class OracleTransactionTest extends TransactionTestBase {
27+
28+
29+
@ClassRule
30+
public static OracleRule rule = OracleRule.SHARED_INSTANCE;
31+
32+
@Override
33+
protected Pool createPool() {
34+
return OraclePool.pool(vertx, rule.options(), new PoolOptions().setMaxSize(1));
35+
}
36+
37+
@Override
38+
protected Pool nonTxPool() {
39+
return OraclePool.pool(vertx, rule.options(), new PoolOptions().setMaxSize(1));
40+
}
41+
42+
@Override
43+
protected String statement(String... parts) {
44+
return String.join(" ?", parts);
45+
}
46+
47+
@Test
48+
@Ignore("to be investigated")
49+
@Override
50+
public void testCommitWithQuery(TestContext ctx) {
51+
super.testCommitWithQuery(ctx);
52+
}
53+
54+
@Test
55+
@Ignore("to be investigated")
56+
@Override
57+
public void testRollbackData(TestContext ctx) {
58+
super.testRollbackData(ctx);
59+
}
60+
61+
@Test
62+
@Ignore("to be investigated")
63+
@Override
64+
public void testCommitWithPreparedQuery(TestContext ctx) {
65+
super.testCommitWithPreparedQuery(ctx);
66+
}
67+
}

vertx-sql-client/src/test/java/io/vertx/sqlclient/tck/TransactionTestBase.java

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,28 @@
11
/*
2-
* Copyright (C) 2020 IBM Corporation
2+
* Copyright (c) 2011-2021 Contributors to the Eclipse Foundation
33
*
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.
78
*
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
1510
*/
1611
package io.vertx.sqlclient.tck;
1712

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-
2913
import io.vertx.core.AsyncResult;
14+
import io.vertx.core.Future;
3015
import io.vertx.core.Handler;
3116
import io.vertx.core.Vertx;
3217
import io.vertx.ext.unit.Async;
3318
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;
3826

3927
public abstract class TransactionTestBase {
4028

@@ -102,7 +90,7 @@ public void tearDown(TestContext ctx) {
10290

10391
protected void cleanTestTable(TestContext ctx) {
10492
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 -> {
10694
res.tx.commit(ctx.asyncAssertSuccess());
10795
}));
10896
}));
@@ -145,7 +133,7 @@ public void testReleaseConnectionOnRollback(TestContext ctx) {
145133
public void testCommitWithPreparedQuery(TestContext ctx) {
146134
Async async = ctx.async();
147135
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 (", ",", ")"))
149137
.execute(Tuple.of(13, "test message1"), ctx.asyncAssertSuccess(result -> {
150138
ctx.assertEquals(1, result.rowCount());
151139
res.tx.commit(ctx.asyncAssertSuccess(v1 -> {
@@ -165,7 +153,7 @@ public void testCommitWithPreparedQuery(TestContext ctx) {
165153
public void testCommitWithQuery(TestContext ctx) {
166154
Async async = ctx.async();
167155
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')")
169157
.execute(ctx.asyncAssertSuccess(result -> {
170158
ctx.assertEquals(1, result.rowCount());
171159
res.tx.commit(ctx.asyncAssertSuccess(v1 -> {

0 commit comments

Comments
 (0)