fix(接口测试): 修复定时同步,新增参数没有同步的缺陷

--bug=1032301 --user=王孝刚 【接口测试】github#27163,接口定义-定时同步,接口请求体变化,新增参数没有同步
https://www.tapd.cn/55049933/s/1435604
This commit is contained in:
wxg0103 2023-11-13 10:46:47 +08:00 committed by Craftsman
parent e78ad2bc11
commit eaa98a3d20
2 changed files with 22 additions and 10 deletions

View File

@ -312,6 +312,11 @@ public class ApiDefinitionImportUtil {
Iterator<Map.Entry<String, JsonNode>> apiFields = apiProperties.fields();
Iterator<Map.Entry<String, JsonNode>> exApiFields = exApiProperties.fields();
Map<String, JsonNode> apiFieldMap = convertToMap(apiFields);
Map<String, JsonNode> exApiFileMap = convertToMap(exApiFields);
if (apiFieldMap.size() != exApiFileMap.size()) {
return true;
}
boolean diffProp = false;
while (apiFields.hasNext()) {
Map.Entry<String, JsonNode> apiNode = apiFields.next();
@ -319,18 +324,12 @@ public class ApiDefinitionImportUtil {
break;
}
if (exApiFields.hasNext()) {
Map.Entry<String, JsonNode> exChildNode = null;
Map.Entry<String, JsonNode> exNode = exApiFields.next();
if (StringUtils.equalsIgnoreCase(apiNode.getKey(), exNode.getKey())) {
exChildNode = exNode;
} else {
JsonNode value1 = exApiFileMap.get(apiNode.getKey());
if (value1 == null) {
diffProp = true;
}
if (exChildNode == null) {
continue;
}
JsonNode value = apiNode.getValue();
JsonNode value1 = exChildNode.getValue();
JsonNode apiPropertiesNode = value.get(PROPERTIES);
JsonNode exApiPropertiesNode = value1.get(PROPERTIES);
if (apiPropertiesNode == null || exApiPropertiesNode == null) {
@ -341,7 +340,20 @@ public class ApiDefinitionImportUtil {
return true;
}
}
return false;
return diffProp;
}
// 将迭代器转换为Map
private static Map<String, JsonNode> convertToMap(Iterator<Map.Entry<String, JsonNode>> iterator) {
Map<String, JsonNode> map = new LinkedHashMap<>();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> entry = iterator.next();
map.put(entry.getKey(), entry.getValue());
}
return map;
}
public static ApiTestCaseWithBLOBs addNewCase(ApiDefinitionWithBLOBs apiDefinition) {

View File

@ -6,7 +6,7 @@ public interface KafkaTopicConstants {
String PROJECT_CREATED_TOPIC = "PROJECT_CREATED";
String CLEAN_UP_REPORT_SCHEDULE = "CLEAN_UP_REPORT_SCHEDULE";
// 原接口执行结果TOPIC
String API_REPORT_TOPIC = "ms-api-exec-topic-4321";
String API_REPORT_TOPIC = "ms-api-exec-topic";
String DEBUG_TOPICS = "MS-API-DEBUG-TOPIC";
String UI_DEBUG_TOPICS = "MS-UI-DEBUG-TOPIC";
// 测试计划接收执行结果TOPIC