From 2868890095414ec3adbe12ed898b27134085cfff Mon Sep 17 00:00:00 2001 From: rusefillc Date: Wed, 1 Jun 2022 13:38:12 -0400 Subject: [PATCH] hard requirement for console version match #4187 --- java_console/io/src/test/java/com/rusefi/TestHelper.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/java_console/io/src/test/java/com/rusefi/TestHelper.java b/java_console/io/src/test/java/com/rusefi/TestHelper.java index 4cdbd5c773..8758ceebb1 100644 --- a/java_console/io/src/test/java/com/rusefi/TestHelper.java +++ b/java_console/io/src/test/java/com/rusefi/TestHelper.java @@ -15,17 +15,21 @@ import com.rusefi.proxy.NetworkConnector; import com.rusefi.server.ControllerInfo; import com.rusefi.server.SessionDetails; import com.rusefi.server.rusEFISSLContext; +import com.rusefi.shared.FileUtil; import com.rusefi.tune.xml.Constant; import org.jetbrains.annotations.NotNull; import org.mockito.stubbing.Answer; import java.io.IOException; import java.net.Socket; +import java.nio.ByteBuffer; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import static com.devexperts.logging.Logging.getLogging; import static com.rusefi.Timeouts.READ_IMAGE_TIMEOUT; +import static com.rusefi.config.generated.Fields.TS_FILE_VERSION; +import static com.rusefi.config.generated.Fields.TS_FILE_VERSION_OFFSET; import static com.rusefi.io.tcp.TcpConnector.LOCALHOST; import static org.junit.Assert.assertTrue; @@ -57,7 +61,10 @@ public class TestHelper { public static BinaryProtocolServer createVirtualController(ConfigurationImage ci, int port, Listener serverSocketCreationCallback, BinaryProtocolServer.Context context) throws IOException { BinaryProtocolState state = new BinaryProtocolState(); state.setController(ci); - state.setCurrentOutputs(new byte[1 + Fields.TS_TOTAL_OUTPUT_SIZE]); + byte[] currentOutputs = new byte[Fields.TS_TOTAL_OUTPUT_SIZE]; + ByteBuffer buffer = FileUtil.littleEndianWrap(currentOutputs, TS_FILE_VERSION_OFFSET, 4); + buffer.putInt(TS_FILE_VERSION); + state.setCurrentOutputs(currentOutputs); LinkManager linkManager = new LinkManager(); linkManager.setConnector(LinkConnector.getDetachedConnector(state));