refactor(接口定义): 修改传参方式
--story=1011108 --user=王孝刚 资源池加载插件直接从MinIO获取 https://www.tapd.cn/55049933/s/1331634
This commit is contained in:
parent
71ff9cd25a
commit
ced2fc21a1
|
@ -266,7 +266,7 @@ public class ApiExecuteService {
|
||||||
if (MapUtils.isNotEmpty(projectJarMap)) {
|
if (MapUtils.isNotEmpty(projectJarMap)) {
|
||||||
TestPlan test = (TestPlan) runRequest.getHashTree().getArray()[0];
|
TestPlan test = (TestPlan) runRequest.getHashTree().getArray()[0];
|
||||||
test.setProperty(ApiTestConstants.JAR_PATH, JSON.toJSONString(projectJarMap.keySet().stream().toList()));
|
test.setProperty(ApiTestConstants.JAR_PATH, JSON.toJSONString(projectJarMap.keySet().stream().toList()));
|
||||||
runRequest.getExtendedParameters().put(ExtendedParameter.PROJECT_JAR_MAP, JSON.toJSONString(projectJarMap));
|
runRequest.setCustomJarInfo(projectJarMap);
|
||||||
}
|
}
|
||||||
return runRequest;
|
return runRequest;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ import io.metersphere.base.mapper.ext.ExtApiScenarioMapper;
|
||||||
import io.metersphere.base.mapper.plan.ext.ExtTestPlanScenarioCaseMapper;
|
import io.metersphere.base.mapper.plan.ext.ExtTestPlanScenarioCaseMapper;
|
||||||
import io.metersphere.commons.constants.ApiRunMode;
|
import io.metersphere.commons.constants.ApiRunMode;
|
||||||
import io.metersphere.commons.constants.ApiTestConstants;
|
import io.metersphere.commons.constants.ApiTestConstants;
|
||||||
import io.metersphere.commons.constants.ExtendedParameter;
|
|
||||||
import io.metersphere.commons.constants.ReportTriggerMode;
|
import io.metersphere.commons.constants.ReportTriggerMode;
|
||||||
import io.metersphere.commons.enums.ApiReportStatus;
|
import io.metersphere.commons.enums.ApiReportStatus;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
|
@ -455,7 +454,7 @@ public class ApiScenarioExecuteService {
|
||||||
if (MapUtils.isNotEmpty(loadJar)) {
|
if (MapUtils.isNotEmpty(loadJar)) {
|
||||||
TestPlan test = (TestPlan) runRequest.getHashTree().getArray()[0];
|
TestPlan test = (TestPlan) runRequest.getHashTree().getArray()[0];
|
||||||
test.setProperty(ApiTestConstants.JAR_PATH, JSON.toJSONString(loadJar.keySet().stream().toList()));
|
test.setProperty(ApiTestConstants.JAR_PATH, JSON.toJSONString(loadJar.keySet().stream().toList()));
|
||||||
runRequest.getExtendedParameters().put(ExtendedParameter.PROJECT_JAR_MAP, JSON.toJSONString(loadJar));
|
runRequest.setCustomJarInfo(loadJar);
|
||||||
}
|
}
|
||||||
jMeterService.run(runRequest);
|
jMeterService.run(runRequest);
|
||||||
return request.getId();
|
return request.getId();
|
||||||
|
|
|
@ -59,24 +59,26 @@ public class NewDriverManager {
|
||||||
//获取文件内容
|
//获取文件内容
|
||||||
FileMetadataService fileMetadataService = CommonBeanFactory.getBean(FileMetadataService.class);
|
FileMetadataService fileMetadataService = CommonBeanFactory.getBean(FileMetadataService.class);
|
||||||
map.forEach((key, value) -> {
|
map.forEach((key, value) -> {
|
||||||
//历史数据
|
if (CollectionUtils.isNotEmpty(value)) {
|
||||||
value.stream().distinct().filter(s -> s.isHasFile()).forEach(s -> {
|
//历史数据
|
||||||
//获取文件内容
|
value.stream().distinct().filter(s -> s.isHasFile()).forEach(s -> {
|
||||||
byte[] bytes = new byte[0];
|
//获取文件内容
|
||||||
// 兼容历史数据
|
byte[] bytes = new byte[0];
|
||||||
bytes = fileMetadataService.getContent(s.getId());
|
// 兼容历史数据
|
||||||
ApiFileUtil.createFile(StringUtils.join(ApiFileUtil.LOCAL_JAR,
|
bytes = fileMetadataService.getContent(s.getId());
|
||||||
File.separator,
|
ApiFileUtil.createFile(StringUtils.join(ApiFileUtil.LOCAL_JAR,
|
||||||
key,
|
File.separator,
|
||||||
File.separator,
|
key,
|
||||||
s.getId(),
|
File.separator,
|
||||||
File.separator,
|
s.getId(),
|
||||||
String.valueOf(s.getUpdateTime()), ".jar"), bytes);
|
File.separator,
|
||||||
});
|
String.valueOf(s.getUpdateTime()), ".jar"), bytes);
|
||||||
List<String> jarIds = value.stream().distinct().filter(s -> !s.isHasFile()).map(ProjectJarConfig::getId).collect(Collectors.toList());
|
});
|
||||||
if (CollectionUtils.isNotEmpty(jarIds)) {
|
List<String> jarIds = value.stream().distinct().filter(s -> !s.isHasFile()).map(ProjectJarConfig::getId).collect(Collectors.toList());
|
||||||
List<FileInfoDTO> fileInfoDTOS = fileMetadataService.downloadFileByIds(jarIds);
|
if (CollectionUtils.isNotEmpty(jarIds)) {
|
||||||
ApiFileUtil.createFiles(fileInfoDTOS, key, value);
|
List<FileInfoDTO> fileInfoDTOS = fileMetadataService.downloadFileByIds(jarIds);
|
||||||
|
ApiFileUtil.createFiles(fileInfoDTOS, key, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,5 @@ package io.metersphere.commons.constants;
|
||||||
public class ExtendedParameter {
|
public class ExtendedParameter {
|
||||||
public static final String SYNC_STATUS = "SYN_RES";
|
public static final String SYNC_STATUS = "SYN_RES";
|
||||||
public static final String SAVE_RESULT = "SAVE_RESULT";
|
public static final String SAVE_RESULT = "SAVE_RESULT";
|
||||||
public static final String PROJECT_ID = "projectId";
|
|
||||||
public static final String TEST_END = "TEST_END";
|
public static final String TEST_END = "TEST_END";
|
||||||
public static final String PROJECT_JAR_MAP = "PROJECT_JAR_MAP";
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import lombok.Data;
|
||||||
import org.apache.jorphan.collections.HashTree;
|
import org.apache.jorphan.collections.HashTree;
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -93,6 +94,9 @@ public class JmeterRunRequestDTO {
|
||||||
//MinIO配置和系统插件信息
|
//MinIO配置和系统插件信息
|
||||||
private PluginConfigDTO pluginConfigDTO;
|
private PluginConfigDTO pluginConfigDTO;
|
||||||
|
|
||||||
|
//自定义jar信息
|
||||||
|
private Map<String, List<ProjectJarConfig>> customJarInfo;
|
||||||
|
|
||||||
public JmeterRunRequestDTO() {
|
public JmeterRunRequestDTO() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,7 @@ public class JarConfigUtils {
|
||||||
//本地没有文件,需要从服务器下载
|
//本地没有文件,需要从服务器下载
|
||||||
jarConfigs.add(projectJarConfig);
|
jarConfigs.add(projectJarConfig);
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isNotEmpty(jarConfigs)) {
|
jarConfigsMap.put(item, jarConfigs);
|
||||||
jarConfigsMap.put(item, jarConfigs);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue