diff --git a/modules/protocols/protocol-jt808/pom.xml b/modules/protocols/protocol-jt808/pom.xml index 77bfd010..de8766a7 100644 --- a/modules/protocols/protocol-jt808/pom.xml +++ b/modules/protocols/protocol-jt808/pom.xml @@ -9,7 +9,7 @@ protocol-jt808 protocol-jt808 - JT/T 808 协议接入(Netty Server,默认 TCP 10808)。 + JT/T 808 协议接入(Netty Server,默认 TCP 808)。 diff --git a/modules/protocols/protocol-jt808/src/main/java/com/lingniu/ingest/protocol/jt808/config/Jt808Properties.java b/modules/protocols/protocol-jt808/src/main/java/com/lingniu/ingest/protocol/jt808/config/Jt808Properties.java index 74532723..da28853d 100644 --- a/modules/protocols/protocol-jt808/src/main/java/com/lingniu/ingest/protocol/jt808/config/Jt808Properties.java +++ b/modules/protocols/protocol-jt808/src/main/java/com/lingniu/ingest/protocol/jt808/config/Jt808Properties.java @@ -7,7 +7,7 @@ public class Jt808Properties { /** 是否启动 JT/T 808 TCP 监听。与 GB32960 独立,通常用于部标终端。 */ private boolean enabled = false; /** JT808 默认监听端口;不要与 32960 端口共用。 */ - private int port = 10808; + private int port = 808; /** Netty worker 线程数;0 表示使用框架默认值。 */ private int workerThreads = 0; diff --git a/modules/protocols/protocol-jt808/src/test/java/com/lingniu/ingest/protocol/jt808/config/Jt808PropertiesTest.java b/modules/protocols/protocol-jt808/src/test/java/com/lingniu/ingest/protocol/jt808/config/Jt808PropertiesTest.java new file mode 100644 index 00000000..0a77d6e4 --- /dev/null +++ b/modules/protocols/protocol-jt808/src/test/java/com/lingniu/ingest/protocol/jt808/config/Jt808PropertiesTest.java @@ -0,0 +1,34 @@ +package com.lingniu.ingest.protocol.jt808.config; + +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; + +import static org.assertj.core.api.Assertions.assertThat; + +class Jt808PropertiesTest { + + @Test + void defaultsToCurrentProductionReceivePort() throws IOException { + assertThat(new Jt808Properties().getPort()).isEqualTo(808); + + String pom = Files.readString(repositoryRoot() + .resolve("modules/protocols/protocol-jt808/pom.xml")); + assertThat(pom) + .contains("默认 TCP 808") + .doesNotContain("10808"); + } + + private static Path repositoryRoot() { + Path current = Path.of(System.getProperty("user.dir")).toAbsolutePath(); + while (current != null) { + if (Files.exists(current.resolve("pom.xml")) && Files.exists(current.resolve("modules"))) { + return current; + } + current = current.getParent(); + } + throw new IllegalStateException("repository root not found"); + } +}