diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java index 2d7ace1cf5..8923193cf7 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java @@ -16,6 +16,7 @@ import io.metersphere.api.service.ApiTestEnvironmentService; import io.metersphere.base.domain.ApiScenarioWithBLOBs; import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs; import io.metersphere.commons.constants.MsTestElementConstants; +import io.metersphere.commons.constants.RunModeConstants; import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.FileUtils; import lombok.Data; @@ -122,7 +123,7 @@ public class MsScenario extends MsTestElement { this.environmentMap = new HashMap<>(16); if (StringUtils.isNotBlank(environmentId)) { // 兼容1.8之前 没有environmentMap但有environmentId的数据 - this.environmentMap.put("historyProjectID", environmentId); + this.environmentMap.put(RunModeConstants.HIS_PRO_ID.toString(), environmentId); } } if (this.environmentMap != null && !this.environmentMap.isEmpty()) { 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 00d2067926..070ea76561 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 @@ -147,12 +147,6 @@ public abstract class MsTestElement { return jmeterTestPlanHashTree; } - public HashTree generateHashTree() { - HashTree jmeterTestPlanHashTree = new ListedHashTree(); - this.toHashTree(jmeterTestPlanHashTree, this.hashTree, new ParameterConfig()); - return jmeterTestPlanHashTree; - } - public Arguments addArguments(ParameterConfig config) { if (config.isEffective(this.getProjectId()) && config.getConfig().get(this.getProjectId()).getCommonConfig() != null && CollectionUtils.isNotEmpty(config.getConfig().get(this.getProjectId()).getCommonConfig().getVariables())) { 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 afd7e8a470..9c567a9eea 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 @@ -23,6 +23,7 @@ import io.metersphere.base.domain.TestPlanApiCase; import io.metersphere.commons.constants.ConditionType; import io.metersphere.commons.constants.DelimiterConstants; import io.metersphere.commons.constants.MsTestElementConstants; +import io.metersphere.commons.constants.RunModeConstants; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.LogUtil; @@ -185,22 +186,22 @@ public class MsHTTPSamplerProxy extends MsTestElement { } // 数据兼容处理 - if (config.getConfig() != null && StringUtils.isNotEmpty(this.getProjectId()) && config.getConfig().containsKey(this.getProjectId())) { - // 1.8 之后 当前正常数据 - } else if (config.getConfig() != null && config.getConfig().containsKey(getParentProjectId())) { + if (config.getConfig() != null && config.getConfig().containsKey(getParentProjectId())) { // 1.8 前后 混合数据 this.setProjectId(getParentProjectId()); + } else if (config.getConfig() != null && StringUtils.isNotEmpty(this.getProjectId()) && config.getConfig().containsKey(this.getProjectId())) { + // 1.8 之后 当前正常数据 } else { // 1.8 之前 数据 if (config.getConfig() != null) { - if (config.getConfig().containsKey("historyProjectID")) { - this.setProjectId("historyProjectID"); - } else { + if (!config.getConfig().containsKey(RunModeConstants.HIS_PRO_ID.toString())) { // 测试计划执行 Iterator it = config.getConfig().keySet().iterator(); if (it.hasNext()) { this.setProjectId(it.next()); } + } else { + this.setProjectId(RunModeConstants.HIS_PRO_ID.toString()); } } } 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 f76a9c9c7f..5b85068ed7 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 @@ -20,6 +20,7 @@ import io.metersphere.base.domain.ApiTestCaseWithBLOBs; import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs; import io.metersphere.commons.constants.DelimiterConstants; import io.metersphere.commons.constants.MsTestElementConstants; +import io.metersphere.commons.constants.RunModeConstants; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.LogUtil; @@ -91,8 +92,8 @@ public class MsJDBCSampler extends MsTestElement { } else { // 1.8 之前 数据 if (config.getConfig() != null) { - if (config.getConfig().containsKey("historyProjectID")) { - this.setProjectId("historyProjectID"); + if (config.getConfig().containsKey(RunModeConstants.HIS_PRO_ID.toString())) { + this.setProjectId(RunModeConstants.HIS_PRO_ID.toString()); } else { // 测试计划执行 Iterator it = config.getConfig().keySet().iterator(); diff --git a/backend/src/main/java/io/metersphere/commons/constants/RunModeConstants.java b/backend/src/main/java/io/metersphere/commons/constants/RunModeConstants.java index 49a1cb3a52..770085f189 100644 --- a/backend/src/main/java/io/metersphere/commons/constants/RunModeConstants.java +++ b/backend/src/main/java/io/metersphere/commons/constants/RunModeConstants.java @@ -2,7 +2,7 @@ package io.metersphere.commons.constants; public enum RunModeConstants { - SERIAL("serial"), SET_REPORT("setReport"), PARALLEL("parallel"); + SERIAL("serial"), SET_REPORT("setReport"), PARALLEL("parallel"), HIS_PRO_ID("historyProjectID"); private String value;