From 9386c45d33552d7cf99a53fa0d1a0a812283ea25 Mon Sep 17 00:00:00 2001 From: AgAngle <1323481023@qq.com> Date: Wed, 25 Sep 2024 15:15:12 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E5=88=97=E8=A1=A8=E5=85=A8=E9=80=89=EF=BC=8C?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=90=8C=E6=AD=A5=EF=BC=8C=E9=83=A8=E5=88=86?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E6=B2=A1=E6=9C=89=E5=90=8C=E6=AD=A5=E6=88=90?= =?UTF-8?q?=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1047132 --user=陈建星 【接口测试】CASE列表-批量选中case-同步成功,查看用例详情仍显示与定义不一致,实际是没同步成功 https://www.tapd.cn/55049933/s/1585866 --- .../api/service/definition/ApiTestCaseService.java | 2 +- .../api/utils/HttpRequestParamDiffUtils.java | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseService.java index 71b89d5c68..3e81787c03 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseService.java @@ -1044,7 +1044,7 @@ public class ApiTestCaseService extends MoveNodeService { AbstractMsTestElement apiMsTestElement = getApiMsTestElement(apiDefinitionBlob); ApiTestCaseBlob apiTestCaseBlob = apiTestCaseBlobMapper.selectByPrimaryKey(apiTestCase.getId()); AbstractMsTestElement apiTestCaseMsTestElement = getTestElement(apiTestCaseBlob); - boolean requestParamDifferent = HttpRequestParamDiffUtils.isRequestParamDiff(request.getSyncItems(), apiMsTestElement, apiTestCaseMsTestElement); + boolean requestParamDifferent = HttpRequestParamDiffUtils.isRequestParamDiff(apiMsTestElement, apiTestCaseMsTestElement); if (requestParamDifferent) { // 如果参数与定义不一致,则同步参数,并记录日志和发送通知 ApiTestCaseLogDTO originCase = BeanUtils.copyBean(new ApiTestCaseLogDTO(), apiTestCase); diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/utils/HttpRequestParamDiffUtils.java b/backend/services/api-test/src/main/java/io/metersphere/api/utils/HttpRequestParamDiffUtils.java index 281b6681ed..13094dde2d 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/utils/HttpRequestParamDiffUtils.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/utils/HttpRequestParamDiffUtils.java @@ -33,10 +33,6 @@ import static io.metersphere.sdk.util.XMLUtils.elementToMap; public class HttpRequestParamDiffUtils { public static boolean isRequestParamDiff(Object request1, Object request2) { - return isRequestParamDiff(new ApiCaseSyncItemRequest(), request1, request2); - } - - public static boolean isRequestParamDiff(ApiCaseSyncItemRequest syncItemRequest, Object request1, Object request2) { if (!(request1 instanceof MsHTTPElement)) { // 其他协议不比较 return false; @@ -48,12 +44,6 @@ public class HttpRequestParamDiffUtils { boolean isHeaderDiff = isParamKeyDiff(httpElement1.getHeaders(), httpElement2.getHeaders()); boolean isBodyDiff = isBodyDiff(httpElement1.getBody(), httpElement2.getBody()); - // 设置需要同步的同步项, 减少比较次数 - syncItemRequest.setBody(isBodyDiff && BooleanUtils.isTrue(syncItemRequest.getBody())); - syncItemRequest.setHeader(isHeaderDiff && BooleanUtils.isTrue(syncItemRequest.getHeader())); - syncItemRequest.setQuery(isQueryDiff && BooleanUtils.isTrue(syncItemRequest.getQuery())); - syncItemRequest.setRest(isRestDiff && BooleanUtils.isTrue(syncItemRequest.getRest())); - if (isQueryDiff || isRestDiff || isHeaderDiff || isBodyDiff) { return true; }