fix(接口测试): 修复场景中SQL步骤自定义数据源显示问题

--bug=1009124 --user=赵勇 【github#8654】场景用例里切换数据库名-保存,再进来看数据库名不是上次保存的数据库名 https://www.tapd.cn/55049933/s/1085725
This commit is contained in:
fit2-zhao 2021-12-22 20:50:28 +08:00 committed by fit2-zhao
parent 7ae67838b7
commit 13b1e35880
3 changed files with 11 additions and 8 deletions

View File

@ -84,9 +84,9 @@ public class JMeterScriptUtil {
}
private static void addItemHashTree(MsTestElement element, HashTree samplerHashTree, ParameterConfig config, String enviromentId) {
if (element != null && element.getEnvironmentId() == null) {
element.setEnvironmentId(enviromentId);
if (element != null) {
element.setEnvironmentId(element.getEnvironmentId() == null ? enviromentId : element.getEnvironmentId());
element.toHashTree(samplerHashTree, element.getHashTree(), config);
}
element.toHashTree(samplerHashTree, element.getHashTree(), config);
}
}

View File

@ -31,9 +31,12 @@ import java.util.Map;
public class GenerateHashTreeUtil {
public static MsScenario parseScenarioDefinition(String scenarioDefinition) {
MsScenario scenario = JSONObject.parseObject(scenarioDefinition, MsScenario.class);
parse(scenarioDefinition, scenario, scenario.getId(), null);
return scenario;
if(StringUtils.isNotEmpty(scenarioDefinition)) {
MsScenario scenario = JSONObject.parseObject(scenarioDefinition, MsScenario.class);
parse(scenarioDefinition, scenario, scenario.getId(), null);
return scenario;
}
return null;
}
public static void parse(String scenarioDefinition, MsScenario scenario, String id, String reportType) {

View File

@ -364,7 +364,7 @@ export default {
}
}
}
if (databaseConfigsOptions.length > 0) {
if (databaseConfigsOptions.length > 0 && this.request.environmentId !== this.environment.id) {
this.request.dataSourceId = databaseConfigsOptions[0].id;
this.request.environmentId = this.environment.id;
}
@ -639,7 +639,7 @@ export default {
clickResource(resource) {
if (resource.refType && resource.refType === 'API') {
if(resource.protocol==='dubbo://'){
if (resource.protocol === 'dubbo://') {
resource.protocol = 'DUBBO'
}
let definitionData = this.$router.resolve({