fix(接口测试): 批量执行获取资源池,没有默认选中默认资源池

--bug=1047796 --user=陈建星 【接口测试】-批量执行CASE、场景时,默认选择的资源池不是项目指定的执行资源池 https://www.tapd.cn/55049933/s/1595627
This commit is contained in:
AgAngle 2024-10-22 15:35:45 +08:00 committed by Craftsman
parent c0f4b89742
commit 83ca47c242
1 changed files with 6 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import io.metersphere.plugin.api.dto.ApiPluginSelectOption;
import io.metersphere.plugin.api.spi.AbstractApiPlugin; import io.metersphere.plugin.api.spi.AbstractApiPlugin;
import io.metersphere.plugin.api.spi.AbstractProtocolPlugin; import io.metersphere.plugin.api.spi.AbstractProtocolPlugin;
import io.metersphere.project.api.KeyValueParam; import io.metersphere.project.api.KeyValueParam;
import io.metersphere.project.domain.ProjectApplication;
import io.metersphere.project.dto.CommonScriptInfo; import io.metersphere.project.dto.CommonScriptInfo;
import io.metersphere.project.dto.customfunction.CustomFunctionDTO; import io.metersphere.project.dto.customfunction.CustomFunctionDTO;
import io.metersphere.project.dto.environment.EnvironmentConfig; import io.metersphere.project.dto.environment.EnvironmentConfig;
@ -134,7 +135,12 @@ public class ApiTestService {
} }
public String getPoolId(String projectId) { public String getPoolId(String projectId) {
// 查询接口默认资源池
ProjectApplication resourcePoolConfig = projectApplicationService.getByType(projectId, ProjectApplicationType.API.API_RESOURCE_POOL_ID.name());
Map<String, Object> configMap = new HashMap<>(); Map<String, Object> configMap = new HashMap<>();
if (resourcePoolConfig != null && StringUtils.isNotBlank(resourcePoolConfig.getTypeValue())) {
configMap.put(ProjectApplicationType.API.API_RESOURCE_POOL_ID.name(), resourcePoolConfig.getTypeValue());
}
projectApplicationService.putResourcePool(projectId, configMap, "apiTest"); projectApplicationService.putResourcePool(projectId, configMap, "apiTest");
if (configMap.isEmpty()) { if (configMap.isEmpty()) {
return null; return null;