test: centralize vehicle identity fixtures
This commit is contained in:
@@ -122,6 +122,7 @@ class MavenModuleProfileTest {
|
||||
void xindaModulesAreRemovedFromBuildSurface() throws Exception {
|
||||
Document pom = rootPom();
|
||||
String rootPomText = Files.readString(repositoryRoot().resolve("pom.xml"));
|
||||
String readme = Files.readString(repositoryRoot().resolve("README.md"));
|
||||
|
||||
assertThat(defaultModules(pom))
|
||||
.doesNotContain("modules/inbound/inbound-xinda-push")
|
||||
@@ -137,6 +138,10 @@ class MavenModuleProfileTest {
|
||||
.doesNotContain("legacy-xinda")
|
||||
.doesNotContain("inbound-xinda-push")
|
||||
.doesNotContain("xinda-push-app");
|
||||
assertThat(readme)
|
||||
.contains("信达 Push 已废弃并删除源码")
|
||||
.doesNotContain("信达 Push 仅保留")
|
||||
.doesNotContain("废弃兼容模块");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -187,6 +192,29 @@ class MavenModuleProfileTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void vehicleIdentityTestSupportIsCentralizedInsteadOfCopiedIntoProtocolTests() throws Exception {
|
||||
Document pom = rootPom();
|
||||
List<String> testSupportFixtures = javaFilesNamed("InMemoryVehicleIdentityService.java");
|
||||
|
||||
assertThat(defaultModules(pom))
|
||||
.contains("modules/testing/vehicle-identity-test-support");
|
||||
assertThat(rootDependencyManagementArtifacts(pom))
|
||||
.contains("vehicle-identity-test-support");
|
||||
assertThat(testSupportFixtures)
|
||||
.containsExactly("modules/testing/vehicle-identity-test-support/src/main/java/com/lingniu/ingest/identity/InMemoryVehicleIdentityService.java");
|
||||
|
||||
for (String modulePom : List.of(
|
||||
"modules/protocols/protocol-jt808/pom.xml",
|
||||
"modules/inbound/inbound-mqtt/pom.xml",
|
||||
"modules/protocols/protocol-jt1078/pom.xml",
|
||||
"modules/protocols/protocol-jsatl12/pom.xml")) {
|
||||
assertThat(hasDependency(modulePom(modulePom), "com.lingniu.ingest", "vehicle-identity-test-support"))
|
||||
.as(modulePom)
|
||||
.isTrue();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void readmeMatchesCurrentRuntimeVersionsAndSplitAppResponsibilities() throws Exception {
|
||||
Document pom = rootPom();
|
||||
@@ -798,6 +826,19 @@ class MavenModuleProfileTest {
|
||||
}
|
||||
}
|
||||
|
||||
private static List<String> javaFilesNamed(String fileName) throws Exception {
|
||||
Path root = repositoryRoot();
|
||||
try (Stream<Path> files = Files.walk(root.resolve("modules"))) {
|
||||
return files
|
||||
.filter(Files::isRegularFile)
|
||||
.filter(path -> fileName.equals(path.getFileName().toString()))
|
||||
.map(root::relativize)
|
||||
.map(Path::toString)
|
||||
.sorted()
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
private static Element firstDirectChild(Element parent, String tagName) {
|
||||
NodeList children = parent.getChildNodes();
|
||||
for (int i = 0; i < children.getLength(); i++) {
|
||||
|
||||
Reference in New Issue
Block a user