From 29ecd9fd11f25d31dee9db42989e1ee82ac26f61 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Wed, 7 Jul 2021 16:44:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8E=BB=E9=99=A4=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=97=A0=E7=94=A8=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 去除页面无用提示信息 --- .../api/dto/definition/request/MsTestElement.java | 2 +- .../definition/request/processors/MsJSR223Processor.java | 8 ++++---- .../request/processors/post/MsJSR223PostProcessor.java | 8 ++++---- .../request/processors/pre/MsJSR223PreProcessor.java | 8 ++++---- .../definition/request/sampler/MsHTTPSamplerProxy.java | 9 ++++++--- .../components/api/automation/scenario/DebugRun.vue | 1 - 6 files changed, 19 insertions(+), 17 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java index f1904e04e2..9d5078f9d7 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java @@ -108,7 +108,7 @@ public abstract class MsTestElement { @JSONField(ordinal = 13) private boolean isMockEnvironment; @JSONField(ordinal = 14) - private String useEnvironment; + private String environmentId; private MsTestElement parent; private static final String BODY_FILE_DIR = FileUtils.BODY_FILE_DIR; diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/MsJSR223Processor.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/MsJSR223Processor.java index 87714884bf..32971f588a 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/MsJSR223Processor.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/MsJSR223Processor.java @@ -36,17 +36,17 @@ public class MsJSR223Processor extends MsTestElement { @Override public void toHashTree(HashTree tree, List hashTree, ParameterConfig config) { //替换Metersphere环境变量 - if(StringUtils.isEmpty(this.getUseEnvironment())){ + if(StringUtils.isEmpty(this.getEnvironmentId())){ if(config.getConfig() != null){ if(config.getProjectId() != null){ String evnId = config.getConfig().get(config.getProjectId()).getApiEnvironmentid(); - this.setUseEnvironment(evnId); + this.setEnvironmentId(evnId); }else { Collection evnConfigList = config.getConfig().values(); if(evnConfigList!=null && !evnConfigList.isEmpty()){ for (EnvironmentConfig configItem : evnConfigList) { String evnId = configItem.getApiEnvironmentid(); - this.setUseEnvironment(evnId); + this.setEnvironmentId(evnId); break; } } @@ -54,7 +54,7 @@ public class MsJSR223Processor extends MsTestElement { } } - script = StringUtils.replace(script, RunningParamKeys.API_ENVIRONMENT_ID,"\""+RunningParamKeys.RUNNING_PARAMS_PREFIX+this.getUseEnvironment()+".\""); + script = StringUtils.replace(script, RunningParamKeys.API_ENVIRONMENT_ID,"\""+RunningParamKeys.RUNNING_PARAMS_PREFIX+this.getEnvironmentId()+".\""); // 非导出操作,且不是启用状态则跳过执行 if (!config.isOperating() && !this.isEnable()) { diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/post/MsJSR223PostProcessor.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/post/MsJSR223PostProcessor.java index 1a224a47e3..02b7f0f712 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/post/MsJSR223PostProcessor.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/post/MsJSR223PostProcessor.java @@ -32,17 +32,17 @@ public class MsJSR223PostProcessor extends MsTestElement { @Override public void toHashTree(HashTree tree, List hashTree, ParameterConfig config) { - if(StringUtils.isEmpty(this.getUseEnvironment())){ + if(StringUtils.isEmpty(this.getEnvironmentId())){ if(config.getConfig() != null){ if(config.getProjectId() != null){ String evnId = config.getConfig().get(config.getProjectId()).getApiEnvironmentid(); - this.setUseEnvironment(evnId); + this.setEnvironmentId(evnId); }else { Collection evnConfigList = config.getConfig().values(); if(evnConfigList!=null && !evnConfigList.isEmpty()){ for (EnvironmentConfig configItem : evnConfigList) { String evnId = configItem.getApiEnvironmentid(); - this.setUseEnvironment(evnId); + this.setEnvironmentId(evnId); break; } } @@ -50,7 +50,7 @@ public class MsJSR223PostProcessor extends MsTestElement { } } //替换Metersphere环境变量 - script = StringUtils.replace(script,RunningParamKeys.API_ENVIRONMENT_ID,"\""+RunningParamKeys.RUNNING_PARAMS_PREFIX+this.getUseEnvironment()+".\""); + script = StringUtils.replace(script,RunningParamKeys.API_ENVIRONMENT_ID,"\""+RunningParamKeys.RUNNING_PARAMS_PREFIX+this.getEnvironmentId()+".\""); // 非导出操作,且不是启用状态则跳过执行 if (!config.isOperating() && !this.isEnable()) { diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/pre/MsJSR223PreProcessor.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/pre/MsJSR223PreProcessor.java index 4ebedefc9d..e609bc77f8 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/pre/MsJSR223PreProcessor.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/pre/MsJSR223PreProcessor.java @@ -32,17 +32,17 @@ public class MsJSR223PreProcessor extends MsTestElement { @Override public void toHashTree(HashTree tree, List hashTree, ParameterConfig config) { - if(StringUtils.isEmpty(this.getUseEnvironment())){ + if(StringUtils.isEmpty(this.getEnvironmentId())){ if(config.getConfig() != null){ if(config.getProjectId() != null){ String evnId = config.getConfig().get(config.getProjectId()).getApiEnvironmentid(); - this.setUseEnvironment(evnId); + this.setEnvironmentId(evnId); }else { Collection evnConfigList = config.getConfig().values(); if(evnConfigList!=null && !evnConfigList.isEmpty()){ for (EnvironmentConfig configItem : evnConfigList) { String evnId = configItem.getApiEnvironmentid(); - this.setUseEnvironment(evnId); + this.setEnvironmentId(evnId); break; } } @@ -50,7 +50,7 @@ public class MsJSR223PreProcessor extends MsTestElement { } } //替换Metersphere环境变量 - script = StringUtils.replace(script,RunningParamKeys.API_ENVIRONMENT_ID,"\""+RunningParamKeys.RUNNING_PARAMS_PREFIX+this.getUseEnvironment()+".\""); + script = StringUtils.replace(script,RunningParamKeys.API_ENVIRONMENT_ID,"\""+RunningParamKeys.RUNNING_PARAMS_PREFIX+this.getEnvironmentId()+".\""); // 非导出操作,且不是启用状态则跳过执行 if (!config.isOperating() && !this.isEnable()) { diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java index 83916b9241..5572fbfc33 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java @@ -161,6 +161,9 @@ public class MsHTTPSamplerProxy extends MsTestElement { @Override public void toHashTree(HashTree tree, List hashTree, ParameterConfig config) { + if(StringUtils.isEmpty(this.getEnvironmentId())){ + this.setEnvironmentId(this.useEnvironment); + } // 非导出操作,且不是启用状态则跳过执行 if (!config.isOperating() && !this.isEnable()) { return; @@ -252,7 +255,7 @@ public class MsHTTPSamplerProxy extends MsTestElement { if (CollectionUtils.isNotEmpty(hashTree)) { for (MsTestElement el : hashTree) { - el.setUseEnvironment(useEnvironment); + el.setEnvironmentId(useEnvironment); el.toHashTree(httpSamplerTree, el.getHashTree(), config); } } @@ -266,8 +269,8 @@ public class MsHTTPSamplerProxy extends MsTestElement { private HttpConfig getHttpConfig(ParameterConfig config) { if (config.isEffective(this.getProjectId())) { String useEvnId = config.getConfig().get(this.getProjectId()).getApiEnvironmentid(); - if(StringUtils.isNotEmpty(useEvnId) && !StringUtils.equals(useEvnId,this.getUseEnvironment())){ - this.setUseEnvironment(useEvnId); + if(StringUtils.isNotEmpty(useEvnId) && !StringUtils.equals(useEvnId,this.getEnvironmentId())){ + this.setEnvironmentId(useEvnId); } return getHttpConfig(config.getConfig().get(this.getProjectId()).getHttpConfig()); } diff --git a/frontend/src/business/components/api/automation/scenario/DebugRun.vue b/frontend/src/business/components/api/automation/scenario/DebugRun.vue index 8cd652f4db..630a4a7a3c 100644 --- a/frontend/src/business/components/api/automation/scenario/DebugRun.vue +++ b/frontend/src/business/components/api/automation/scenario/DebugRun.vue @@ -49,7 +49,6 @@ import {saveScenario} from "@/business/components/api/automation/api-automation" this.$emit('runRefresh', {}); this.$emit("changeDebugButton"); }); - alert("123"); }, } }