fix(接口测试): 修复V1版本旧数据中前后置SQL组件取不到环境的问题
修复V1版本旧数据中前后置SQL组件取不到环境的问题
This commit is contained in:
parent
3ad28234e5
commit
0527393ab4
|
@ -53,6 +53,10 @@ public class MsJDBCPostProcessor extends MsTestElement {
|
|||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
//检查projectId 旧数据
|
||||
if (StringUtils.isBlank(this.getProjectId()) && this.getParent() != null) {
|
||||
this.setProjectId(this.getParent().getProjectId());
|
||||
}
|
||||
if (config.getConfig() == null) {
|
||||
// 单独接口执行
|
||||
this.setProjectId(config.getProjectId());
|
||||
|
|
|
@ -53,6 +53,10 @@ public class MsJDBCPreProcessor extends MsTestElement {
|
|||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
//检查projectId 旧数据
|
||||
if (StringUtils.isBlank(this.getProjectId()) && this.getParent() != null) {
|
||||
this.setProjectId(this.getParent().getProjectId());
|
||||
}
|
||||
if (config.getConfig() == null) {
|
||||
// 单独接口执行
|
||||
this.setProjectId(config.getProjectId());
|
||||
|
|
|
@ -6,7 +6,9 @@ import io.metersphere.api.dto.definition.request.ParameterConfig;
|
|||
import io.metersphere.api.dto.definition.request.assertions.MsAssertions;
|
||||
import io.metersphere.api.dto.definition.request.auth.MsAuthManager;
|
||||
import io.metersphere.api.dto.definition.request.dns.MsDNSCacheManager;
|
||||
import io.metersphere.api.dto.definition.request.processors.post.MsJDBCPostProcessor;
|
||||
import io.metersphere.api.dto.definition.request.processors.post.MsJSR223PostProcessor;
|
||||
import io.metersphere.api.dto.definition.request.processors.pre.MsJDBCPreProcessor;
|
||||
import io.metersphere.api.dto.definition.request.processors.pre.MsJSR223PreProcessor;
|
||||
import io.metersphere.api.dto.mock.MockApiHeaders;
|
||||
import io.metersphere.api.dto.scenario.Body;
|
||||
|
@ -237,6 +239,9 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
hashTree = ElementUtil.order(hashTree);
|
||||
for (MsTestElement el : hashTree) {
|
||||
if (el instanceof MsJDBCPreProcessor || el instanceof MsJDBCPostProcessor) {
|
||||
el.setParent(this);
|
||||
}
|
||||
if (el.getEnvironmentId() == null) {
|
||||
if (this.getEnvironmentId() == null) {
|
||||
el.setEnvironmentId(useEnvironment);
|
||||
|
@ -425,7 +430,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
envPath += this.getPath();
|
||||
}
|
||||
sampler.setPort(httpConfig.getPort());
|
||||
if (httpConfig.getDomain().startsWith("${")){
|
||||
if (httpConfig.getDomain().startsWith("${")) {
|
||||
sampler.setProtocol(httpConfig.getProtocol());
|
||||
envPath = StringUtils.isNotBlank(this.path) ? StringUtils.join(httpConfig.getSocket(), this.path) : url;
|
||||
} else if (StringUtils.isNotEmpty(httpConfig.getDomain())) {
|
||||
|
|
|
@ -2,6 +2,8 @@ package io.metersphere.api.dto.definition.request.sampler;
|
|||
|
||||
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.MsJDBCPostProcessor;
|
||||
import io.metersphere.api.dto.definition.request.processors.pre.MsJDBCPreProcessor;
|
||||
import io.metersphere.api.dto.scenario.DatabaseConfig;
|
||||
import io.metersphere.api.dto.scenario.KeyValue;
|
||||
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
|
||||
|
@ -150,6 +152,9 @@ public class MsJDBCSampler extends MsTestElement {
|
|||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
hashTree = ElementUtil.order(hashTree);
|
||||
hashTree.forEach(el -> {
|
||||
if (el instanceof MsJDBCPreProcessor || el instanceof MsJDBCPostProcessor) {
|
||||
el.setParent(this);
|
||||
}
|
||||
el.toHashTree(samplerHashTree, el.getHashTree(), config);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package io.metersphere.api.dto.definition.request.sampler;
|
|||
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.MsJDBCPostProcessor;
|
||||
import io.metersphere.api.dto.definition.request.processors.pre.MsJDBCPreProcessor;
|
||||
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;
|
||||
|
@ -164,6 +166,9 @@ public class MsTCPSampler extends MsTestElement {
|
|||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
hashTree = ElementUtil.order(hashTree);
|
||||
hashTree.forEach(el -> {
|
||||
if (el instanceof MsJDBCPreProcessor || el instanceof MsJDBCPostProcessor) {
|
||||
el.setParent(this);
|
||||
}
|
||||
el.toHashTree(samplerHashTree, el.getHashTree(), config);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue