From f0492e1346d6ade41d98344f827afa4abf0a4aba Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 25 Mar 2021 17:23:30 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E4=BF=AE=E6=94=B9=E5=9C=BA=E6=99=AF=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E5=90=8D=E7=A7=B0=E9=95=BF=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/resources/db/migration/V79__v1.8.1_release.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 backend/src/main/resources/db/migration/V79__v1.8.1_release.sql diff --git a/backend/src/main/resources/db/migration/V79__v1.8.1_release.sql b/backend/src/main/resources/db/migration/V79__v1.8.1_release.sql new file mode 100644 index 0000000000..8c15c4fe47 --- /dev/null +++ b/backend/src/main/resources/db/migration/V79__v1.8.1_release.sql @@ -0,0 +1,2 @@ +-- api_scenario_report modify column length +ALTER TABLE api_scenario_report MODIFY COLUMN name VARCHAR(300); \ No newline at end of file From c43a258780916d05ff2c779e8ccf5ff25b623a67 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 25 Mar 2021 17:53:26 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E4=BF=AE=E5=A4=8Djmx=E5=AF=BC=E5=87=BA=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E4=BD=93=E6=95=B0=E6=8D=AE=E7=B1=BB=E5=9E=8B=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/dto/automation/parse/MsJmeterParser.java | 10 ++++++++-- .../java/io/metersphere/api/dto/scenario/Body.java | 1 + frontend/src/business/components/xpack | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/automation/parse/MsJmeterParser.java b/backend/src/main/java/io/metersphere/api/dto/automation/parse/MsJmeterParser.java index 914ef1eef0..0ce4456848 100644 --- a/backend/src/main/java/io/metersphere/api/dto/automation/parse/MsJmeterParser.java +++ b/backend/src/main/java/io/metersphere/api/dto/automation/parse/MsJmeterParser.java @@ -137,7 +137,7 @@ public class MsJmeterParser extends ApiImportAbstractParser { HTTPSamplerProxy source = (HTTPSamplerProxy) key; BeanUtils.copyBean(samplerProxy, source); if (source != null && source.getHTTPFiles().length > 0) { - samplerProxy.getBody().setBinary(new ArrayList<>()); + samplerProxy.getBody().initBinary(); samplerProxy.getBody().setType(Body.FORM_DATA); List keyValues = new LinkedList<>(); for (HTTPFileArg arg : source.getHTTPFiles()) { @@ -153,7 +153,12 @@ public class MsJmeterParser extends ApiImportAbstractParser { keyValue.setFiles(files); keyValues.add(keyValue); } - samplerProxy.getBody().setKvs(keyValues); + if (source.getPostBodyRaw() && CollectionUtils.isNotEmpty(keyValues)) { + samplerProxy.getBody().setType(Body.RAW); + samplerProxy.getBody().setRaw(keyValues.get(0).getValue()); + } else { + samplerProxy.getBody().setKvs(keyValues); + } } samplerProxy.setProtocol(RequestType.HTTP); samplerProxy.setPort(source.getPort() + ""); @@ -173,6 +178,7 @@ public class MsJmeterParser extends ApiImportAbstractParser { samplerProxy.setArguments(keyValues); } } + samplerProxy.getBody().initBinary(); } samplerProxy.setPath(""); samplerProxy.setMethod(source.getMethod()); diff --git a/backend/src/main/java/io/metersphere/api/dto/scenario/Body.java b/backend/src/main/java/io/metersphere/api/dto/scenario/Body.java index f3f484b747..cabfccc0c4 100644 --- a/backend/src/main/java/io/metersphere/api/dto/scenario/Body.java +++ b/backend/src/main/java/io/metersphere/api/dto/scenario/Body.java @@ -74,6 +74,7 @@ public class Body { } } KeyValue keyValue = new KeyValue("", "JSON-SCHEMA", this.getRaw(), true, true); + sampler.setPostBodyRaw(true); keyValue.setEnable(true); keyValue.setEncode(false); body.add(keyValue); diff --git a/frontend/src/business/components/xpack b/frontend/src/business/components/xpack index 2115bd28a9..07951ba17a 160000 --- a/frontend/src/business/components/xpack +++ b/frontend/src/business/components/xpack @@ -1 +1 @@ -Subproject commit 2115bd28a90854d2b6276a90878934715498c584 +Subproject commit 07951ba17aef6f29e50cfd68e40de3266f9a60cd From 683430ec8d89c5a45709428d85f5e2a169eb8ab3 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Thu, 25 Mar 2021 18:11:58 +0800 Subject: [PATCH 3/4] =?UTF-8?q?refactor:=20jmeter=20=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/pom.xml b/backend/pom.xml index 55853f97ac..3af82d43e6 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -17,7 +17,7 @@ UTF-8 1.6.0 1.8 - 5.2.1 + 5.4.1 1.1.3 2.7.8 20.1.0 From d6a0feb4faaf454778aed26276105c4a097c00d0 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 25 Mar 2021 18:13:53 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E4=BF=AE=E5=A4=8Djmx=E5=AF=BC=E5=85=A5=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E9=80=89=E9=A1=B9=E4=B8=8D=E8=83=BD=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/dto/automation/parse/MsJmeterParser.java | 10 ++++------ .../java/io/metersphere/api/dto/scenario/Body.java | 8 ++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/automation/parse/MsJmeterParser.java b/backend/src/main/java/io/metersphere/api/dto/automation/parse/MsJmeterParser.java index 0ce4456848..7cb52c524c 100644 --- a/backend/src/main/java/io/metersphere/api/dto/automation/parse/MsJmeterParser.java +++ b/backend/src/main/java/io/metersphere/api/dto/automation/parse/MsJmeterParser.java @@ -136,6 +136,8 @@ public class MsJmeterParser extends ApiImportAbstractParser { try { HTTPSamplerProxy source = (HTTPSamplerProxy) key; BeanUtils.copyBean(samplerProxy, source); + samplerProxy.setRest(new ArrayList(){{this.add(new KeyValue());}}); + samplerProxy.setArguments(new ArrayList(){{this.add(new KeyValue());}}); if (source != null && source.getHTTPFiles().length > 0) { samplerProxy.getBody().initBinary(); samplerProxy.getBody().setType(Body.FORM_DATA); @@ -153,12 +155,7 @@ public class MsJmeterParser extends ApiImportAbstractParser { keyValue.setFiles(files); keyValues.add(keyValue); } - if (source.getPostBodyRaw() && CollectionUtils.isNotEmpty(keyValues)) { - samplerProxy.getBody().setType(Body.RAW); - samplerProxy.getBody().setRaw(keyValues.get(0).getValue()); - } else { - samplerProxy.getBody().setKvs(keyValues); - } + samplerProxy.getBody().setKvs(keyValues); } samplerProxy.setProtocol(RequestType.HTTP); samplerProxy.setPort(source.getPort() + ""); @@ -168,6 +165,7 @@ public class MsJmeterParser extends ApiImportAbstractParser { source.getArguments().getArgumentsAsMap().forEach((k, v) -> { samplerProxy.getBody().setRaw(v); }); + samplerProxy.getBody().initKvs(); } else { List keyValues = new LinkedList<>(); source.getArguments().getArgumentsAsMap().forEach((k, v) -> { diff --git a/backend/src/main/java/io/metersphere/api/dto/scenario/Body.java b/backend/src/main/java/io/metersphere/api/dto/scenario/Body.java index cabfccc0c4..4ae0e7d279 100644 --- a/backend/src/main/java/io/metersphere/api/dto/scenario/Body.java +++ b/backend/src/main/java/io/metersphere/api/dto/scenario/Body.java @@ -66,12 +66,8 @@ public class Body { sampler.setDoMultipart(true); } } else { - if (!this.isJson()) { - sampler.setPostBodyRaw(true); - } else { - if (StringUtils.isNotEmpty(this.format) && "JSON-SCHEMA".equals(this.format) && this.getJsonSchema() != null) { - this.raw = JSONSchemaGenerator.getJson(com.alibaba.fastjson.JSON.toJSONString(this.getJsonSchema())); - } + if (StringUtils.isNotEmpty(this.format) && "JSON-SCHEMA".equals(this.format) && this.getJsonSchema() != null) { + this.raw = JSONSchemaGenerator.getJson(com.alibaba.fastjson.JSON.toJSONString(this.getJsonSchema())); } KeyValue keyValue = new KeyValue("", "JSON-SCHEMA", this.getRaw(), true, true); sampler.setPostBodyRaw(true);