refactor: remove legacy event file store

This commit is contained in:
lingniu
2026-07-01 11:04:11 +08:00
parent e80fa6f38c
commit 7ce64e9963
16 changed files with 61 additions and 1675 deletions

View File

@@ -64,19 +64,27 @@ class MavenModuleProfileTest {
}
@Test
void eventFileStoreCompatibilityPathIsOptionalAndOutsideDefaultProductionReactor() throws Exception {
void eventFileStoreCompatibilityPathIsRemovedFromProductionStack() throws Exception {
Document pom = rootPom();
Document eventHistoryServicePom = modulePom("modules/services/event-history-service/pom.xml");
String readme = Files.readString(repositoryRoot().resolve("README.md"));
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")
.as("DuckDB/Parquet event-file-store has been replaced by TDengine raw history")
.isEmpty();
assertThat(Files.exists(repositoryRoot().resolve("modules/sinks/event-file-store")))
.isFalse();
assertThat(rootDependencyManagementArtifacts(pom))
.doesNotContain("event-file-store");
assertThat(hasProjectProperty(pom, "duckdb.version"))
.isFalse();
assertThat(hasDependency(pom, "org.duckdb", "duckdb_jdbc"))
.isFalse();
assertThat(readme)
.doesNotContain("event-file-store")
.doesNotContain("DuckDB")
.doesNotContain("Parquet");
}
@Test
@@ -124,7 +132,6 @@ class MavenModuleProfileTest {
"protocol-jsatl12",
"vehicle-state-service",
"raw-archive-store",
"event-file-store",
"command-gateway",
"inbound-xinda-push",
"xinda-push-app");
@@ -138,7 +145,7 @@ class MavenModuleProfileTest {
assertThat(profileDependencyManagementArtifacts(pom, "optional-raw-archive-store"))
.containsExactly("raw-archive-store");
assertThat(profileDependencyManagementArtifacts(pom, "optional-event-file-store"))
.containsExactly("event-file-store");
.isEmpty();
assertThat(profileDependencyManagementArtifacts(pom, "legacy-xinda"))
.containsExactly("inbound-xinda-push", "xinda-push-app");
}
@@ -165,7 +172,6 @@ class MavenModuleProfileTest {
.contains("session-core/ 设备会话 + 鉴权 + Token + Redis SessionStore")
.contains("protocol-jt1078/ JT/T 1078optional-command-gateway profile")
.contains("protocol-jsatl12/ 苏标主动安全报警附件optional-attachments profile")
.contains("event-file-store/ 可选兼容索引(旧 Parquet/DuckDB 路径,仅 -Poptional-event-file-store 显式构建)")
.contains("vehicle-state-service/ Kafka 全字段事件消费 + Redis 热状态查询optional-latest-state profile")
.contains("command-gateway/ 可选 HTTP → 设备下行命令optional-command-gateway profile")
.contains("vehicle-history-app/ TDengine 历史查询 + RAW JSON")
@@ -175,6 +181,9 @@ class MavenModuleProfileTest {
.doesNotContain("HiveMQ MQTT Client")
.doesNotContain("Caffeine 内存降级")
.doesNotContain("Redis/Memory SessionStore")
.doesNotContain("event-file-store")
.doesNotContain("DuckDB")
.doesNotContain("Parquet")
.doesNotContain("Parquet + DuckDB 文件型明细库")
.doesNotContain("车辆状态/日统计消费");
}
@@ -228,7 +237,8 @@ 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("event-file-store")
.doesNotContain("optional-event-file-store")
.doesNotContain("## ADR-004 信达 Push保留模块但彻底重写\n- **Status**: Accepted")
.doesNotContain("Spring Boot 3.4.x");
}
@@ -249,12 +259,15 @@ class MavenModuleProfileTest {
}
@Test
void duckDbDriverDoesNotLeakFromCompatibilityStoreIntoProductionApps() throws Exception {
Document eventFileStorePom = modulePom("modules/sinks/event-file-store/pom.xml");
void duckDbAndParquetAreNotPartOfTheCurrentBuildSurface() throws Exception {
Document pom = rootPom();
assertThat(dependencyOptional(eventFileStorePom, "org.duckdb", "duckdb_jdbc"))
.as("event-file-store is a compatibility path; DuckDB must not be transitive")
.isTrue();
assertThat(hasProjectProperty(pom, "duckdb.version"))
.isFalse();
assertThat(hasDependency(pom, "org.duckdb", "duckdb_jdbc"))
.isFalse();
assertThat(Files.exists(repositoryRoot().resolve("modules/sinks/event-file-store")))
.isFalse();
}
private static Document rootPom() throws Exception {
@@ -276,6 +289,11 @@ class MavenModuleProfileTest {
return property.getTextContent().trim();
}
private static boolean hasProjectProperty(Document pom, String name) {
Element properties = firstDirectChild(pom.getDocumentElement(), "properties");
return properties != null && firstDirectChild(properties, name) != null;
}
private static List<String> defaultModules(Document pom) {
Element project = pom.getDocumentElement();
return directModules(firstDirectChild(project, "modules"));
@@ -359,31 +377,20 @@ class MavenModuleProfileTest {
return List.copyOf(artifacts);
}
private static boolean dependencyOptional(Document pom, String groupId, String artifactId) {
Element dependencies = firstDirectChild(pom.getDocumentElement(), "dependencies");
if (dependencies == null) {
private static boolean hasDependency(Document pom, String groupId, String artifactId) {
Element owner = pom.getDocumentElement();
Element dependencyManagement = firstDirectChild(owner, "dependencyManagement");
Element dependencies = firstDirectChild(owner, "dependencies");
if (hasDependencyIn(dependencies, groupId, artifactId)) {
return true;
}
if (dependencyManagement == 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())) {
Element optional = firstDirectChild(dependency, "optional");
return optional != null && Boolean.parseBoolean(optional.getTextContent().trim());
}
}
return false;
return hasDependencyIn(firstDirectChild(dependencyManagement, "dependencies"), groupId, artifactId);
}
private static boolean hasDependency(Document pom, String groupId, String artifactId) {
Element dependencies = firstDirectChild(pom.getDocumentElement(), "dependencies");
private static boolean hasDependencyIn(Element dependencies, String groupId, String artifactId) {
if (dependencies == null) {
return false;
}