diff --git a/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/ArcRecorder.java b/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/ArcRecorder.java index 4c1ecac85a712..ff8ccc90061d6 100644 --- a/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/ArcRecorder.java +++ b/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/ArcRecorder.java @@ -51,6 +51,7 @@ public ArcContainer initContainer(ShutdownContext shutdown, RuntimeValue> action) throws Exception { - Vertx vertx = Vertx.vertx(); WebSocketClient client = vertx.createWebSocketClient(); try { LinkedBlockingDeque message = new LinkedBlockingDeque<>(); diff --git a/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/broadcast/BroadcastConnectionTest.java b/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/broadcast/BroadcastConnectionTest.java index 15feb4d16ec52..740a0c9100965 100644 --- a/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/broadcast/BroadcastConnectionTest.java +++ b/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/broadcast/BroadcastConnectionTest.java @@ -9,6 +9,8 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import jakarta.inject.Inject; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -20,21 +22,23 @@ public class BroadcastConnectionTest { - @TestHTTPResource("lo-connection") - URI loConnectionUri; - @RegisterExtension public static final QuarkusUnitTest test = new QuarkusUnitTest() .withApplicationRoot(root -> { root.addClasses(LoConnection.class); }); + @TestHTTPResource("lo-connection") + URI loConnectionUri; + + @Inject + Vertx vertx; + @Test public void testBroadcast() throws Exception { WebSocketClient client1 = null, client2 = null, client3 = null; try { List messages = new CopyOnWriteArrayList<>(); - Vertx vertx = Vertx.vertx(); client1 = connect(vertx, "C1", messages); client2 = connect(vertx, "C2", messages); client3 = connect(vertx, "C3", messages); diff --git a/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/broadcast/BroadcastOnMessageTest.java b/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/broadcast/BroadcastOnMessageTest.java index 89e918bb0ebb7..b2f18ba95d697 100644 --- a/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/broadcast/BroadcastOnMessageTest.java +++ b/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/broadcast/BroadcastOnMessageTest.java @@ -10,6 +10,8 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; +import jakarta.inject.Inject; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -21,6 +23,12 @@ public class BroadcastOnMessageTest { + @RegisterExtension + public static final QuarkusUnitTest test = new QuarkusUnitTest() + .withApplicationRoot(root -> { + root.addClasses(Up.class, UpBlocking.class, UpMultiBidi.class); + }); + @TestHTTPResource("up") URI upUri; @@ -30,11 +38,8 @@ public class BroadcastOnMessageTest { @TestHTTPResource("up-multi-bidi") URI upMultiBidiUri; - @RegisterExtension - public static final QuarkusUnitTest test = new QuarkusUnitTest() - .withApplicationRoot(root -> { - root.addClasses(Up.class, UpBlocking.class, UpMultiBidi.class); - }); + @Inject + Vertx vertx; @Test public void testUp() throws Exception { @@ -52,7 +57,6 @@ public void testUpMultiBidi() throws Exception { } public void assertBroadcast(URI testUri) throws Exception { - Vertx vertx = Vertx.vertx(); WebSocketClient client1 = vertx.createWebSocketClient(); WebSocketClient client2 = vertx.createWebSocketClient(); try { diff --git a/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/broadcast/BroadcastOnOpenTest.java b/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/broadcast/BroadcastOnOpenTest.java index 8c4cbf205df7f..3303ede6151a0 100644 --- a/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/broadcast/BroadcastOnOpenTest.java +++ b/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/broadcast/BroadcastOnOpenTest.java @@ -9,6 +9,8 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import jakarta.inject.Inject; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -20,6 +22,12 @@ public class BroadcastOnOpenTest { + @RegisterExtension + public static final QuarkusUnitTest test = new QuarkusUnitTest() + .withApplicationRoot(root -> { + root.addClasses(Lo.class, LoBlocking.class, LoMultiProduce.class); + }); + @TestHTTPResource("lo") URI loUri; @@ -29,11 +37,8 @@ public class BroadcastOnOpenTest { @TestHTTPResource("lo-multi-produce") URI loMultiProduceUri; - @RegisterExtension - public static final QuarkusUnitTest test = new QuarkusUnitTest() - .withApplicationRoot(root -> { - root.addClasses(Lo.class, LoBlocking.class, LoMultiProduce.class); - }); + @Inject + Vertx vertx; @Test public void testLo() throws Exception { @@ -51,7 +56,6 @@ public void testLoMultiBidi() throws Exception { } public void assertBroadcast(URI testUri) throws Exception { - Vertx vertx = Vertx.vertx(); WebSocketClient client1 = vertx.createWebSocketClient(); WebSocketClient client2 = vertx.createWebSocketClient(); try { diff --git a/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/codec/BinaryCodecTest.java b/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/codec/BinaryCodecTest.java index 67f834b7f2ea2..21d4f94ddf7d4 100644 --- a/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/codec/BinaryCodecTest.java +++ b/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/codec/BinaryCodecTest.java @@ -6,6 +6,8 @@ import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.TimeUnit; +import jakarta.inject.Inject; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -20,9 +22,6 @@ public class BinaryCodecTest { - @TestHTTPResource("find-binary") - URI findBinaryUri; - @RegisterExtension public static final QuarkusUnitTest test = new QuarkusUnitTest() .withApplicationRoot(root -> { @@ -30,6 +29,12 @@ public class BinaryCodecTest { FindBinary.ListItemBinaryMessageCodec.class); }); + @TestHTTPResource("find-binary") + URI findBinaryUri; + + @Inject + Vertx vertx; + @Test public void testCodec() throws Exception { JsonArray items = new JsonArray(); @@ -41,7 +46,6 @@ public void testCodec() throws Exception { public void assertCodec(URI testUri, Buffer payload, Buffer expected) throws Exception { - Vertx vertx = Vertx.vertx(); WebSocketClient client = vertx.createWebSocketClient(); try { LinkedBlockingDeque message = new LinkedBlockingDeque<>(); diff --git a/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/codec/CustomCodecTest.java b/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/codec/CustomCodecTest.java index 8fccf5a957f6e..de349ec3a87ab 100644 --- a/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/codec/CustomCodecTest.java +++ b/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/codec/CustomCodecTest.java @@ -6,6 +6,8 @@ import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.TimeUnit; +import jakarta.inject.Inject; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -19,15 +21,18 @@ public class CustomCodecTest { - @TestHTTPResource("find") - URI findUri; - @RegisterExtension public static final QuarkusUnitTest test = new QuarkusUnitTest() .withApplicationRoot(root -> { root.addClasses(Find.class, Item.class, AbstractFind.class, MyItemCodec.class); }); + @TestHTTPResource("find") + URI findUri; + + @Inject + Vertx vertx; + @Test public void testCodec() throws Exception { JsonArray items = new JsonArray(); @@ -39,7 +44,6 @@ public void testCodec() throws Exception { public void assertCodec(URI testUri, String payload, String expected) throws Exception { - Vertx vertx = Vertx.vertx(); WebSocketClient client = vertx.createWebSocketClient(); try { LinkedBlockingDeque message = new LinkedBlockingDeque<>(); diff --git a/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/codec/DefaultTextCodecTest.java b/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/codec/DefaultTextCodecTest.java index 866172e1bf296..0002e03b08652 100644 --- a/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/codec/DefaultTextCodecTest.java +++ b/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/codec/DefaultTextCodecTest.java @@ -6,6 +6,8 @@ import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.TimeUnit; +import jakarta.inject.Inject; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -19,15 +21,18 @@ public class DefaultTextCodecTest { - @TestHTTPResource("find") - URI findUri; - @RegisterExtension public static final QuarkusUnitTest test = new QuarkusUnitTest() .withApplicationRoot(root -> { root.addClasses(Find.class, AbstractFind.class, Item.class); }); + @TestHTTPResource("find") + URI findUri; + + @Inject + Vertx vertx; + @Test public void testCodec() throws Exception { JsonArray items = new JsonArray(); @@ -39,7 +44,6 @@ public void testCodec() throws Exception { public void assertCodec(URI testUri, String payload, String expected) throws Exception { - Vertx vertx = Vertx.vertx(); WebSocketClient client = vertx.createWebSocketClient(); try { LinkedBlockingDeque message = new LinkedBlockingDeque<>(); diff --git a/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/codec/TextInputCodecTest.java b/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/codec/TextInputCodecTest.java index 572c777810a52..d1d53473a8374 100644 --- a/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/codec/TextInputCodecTest.java +++ b/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/codec/TextInputCodecTest.java @@ -6,6 +6,8 @@ import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.TimeUnit; +import jakarta.inject.Inject; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -19,15 +21,18 @@ public class TextInputCodecTest { - @TestHTTPResource("find-input-codec") - URI itemCodecUri; - @RegisterExtension public static final QuarkusUnitTest test = new QuarkusUnitTest() .withApplicationRoot(root -> { root.addClasses(FindInputCodec.class, FindInputCodec.MyInputCodec.class, AbstractFind.class, Item.class); }); + @TestHTTPResource("find-input-codec") + URI itemCodecUri; + + @Inject + Vertx vertx; + @Test public void testCodec() throws Exception { JsonArray items = new JsonArray(); @@ -39,7 +44,6 @@ public void testCodec() throws Exception { public void assertCodec(URI testUri, String payload, String expected) throws Exception { - Vertx vertx = Vertx.vertx(); WebSocketClient client = vertx.createWebSocketClient(); try { LinkedBlockingDeque message = new LinkedBlockingDeque<>(); diff --git a/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/codec/TextOutputCodecTest.java b/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/codec/TextOutputCodecTest.java index 66b04e7c2b277..c2970ff8d24a8 100644 --- a/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/codec/TextOutputCodecTest.java +++ b/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/codec/TextOutputCodecTest.java @@ -6,6 +6,8 @@ import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.TimeUnit; +import jakarta.inject.Inject; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -19,15 +21,18 @@ public class TextOutputCodecTest { - @TestHTTPResource("find-output-codec") - URI itemCodecUri; - @RegisterExtension public static final QuarkusUnitTest test = new QuarkusUnitTest() .withApplicationRoot(root -> { root.addClasses(FindOutputCodec.class, FindOutputCodec.MyOutputCodec.class, AbstractFind.class, Item.class); }); + @Inject + Vertx vertx; + + @TestHTTPResource("find-output-codec") + URI itemCodecUri; + @Test public void testCodec() throws Exception { JsonArray items = new JsonArray(); @@ -39,7 +44,6 @@ public void testCodec() throws Exception { public void assertCodec(URI testUri, String payload, String expected) throws Exception { - Vertx vertx = Vertx.vertx(); WebSocketClient client = vertx.createWebSocketClient(); try { LinkedBlockingDeque message = new LinkedBlockingDeque<>(); diff --git a/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/subsocket/SubWebSocketTest.java b/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/subsocket/SubWebSocketTest.java index e2663b3813c09..39b9cb85f0d80 100644 --- a/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/subsocket/SubWebSocketTest.java +++ b/extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/subsocket/SubWebSocketTest.java @@ -6,6 +6,8 @@ import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.TimeUnit; +import jakarta.inject.Inject; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -19,6 +21,9 @@ public class SubWebSocketTest { + @Inject + Vertx vertx; + @TestHTTPResource("sub") URI echoUri; @@ -44,7 +49,6 @@ public void testSubSubSub() throws Exception { } public void assertEcho(URI testUri, String path, String payload, String expected) throws Exception { - Vertx vertx = Vertx.vertx(); WebSocketClient client = vertx.createWebSocketClient(); try { LinkedBlockingDeque message = new LinkedBlockingDeque<>();