From 565dca2e4c4097d70c65e09fc2cacb875b67d36a Mon Sep 17 00:00:00 2001 From: Nathan Mo <54135657+QizhengMo@users.noreply.github.com> Date: Thu, 28 Nov 2024 17:29:24 +0800 Subject: [PATCH 1/3] feat: ignore type by config (#363) * feat: ignore type by config --- .../impl/DefaultReplayResultComparer.java | 19 +++++-------------- .../model/config/ReplayComparisonConfig.java | 17 ----------------- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/arex-schedule-web-api/src/main/java/com/arextest/schedule/comparer/impl/DefaultReplayResultComparer.java b/arex-schedule-web-api/src/main/java/com/arextest/schedule/comparer/impl/DefaultReplayResultComparer.java index 891c152d..6927b82d 100644 --- a/arex-schedule-web-api/src/main/java/com/arextest/schedule/comparer/impl/DefaultReplayResultComparer.java +++ b/arex-schedule-web-api/src/main/java/com/arextest/schedule/comparer/impl/DefaultReplayResultComparer.java @@ -27,6 +27,7 @@ import com.arextest.schedule.progress.ProgressTracer; import com.arextest.schedule.service.MetricService; import com.arextest.web.model.contract.contracts.compare.CategoryDetail; +import jakarta.annotation.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; @@ -154,12 +155,9 @@ public List doContentCompare(ReplayActionCaseItem caseItem, List replayCompareResults = new ArrayList<>(); for (CategoryComparisonHolder bindHolder : waitCompareMap) { - if (operationConfig.checkIgnoreMockMessageType(bindHolder.getCategoryName())) { - continue; - } replayCompareResults.addAll(compareReplayResult(bindHolder, caseItem, operationConfig)); } - return replayCompareResults; + return replayCompareResults.stream().filter(Objects::nonNull).collect(Collectors.toList()); } /** @@ -268,7 +266,8 @@ private List matchCompareReplayResults(CategoryComparisonHo return compareResults; } - private ReplayCompareResult compareRecordAndResult(ComparisonInterfaceConfig operationConfig, + private @Nullable ReplayCompareResult compareRecordAndResult( + ComparisonInterfaceConfig operationConfig, ReplayActionCaseItem caseItem, String category, CompareItem target, CompareItem source) { String operation = source != null ? source.getCompareOperation() : target.getCompareOperation(); @@ -280,17 +279,9 @@ private ReplayCompareResult compareRecordAndResult(ComparisonInterfaceConfig ope CompareResult comparedResult = new CompareResult(); ReplayCompareResult resultNew = ReplayCompareResult.createFrom(caseItem); - - // use operation config to ignore category if (ignoreCategory(category, operation, operationConfig.getIgnoreCategoryTypes())) { - comparedResult.setCode(DiffResultCode.COMPARED_WITHOUT_DIFFERENCE); - comparedResult.setProcessedBaseMsg(record); - comparedResult.setProcessedTestMsg(replay); - mergeResult(operation, category, resultNew, comparedResult, source, target); - resultNew.setIgnore(true); - return resultNew; + return null; } - StopWatch stopWatch = new StopWatch(); stopWatch.start(LogType.COMPARE_SDK.getValue()); comparedResult = compareProcess(category, record, replay, compareConfig, diff --git a/arex-schedule-web-api/src/main/java/com/arextest/schedule/model/config/ReplayComparisonConfig.java b/arex-schedule-web-api/src/main/java/com/arextest/schedule/model/config/ReplayComparisonConfig.java index 79971840..4961072f 100644 --- a/arex-schedule-web-api/src/main/java/com/arextest/schedule/model/config/ReplayComparisonConfig.java +++ b/arex-schedule-web-api/src/main/java/com/arextest/schedule/model/config/ReplayComparisonConfig.java @@ -1,7 +1,6 @@ package com.arextest.schedule.model.config; -import com.arextest.model.mock.MockCategoryType; import com.arextest.web.model.contract.contracts.compare.CategoryDetail; import com.arextest.web.model.contract.contracts.compare.TransformDetail; import com.arextest.web.model.contract.contracts.config.replay.ComparisonSummaryConfiguration.ReplayScriptMethod; @@ -18,7 +17,6 @@ import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; import lombok.Data; @@ -27,7 +25,6 @@ */ @Data public class ReplayComparisonConfig { - private String operationName; private List operationTypes; private List ignoreCategoryTypes; @@ -55,20 +52,6 @@ public class ReplayComparisonConfig { */ private Map additionalConfig; - public final boolean checkIgnoreMockMessageType(String type) { - // [b_yu] 2022-10-11 Dynamic type does not compare - if (Objects.equals(type, MockCategoryType.DYNAMIC_CLASS.getName())) { - return true; - } - if (Objects.equals(type, MockCategoryType.REDIS.getName())) { - return true; - } - if (Objects.equals(type, MockCategoryType.Q_MESSAGE_CONSUMER.getName())) { - return true; - } - return false; - } - public void fillCommonFields() { this.setExclusionList(Collections.emptySet()); this.setInclusionList(Collections.emptySet()); From f38b6a0bef79ca3fb73378eb27548ebd4101b041 Mon Sep 17 00:00:00 2001 From: lkun <646703306@qq.com> Date: Thu, 19 Dec 2024 20:11:09 +0800 Subject: [PATCH 2/3] fix: Remove content-length header to resolve multipart/form-data request body mismatch issue (#364) * fix: Remove content-length header to resolve multipart/form-data request body mismatch issue * fix: Remove Content-Length header in AbstractHttpRequestBuilder --------- Co-authored-by: liaokun --- .../schedule/sender/httprequest/AbstractHttpRequestBuilder.java | 1 + 1 file changed, 1 insertion(+) diff --git a/arex-schedule-web-api/src/main/java/com/arextest/schedule/sender/httprequest/AbstractHttpRequestBuilder.java b/arex-schedule-web-api/src/main/java/com/arextest/schedule/sender/httprequest/AbstractHttpRequestBuilder.java index 5620c3fb..9262947b 100644 --- a/arex-schedule-web-api/src/main/java/com/arextest/schedule/sender/httprequest/AbstractHttpRequestBuilder.java +++ b/arex-schedule-web-api/src/main/java/com/arextest/schedule/sender/httprequest/AbstractHttpRequestBuilder.java @@ -35,6 +35,7 @@ protected HttpHeaders createRequestHeaders(Map sourceHeaders, St contentType = contentType(format); } httpHeaders.setContentType(contentType); + httpHeaders.remove(HttpHeaders.CONTENT_LENGTH); return httpHeaders; } From accbb10334fae4f9ac1ab23b0c6246f5f2732192 Mon Sep 17 00:00:00 2001 From: pangdayuan1 <116159079+pangdayuan1@users.noreply.github.com> Date: Fri, 27 Dec 2024 10:58:15 +0800 Subject: [PATCH 3/3] feat: update compare version (#366) --- arex-schedule-web-api/pom.xml | 4 ++-- .../schedule/model/deploy/ServiceInstanceOperation.java | 4 ---- pom.xml | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/arex-schedule-web-api/pom.xml b/arex-schedule-web-api/pom.xml index c915a87e..82a8aa2e 100644 --- a/arex-schedule-web-api/pom.xml +++ b/arex-schedule-web-api/pom.xml @@ -139,7 +139,7 @@ arex-schedule-parent com.arextest - 2.0.4 + 2.0.5 @@ -337,5 +337,5 @@ - 2.0.4 + 2.0.5 \ No newline at end of file diff --git a/arex-schedule-web-api/src/main/java/com/arextest/schedule/model/deploy/ServiceInstanceOperation.java b/arex-schedule-web-api/src/main/java/com/arextest/schedule/model/deploy/ServiceInstanceOperation.java index 9d81889d..54b9b898 100644 --- a/arex-schedule-web-api/src/main/java/com/arextest/schedule/model/deploy/ServiceInstanceOperation.java +++ b/arex-schedule-web-api/src/main/java/com/arextest/schedule/model/deploy/ServiceInstanceOperation.java @@ -12,8 +12,4 @@ public class ServiceInstanceOperation { @JsonAlias("Name") private String name; - @JsonAlias("RequestMessage") - private DefinedMessageFormatter requestMessage; - @JsonAlias("ResponseMessage") - private DefinedMessageFormatter responseMessage; } \ No newline at end of file diff --git a/pom.xml b/pom.xml index d78a9515..dba33ca8 100644 --- a/pom.xml +++ b/pom.xml @@ -283,7 +283,7 @@ 3.2.3 3.3.2 - 0.2.18 + 0.2.19 2.0.23 29.0-jre 1.8 @@ -317,5 +317,5 @@ https://github.com/arextest/arex-replay-schedule https://github.com/arextest/arex-replay-schedule - 2.0.4 + 2.0.5 \ No newline at end of file