refactor(接口测试): 接口导入不会进入待更新列表

--user=郭雨琦
This commit is contained in:
guoyuqi 2022-10-25 14:41:36 +08:00 committed by f2c-ci-robot[bot]
parent db9a726048
commit 30476a8e92
1 changed files with 1 additions and 16 deletions

View File

@ -1174,15 +1174,7 @@ public class ApiDefinitionService {
} else if (apiTestImportRequest.getCoverModule() != null && apiTestImportRequest.getCoverModule()) { } else if (apiTestImportRequest.getCoverModule() != null && apiTestImportRequest.getCoverModule()) {
apiDefinition.setUpdateTime(System.currentTimeMillis()); apiDefinition.setUpdateTime(System.currentTimeMillis());
} }
if (CollectionUtils.isEmpty(caseList)) {
apiDefinition.setToBeUpdated(false);
} else {
List<ApiTestCaseWithBLOBs> oldCaseList = caseList.stream().filter(t -> StringUtils.equalsIgnoreCase("old_case", t.getVersionId()) && StringUtils.isNotBlank(t.getId())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(oldCaseList)) {
apiDefinition.setToBeUpdated(false);
}
}
} else { } else {
apiDefinition.setUpdateTime(System.currentTimeMillis()); apiDefinition.setUpdateTime(System.currentTimeMillis());
} }
@ -1319,7 +1311,6 @@ public class ApiDefinitionService {
diffByNodes = getDiffByArrayNodes(apiRequest, exApiRequest, objectMapper, property); diffByNodes = getDiffByArrayNodes(apiRequest, exApiRequest, objectMapper, property);
if (diffByNodes) { if (diffByNodes) {
if (toUpdate && applicationMap.get(property)) { if (toUpdate && applicationMap.get(property)) {
apiDefinition.setToBeUpdated(true);
apiDefinition.setToBeUpdateTime(System.currentTimeMillis()); apiDefinition.setToBeUpdateTime(System.currentTimeMillis());
} }
break; break;
@ -1341,7 +1332,6 @@ public class ApiDefinitionService {
if (exRowNode != null && rowNode != null) { if (exRowNode != null && rowNode != null) {
if (!StringUtils.equals(exRowNode.asText(), rowNode.asText())) { if (!StringUtils.equals(exRowNode.asText(), rowNode.asText())) {
if (applicationMap.get(BODY)) { if (applicationMap.get(BODY)) {
apiDefinition.setToBeUpdated(true);
apiDefinition.setToBeUpdateTime(System.currentTimeMillis()); apiDefinition.setToBeUpdateTime(System.currentTimeMillis());
} }
return true; return true;
@ -1350,7 +1340,6 @@ public class ApiDefinitionService {
boolean diffByNodes = getDiffByArrayNodes(bodyNode, exBodyNode, objectMapper, "kvs"); boolean diffByNodes = getDiffByArrayNodes(bodyNode, exBodyNode, objectMapper, "kvs");
if (diffByNodes && toUpdate && applicationMap.get(BODY)) { if (diffByNodes && toUpdate && applicationMap.get(BODY)) {
apiDefinition.setToBeUpdated(true);
apiDefinition.setToBeUpdateTime(System.currentTimeMillis()); apiDefinition.setToBeUpdateTime(System.currentTimeMillis());
} }
if (diffByNodes) { if (diffByNodes) {
@ -1369,7 +1358,6 @@ public class ApiDefinitionService {
} }
boolean diffJsonschema = replenishCaseProperties(exApiProperties, apiProperties); boolean diffJsonschema = replenishCaseProperties(exApiProperties, apiProperties);
if (diffJsonschema && toUpdate && applicationMap.get(BODY)) { if (diffJsonschema && toUpdate && applicationMap.get(BODY)) {
apiDefinition.setToBeUpdated(true);
apiDefinition.setToBeUpdateTime(System.currentTimeMillis()); apiDefinition.setToBeUpdateTime(System.currentTimeMillis());
} }
return diffJsonschema; return diffJsonschema;
@ -1425,14 +1413,12 @@ public class ApiDefinitionService {
private static Boolean delBasicInfo(ApiDefinitionWithBLOBs existApi, ApiDefinitionWithBLOBs apiDefinition, ApiSyncCaseRequest apiSyncCaseRequest, Boolean toUpdate) { private static Boolean delBasicInfo(ApiDefinitionWithBLOBs existApi, ApiDefinitionWithBLOBs apiDefinition, ApiSyncCaseRequest apiSyncCaseRequest, Boolean toUpdate) {
if (!StringUtils.equals(apiDefinition.getMethod(), existApi.getMethod())) { if (!StringUtils.equals(apiDefinition.getMethod(), existApi.getMethod())) {
if (apiSyncCaseRequest.getMethod() && toUpdate) { if (apiSyncCaseRequest.getMethod() && toUpdate) {
apiDefinition.setToBeUpdated(true);
apiDefinition.setToBeUpdateTime(System.currentTimeMillis()); apiDefinition.setToBeUpdateTime(System.currentTimeMillis());
} }
return true; return true;
} }
if (!StringUtils.equals(apiDefinition.getProtocol(), existApi.getProtocol())) { if (!StringUtils.equals(apiDefinition.getProtocol(), existApi.getProtocol())) {
if (apiSyncCaseRequest.getProtocol() && toUpdate) { if (apiSyncCaseRequest.getProtocol() && toUpdate) {
apiDefinition.setToBeUpdated(true);
apiDefinition.setToBeUpdateTime(System.currentTimeMillis()); apiDefinition.setToBeUpdateTime(System.currentTimeMillis());
} }
return true; return true;
@ -1440,7 +1426,6 @@ public class ApiDefinitionService {
if (!StringUtils.equals(apiDefinition.getPath(), existApi.getPath())) { if (!StringUtils.equals(apiDefinition.getPath(), existApi.getPath())) {
if (apiSyncCaseRequest.getPath() && toUpdate) { if (apiSyncCaseRequest.getPath() && toUpdate) {
apiDefinition.setToBeUpdated(true);
apiDefinition.setToBeUpdateTime(System.currentTimeMillis()); apiDefinition.setToBeUpdateTime(System.currentTimeMillis());
} }
return true; return true;