fix(性能测试): 修改性能测试执行时检查是否含有jmx文件的校验方法
This commit is contained in:
parent
eac325046c
commit
0ba6e94d06
|
@ -250,6 +250,10 @@ public class FileMetadataService {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FileMetadataWithBLOBs selectById(String id) {
|
||||||
|
return fileMetadataMapper.selectByPrimaryKey(id);
|
||||||
|
}
|
||||||
|
|
||||||
public byte[] loadFileAsBytes(String id) {
|
public byte[] loadFileAsBytes(String id) {
|
||||||
FileMetadataWithBLOBs fileMetadata = fileMetadataMapper.selectByPrimaryKey(id);
|
FileMetadataWithBLOBs fileMetadata = fileMetadataMapper.selectByPrimaryKey(id);
|
||||||
if (fileMetadata == null) {
|
if (fileMetadata == null) {
|
||||||
|
@ -258,7 +262,7 @@ public class FileMetadataService {
|
||||||
return this.loadFileAsBytes(fileMetadata);
|
return this.loadFileAsBytes(fileMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] loadFileAsBytes(FileMetadataWithBLOBs fileMetadata) {
|
public byte[] loadFileAsBytes(FileMetadataWithBLOBs fileMetadata) {
|
||||||
byte[] bytes = new byte[0];
|
byte[] bytes = new byte[0];
|
||||||
// 兼容历史数据
|
// 兼容历史数据
|
||||||
if (StringUtils.isEmpty(fileMetadata.getStorage()) && StringUtils.isEmpty(fileMetadata.getResourceType())) {
|
if (StringUtils.isEmpty(fileMetadata.getStorage()) && StringUtils.isEmpty(fileMetadata.getResourceType())) {
|
||||||
|
|
|
@ -387,12 +387,14 @@ public class PerformanceTestService {
|
||||||
loadTestFileExample.createCriteria().andTestIdEqualTo(id);
|
loadTestFileExample.createCriteria().andTestIdEqualTo(id);
|
||||||
List<LoadTestFile> loadTestFileList = loadTestFileMapper.selectByExample(loadTestFileExample);
|
List<LoadTestFile> loadTestFileList = loadTestFileMapper.selectByExample(loadTestFileExample);
|
||||||
List<String> fileIdList = loadTestFileList.stream().map(LoadTestFile::getFileId).collect(Collectors.toList());
|
List<String> fileIdList = loadTestFileList.stream().map(LoadTestFile::getFileId).collect(Collectors.toList());
|
||||||
List<FileInfoDTO> fileInfoDTOList = fileMetadataService.downloadFileByIds(fileIdList);
|
|
||||||
boolean hasJmx = false;
|
boolean hasJmx = false;
|
||||||
for (FileInfoDTO fileInfoDTO : fileInfoDTOList) {
|
for (String fileId : fileIdList) {
|
||||||
if (StringUtils.equalsIgnoreCase(fileInfoDTO.getType(), "jmx")) {
|
FileMetadataWithBLOBs fileMetadata = fileMetadataService.selectById(fileId);
|
||||||
|
if (fileMetadata != null && StringUtils.equalsIgnoreCase(fileMetadata.getType(), "jmx")) {
|
||||||
hasJmx = true;
|
hasJmx = true;
|
||||||
if (!JmxParseUtil.isJmxFile(fileInfoDTO.getFileByte())) {
|
byte[] bytes = fileMetadataService.loadFileAsBytes(fileMetadata);
|
||||||
|
if (bytes == null || bytes.length == 0) {
|
||||||
MSException.throwException(Translator.get("load_test_file_is_not_jmx"));
|
MSException.throwException(Translator.get("load_test_file_is_not_jmx"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue