fix: preserve jt808 location raw archive uri
This commit is contained in:
@@ -55,7 +55,9 @@ public final class TdengineEnvelopeRows {
|
|||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
LocationPayload location = envelope.getLocation();
|
LocationPayload location = envelope.getLocation();
|
||||||
String rawUri = envelope.hasRawArchive() ? envelope.getRawArchive().getUri() : "";
|
String rawUri = firstNonBlank(
|
||||||
|
envelope.hasRawArchive() ? envelope.getRawArchive().getUri() : "",
|
||||||
|
envelope.getMetadataOrDefault("rawArchiveUri", ""));
|
||||||
String frameId = envelope.getMetadataOrDefault("frame_id", envelope.getEventId());
|
String frameId = envelope.getMetadataOrDefault("frame_id", envelope.getEventId());
|
||||||
return Optional.of(new TdengineLocationRow(
|
return Optional.of(new TdengineLocationRow(
|
||||||
instant(envelope.getEventTimeMs()),
|
instant(envelope.getEventTimeMs()),
|
||||||
|
|||||||
@@ -89,6 +89,26 @@ class TdengineEnvelopeRowsTest {
|
|||||||
assertThat(row.rawUri()).isEqualTo("archive://gb32960/2026/06/29/frame-location-1.bin");
|
assertThat(row.rawUri()).isEqualTo("archive://gb32960/2026/06/29/frame-location-1.bin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void mapsLocationRawUriFromMetadataWhenRawArchiveRefIsAbsent() {
|
||||||
|
VehicleEnvelope envelope = VehicleEnvelope.newBuilder()
|
||||||
|
.setEventId("evt-location-metadata-raw")
|
||||||
|
.setVin("unknown")
|
||||||
|
.setSource("JT808")
|
||||||
|
.setEventTimeMs(1_772_000_002_000L)
|
||||||
|
.setIngestTimeMs(1_772_000_002_321L)
|
||||||
|
.putMetadata("phone", "13079963291")
|
||||||
|
.putMetadata("rawArchiveUri", "archive://jt808/metadata-only.bin")
|
||||||
|
.setLocation(LocationPayload.newBuilder()
|
||||||
|
.setLongitude(119.12)
|
||||||
|
.setLatitude(29.45))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
TdengineLocationRow row = TdengineEnvelopeRows.location(envelope).orElseThrow();
|
||||||
|
|
||||||
|
assertThat(row.rawUri()).isEqualTo("archive://jt808/metadata-only.bin");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void mapsTelemetrySnapshotEnvelopeToFieldRows() {
|
void mapsTelemetrySnapshotEnvelopeToFieldRows() {
|
||||||
VehicleEnvelope envelope = VehicleEnvelope.newBuilder()
|
VehicleEnvelope envelope = VehicleEnvelope.newBuilder()
|
||||||
|
|||||||
Reference in New Issue
Block a user