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); preCreate(hashTree);
// 更新数据源 // 更新数据源
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class); ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
if (dataPools.getDataSources() != null) {
dataPools.getEnvConfig().setDatabaseConfigs(new ArrayList<>(dataPools.getDataSources().values())); dataPools.getEnvConfig().setDatabaseConfigs(new ArrayList<>(dataPools.getDataSources().values()));
}
if (dataPools.getIsCreate()) { if (dataPools.getIsCreate()) {
dataPools.getTestEnvironmentWithBLOBs().setConfig(JSON.toJSONString(dataPools.getEnvConfig())); dataPools.getTestEnvironmentWithBLOBs().setConfig(JSON.toJSONString(dataPools.getEnvConfig()));
String id = environmentService.add(dataPools.getTestEnvironmentWithBLOBs()); 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 io.metersphere.api.dto.scenario.TCPConfig;
import lombok.Data; import lombok.Data;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Data @Data
@ -13,4 +14,11 @@ public class EnvironmentConfig {
private HttpConfig httpConfig; private HttpConfig httpConfig;
private List<DatabaseConfig> databaseConfigs; private List<DatabaseConfig> databaseConfigs;
private TCPConfig tcpConfig; private TCPConfig tcpConfig;
public EnvironmentConfig() {
this.commonConfig = new CommonConfig();
this.httpConfig = new HttpConfig();
this.databaseConfigs = new ArrayList<>();
this.tcpConfig = new TCPConfig();
}
} }