From c96ff48464aeabe16e275a76bd23602e65f6e344 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Tue, 21 Dec 2021 15:58:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9C=BA=E6=99=AF=E8=BD=AC=E6=80=A7?= =?UTF-8?q?=E8=83=BD=E6=B5=8B=E8=AF=95):=20=E5=9C=BA=E6=99=AF=E8=BD=AC?= =?UTF-8?q?=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95=E6=97=B6=E5=8E=BB=E9=99=A4?= =?UTF-8?q?debugSampler?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 场景转性能测试时去除debugSampler --- .../io/metersphere/api/service/APITestService.java | 11 ++++++++++- .../controller/PerformanceTestController.java | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/APITestService.java b/backend/src/main/java/io/metersphere/api/service/APITestService.java index 934826919a..71a9dce003 100644 --- a/backend/src/main/java/io/metersphere/api/service/APITestService.java +++ b/backend/src/main/java/io/metersphere/api/service/APITestService.java @@ -1,7 +1,6 @@ package io.metersphere.api.service; import com.alibaba.fastjson.JSONObject; -import com.alibaba.nacos.client.utils.StringUtils; import io.github.ningyu.jmeter.plugin.dubbo.sample.ProviderService; import io.metersphere.api.dto.*; import io.metersphere.api.dto.definition.RunDefinitionRequest; @@ -34,6 +33,7 @@ import io.metersphere.job.sechedule.ApiTestJob; import io.metersphere.service.FileService; import io.metersphere.service.ScheduleService; import io.metersphere.track.service.TestCaseService; +import org.apache.commons.lang3.StringUtils; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.constants.CommonConstants; import org.apache.jorphan.collections.HashTree; @@ -504,6 +504,15 @@ public class APITestService { //HTTPSamplerProxy, 进行附件转化: 1.elementProp里去掉路径; 2。elementProp->filePath获取路径并读出来 attachmentFilePathList.addAll(this.parseAttachmentFileInfo(element)); + + //查看是否含有RunningDebugSampler,转jmx的时候去掉 + List debugSamplerElementList = element.elements("DebugSampler"); + for (Element debugSampler : debugSamplerElementList) { + String testname = debugSampler.attributeValue("testname"); + if (StringUtils.equalsAnyIgnoreCase(testname, RunningParamKeys.RUNNING_DEBUG_SAMPLER_NAME)) { + element.remove(debugSampler); + } + } } //如果存在证书文件,也要匹配出来 attachmentFilePathList.addAll(this.parseAttachmentFileInfo(innerHashTreeElement)); diff --git a/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java b/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java index c5cf78e316..005b6304b7 100644 --- a/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java +++ b/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java @@ -198,7 +198,7 @@ public class PerformanceTestController { byte[] bytes = fileService.loadFileAsBytes(fileOperationRequest.getId()); return ResponseEntity.ok() .contentType(MediaType.parseMediaType("application/octet-stream")) - .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + fileOperationRequest.getName() + "\"") + .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + fileOperationRequest.getId()+".jmx" + "\"") .body(bytes); }