From 25ab92601ba13d2fe083d48578028e69d4ec2bc8 Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Tue, 31 Aug 2021 09:47:43 +1000 Subject: [PATCH] Update Dev UI with the correct state when resuming Fixes #19777 --- ...ntinuousTestingWebSocketTestListener.java} | 40 ++++++++++++------- .../devmode/tests/TestsProcessor.java | 4 +- 2 files changed, 28 insertions(+), 16 deletions(-) rename extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/{ContinuousTestingWebSocketListener.java => ContinuousTestingWebSocketTestListener.java} (56%) diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/ContinuousTestingWebSocketListener.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/ContinuousTestingWebSocketTestListener.java similarity index 56% rename from extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/ContinuousTestingWebSocketListener.java rename to extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/ContinuousTestingWebSocketTestListener.java index 703dfe9514f44..2d83492a8186b 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/ContinuousTestingWebSocketListener.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/ContinuousTestingWebSocketTestListener.java @@ -11,7 +11,9 @@ import io.quarkus.deployment.dev.testing.TestRunResults; import io.quarkus.dev.testing.ContinuousTestingWebsocketListener; -public class ContinuousTestingWebSocketListener implements TestListener { +public class ContinuousTestingWebSocketTestListener implements TestListener { + + private volatile ContinuousTestingWebsocketListener.State lastState; @Override public void listenerRegistered(TestController testController) { @@ -20,9 +22,18 @@ public void listenerRegistered(TestController testController) { @Override public void testsEnabled() { - ContinuousTestingWebsocketListener - .setLastState( - new ContinuousTestingWebsocketListener.State(true, true, 0L, 0L, 0L, 0L, false, false, false, true)); + if (lastState == null) { + ContinuousTestingWebsocketListener + .setLastState(new ContinuousTestingWebsocketListener.State(true, false, + 0, 0, 0, 0, + ContinuousTestingWebsocketListener.getLastState().isBrokenOnly, + ContinuousTestingWebsocketListener.getLastState().isTestOutput, + ContinuousTestingWebsocketListener.getLastState().isInstrumentationBasedReload, + ContinuousTestingWebsocketListener.getLastState().isLiveReload)); + } else { + ContinuousTestingWebsocketListener + .setLastState(lastState); + } } @Override @@ -46,17 +57,18 @@ public void testComplete(TestResult result) { @Override public void runComplete(TestRunResults testRunResults) { + lastState = new ContinuousTestingWebsocketListener.State(true, false, + testRunResults.getPassedCount() + + testRunResults.getFailedCount() + + testRunResults.getSkippedCount(), + testRunResults.getPassedCount(), + testRunResults.getFailedCount(), testRunResults.getSkippedCount(), + ContinuousTestingWebsocketListener.getLastState().isBrokenOnly, + ContinuousTestingWebsocketListener.getLastState().isTestOutput, + ContinuousTestingWebsocketListener.getLastState().isInstrumentationBasedReload, + ContinuousTestingWebsocketListener.getLastState().isLiveReload); ContinuousTestingWebsocketListener.setLastState( - new ContinuousTestingWebsocketListener.State(true, false, - testRunResults.getPassedCount() + - testRunResults.getFailedCount() + - testRunResults.getSkippedCount(), - testRunResults.getPassedCount(), - testRunResults.getFailedCount(), testRunResults.getSkippedCount(), - ContinuousTestingWebsocketListener.getLastState().isBrokenOnly, - ContinuousTestingWebsocketListener.getLastState().isTestOutput, - ContinuousTestingWebsocketListener.getLastState().isInstrumentationBasedReload, - ContinuousTestingWebsocketListener.getLastState().isLiveReload)); + lastState); } @Override diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/tests/TestsProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/tests/TestsProcessor.java index fe0a98105eb8b..6bc93507d3b80 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/tests/TestsProcessor.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/tests/TestsProcessor.java @@ -23,7 +23,7 @@ import io.quarkus.devconsole.spi.DevConsoleTemplateInfoBuildItem; import io.quarkus.vertx.http.deployment.NonApplicationRootPathBuildItem; import io.quarkus.vertx.http.deployment.RouteBuildItem; -import io.quarkus.vertx.http.deployment.devmode.console.ContinuousTestingWebSocketListener; +import io.quarkus.vertx.http.deployment.devmode.console.ContinuousTestingWebSocketTestListener; import io.quarkus.vertx.http.runtime.devmode.DevConsoleRecorder; import io.quarkus.vertx.http.runtime.devmode.Json; import io.vertx.core.Handler; @@ -61,7 +61,7 @@ public void setupTestRoutes( .route("dev/test") .handler(recorder.continousTestHandler(shutdownContextBuildItem)) .build()); - testListenerBuildItemBuildProducer.produce(new TestListenerBuildItem(new ContinuousTestingWebSocketListener())); + testListenerBuildItemBuildProducer.produce(new TestListenerBuildItem(new ContinuousTestingWebSocketTestListener())); } }