测试验收:补充一期后端业务场景测试
This commit is contained in:
1 parent
4d9601a4f1
commit
126dddfa7b
24 files changed
+2313
No files matched your search
@@ -0,0 +1,41 @@
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.sql.*;
|
||||
|
||||
public class VerifyDbIntegrity {
|
||||
public static void main(String[] args) throws Exception {
|
||||
Class.forName("com.kingbase8.Driver");
|
||||
File yml = new File("RuoYi-Vue/ruoyi-admin/src/main/resources/application-druid.yml");
|
||||
String pass = "";
|
||||
for (String line : Files.readAllLines(yml.toPath())) {
|
||||
if (line.trim().startsWith("password:")) pass = line.trim().substring("password:".length()).trim();
|
||||
}
|
||||
try (Connection conn = DriverManager.getConnection("jdbc:kingbase8://127.0.0.1:4321/railwaysystem_integrated_qa_20260916?useUnicode=true&characterEncoding=utf8", "kingbase", pass)) {
|
||||
// 1. Check orphan enrollments
|
||||
int orphanEnrollments = 0;
|
||||
try (Statement st = conn.createStatement();
|
||||
ResultSet rs = st.executeQuery("SELECT count(*) FROM public.train_enrollment e WHERE NOT EXISTS (SELECT 1 FROM public.train_class_plan p WHERE p.plan_id = e.plan_id)")) {
|
||||
if (rs.next()) orphanEnrollments = rs.getInt(1);
|
||||
}
|
||||
|
||||
// 2. Check active accommodation duplicate count
|
||||
int activeDup = 0;
|
||||
try (Statement st = conn.createStatement();
|
||||
ResultSet rs = st.executeQuery("SELECT enrollment_id, count(*) FROM public.train_accommodation WHERE accommodation_status = 1 GROUP BY enrollment_id HAVING count(*) > 1")) {
|
||||
while (rs.next()) activeDup++;
|
||||
}
|
||||
|
||||
// 3. Check operation idempotency violation
|
||||
int idempDup = 0;
|
||||
try (Statement st = conn.createStatement();
|
||||
ResultSet rs = st.executeQuery("SELECT door_auth_id, operation_type, count(*) FROM public.train_external_operation GROUP BY door_auth_id, operation_type HAVING count(*) > 1")) {
|
||||
while (rs.next()) idempDup++;
|
||||
}
|
||||
|
||||
System.out.println("ORPHAN_COUNT=" + orphanEnrollments);
|
||||
System.out.println("ACTIVE_ACCOMMODATION_DUPLICATE_COUNT=" + activeDup);
|
||||
System.out.println("DMS_OPERATION_IDEMPOTENCY_VIOLATION=" + idempDup);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user