From a7e6aa4c9d8ae283b1491c0acb9312f9b3f9c56c Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Fri, 22 Oct 2021 17:39:49 +0800 Subject: [PATCH] =?UTF-8?q?fix=20(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E4=BF=AE=E5=A4=8DSQL=E8=AF=B7=E6=B1=82=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E6=AD=A5=E9=AA=A4=E6=89=A7=E8=A1=8C=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20--bug=3D1007360=20--user=3D=E8=B5=B5=E5=8B=87=20=E3=80=90git?= =?UTF-8?q?hub=20#6716=E3=80=91[BUG]sql=E7=B1=BB=E5=9E=8B=E7=9A=84?= =?UTF-8?q?=E5=90=8E=E7=BD=AE=E5=86=85=E5=AE=B9=E4=BF=AE=E6=94=B9=EF=BC=8C?= =?UTF-8?q?=E5=9C=A8=E5=9C=BA=E6=99=AF=E7=9B=B4=E6=8E=A5=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B=E6=98=AF?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E7=9A=84=EF=BC=8C=E5=BD=93=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E4=BA=86=E8=BF=99=E4=B8=AAsql=E7=94=A8=E4=BE=8B=E7=9A=84?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E8=A2=AB=E5=86=8D=E6=AC=A1=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=AF=B9sql=E7=94=A8=E4=BE=8B=E7=9A=84?= =?UTF-8?q?=E5=90=8E=E7=BD=AE=E8=84=9A=E6=9C=AC=E4=BF=AE=E6=94=B9=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=98=AF=E4=BF=AE=E6=94=B9=E5=90=8E=E7=9A=84=EF=BC=8C?= =?UTF-8?q?=E4=BD=86=E6=98=AF=E6=89=A7=E8=A1=8C=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E8=BF=98=E6=98=AF=E6=89=A7=E8=A1=8C=E7=9A=84=E4=B9=8B=E5=89=8D?= =?UTF-8?q?=E7=9A=84=E8=84=9A=E6=9C=AC=E5=86=85=E5=AE=B9=20https://www.tap?= =?UTF-8?q?d.cn/55049933/s/1057910?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/dto/definition/request/sampler/MsDubboSampler.java | 1 + .../api/dto/definition/request/sampler/MsJDBCSampler.java | 7 +++---- .../api/dto/definition/request/sampler/MsTCPSampler.java | 2 +- .../io/metersphere/api/service/ApiAutomationService.java | 5 ++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsDubboSampler.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsDubboSampler.java index b3e6c0c9d9..15c7842f41 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsDubboSampler.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsDubboSampler.java @@ -90,6 +90,7 @@ public class MsDubboSampler extends MsTestElement { } if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) { this.setRefElement(); + hashTree = this.getHashTree(); } final HashTree testPlanTree = tree.add(dubboSample(config)); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsJDBCSampler.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsJDBCSampler.java index 1e96c88dc0..6dcd3edb34 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsJDBCSampler.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsJDBCSampler.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import io.metersphere.api.dto.definition.request.ElementUtil; import io.metersphere.api.dto.definition.request.ParameterConfig; -import io.metersphere.api.dto.definition.request.processors.post.MsJSR223PostProcessor; -import io.metersphere.api.dto.definition.request.processors.pre.MsJSR223PreProcessor; import io.metersphere.api.dto.scenario.DatabaseConfig; import io.metersphere.api.dto.scenario.KeyValue; import io.metersphere.api.dto.scenario.environment.EnvironmentConfig; @@ -86,6 +84,7 @@ public class MsJDBCSampler extends MsTestElement { } if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) { this.setRefElement(); + hashTree = this.getHashTree(); } if (config.getConfig() == null) { // 单独接口执行 @@ -123,9 +122,9 @@ public class MsJDBCSampler extends MsTestElement { this.dataSource = null; // 取当前环境下默认的一个数据源 if (config.isEffective(this.getProjectId())) { - if(config.getConfig().get(this.getProjectId()) != null){ + if (config.getConfig().get(this.getProjectId()) != null) { envConfig = config.getConfig().get(this.getProjectId()); - if(CollectionUtils.isNotEmpty(envConfig.getDatabaseConfigs())){ + if (CollectionUtils.isNotEmpty(envConfig.getDatabaseConfigs())) { this.dataSource = envConfig.getDatabaseConfigs().get(0); } } diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsTCPSampler.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsTCPSampler.java index d211dc1222..0c8cdf1a68 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsTCPSampler.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsTCPSampler.java @@ -11,7 +11,6 @@ import io.metersphere.api.dto.automation.EsbDataStruct; import io.metersphere.api.dto.automation.TcpTreeTableDataStruct; import io.metersphere.api.dto.definition.request.ElementUtil; import io.metersphere.api.dto.definition.request.ParameterConfig; -import io.metersphere.api.dto.definition.request.processors.post.MsJSR223PostProcessor; import io.metersphere.api.dto.definition.request.processors.pre.MsJSR223PreProcessor; import io.metersphere.api.dto.scenario.KeyValue; import io.metersphere.api.dto.scenario.environment.EnvironmentConfig; @@ -122,6 +121,7 @@ public class MsTCPSampler extends MsTestElement { } if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) { this.setRefElement(); + hashTree = this.getHashTree(); } if (config.getConfig() == null) { // 单独接口执行 diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index c70dfe6e01..ab41655edb 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -355,7 +355,7 @@ public class ApiAutomationService { scenario.setVersion(version + 1); } - deleteUpdateBodyFile(scenario); + deleteUpdateBodyFile(scenario,beforeScenario); List useUrl = this.parseUrl(scenario); scenario.setUseUrl(JSONArray.toJSONString(useUrl)); apiScenarioMapper.updateByPrimaryKeySelective(scenario); @@ -376,8 +376,7 @@ public class ApiAutomationService { * * @param scenario */ - public void deleteUpdateBodyFile(ApiScenarioWithBLOBs scenario) { - ApiScenarioWithBLOBs oldScenario = apiScenarioMapper.selectByPrimaryKey(scenario.getId()); + public void deleteUpdateBodyFile(ApiScenarioWithBLOBs scenario,ApiScenarioWithBLOBs oldScenario) { Set newRequestIds = getRequestIds(scenario.getScenarioDefinition()); MsTestElement msTestElement = parseScenarioDefinition(oldScenario.getScenarioDefinition()); List oldRequests = MsHTTPSamplerProxy.findHttpSampleFromHashTree(msTestElement);