diff --git a/java_console/ui/src/test/java/com/rusefi/FullServerTest.java b/java_console/ui/src/test/java/com/rusefi/FullServerTest.java index 80d5629d13..5b96939a47 100644 --- a/java_console/ui/src/test/java/com/rusefi/FullServerTest.java +++ b/java_console/ui/src/test/java/com/rusefi/FullServerTest.java @@ -69,9 +69,7 @@ public class FullServerTest { // create virtual controller to which "rusEFI network connector" connects to int controllerPort = 7002; ConfigurationImage controllerImage = prepareImage(value, createIniField(Fields.CYLINDERSCOUNT)); - CountDownLatch controllerCreated = new CountDownLatch(1); - TestHelper.createVirtualController(controllerImage, controllerPort, parameter -> controllerCreated.countDown(), logger); - assertTrue(controllerCreated.await(READ_IMAGE_TIMEOUT, TimeUnit.MILLISECONDS)); + TestHelper.createVirtualController(controllerPort, controllerImage, logger); // start "rusEFI network connector" to connect controller with backend since in real life controller has only local serial port it does not have network diff --git a/java_console/ui/src/test/java/com/rusefi/TestHelper.java b/java_console/ui/src/test/java/com/rusefi/TestHelper.java index ddcb4f7638..e533516dc7 100644 --- a/java_console/ui/src/test/java/com/rusefi/TestHelper.java +++ b/java_console/ui/src/test/java/com/rusefi/TestHelper.java @@ -17,6 +17,11 @@ import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.net.Socket; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import static com.rusefi.Timeouts.READ_IMAGE_TIMEOUT; +import static org.junit.Assert.assertTrue; public class TestHelper { public static final String LOCALHOST = "localhost"; @@ -68,4 +73,11 @@ public class TestHelper { } return targetEcuSocket; } + + public static BinaryProtocolServer createVirtualController(int controllerPort, ConfigurationImage controllerImage, Logger logger) throws InterruptedException { + CountDownLatch controllerCreated = new CountDownLatch(1); + BinaryProtocolServer server = createVirtualController(controllerImage, controllerPort, parameter -> controllerCreated.countDown(), logger); + assertTrue(controllerCreated.await(READ_IMAGE_TIMEOUT, TimeUnit.MILLISECONDS)); + return server; + } } diff --git a/java_console/ui/src/test/java/com/rusefi/io/TcpCommunicationIntegrationTest.java b/java_console/ui/src/test/java/com/rusefi/io/TcpCommunicationIntegrationTest.java index 4a60dec37d..e593408881 100644 --- a/java_console/ui/src/test/java/com/rusefi/io/TcpCommunicationIntegrationTest.java +++ b/java_console/ui/src/test/java/com/rusefi/io/TcpCommunicationIntegrationTest.java @@ -51,9 +51,7 @@ public class TcpCommunicationIntegrationTest { ConfigurationImage serverImage = TestHelper.prepareImage(value, iniField); int port = 6100; - CountDownLatch serverCreated = new CountDownLatch(1); - BinaryProtocolServer server = TestHelper.createVirtualController(serverImage, port, parameter -> serverCreated.countDown(), LOGGER); - assertTrue(serverCreated.await(30, TimeUnit.SECONDS)); + BinaryProtocolServer server = TestHelper.createVirtualController(port, serverImage, LOGGER); CountDownLatch connectionEstablishedCountDownLatch = new CountDownLatch(1); @@ -90,9 +88,7 @@ public class TcpCommunicationIntegrationTest { int controllerPort = 6102; // create virtual controller - CountDownLatch serverCreated = new CountDownLatch(1); - BinaryProtocolServer server = TestHelper.createVirtualController(serverImage, controllerPort, parameter -> serverCreated.countDown(), LOGGER); - assertTrue(serverCreated.await(30, TimeUnit.SECONDS)); + TestHelper.createVirtualController(controllerPort, serverImage, LOGGER); int proxyPort = 6103; diff --git a/java_tools/ts_plugin/src/main/java/com/rusefi/ts_plugin/UploadQueue.java b/java_tools/ts_plugin/src/main/java/com/rusefi/ts_plugin/UploadQueue.java index c9e448465a..262b36bb36 100644 --- a/java_tools/ts_plugin/src/main/java/com/rusefi/ts_plugin/UploadQueue.java +++ b/java_tools/ts_plugin/src/main/java/com/rusefi/ts_plugin/UploadQueue.java @@ -15,7 +15,7 @@ import java.util.concurrent.LinkedBlockingDeque; public class UploadQueue { public static final String OUTBOX_FOLDER = FileUtil.RUSEFI_SETTINGS_FOLDER + File.separator + "outbox"; - private static LinkedBlockingDeque queue = new LinkedBlockingDeque<>(128); + private static final LinkedBlockingDeque queue = new LinkedBlockingDeque<>(128); private static boolean isStarted;