fix(性能测试): [性能测试]github#24464场景修改csv 文件后,性能里点击同步场景设置最新变更,页面csv 文件未刷新过来

【[性能测试]github#24464场景修改csv 文件后,性能里点击同步场景设置最新变更,页面csv
文件未刷新过来】https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001026339
This commit is contained in:
song-tianyang 2023-05-22 18:48:31 +08:00 committed by 建国
parent 67f34ff496
commit 07f9a08275
1 changed files with 9 additions and 4 deletions

View File

@ -9,6 +9,7 @@ import io.metersphere.base.mapper.ext.ExtApiLoadTestMapper;
import io.metersphere.base.mapper.ext.ExtLoadTestMapper; import io.metersphere.base.mapper.ext.ExtLoadTestMapper;
import io.metersphere.commons.constants.MicroServiceName; import io.metersphere.commons.constants.MicroServiceName;
import io.metersphere.commons.constants.PerformanceTestStatus; import io.metersphere.commons.constants.PerformanceTestStatus;
import io.metersphere.commons.constants.StorageConstants;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.FileUtils; import io.metersphere.commons.utils.FileUtils;
import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.LogUtil;
@ -16,12 +17,12 @@ import io.metersphere.i18n.Translator;
import io.metersphere.metadata.service.FileMetadataService; import io.metersphere.metadata.service.FileMetadataService;
import io.metersphere.request.EditTestPlanRequest; import io.metersphere.request.EditTestPlanRequest;
import io.metersphere.service.MicroService; import io.metersphere.service.MicroService;
import jakarta.annotation.Resource;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import java.io.File; import java.io.File;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.List; import java.util.List;
@ -166,9 +167,13 @@ public class ApiPerformanceService {
private void saveOtherFile(List<FileMetadata> fileNames, String loadTestId) { private void saveOtherFile(List<FileMetadata> fileNames, String loadTestId) {
for (int i = 0; i < fileNames.size(); i++) { for (int i = 0; i < fileNames.size(); i++) {
FileMetadata model = fileNames.get(i); FileMetadata model = fileNames.get(i);
String fileName = model.getName(); if (StringUtils.equalsAnyIgnoreCase(model.getStorage(), StorageConstants.GIT.name(), StorageConstants.MINIO.name())) {
File file = FileUtils.getFileByName(fileName); saveLoadTestFile(model, loadTestId, i + 1);
saveUploadFile(file, loadTestId, i + 1); } else {
String fileName = model.getName();
File file = FileUtils.getFileByName(fileName);
saveUploadFile(file, loadTestId, i + 1);
}
} }
} }