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