docs: align jt808 mileage metric design
This commit is contained in:
@@ -2,7 +2,10 @@ package com.lingniu.ingest.vehiclestat;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -15,4 +18,30 @@ class VehicleStatRepositoryContractTest {
|
||||
.map(Method::getName))
|
||||
.containsExactlyInAnyOrder("recordDailyMileageSample", "findDailyStat");
|
||||
}
|
||||
|
||||
@Test
|
||||
void jt808MileagePlanDocumentsMetricTableDiffOnly() throws IOException {
|
||||
String plan = Files.readString(repositoryRoot()
|
||||
.resolve("docs/superpowers/plans/2026-06-30-kafka-streaming-mileage.md"));
|
||||
|
||||
assertThat(plan)
|
||||
.contains("Runtime state: none outside `vehicle_stat_metric`")
|
||||
.contains("daily_mileage_km = last_total_mileage_km - first_total_mileage_km")
|
||||
.contains("Do not create or write a protocol-specific JT808 daily-mileage table.")
|
||||
.doesNotContain("Redis `Jt808MileageStateStore`")
|
||||
.doesNotContain("REDIS_HOST")
|
||||
.doesNotContain("GPS segment distance")
|
||||
.doesNotContain("speed integral");
|
||||
}
|
||||
|
||||
private static Path repositoryRoot() {
|
||||
Path path = Path.of("").toAbsolutePath();
|
||||
while (path != null && !Files.exists(path.resolve("docs/superpowers/plans"))) {
|
||||
path = path.getParent();
|
||||
}
|
||||
if (path == null) {
|
||||
throw new IllegalStateException("repository root not found");
|
||||
}
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user