diff --git a/jooq-async-api-tck/src/main/java/fr/maif/jooq/AbstractPgAsyncPoolTest.java b/jooq-async-api-tck/src/main/java/fr/maif/jooq/AbstractPgAsyncPoolTest.java index 2f045fd..29e8fa5 100644 --- a/jooq-async-api-tck/src/main/java/fr/maif/jooq/AbstractPgAsyncPoolTest.java +++ b/jooq-async-api-tck/src/main/java/fr/maif/jooq/AbstractPgAsyncPoolTest.java @@ -22,6 +22,7 @@ import org.junit.Test; import org.postgresql.ds.PGSimpleDataSource; import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.utility.DockerImageName; import reactor.core.publisher.Flux; @@ -41,7 +42,9 @@ public abstract class AbstractPgAsyncPoolTest { - private final PostgreSQLContainer postgreSQLContainer = new PostgreSQLContainer<>(DockerImageName.parse("postgres").withTag("14")); + private final PostgreSQLContainer postgreSQLContainer = new PostgreSQLContainer<>(DockerImageName.parse("postgres") + .withTag("14")) + .waitingFor(Wait.forListeningPort()); private final static ObjectMapper mapper = new ObjectMapper(); private PgAsyncPool pgAsyncPool; diff --git a/jooq-async-reactive/src/main/java/fr/maif/jooq/reactive/ReactivePgAsyncPool.java b/jooq-async-reactive/src/main/java/fr/maif/jooq/reactive/ReactivePgAsyncPool.java index 928f049..eab359e 100644 --- a/jooq-async-reactive/src/main/java/fr/maif/jooq/reactive/ReactivePgAsyncPool.java +++ b/jooq-async-reactive/src/main/java/fr/maif/jooq/reactive/ReactivePgAsyncPool.java @@ -6,6 +6,7 @@ import fr.maif.jooq.QueryResult; import io.vavr.concurrent.Future; import io.vertx.pgclient.PgPool; +import io.vertx.sqlclient.Pool; import io.vertx.sqlclient.TransactionRollbackException; import org.jooq.Configuration; import org.jooq.DSLContext; @@ -20,9 +21,9 @@ import static fr.maif.jooq.reactive.FutureConversions.fromVertx; -public class ReactivePgAsyncPool extends AbstractReactivePgAsyncClient implements PgAsyncPool { +public class ReactivePgAsyncPool extends AbstractReactivePgAsyncClient implements PgAsyncPool { - public ReactivePgAsyncPool(PgPool client, Configuration configuration) { + public ReactivePgAsyncPool(Pool client, Configuration configuration) { super(client, configuration); } diff --git a/jooq-async-reactive/src/main/java/fr/maif/jooq/reactor/PgAsyncPool.java b/jooq-async-reactive/src/main/java/fr/maif/jooq/reactor/PgAsyncPool.java index 751bba8..0cdcb2b 100644 --- a/jooq-async-reactive/src/main/java/fr/maif/jooq/reactor/PgAsyncPool.java +++ b/jooq-async-reactive/src/main/java/fr/maif/jooq/reactor/PgAsyncPool.java @@ -6,6 +6,8 @@ import fr.maif.jooq.reactor.impl.ReactorPgAsyncPool; import io.vertx.pgclient.PgPool; import org.jooq.Configuration; + +import io.vertx.sqlclient.Pool; import reactor.core.publisher.Mono; import java.util.function.Function; @@ -16,7 +18,7 @@ public interface PgAsyncPool extends PgAsyncClient, fr.maif.jooq.PgAsyncPool, Pg Mono beginMono(); - static PgAsyncPool create(PgPool client, Configuration configuration) { + static PgAsyncPool create(Pool client, Configuration configuration) { ReactivePgAsyncPool pool = new ReactivePgAsyncPool(client, configuration); return new ReactorPgAsyncPool(pool); } diff --git a/jooq-async-reactive/src/test/java/fr/maif/jooq/ReactiveAsyncPoolTest.java b/jooq-async-reactive/src/test/java/fr/maif/jooq/ReactiveAsyncPoolTest.java index bec196e..f456cb8 100644 --- a/jooq-async-reactive/src/test/java/fr/maif/jooq/ReactiveAsyncPoolTest.java +++ b/jooq-async-reactive/src/test/java/fr/maif/jooq/ReactiveAsyncPoolTest.java @@ -2,8 +2,10 @@ import fr.maif.jooq.reactive.ReactivePgAsyncPool; import io.vertx.core.Vertx; +import io.vertx.pgclient.PgBuilder; import io.vertx.pgclient.PgConnectOptions; import io.vertx.pgclient.PgPool; +import io.vertx.sqlclient.Pool; import io.vertx.sqlclient.PoolOptions; import org.jooq.Configuration; import org.jooq.SQLDialect; @@ -17,7 +19,7 @@ public class ReactiveAsyncPoolTest extends AbstractPgAsyncPoolTest { private static Vertx vertx = Vertx.vertx(); - private PgPool pool; + private Pool pool; @Override public PgAsyncPool pgAsyncPool(PostgreSQLContainer postgreSQLContainer) { @@ -37,7 +39,11 @@ public PgAsyncPool pgAsyncPool(PostgreSQLContainer postgreSQLContainer) { .setUser(username) .setPassword(password); PoolOptions poolOptions = new PoolOptions().setMaxSize(3); - pool = PgPool.pool(vertx, options, poolOptions); + pool = PgBuilder.pool() + .using(vertx) + .connectingTo(options) + .with(poolOptions) + .build(); var connection = pool.getConnection().toCompletionStage().toCompletableFuture().join(); connection.close().toCompletionStage().toCompletableFuture().join(); return new ReactivePgAsyncPool(pool, jooqConfig); diff --git a/readme.md b/readme.md index 48b0106..d7ab4cd 100644 --- a/readme.md +++ b/readme.md @@ -78,7 +78,11 @@ PgConnectOptions options = new PgConnectOptions() .setPassword(password); PoolOptions poolOptions = new PoolOptions().setMaxSize(10); Vertx vertx = Vertx.vertx(); -PgPool client = PgPool.pool(vertx, options, poolOptions); +Pool client = PgBuilder.pool() + .using(vertx) + .connectingTo(options) + .with(poolOptions) + .build(); PgAsyncPool reactivePgAsyncPool = new ReactivePgAsyncPool(client, jooqConfig); ```