fix(接口自动化): 修复导入jmx数据源问题

This commit is contained in:
fit2-zhao 2021-03-02 11:26:30 +08:00
parent 5114672358
commit eae9359892
2 changed files with 11 additions and 1 deletions

View File

@ -280,7 +280,9 @@ public class MsJmeterParser extends ApiImportAbstractParser<ScenarioImport> {
preCreate(hashTree);
// 更新数据源
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
dataPools.getEnvConfig().setDatabaseConfigs(new ArrayList<>(dataPools.getDataSources().values()));
if (dataPools.getDataSources() != null) {
dataPools.getEnvConfig().setDatabaseConfigs(new ArrayList<>(dataPools.getDataSources().values()));
}
if (dataPools.getIsCreate()) {
dataPools.getTestEnvironmentWithBLOBs().setConfig(JSON.toJSONString(dataPools.getEnvConfig()));
String id = environmentService.add(dataPools.getTestEnvironmentWithBLOBs());

View File

@ -5,6 +5,7 @@ import io.metersphere.api.dto.scenario.HttpConfig;
import io.metersphere.api.dto.scenario.TCPConfig;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
@ -13,4 +14,11 @@ public class EnvironmentConfig {
private HttpConfig httpConfig;
private List<DatabaseConfig> databaseConfigs;
private TCPConfig tcpConfig;
public EnvironmentConfig() {
this.commonConfig = new CommonConfig();
this.httpConfig = new HttpConfig();
this.databaseConfigs = new ArrayList<>();
this.tcpConfig = new TCPConfig();
}
}