From 7feb34fc58fbbb5854723d0409b75db16288cea4 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Wed, 19 Apr 2023 14:27:45 +0300 Subject: [PATCH] Restore the ability to use @TestReactiveTransaction on a test class Fixes: #32650 --- .../it/panache/reactive/TestReactiveTransactionTest.java | 6 +----- .../test/vertx/RunOnVertxContextTestMethodInvoker.java | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/integration-tests/hibernate-reactive-panache/src/test/java/io/quarkus/it/panache/reactive/TestReactiveTransactionTest.java b/integration-tests/hibernate-reactive-panache/src/test/java/io/quarkus/it/panache/reactive/TestReactiveTransactionTest.java index 241f7bf51e6e5..57e872960e8a1 100644 --- a/integration-tests/hibernate-reactive-panache/src/test/java/io/quarkus/it/panache/reactive/TestReactiveTransactionTest.java +++ b/integration-tests/hibernate-reactive-panache/src/test/java/io/quarkus/it/panache/reactive/TestReactiveTransactionTest.java @@ -6,21 +6,17 @@ import io.quarkus.hibernate.reactive.panache.Panache; import io.quarkus.test.TestReactiveTransaction; import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.vertx.RunOnVertxContext; import io.quarkus.test.vertx.UniAsserter; @QuarkusTest +@TestReactiveTransaction public class TestReactiveTransactionTest { - @RunOnVertxContext - @TestReactiveTransaction @Test public void testTestTransaction(UniAsserter asserter) { asserter.assertNotNull(() -> Panache.currentTransaction()); } - @RunOnVertxContext - @TestReactiveTransaction @BeforeEach public void beforeEach(UniAsserter asserter) { asserter.assertNotNull(() -> Panache.currentTransaction()); diff --git a/test-framework/vertx/src/main/java/io/quarkus/test/vertx/RunOnVertxContextTestMethodInvoker.java b/test-framework/vertx/src/main/java/io/quarkus/test/vertx/RunOnVertxContextTestMethodInvoker.java index a348c0a83c430..39214de3f94b3 100644 --- a/test-framework/vertx/src/main/java/io/quarkus/test/vertx/RunOnVertxContextTestMethodInvoker.java +++ b/test-framework/vertx/src/main/java/io/quarkus/test/vertx/RunOnVertxContextTestMethodInvoker.java @@ -99,7 +99,8 @@ private boolean shouldContextBeDuplicated(Class c, Method m) { } if (runOnVertxContext == null) { // Use duplicated context if @TestReactiveTransaction is present - return m.isAnnotationPresent(TestReactiveTransaction.class); + return m.isAnnotationPresent(TestReactiveTransaction.class) + || m.getDeclaringClass().isAnnotationPresent(TestReactiveTransaction.class); } else { return runOnVertxContext.duplicateContext(); }