Merge branch 'main' of https://github.com/metersphere/metersphere
This commit is contained in:
commit
78b270dd61
|
@ -29,7 +29,6 @@ import io.metersphere.base.mapper.ApiScenarioMapper;
|
|||
import io.metersphere.commons.constants.ElementConstants;
|
||||
import io.metersphere.commons.constants.PropertyConstant;
|
||||
import io.metersphere.commons.constants.StorageConstants;
|
||||
import io.metersphere.commons.enums.StorageEnums;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.*;
|
||||
import io.metersphere.commons.vo.JDBCProcessorVO;
|
||||
|
@ -105,97 +104,64 @@ public class ElementUtil {
|
|||
list = config.getTransferVariables().stream().filter(ScenarioVariable::isCSVValid).filter(ScenarioVariable::isEnable).collect(Collectors.toList());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
FileMetadataService fileMetadataService = CommonBeanFactory.getBean(FileMetadataService.class);
|
||||
list.forEach(item -> {
|
||||
CSVDataSet csvDataSet = new CSVDataSet();
|
||||
csvDataSet.setEnabled(true);
|
||||
csvDataSet.setProperty(TestElement.TEST_CLASS, CSVDataSet.class.getName());
|
||||
csvDataSet.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass(TEST_BEAN_GUI));
|
||||
csvDataSet.setName(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName());
|
||||
csvDataSet.setProperty("fileEncoding", StringUtils.isEmpty(item.getEncoding()) ? StandardCharsets.UTF_8.name() : item.getEncoding());
|
||||
if (CollectionUtils.isEmpty(item.getFiles())) {
|
||||
MSException.throwException(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName() + ":[ " + Translator.get("csv_no_exist") + " ]");
|
||||
} else {
|
||||
boolean isRef = false;
|
||||
String fileId = null;
|
||||
boolean isRepository = false;
|
||||
BodyFile file = item.getFiles().get(0);
|
||||
String path = BODY_FILE_DIR + "/" + item.getFiles().get(0).getId() + "_" + item.getFiles().get(0).getName();
|
||||
if (StringUtils.equalsIgnoreCase(file.getStorage(), StorageConstants.FILE_REF.name())) {
|
||||
isRef = true;
|
||||
fileId = file.getFileId();
|
||||
if (fileMetadataService != null) {
|
||||
FileMetadata fileMetadata = fileMetadataService.getFileMetadataById(fileId);
|
||||
if (fileMetadata != null && !StringUtils.equals(fileMetadata.getStorage(), StorageConstants.LOCAL.name())) {
|
||||
isRepository = true;
|
||||
}
|
||||
}
|
||||
path = FileUtils.getFilePath(file);
|
||||
}
|
||||
if (!config.isOperating() && !isRepository && !new File(path).exists()) {
|
||||
MSException.throwException(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName() + ":[ " + Translator.get("csv_no_exist") + " ]");
|
||||
}
|
||||
csvDataSet.setProperty(ElementConstants.FILENAME, path);
|
||||
csvDataSet.setProperty(ElementConstants.IS_REF, isRef);
|
||||
csvDataSet.setProperty(ElementConstants.FILE_ID, fileId);
|
||||
csvDataSet.setProperty(ElementConstants.RESOURCE_ID, file.getId());
|
||||
}
|
||||
csvDataSet.setIgnoreFirstLine(false);
|
||||
csvDataSet.setProperty("shareMode", shareMode);
|
||||
csvDataSet.setProperty("recycle", true);
|
||||
csvDataSet.setProperty("delimiter", item.getDelimiter());
|
||||
csvDataSet.setProperty("quotedData", item.isQuotedData());
|
||||
csvDataSet.setComment(StringUtils.isEmpty(item.getDescription()) ? "" : item.getDescription());
|
||||
tree.add(csvDataSet);
|
||||
});
|
||||
addCsv(tree, config, shareMode, list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addCsv(HashTree tree, ParameterConfig config, String shareMode, List<ScenarioVariable> list) {
|
||||
FileMetadataService fileMetadataService = CommonBeanFactory.getBean(FileMetadataService.class);
|
||||
list.forEach(item -> {
|
||||
CSVDataSet csvDataSet = new CSVDataSet();
|
||||
csvDataSet.setEnabled(true);
|
||||
csvDataSet.setProperty(TestElement.TEST_CLASS, CSVDataSet.class.getName());
|
||||
csvDataSet.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass(TEST_BEAN_GUI));
|
||||
csvDataSet.setName(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName());
|
||||
csvDataSet.setProperty("fileEncoding", StringUtils.isEmpty(item.getEncoding()) ? StandardCharsets.UTF_8.name() : item.getEncoding());
|
||||
if (CollectionUtils.isEmpty(item.getFiles())) {
|
||||
MSException.throwException(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName() + ":[ " + Translator.get("csv_no_exist") + " ]");
|
||||
} else {
|
||||
String fileId = null;
|
||||
boolean isRepository = false;
|
||||
BodyFile file = item.getFiles().get(0);
|
||||
boolean isRef = StringUtils.equalsIgnoreCase(file.getStorage(), StorageConstants.FILE_REF.name());
|
||||
String path = StringUtils.join(BODY_FILE_DIR, File.pathSeparator, item.getFiles().get(0).getId(), "_", item.getFiles().get(0).getName());
|
||||
if (StringUtils.equalsIgnoreCase(file.getStorage(), StorageConstants.FILE_REF.name())) {
|
||||
fileId = file.getFileId();
|
||||
FileMetadata fileMetadata = fileMetadataService.getFileMetadataById(fileId);
|
||||
if (fileMetadata != null
|
||||
&& !StringUtils.equals(fileMetadata.getStorage(), StorageConstants.LOCAL.name())) {
|
||||
isRepository = true;
|
||||
}
|
||||
path = FileUtils.getFilePath(file);
|
||||
}
|
||||
if (!config.isOperating() && !isRepository && !new File(path).exists()) {
|
||||
// 从MinIO下载
|
||||
ApiFileUtil.downloadFile(file.getId(), path);
|
||||
if (!new File(path).exists()) {
|
||||
MSException.throwException(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName() + ":[ " + Translator.get("csv_no_exist") + " ]");
|
||||
}
|
||||
}
|
||||
csvDataSet.setProperty(ElementConstants.FILENAME, path);
|
||||
csvDataSet.setProperty(ElementConstants.IS_REF, isRef);
|
||||
csvDataSet.setProperty(ElementConstants.FILE_ID, fileId);
|
||||
csvDataSet.setProperty(ElementConstants.RESOURCE_ID, file.getId());
|
||||
}
|
||||
csvDataSet.setIgnoreFirstLine(false);
|
||||
csvDataSet.setProperty("shareMode", shareMode);
|
||||
csvDataSet.setProperty("recycle", true);
|
||||
csvDataSet.setProperty("delimiter", item.getDelimiter());
|
||||
csvDataSet.setProperty("quotedData", item.isQuotedData());
|
||||
csvDataSet.setComment(StringUtils.isEmpty(item.getDescription()) ? "" : item.getDescription());
|
||||
tree.add(csvDataSet);
|
||||
});
|
||||
}
|
||||
|
||||
public static void addApiCsvDataSet(HashTree tree, List<ScenarioVariable> variables, ParameterConfig config, String shareMode) {
|
||||
if (CollectionUtils.isNotEmpty(variables)) {
|
||||
List<ScenarioVariable> list = variables.stream().filter(ScenarioVariable::isCSVValid).filter(ScenarioVariable::isEnable).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
list.forEach(item -> {
|
||||
CSVDataSet csvDataSet = new CSVDataSet();
|
||||
csvDataSet.setEnabled(true);
|
||||
csvDataSet.setProperty(TestElement.TEST_CLASS, CSVDataSet.class.getName());
|
||||
csvDataSet.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass(TEST_BEAN_GUI));
|
||||
csvDataSet.setName(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName());
|
||||
csvDataSet.setProperty("fileEncoding", StringUtils.isEmpty(item.getEncoding()) ? StandardCharsets.UTF_8.name() : item.getEncoding());
|
||||
if (CollectionUtils.isEmpty(item.getFiles())) {
|
||||
MSException.throwException(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName() + ":[ " + Translator.get("csv_no_exist") + " ]");
|
||||
} else {
|
||||
BodyFile file = item.getFiles().get(0);
|
||||
String fileId = item.getId();
|
||||
boolean isRef = false;
|
||||
String path;
|
||||
if (StringUtils.equalsIgnoreCase(file.getStorage(), StorageConstants.FILE_REF.name())) {
|
||||
isRef = true;
|
||||
fileId = file.getFileId();
|
||||
path = FileUtils.getFilePath(file);
|
||||
} else {
|
||||
path = BODY_FILE_DIR + "/" + item.getFiles().get(0).getId() + "_" + item.getFiles().get(0).getName();
|
||||
if (StringUtils.equalsIgnoreCase(file.getStorage(), StorageEnums.FILE_REF.name())) {
|
||||
path = ApiFileUtil.getFilePath(file);
|
||||
}
|
||||
if (!config.isOperating() && !new File(path).exists()) {
|
||||
MSException.throwException(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName() + ":[ " + Translator.get("csv_no_exist") + " ]");
|
||||
}
|
||||
}
|
||||
csvDataSet.setProperty(ElementConstants.FILENAME, path);
|
||||
csvDataSet.setProperty(ElementConstants.IS_REF, isRef);
|
||||
csvDataSet.setProperty(ElementConstants.FILE_ID, fileId);
|
||||
csvDataSet.setProperty(ElementConstants.RESOURCE_ID, file.getId());
|
||||
}
|
||||
csvDataSet.setIgnoreFirstLine(false);
|
||||
csvDataSet.setProperty("shareMode", shareMode);
|
||||
csvDataSet.setProperty("recycle", true);
|
||||
csvDataSet.setProperty("delimiter", item.getDelimiter());
|
||||
csvDataSet.setProperty("quotedData", item.isQuotedData());
|
||||
csvDataSet.setComment(StringUtils.isEmpty(item.getDescription()) ? "" : item.getDescription());
|
||||
tree.add(csvDataSet);
|
||||
});
|
||||
addCsv(tree, config, shareMode, list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -554,7 +554,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
try {
|
||||
String value = keyValue.getValue() != null && keyValue.getValue().startsWith("@") ?
|
||||
ScriptEngineUtils.buildFunctionCallString(keyValue.getValue()) : keyValue.getValue();
|
||||
value = keyValue.isUrlEncode() ? StringUtils.join(StringUtils.join("${__urlencode(", value), ")}") : value;
|
||||
value = keyValue.isUrlEncode() ? StringUtils.join("${__urlencode(", value, ")}") : value;
|
||||
keyValueMap.put(keyValue.getName(), value);
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
|
@ -585,11 +585,11 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
stringBuffer.append("?");
|
||||
}
|
||||
this.getArguments().stream().filter(KeyValue::isEnable).filter(KeyValue::isValid).forEach(keyValue -> {
|
||||
stringBuffer.append(keyValue.isUrlEncode() ? StringUtils.join(StringUtils.join("${__urlencode(", keyValue.getName()), ")}") : keyValue.getName());
|
||||
stringBuffer.append(keyValue.isUrlEncode() ? StringUtils.join("${__urlencode(", keyValue.getName(), ")}") : keyValue.getName());
|
||||
if (keyValue.getValue() != null) {
|
||||
try {
|
||||
String value = keyValue.getValue().startsWith("@") ? ScriptEngineUtils.buildFunctionCallString(keyValue.getValue()) : keyValue.getValue();
|
||||
value = keyValue.isUrlEncode() ? StringUtils.join(StringUtils.join("${__urlencode(", value), ")}") : value;
|
||||
value = keyValue.isUrlEncode() ? StringUtils.join("${__urlencode(", value, ")}") : value;
|
||||
if (StringUtils.isNotEmpty(value) && value.contains(StringUtils.CR)) {
|
||||
value = value.replaceAll(StringUtils.CR, StringUtils.EMPTY);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import io.metersphere.jmeter.JMeterBase;
|
|||
import io.metersphere.jmeter.LocalRunner;
|
||||
import io.metersphere.service.RemakeReportService;
|
||||
import io.metersphere.utils.LoggerUtil;
|
||||
import io.metersphere.xpack.api.service.ApiPoolDebugService;
|
||||
import io.metersphere.service.ApiPoolDebugService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
@ -59,6 +59,8 @@ public class JMeterService {
|
|||
private RemakeReportService remakeReportService;
|
||||
@Resource
|
||||
private ExecThreadPoolExecutor execThreadPoolExecutor;
|
||||
@Resource
|
||||
private ApiPoolDebugService apiPoolDebugService;
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
|
@ -172,16 +174,13 @@ public class JMeterService {
|
|||
|
||||
private synchronized void nodeDebug(JmeterRunRequestDTO request) {
|
||||
try {
|
||||
ApiPoolDebugService apiPoolDebugService = CommonBeanFactory.getBean(ApiPoolDebugService.class);
|
||||
if (apiPoolDebugService != null) {
|
||||
List<TestResource> resources = GenerateHashTreeUtil.setPoolResource(request.getPoolId());
|
||||
if (request.getHashTree() != null) {
|
||||
String key = StringUtils.join(request.getReportId(), "-", request.getTestId());
|
||||
redisTemplate.opsForValue().set(key, new MsTestPlan().getJmx(request.getHashTree()));
|
||||
request.setHashTree(null);
|
||||
}
|
||||
apiPoolDebugService.run(request, resources);
|
||||
List<TestResource> resources = GenerateHashTreeUtil.setPoolResource(request.getPoolId());
|
||||
if (request.getHashTree() != null) {
|
||||
String key = StringUtils.join(request.getReportId(), "-", request.getTestId());
|
||||
redisTemplate.opsForValue().set(key, new MsTestPlan().getJmx(request.getHashTree()));
|
||||
request.setHashTree(null);
|
||||
}
|
||||
apiPoolDebugService.run(request, resources);
|
||||
} catch (Exception e) {
|
||||
LoggerUtil.error(e);
|
||||
remakeReportService.remake(request);
|
||||
|
@ -263,9 +262,6 @@ public class JMeterService {
|
|||
}
|
||||
|
||||
public void verifyPool(String projectId, RunModeConfigDTO runModeConfigDTO) {
|
||||
ApiPoolDebugService debugService = CommonBeanFactory.getBean(ApiPoolDebugService.class);
|
||||
if (debugService != null) {
|
||||
debugService.verifyPool(projectId, runModeConfigDTO);
|
||||
}
|
||||
apiPoolDebugService.verifyPool(projectId, runModeConfigDTO);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,8 +99,8 @@ public class ApiTestDefinitionDiffUtilImpl implements ApiDefinitionDiffUtil {
|
|||
httpOld.getHeaders().remove(httpOld.getHeaders().size() - 1);
|
||||
}
|
||||
|
||||
String headerNew = StringUtils.join(StringUtils.join(JSON_START, JSON.toJSONString(httpNew.getHeaders())), JSON_END);
|
||||
String headerOld = StringUtils.join(StringUtils.join(JSON_START, JSON.toJSONString(httpOld.getHeaders())), JSON_END);
|
||||
String headerNew = StringUtils.join(JSON_START, JSON.toJSONString(httpNew.getHeaders()), JSON_END);
|
||||
String headerOld = StringUtils.join(JSON_START, JSON.toJSONString(httpOld.getHeaders()), JSON_END);
|
||||
if (!StringUtils.equals(headerNew, headerOld)) {
|
||||
String patch = jsonDiff.diff(headerOld, headerNew);
|
||||
String diffPatch = jsonDiff.apply(headerOld, patch);
|
||||
|
@ -113,8 +113,8 @@ public class ApiTestDefinitionDiffUtilImpl implements ApiDefinitionDiffUtil {
|
|||
httpNew.getArguments().remove(httpNew.getArguments().size() - 1);
|
||||
httpOld.getArguments().remove(httpOld.getArguments().size() - 1);
|
||||
}
|
||||
String queryNew = StringUtils.join(StringUtils.join(JSON_START, JSON.toJSONString(httpNew.getArguments())), JSON_END);
|
||||
String queryOld = StringUtils.join(StringUtils.join(JSON_START, JSON.toJSONString(httpOld.getArguments())), JSON_END);
|
||||
String queryNew = StringUtils.join(JSON_START, JSON.toJSONString(httpNew.getArguments()), JSON_END);
|
||||
String queryOld = StringUtils.join(JSON_START, JSON.toJSONString(httpOld.getArguments()), JSON_END);
|
||||
if (!StringUtils.equals(queryNew, queryOld)) {
|
||||
String patch = jsonDiff.diff(queryOld, queryNew);
|
||||
String diff = jsonDiff.apply(queryOld, patch);
|
||||
|
@ -127,8 +127,8 @@ public class ApiTestDefinitionDiffUtilImpl implements ApiDefinitionDiffUtil {
|
|||
httpNew.getRest().remove(httpNew.getRest().size() - 1);
|
||||
httpOld.getRest().remove(httpOld.getRest().size() - 1);
|
||||
}
|
||||
String restNew = StringUtils.join(StringUtils.join(JSON_START, JSON.toJSONString(httpNew.getRest())), JSON_END);
|
||||
String restOld = StringUtils.join(StringUtils.join(JSON_START, JSON.toJSONString(httpOld.getRest())), JSON_END);
|
||||
String restNew = StringUtils.join(JSON_START, JSON.toJSONString(httpNew.getRest()), JSON_END);
|
||||
String restOld = StringUtils.join(JSON_START, JSON.toJSONString(httpOld.getRest()), JSON_END);
|
||||
if (!StringUtils.equals(restNew, restOld)) {
|
||||
String patch = jsonDiff.diff(restOld, restNew);
|
||||
String diff = jsonDiff.apply(restOld, patch);
|
||||
|
@ -152,8 +152,8 @@ public class ApiTestDefinitionDiffUtilImpl implements ApiDefinitionDiffUtil {
|
|||
httpNew.getBody().getKvs().remove(httpNew.getBody().getKvs().size() - 1);
|
||||
httpOld.getBody().getKvs().remove(httpOld.getBody().getKvs().size() - 1);
|
||||
}
|
||||
String bodyFormNew = StringUtils.join(StringUtils.join(JSON_START, JSON.toJSONString(httpNew.getBody().getKvs())), JSON_END);
|
||||
String bodyFormOld = StringUtils.join(StringUtils.join(JSON_START, JSON.toJSONString(httpOld.getBody().getKvs())), JSON_END);
|
||||
String bodyFormNew = StringUtils.join(JSON_START, JSON.toJSONString(httpNew.getBody().getKvs()), JSON_END);
|
||||
String bodyFormOld = StringUtils.join(JSON_START, JSON.toJSONString(httpOld.getBody().getKvs()), JSON_END);
|
||||
if (!StringUtils.equals(bodyFormNew, bodyFormOld)) {
|
||||
String patch = jsonDiff.diff(bodyFormOld, bodyFormNew);
|
||||
String diff = jsonDiff.apply(bodyFormNew, patch);
|
||||
|
@ -197,8 +197,8 @@ public class ApiTestDefinitionDiffUtilImpl implements ApiDefinitionDiffUtil {
|
|||
private static void diffHttpResponse(JSONObject httpNew, JSONObject httpOld, JsonDiff jsonDiff, Map<String, String> diffMap) {
|
||||
// 请求头对比 old/new
|
||||
if (httpNew.get(HEADS) != null && httpOld.get(HEADS) != null) {
|
||||
String headerNew = StringUtils.join(StringUtils.join(JSON_START, httpNew.get(HEADS).toString()), JSON_END);
|
||||
String headerOld = StringUtils.join(StringUtils.join(JSON_START, httpOld.get(HEADS).toString()), JSON_END);
|
||||
String headerNew = StringUtils.join(JSON_START, httpNew.get(HEADS).toString(), JSON_END);
|
||||
String headerOld = StringUtils.join(JSON_START, httpOld.get(HEADS).toString(), JSON_END);
|
||||
if (!StringUtils.equals(headerNew, headerOld)) {
|
||||
String patch = jsonDiff.diff(headerOld, headerNew);
|
||||
String diffPatch = jsonDiff.apply(headerNew, patch);
|
||||
|
@ -209,8 +209,8 @@ public class ApiTestDefinitionDiffUtilImpl implements ApiDefinitionDiffUtil {
|
|||
}
|
||||
// 对比statusCode参数
|
||||
if (httpNew.get(STATUS_CODE) != null && httpOld.get(STATUS_CODE) != null) {
|
||||
String statusCodeNew = StringUtils.join(StringUtils.join(JSON_START, httpNew.get(STATUS_CODE).toString()), JSON_END);
|
||||
String statusCodeOld = StringUtils.join(StringUtils.join(JSON_START, httpOld.get(STATUS_CODE).toString()), JSON_END);
|
||||
String statusCodeNew = StringUtils.join(JSON_START, httpNew.get(STATUS_CODE).toString(), JSON_END);
|
||||
String statusCodeOld = StringUtils.join(JSON_START, httpOld.get(STATUS_CODE).toString(), JSON_END);
|
||||
if (!StringUtils.equals(statusCodeNew, statusCodeOld)) {
|
||||
String patch = jsonDiff.diff(statusCodeOld, statusCodeNew);
|
||||
String diff = jsonDiff.apply(statusCodeNew, patch);
|
||||
|
@ -238,8 +238,8 @@ public class ApiTestDefinitionDiffUtilImpl implements ApiDefinitionDiffUtil {
|
|||
bodyNew.getKvs().remove(bodyNew.getKvs().size() - 1);
|
||||
bodyOld.getKvs().remove(bodyOld.getKvs().size() - 1);
|
||||
}
|
||||
String bodyFormNew = StringUtils.join(StringUtils.join(JSON_START, JSON.toJSONString(bodyNew.getKvs())), JSON_END);
|
||||
String bodyFormOld = StringUtils.join(StringUtils.join(JSON_START, JSON.toJSONString(bodyOld.getKvs())), JSON_END);
|
||||
String bodyFormNew = StringUtils.join(JSON_START, JSON.toJSONString(bodyNew.getKvs()), JSON_END);
|
||||
String bodyFormOld = StringUtils.join(JSON_START, JSON.toJSONString(bodyOld.getKvs()), JSON_END);
|
||||
if (!StringUtils.equals(bodyFormNew, bodyFormOld)) {
|
||||
String patch = jsonDiff.diff(bodyFormOld, bodyFormNew);
|
||||
String diff = jsonDiff.apply(bodyFormNew, patch);
|
||||
|
@ -261,8 +261,8 @@ public class ApiTestDefinitionDiffUtilImpl implements ApiDefinitionDiffUtil {
|
|||
tcpNew.getParameters().remove(tcpNew.getParameters().size() - 1);
|
||||
tcpOld.getParameters().remove(tcpOld.getParameters().size() - 1);
|
||||
}
|
||||
String queryNew = StringUtils.join(StringUtils.join(JSON_START, JSON.toJSONString(tcpNew.getParameters())), JSON_END);
|
||||
String queryOld = StringUtils.join(StringUtils.join(JSON_START, JSON.toJSONString(tcpOld.getParameters())), JSON_END);
|
||||
String queryNew = StringUtils.join(JSON_START, JSON.toJSONString(tcpNew.getParameters()), JSON_END);
|
||||
String queryOld = StringUtils.join(JSON_START, JSON.toJSONString(tcpOld.getParameters()), JSON_END);
|
||||
if (!StringUtils.equals(queryNew, queryOld)) {
|
||||
String patch = jsonDiff.diff(queryOld, queryNew);
|
||||
String diff = jsonDiff.apply(queryNew, patch);
|
||||
|
@ -279,8 +279,8 @@ public class ApiTestDefinitionDiffUtilImpl implements ApiDefinitionDiffUtil {
|
|||
}
|
||||
}
|
||||
// 对比BODY-XML参数
|
||||
String xmlNew = StringUtils.join(StringUtils.join(JSON_START, JSON.toJSONString(tcpNew.getXmlDataStruct())), JSON_END);
|
||||
String xmlOld = StringUtils.join(StringUtils.join(JSON_START, JSON.toJSONString(tcpOld.getXmlDataStruct())), JSON_END);
|
||||
String xmlNew = StringUtils.join(JSON_START, JSON.toJSONString(tcpNew.getXmlDataStruct()), JSON_END);
|
||||
String xmlOld = StringUtils.join(JSON_START, JSON.toJSONString(tcpOld.getXmlDataStruct()), JSON_END);
|
||||
if (!StringUtils.equals(xmlNew, xmlOld)) {
|
||||
diffMap.put(StringUtils.join(BODY_XML, "_1"), JSON.toJSONString(tcpNew.getXmlDataStruct()));
|
||||
diffMap.put(StringUtils.join(BODY_XML, "_2"), JSON.toJSONString(tcpOld.getXmlDataStruct()));
|
||||
|
@ -326,8 +326,8 @@ public class ApiTestDefinitionDiffUtilImpl implements ApiDefinitionDiffUtil {
|
|||
jdbcNew.getVariables().remove(jdbcNew.getVariables().size() - 1);
|
||||
jdbcOld.getVariables().remove(jdbcOld.getVariables().size() - 1);
|
||||
}
|
||||
String variablesNew = StringUtils.join(StringUtils.join(JSON_START, JSON.toJSONString(jdbcNew.getVariables())), JSON_END);
|
||||
String variablesOld = StringUtils.join(StringUtils.join(JSON_START, JSON.toJSONString(jdbcOld.getVariables())), JSON_END);
|
||||
String variablesNew = StringUtils.join(JSON_START, JSON.toJSONString(jdbcNew.getVariables()), JSON_END);
|
||||
String variablesOld = StringUtils.join(JSON_START, JSON.toJSONString(jdbcOld.getVariables()), JSON_END);
|
||||
if (!StringUtils.equals(variablesNew, variablesOld)) {
|
||||
String patch = jsonDiff.diff(variablesOld, variablesNew);
|
||||
String diffPatch = jsonDiff.apply(variablesNew, patch);
|
||||
|
@ -367,8 +367,8 @@ public class ApiTestDefinitionDiffUtilImpl implements ApiDefinitionDiffUtil {
|
|||
dubboNew.getArgs().remove(dubboNew.getArgs().size() - 1);
|
||||
dubboOld.getArgs().remove(dubboOld.getArgs().size() - 1);
|
||||
}
|
||||
String argsNew = StringUtils.join(StringUtils.join(JSON_START, JSON.toJSONString(dubboNew.getArgs())), JSON_END);
|
||||
String argsOld = StringUtils.join(StringUtils.join(JSON_START, JSON.toJSONString(dubboOld.getArgs())), JSON_END);
|
||||
String argsNew = StringUtils.join(JSON_START, JSON.toJSONString(dubboNew.getArgs()), JSON_END);
|
||||
String argsOld = StringUtils.join(JSON_START, JSON.toJSONString(dubboOld.getArgs()), JSON_END);
|
||||
if (!StringUtils.equals(argsNew, argsOld)) {
|
||||
String patch = jsonDiff.diff(argsOld, argsNew);
|
||||
String diffPatch = jsonDiff.apply(argsNew, patch);
|
||||
|
@ -381,8 +381,8 @@ public class ApiTestDefinitionDiffUtilImpl implements ApiDefinitionDiffUtil {
|
|||
dubboNew.getAttachmentArgs().remove(dubboNew.getAttachmentArgs().size() - 1);
|
||||
dubboOld.getAttachmentArgs().remove(dubboOld.getAttachmentArgs().size() - 1);
|
||||
}
|
||||
String attachmentNew = StringUtils.join(StringUtils.join(JSON_START, JSON.toJSONString(dubboNew.getAttachmentArgs())), JSON_END);
|
||||
String attachmentOld = StringUtils.join(StringUtils.join(JSON_START, JSON.toJSONString(dubboOld.getAttachmentArgs())), JSON_END);
|
||||
String attachmentNew = StringUtils.join(JSON_START, JSON.toJSONString(dubboNew.getAttachmentArgs()), JSON_END);
|
||||
String attachmentOld = StringUtils.join(JSON_START, JSON.toJSONString(dubboOld.getAttachmentArgs()), JSON_END);
|
||||
if (!StringUtils.equals(attachmentNew, attachmentOld)) {
|
||||
String patch = jsonDiff.diff(attachmentOld, attachmentNew);
|
||||
String diffPatch = jsonDiff.apply(attachmentNew, patch);
|
||||
|
|
|
@ -100,7 +100,6 @@ import { getCurrentProjectID } from 'metersphere-frontend/src/utils/token';
|
|||
import { getSystemBaseSetting } from 'metersphere-frontend/src/api/system';
|
||||
import EnvSelectPopover from '@/business/automation/scenario/EnvSelectPopover';
|
||||
import { getApiCaseEnvironments } from '@/api/api-test-case';
|
||||
import { hasLicense } from 'metersphere-frontend/src/utils/permission';
|
||||
|
||||
export default {
|
||||
name: 'ApiRunMode',
|
||||
|
@ -155,9 +154,7 @@ export default {
|
|||
this.runModeVisible = true;
|
||||
this.getResourcePools();
|
||||
this.getWsProjects();
|
||||
if (hasLicense()) {
|
||||
this.query();
|
||||
}
|
||||
this.query();
|
||||
this.showPopover();
|
||||
this.runConfig.environmentType = ENV_TYPE.JSON;
|
||||
},
|
||||
|
|
|
@ -115,7 +115,6 @@ import EnvPopover from '@/business/automation/scenario/EnvPopover';
|
|||
import { getMaintainer, getOwnerProjects, getProjectConfig } from '@/api/project';
|
||||
import { getTestResourcePools } from '@/api/test-resource-pool';
|
||||
import { getSystemBaseSetting } from 'metersphere-frontend/src/api/system';
|
||||
import { hasLicense } from 'metersphere-frontend/src/utils/permission';
|
||||
|
||||
function defaultCustomValidate() {
|
||||
return { pass: true };
|
||||
|
@ -322,9 +321,7 @@ export default {
|
|||
this.activeName = 'first';
|
||||
this.getResourcePools();
|
||||
this.getWsProjects();
|
||||
if (hasLicense()) {
|
||||
this.query();
|
||||
}
|
||||
this.query();
|
||||
this.runConfig.environmentType = ENV_TYPE.JSON;
|
||||
},
|
||||
findSchedule() {
|
||||
|
|
|
@ -174,14 +174,14 @@ public class ReflexObjectUtil {
|
|||
List<String> originalValueArray = JSON.parseArray(originalValue.toString(), String.class);
|
||||
Collections.sort(originalValueArray);
|
||||
Object originalObject = JSON.toJSONString(originalValueArray);
|
||||
oldTags = StringUtils.join(StringUtils.join(JSON_START, ((originalColumns.get(i) != null && originalObject != null) ? originalObject.toString() : "\"\"")), JSON_END);
|
||||
oldTags = StringUtils.join(JSON_START, ((originalColumns.get(i) != null && originalObject != null) ? originalObject.toString() : "\"\""), JSON_END);
|
||||
}
|
||||
List<String> newValueArray = JSON.parseArray(newValue.toString(), String.class);
|
||||
if (CollectionUtils.isNotEmpty(newValueArray)) {
|
||||
Collections.sort(newValueArray);
|
||||
}
|
||||
Object newObject = JSON.toJSONString(newValueArray);
|
||||
String newTags = StringUtils.join(StringUtils.join(JSON_START, ((newColumns.get(i) != null && newObject != null) ? newObject.toString() : "\"\"")), JSON_END);
|
||||
String newTags = StringUtils.join(JSON_START, ((newColumns.get(i) != null && newObject != null) ? newObject.toString() : "\"\""), JSON_END);
|
||||
String diffValue;
|
||||
if (oldTags != null) {
|
||||
String diffStr = diff.diff(oldTags, newTags);
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
package io.metersphere.service;
|
||||
|
||||
import io.metersphere.base.domain.TestResource;
|
||||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.JSON;
|
||||
import io.metersphere.dto.*;
|
||||
import io.metersphere.utils.LoggerUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ApiPoolDebugService {
|
||||
public static final String BASE_URL = "http://%s:%d";
|
||||
public static final String POOL = "POOL";
|
||||
|
||||
@Resource
|
||||
private RestTemplate restTemplate;
|
||||
public static final String SAVE_RESULT = "SAVE_RESULT";
|
||||
@Resource
|
||||
private SystemParameterService systemParameterService;
|
||||
@Resource
|
||||
private BaseProjectApplicationService baseProjectApplicationService;
|
||||
|
||||
public void run(JmeterRunRequestDTO request, List<TestResource> resources) throws MSException {
|
||||
try {
|
||||
if (request.isDebug() && !StringUtils.equalsAny(request.getRunMode(), ApiRunMode.DEFINITION.name())) {
|
||||
request.getExtendedParameters().put(SAVE_RESULT, true);
|
||||
} else if (!request.isDebug()) {
|
||||
request.getExtendedParameters().put(SAVE_RESULT, true);
|
||||
}
|
||||
String uri = null;
|
||||
int index = (int) (Math.random() * resources.size());
|
||||
String configuration = resources.get(index).getConfiguration();
|
||||
if (StringUtils.isNotEmpty(configuration)) {
|
||||
NodeDTO node = JSON.parseObject(configuration, NodeDTO.class);
|
||||
uri = String.format(BASE_URL + "/jmeter/debug", node.getIp(), node.getPort());
|
||||
}
|
||||
if (StringUtils.isEmpty(uri)) {
|
||||
LoggerUtil.info("url为空", request.getReportId());
|
||||
MSException.throwException("请在【项目设置-应用管理-接口测试】中选择资源池");
|
||||
}
|
||||
LoggerUtil.info("开始发送请求【 " + request.getTestId() + " 】到 " + uri + " 节点执行", request.getReportId());
|
||||
ResponseEntity<String> result = restTemplate.postForEntity(uri, request, String.class);
|
||||
if (result == null || !StringUtils.equals("SUCCESS", result.getBody())) {
|
||||
LoggerUtil.error("发送请求[ " + request.getTestId() + " ] 到" + uri + " 节点执行失败", request.getReportId());
|
||||
LoggerUtil.info(result);
|
||||
MSException.throwException("请在【项目设置-应用管理-接口测试】中选择资源池");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LoggerUtil.error("发送请求[ " + request.getTestId() + " ] 执行失败,进行数据回滚:", request.getReportId(), e);
|
||||
MSException.throwException("请在【项目设置-应用管理-接口测试】中选择资源池");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否禁用了本地执行
|
||||
*
|
||||
* @param projectId
|
||||
* @param runConfig
|
||||
*/
|
||||
public void verifyPool(String projectId, RunModeConfigDTO runConfig) {
|
||||
if (runConfig != null && StringUtils.isEmpty(runConfig.getResourcePoolId())) {
|
||||
BaseSystemConfigDTO configDTO = systemParameterService.getBaseInfo();
|
||||
LoggerUtil.info("校验项目为:【" + projectId + "】", runConfig.getReportId());
|
||||
if (StringUtils.equals(configDTO.getRunMode(), POOL)) {
|
||||
ProjectConfig config = baseProjectApplicationService.getProjectConfig(projectId);
|
||||
if (config == null || !config.getPoolEnable() || StringUtils.isEmpty(config.getResourcePoolId())) {
|
||||
MSException.throwException("请在【项目设置-应用管理-接口测试】中选择资源池");
|
||||
}
|
||||
runConfig = runConfig == null ? new RunModeConfigDTO() : runConfig;
|
||||
runConfig.setResourcePoolId(config.getResourcePoolId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package io.metersphere.xpack.api.service;
|
||||
|
||||
import io.metersphere.base.domain.TestResource;
|
||||
import io.metersphere.dto.JmeterRunRequestDTO;
|
||||
import io.metersphere.dto.RunModeConfigDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ApiPoolDebugService {
|
||||
public void run(JmeterRunRequestDTO request, List<TestResource> resources);
|
||||
|
||||
public void verifyPool(String projectId, RunModeConfigDTO runConfig);
|
||||
}
|
|
@ -97,7 +97,7 @@
|
|||
|
||||
<!-- 接口测试资源池 -->
|
||||
<app-manage-item :title="$t('pj.api_run_pool_title')" :prepend-span="8" :middle-span="12"
|
||||
:append-span="4" v-if="isPool && isXpack">
|
||||
:append-span="4" v-if="isPool">
|
||||
<template #middle>
|
||||
<el-select v-model="config.resourcePoolId"
|
||||
size="mini"
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<el-form-item :label="$t('commons.help_documentation')" prop="docUrl">
|
||||
<el-input v-model="formInline.docUrl" placeholder="https://metersphere.io/docs/index.html"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('system.api_default_run')" prop="runMode" v-if="hasLicense()">
|
||||
<el-form-item :label="$t('system.api_default_run')" prop="runMode">
|
||||
<el-switch active-value="LOCAL" inactive-value="POOL" v-model="formInline.runMode" @change="modeChange"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
@ -41,7 +41,6 @@
|
|||
<script>
|
||||
|
||||
import {getSystemBaseSetting, saveSystemBaseSetting} from "../../../api/system";
|
||||
import {hasLicense} from 'metersphere-frontend/src/utils/permission';
|
||||
|
||||
export default {
|
||||
name: "BaseSetting",
|
||||
|
@ -80,7 +79,6 @@ export default {
|
|||
this.query()
|
||||
},
|
||||
methods: {
|
||||
hasLicense,
|
||||
query() {
|
||||
this.loading = getSystemBaseSetting().then(res => {
|
||||
if(!res.data.runMode) {
|
||||
|
|
|
@ -49,7 +49,7 @@ import io.metersphere.request.ScheduleRequest;
|
|||
import io.metersphere.service.*;
|
||||
import io.metersphere.utils.DiscoveryUtil;
|
||||
import io.metersphere.utils.LoggerUtil;
|
||||
import io.metersphere.xpack.api.service.ApiPoolDebugService;
|
||||
import io.metersphere.service.ApiPoolDebugService;
|
||||
import io.metersphere.xpack.track.dto.IssuesDao;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
|
@ -65,8 +65,6 @@ import org.springframework.kafka.core.KafkaTemplate;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
|
@ -156,6 +154,8 @@ public class TestPlanService {
|
|||
private TestResourcePoolMapper testResourcePoolMapper;
|
||||
@Resource
|
||||
private TestPlanReportMapper testPlanReportMapper;
|
||||
@Resource
|
||||
private ApiPoolDebugService apiPoolDebugService;
|
||||
|
||||
public synchronized TestPlan addTestPlan(AddTestPlanRequest testPlan) {
|
||||
if (getTestPlanByName(testPlan.getName()).size() > 0) {
|
||||
|
@ -913,10 +913,7 @@ public class TestPlanService {
|
|||
|
||||
public void verifyPool(String projectId, RunModeConfigDTO runConfig) {
|
||||
// 检查是否禁用了本地执行
|
||||
ApiPoolDebugService debugService = CommonBeanFactory.getBean(ApiPoolDebugService.class);
|
||||
if (debugService != null) {
|
||||
debugService.verifyPool(projectId, runConfig);
|
||||
}
|
||||
apiPoolDebugService.verifyPool(projectId, runConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1393,7 +1390,7 @@ public class TestPlanService {
|
|||
TestPlanSimpleReportDTO report = buildPlanReport(planId, true);
|
||||
report.setLang(lang);
|
||||
TestPlanExtReportDTO extReport = getExtInfoByPlanId(planId);
|
||||
if(extReport != null) {
|
||||
if (extReport != null) {
|
||||
BeanUtils.copyBean(report, extReport);
|
||||
}
|
||||
render(report, response);
|
||||
|
@ -1402,7 +1399,7 @@ public class TestPlanService {
|
|||
public void exportPlanDbReport(String reportId, String lang, HttpServletResponse response) throws UnsupportedEncodingException, JsonProcessingException {
|
||||
TestPlanSimpleReportDTO report = testPlanReportService.getReport(reportId);
|
||||
TestPlanExtReportDTO extReport = getExtInfoByReportId(reportId);
|
||||
if(extReport != null) {
|
||||
if (extReport != null) {
|
||||
BeanUtils.copyBean(report, extReport);
|
||||
}
|
||||
Set<String> serviceIdSet = DiscoveryUtil.getServiceIdSet();
|
||||
|
@ -1983,14 +1980,14 @@ public class TestPlanService {
|
|||
Set<String> serviceIdSet = DiscoveryUtil.getServiceIdSet();
|
||||
if (serviceIdSet.contains(MicroServiceName.API_TEST)) {
|
||||
List<ApiDefinitionExecResultWithBLOBs> apiDefinitionLists = planTestPlanApiCaseService.selectExtForPlanReport(reportId);
|
||||
if(CollectionUtils.isNotEmpty(apiDefinitionLists)){
|
||||
if (CollectionUtils.isNotEmpty(apiDefinitionLists)) {
|
||||
ApiDefinitionExecResultWithBLOBs apiDefinition = apiDefinitionLists.get(0);
|
||||
convertEnvConfig(apiDefinition.getEnvConfig(), testPlanExtReportDTO);
|
||||
getResourcePool(apiDefinition.getActuator(), testPlanExtReportDTO);
|
||||
return testPlanExtReportDTO;
|
||||
}
|
||||
List<ApiScenarioReportWithBLOBs> apiScenarioLists = planTestPlanApiCaseService.selectExtForPlanScenarioReport(reportId);
|
||||
if(CollectionUtils.isNotEmpty(apiScenarioLists)){
|
||||
if (CollectionUtils.isNotEmpty(apiScenarioLists)) {
|
||||
ApiScenarioReportWithBLOBs apiScenario = apiScenarioLists.get(0);
|
||||
convertEnvConfig(apiScenario.getEnvConfig(), testPlanExtReportDTO);
|
||||
getResourcePool(apiScenario.getActuator(), testPlanExtReportDTO);
|
||||
|
@ -1999,7 +1996,7 @@ public class TestPlanService {
|
|||
}
|
||||
if (serviceIdSet.contains(MicroServiceName.UI_TEST)) {
|
||||
List<UiScenarioReportWithBLOBs> apiDefinitionLists = planTestPlanUiScenarioCaseService.selectExtForPlanReport(reportId);
|
||||
if(CollectionUtils.isNotEmpty(apiDefinitionLists)){
|
||||
if (CollectionUtils.isNotEmpty(apiDefinitionLists)) {
|
||||
UiScenarioReportWithBLOBs apiDefinition = apiDefinitionLists.get(0);
|
||||
convertEnvConfig(apiDefinition.getEnvConfig(), testPlanExtReportDTO);
|
||||
getResourcePool(apiDefinition.getActuator(), testPlanExtReportDTO);
|
||||
|
@ -2029,12 +2026,12 @@ public class TestPlanService {
|
|||
}
|
||||
|
||||
private void convertEnvConfig(String envConfig, TestPlanExtReportDTO testPlanExtReportDTO) throws JsonProcessingException {
|
||||
if(StringUtils.isEmpty(envConfig)){
|
||||
if (StringUtils.isEmpty(envConfig)) {
|
||||
return;
|
||||
}
|
||||
EnvConfig env = objectMapper.readValue(envConfig, EnvConfig.class);
|
||||
if(StringUtils.isNotEmpty(env.getMode())){
|
||||
if(RunMode.RUN_MODE_SERIAL.getCode().equals(env.getMode())){
|
||||
if (StringUtils.isNotEmpty(env.getMode())) {
|
||||
if (RunMode.RUN_MODE_SERIAL.getCode().equals(env.getMode())) {
|
||||
testPlanExtReportDTO.setRunMode(RunMode.RUN_MODE_SERIAL.getDesc());
|
||||
} else if (RunMode.RUN_MODE_PARALLEL.getCode().equals(env.getMode())) {
|
||||
testPlanExtReportDTO.setRunMode(RunMode.RUN_MODE_PARALLEL.getDesc());
|
||||
|
@ -2042,8 +2039,8 @@ public class TestPlanService {
|
|||
}
|
||||
}
|
||||
|
||||
private void getResourcePool(String actuator, TestPlanExtReportDTO testPlanExtReportDTO){
|
||||
if(StringUtils.isEmpty(actuator)){
|
||||
private void getResourcePool(String actuator, TestPlanExtReportDTO testPlanExtReportDTO) {
|
||||
if (StringUtils.isEmpty(actuator)) {
|
||||
return;
|
||||
}
|
||||
TestResourcePool testResourcePool = testResourcePoolMapper.selectByPrimaryKey(actuator);
|
||||
|
@ -2052,21 +2049,21 @@ public class TestPlanService {
|
|||
|
||||
public TestPlanExtReportDTO getExtInfoByPlanId(String planId) throws JsonProcessingException {
|
||||
String reportId = testPlanReportService.getLastReportByPlanId(planId);
|
||||
if(StringUtils.isEmpty(reportId)){
|
||||
if (StringUtils.isEmpty(reportId)) {
|
||||
return null;
|
||||
}
|
||||
TestPlanExtReportDTO testPlanExtReportDTO = new TestPlanExtReportDTO();
|
||||
Set<String> serviceIdSet = DiscoveryUtil.getServiceIdSet();
|
||||
if (serviceIdSet.contains(MicroServiceName.API_TEST)) {
|
||||
List<ApiDefinitionExecResultWithBLOBs> apiDefinitionLists = planTestPlanApiCaseService.selectExtForPlanReport(reportId);
|
||||
if(CollectionUtils.isNotEmpty(apiDefinitionLists)){
|
||||
if (CollectionUtils.isNotEmpty(apiDefinitionLists)) {
|
||||
ApiDefinitionExecResultWithBLOBs apiDefinition = apiDefinitionLists.get(0);
|
||||
convertEnvConfig(apiDefinition.getEnvConfig(), testPlanExtReportDTO);
|
||||
getResourcePool(apiDefinition.getActuator(), testPlanExtReportDTO);
|
||||
return testPlanExtReportDTO;
|
||||
}
|
||||
List<ApiScenarioReportWithBLOBs> apiScenarioLists = planTestPlanApiCaseService.selectExtForPlanScenarioReport(reportId);
|
||||
if(CollectionUtils.isNotEmpty(apiScenarioLists)){
|
||||
if (CollectionUtils.isNotEmpty(apiScenarioLists)) {
|
||||
ApiScenarioReportWithBLOBs apiScenario = apiScenarioLists.get(0);
|
||||
convertEnvConfig(apiScenario.getEnvConfig(), testPlanExtReportDTO);
|
||||
getResourcePool(apiScenario.getActuator(), testPlanExtReportDTO);
|
||||
|
@ -2118,12 +2115,12 @@ public class TestPlanService {
|
|||
}
|
||||
|
||||
private void convertPlanEnvConfig(String envConfig, TestPlanExtReportDTO testPlanExtReportDTO) throws JsonProcessingException {
|
||||
if(StringUtils.isEmpty(envConfig)){
|
||||
if (StringUtils.isEmpty(envConfig)) {
|
||||
return;
|
||||
}
|
||||
PlanEnvConfig env = objectMapper.readValue(envConfig, PlanEnvConfig.class);
|
||||
if(StringUtils.isNotEmpty(env.getRunMode())){
|
||||
if(RunMode.RUN_MODE_SERIAL.getCode().equals(env.getRunMode())){
|
||||
if (StringUtils.isNotEmpty(env.getRunMode())) {
|
||||
if (RunMode.RUN_MODE_SERIAL.getCode().equals(env.getRunMode())) {
|
||||
testPlanExtReportDTO.setRunMode(RunMode.RUN_MODE_SERIAL.getDesc());
|
||||
} else if (RunMode.RUN_MODE_PARALLEL.getCode().equals(env.getRunMode())) {
|
||||
testPlanExtReportDTO.setRunMode(RunMode.RUN_MODE_PARALLEL.getDesc());
|
||||
|
|
|
@ -281,9 +281,7 @@ export default {
|
|||
this.testType = testType;
|
||||
this.getResourcePools();
|
||||
this.getWsProjects();
|
||||
if(hasLicense()) {
|
||||
this.query();
|
||||
}
|
||||
this.query();
|
||||
},
|
||||
query() {
|
||||
this.loading = true;
|
||||
|
|
|
@ -298,9 +298,7 @@ export default {
|
|||
this.getResourcePools();
|
||||
this.getWsProjects();
|
||||
this.showPopover();
|
||||
if(hasLicense()) {
|
||||
this.query();
|
||||
}
|
||||
this.query();
|
||||
},
|
||||
query() {
|
||||
this.loading = true;
|
||||
|
|
|
@ -368,9 +368,7 @@ export default {
|
|||
return param;
|
||||
},
|
||||
open(row) {
|
||||
if (this.isHasLicense) {
|
||||
this.query();
|
||||
}
|
||||
this.query();
|
||||
this.planId = row.id;
|
||||
//测试计划页面跳转来的
|
||||
let paramTestId = row.id;
|
||||
|
|
|
@ -274,9 +274,7 @@ export default {
|
|||
this.testType = testType;
|
||||
this.getResourcePools();
|
||||
this.getWsProjects();
|
||||
if(hasLicense()) {
|
||||
this.query();
|
||||
}
|
||||
this.query();
|
||||
},
|
||||
query() {
|
||||
this.loading = true;
|
||||
|
|
Loading…
Reference in New Issue