fix: align jt808 protocol default port
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
<artifactId>protocol-jt808</artifactId>
|
<artifactId>protocol-jt808</artifactId>
|
||||||
<name>protocol-jt808</name>
|
<name>protocol-jt808</name>
|
||||||
<description>JT/T 808 协议接入(Netty Server,默认 TCP 10808)。</description>
|
<description>JT/T 808 协议接入(Netty Server,默认 TCP 808)。</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public class Jt808Properties {
|
|||||||
/** 是否启动 JT/T 808 TCP 监听。与 GB32960 独立,通常用于部标终端。 */
|
/** 是否启动 JT/T 808 TCP 监听。与 GB32960 独立,通常用于部标终端。 */
|
||||||
private boolean enabled = false;
|
private boolean enabled = false;
|
||||||
/** JT808 默认监听端口;不要与 32960 端口共用。 */
|
/** JT808 默认监听端口;不要与 32960 端口共用。 */
|
||||||
private int port = 10808;
|
private int port = 808;
|
||||||
/** Netty worker 线程数;0 表示使用框架默认值。 */
|
/** Netty worker 线程数;0 表示使用框架默认值。 */
|
||||||
private int workerThreads = 0;
|
private int workerThreads = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -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");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user