fix: align jt808 protocol default port
This commit is contained in:
@@ -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