fix: align jt808 protocol default port

This commit is contained in:
lingniu
2026-07-01 09:48:55 +08:00
parent ce93236a5a
commit bb051391c2
3 changed files with 36 additions and 2 deletions

View File

@@ -9,7 +9,7 @@
</parent>
<artifactId>protocol-jt808</artifactId>
<name>protocol-jt808</name>
<description>JT/T 808 协议接入Netty Server默认 TCP 10808</description>
<description>JT/T 808 协议接入Netty Server默认 TCP 808</description>
<dependencies>
<dependency>

View File

@@ -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;

View File

@@ -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");
}
}