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

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