Skip to content

Commit cf6f3c0

Browse files
committed
Fix integration test with Verticles
1 parent 4fafc7b commit cf6f3c0

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

integration-tests/verticle-postgres-it/src/main/java/org/hibernate/reactive/it/verticle/ProductVerticle.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,10 @@ public ProductVerticle(Supplier<Mutiny.SessionFactory> emfSupplier) {
4040
this.emfSupplier = emfSupplier;
4141
}
4242

43-
private void startHibernate(Promise<Object> p) {
44-
try {
45-
this.emf = emfSupplier.get();
46-
p.complete();
47-
}
48-
catch (Throwable t) {
49-
p.fail( t );
50-
}
51-
}
52-
5343
@Override
5444
public void start(Promise<Void> startPromise) {
55-
final Future<Object> startHibernate = vertx.executeBlocking( this::startHibernate )
45+
final Future<Mutiny.SessionFactory> startHibernate = vertx
46+
.executeBlocking( this::startHibernate )
5647
.onSuccess( s -> LOG.infof( "✅ Hibernate Reactive is ready" ) );
5748

5849
Router router = Router.router( vertx );
@@ -74,9 +65,15 @@ public void start(Promise<Void> startPromise) {
7465
.onFailure( startPromise::fail );
7566
}
7667

68+
private Mutiny.SessionFactory startHibernate() {
69+
this.emf = emfSupplier.get();
70+
return this.emf;
71+
}
72+
7773
@Override
7874
public void stop(Promise<Void> stopPromise) {
79-
httpServer.close().onComplete( unused -> emf.close() )
75+
httpServer.close()
76+
.onComplete( unused -> emf.close() )
8077
.onSuccess( s -> stopPromise.complete() )
8178
.onFailure( stopPromise::fail );
8279
}

integration-tests/verticle-postgres-it/src/test/java/org/hibernate/reactive/it/LocalContextTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import io.vertx.junit5.VertxExtension;
3232
import io.vertx.junit5.VertxTestContext;
3333

34-
import static io.vertx.core.CompositeFuture.all;
3534
import static io.vertx.core.Future.all;
3635
import static io.vertx.core.Future.failedFuture;
3736
import static io.vertx.core.Future.succeededFuture;
@@ -50,7 +49,7 @@
5049
* that's been close ahead of time by someone else.
5150
* Theoretically, everything could happen in the right order because of chance,
5251
* but it's unlikely and at the moment I don't have a better solution.
53-
* See the <a href="https://github.com/hibernate/hibernate-reactive/issues/1073">the related issue</a>
52+
* See <a href="https://github.com/hibernate/hibernate-reactive/issues/1073">the related issue</a>
5453
* for more details.
5554
* <p>
5655
*/
@@ -88,7 +87,7 @@ public void testProductsGeneration(VertxTestContext context) {
8887
.compose( this::findProducts )
8988
.onSuccess( res -> context.completeNow() )
9089
.onFailure( context::failNow )
91-
.eventually( unused -> vertx.close() );
90+
.eventually( () -> vertx.close() );
9291
}
9392

9493
/**
@@ -97,7 +96,7 @@ public void testProductsGeneration(VertxTestContext context) {
9796
* @see #REQUEST_NUMBER
9897
*/
9998
private Future<?> createProducts(WebClient webClient) {
100-
List<Future> postRequests = new ArrayList<>();
99+
List<Future<?>> postRequests = new ArrayList<>();
101100
for ( int i = 0; i < REQUEST_NUMBER; i++ ) {
102101
final Product product = new Product( i + 1 );
103102

0 commit comments

Comments
 (0)