refactor: make event file store optional
This commit is contained in:
@@ -63,7 +63,8 @@ class Gb32960IngestAppCompositionTest {
|
||||
assertThat(context).hasSingleBean(ArchiveStore.class);
|
||||
assertThat(context).hasSingleBean(RawArchiveEventSink.class);
|
||||
|
||||
assertTypeNotPresent(context, "com.lingniu.ingest.eventfilestore.EventFileStore");
|
||||
assertTypeNotPresent(context, "com.lingniu.ingest.eventfilestore.DuckDbParquetEventFileStore");
|
||||
assertTypeNotPresent(context, "com.lingniu.ingest.eventfilestore.config.EventFileStoreAutoConfiguration");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,8 @@ class Jt808IngestAppCompositionTest {
|
||||
assertThat(context).hasSingleBean(ArchiveStore.class);
|
||||
assertThat(context).hasSingleBean(RawArchiveEventSink.class);
|
||||
|
||||
assertTypeNotPresent(context, "com.lingniu.ingest.eventfilestore.EventFileStore");
|
||||
assertTypeNotPresent(context, "com.lingniu.ingest.eventfilestore.DuckDbParquetEventFileStore");
|
||||
assertTypeNotPresent(context, "com.lingniu.ingest.eventfilestore.config.EventFileStoreAutoConfiguration");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,9 @@ class VehicleAnalyticsAppCompositionTest {
|
||||
assertTypeNotPresent(context, "com.lingniu.ingest.vehiclestate.VehicleStateEnvelopeIngestor");
|
||||
assertTypeNotPresent(context, "com.lingniu.ingest.vehiclestate.config.VehicleStateAutoConfiguration");
|
||||
assertTypeNotPresent(context, "com.lingniu.ingest.protocol.gb32960.inbound.Gb32960NettyServer");
|
||||
assertTypeNotPresent(context, "com.lingniu.ingest.eventfilestore.EventFileStore");
|
||||
assertTypeNotPresent(context, "com.lingniu.ingest.eventfilestore.DuckDbParquetEventFileStore");
|
||||
assertTypeNotPresent(context,
|
||||
"com.lingniu.ingest.eventfilestore.config.EventFileStoreAutoConfiguration");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,22 @@ class MavenModuleProfileTest {
|
||||
.containsExactly("modules/sinks/raw-archive-store");
|
||||
}
|
||||
|
||||
@Test
|
||||
void eventFileStoreCompatibilityPathIsOptionalAndOutsideDefaultProductionReactor() throws Exception {
|
||||
Document pom = rootPom();
|
||||
Document eventHistoryServicePom = modulePom("modules/services/event-history-service/pom.xml");
|
||||
|
||||
assertThat(defaultModules(pom))
|
||||
.doesNotContain("modules/sinks/event-file-store");
|
||||
|
||||
assertThat(profileModules(pom, "optional-event-file-store"))
|
||||
.containsExactly("modules/sinks/event-file-store");
|
||||
|
||||
assertThat(hasDependency(eventHistoryServicePom, "com.lingniu.ingest", "event-file-store"))
|
||||
.as("event-history-service should depend only on the lightweight history contract")
|
||||
.isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void xindaIsLegacyOnlyAndOutsideDefaultProductionReactor() throws Exception {
|
||||
Document pom = rootPom();
|
||||
@@ -97,7 +113,7 @@ class MavenModuleProfileTest {
|
||||
.contains("Netty " + projectProperty(pom, "netty.version"))
|
||||
.contains("Eclipse Paho " + projectProperty(pom, "paho-mqtt.version"))
|
||||
.contains("protocol-jsatl12/ 苏标主动安全报警附件(optional-attachments profile)")
|
||||
.contains("event-file-store/ 可选兼容索引(旧 Parquet/DuckDB 路径)")
|
||||
.contains("event-file-store/ 可选兼容索引(旧 Parquet/DuckDB 路径,仅 -Poptional-event-file-store 显式构建)")
|
||||
.contains("vehicle-state-service/ Kafka 全字段事件消费 + Redis 热状态查询(optional-latest-state profile)")
|
||||
.contains("vehicle-history-app/ TDengine 历史查询 + RAW JSON")
|
||||
.contains("vehicle-analytics-app/ JT808 每日里程指标消费")
|
||||
@@ -133,6 +149,7 @@ class MavenModuleProfileTest {
|
||||
.contains("JSATL12 仅保留在 `optional-attachments` profile")
|
||||
.contains("vehicle-state-service 仅保留在 `optional-latest-state` profile")
|
||||
.contains("raw-archive-store 仅保留在 `optional-raw-archive-store` profile")
|
||||
.contains("event-file-store 仅保留在 `optional-event-file-store` profile")
|
||||
.doesNotContain("## ADR-004 信达 Push:保留模块但彻底重写\n- **Status**: Accepted")
|
||||
.doesNotContain("Spring Boot 3.4.x");
|
||||
}
|
||||
@@ -225,6 +242,28 @@ class MavenModuleProfileTest {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean hasDependency(Document pom, String groupId, String artifactId) {
|
||||
Element dependencies = firstDirectChild(pom.getDocumentElement(), "dependencies");
|
||||
if (dependencies == null) {
|
||||
return false;
|
||||
}
|
||||
NodeList children = dependencies.getChildNodes();
|
||||
for (int i = 0; i < children.getLength(); i++) {
|
||||
if (!(children.item(i) instanceof Element dependency) || !"dependency".equals(dependency.getTagName())) {
|
||||
continue;
|
||||
}
|
||||
Element currentGroupId = firstDirectChild(dependency, "groupId");
|
||||
Element currentArtifactId = firstDirectChild(dependency, "artifactId");
|
||||
if (currentGroupId != null
|
||||
&& currentArtifactId != null
|
||||
&& groupId.equals(currentGroupId.getTextContent().trim())
|
||||
&& artifactId.equals(currentArtifactId.getTextContent().trim())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static Element firstDirectChild(Element parent, String tagName) {
|
||||
NodeList children = parent.getChildNodes();
|
||||
for (int i = 0; i < children.getLength(); i++) {
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.lingniu.ingest.historyapp;
|
||||
import com.lingniu.ingest.api.consumer.EnvelopeConsumerProcessor;
|
||||
import com.lingniu.ingest.api.consumer.EnvelopeDeadLetterSink;
|
||||
import com.lingniu.ingest.api.consumer.EnvelopeIngestResult;
|
||||
import com.lingniu.ingest.eventfilestore.EventFileStore;
|
||||
import com.lingniu.ingest.api.history.EventFileStore;
|
||||
import com.lingniu.ingest.eventhistory.EventHistoryEnvelopeIngestor;
|
||||
import com.lingniu.ingest.eventhistory.Gb32960DecodedFrameService;
|
||||
import com.lingniu.ingest.eventhistory.Gb32960FrameController;
|
||||
|
||||
Reference in New Issue
Block a user