mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-02 12:09:13 +08:00
refactor: "" -> StringUtils.EMPTY
This commit is contained in:
parent
abbae8bd05
commit
671f609866
@ -25,7 +25,7 @@ public class ErrorReportLibraryParseDTO {
|
||||
String errorCodeStr = StringUtils.join(this.errorCodeList,";");
|
||||
return errorCodeStr;
|
||||
}else {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,13 +26,13 @@ public class JmxInfoDTO {
|
||||
private List<FileMetadata> fileMetadataList;
|
||||
|
||||
public JmxInfoDTO(String name, String xml, Map<String, String> attachFiles) {
|
||||
this.name = StringUtils.replace(name, "/", "");
|
||||
this.name = StringUtils.replace(name, "/", StringUtils.EMPTY);
|
||||
this.xml = xml;
|
||||
this.attachFiles = attachFiles;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = StringUtils.replace(name, "/", "");
|
||||
this.name = StringUtils.replace(name, "/", StringUtils.EMPTY);
|
||||
}
|
||||
|
||||
public void addFileMetadataLists(List<FileMetadata> list) {
|
||||
|
@ -131,7 +131,7 @@ public class TestResult {
|
||||
result.setRequestResults(formatedResult);
|
||||
|
||||
result.getRequestResults().forEach(item -> {
|
||||
String itemAndScenarioName = "";
|
||||
String itemAndScenarioName = StringUtils.EMPTY;
|
||||
if (StringUtils.isNotEmpty(item.getScenario())) {
|
||||
//第1个:当前场景, 第all_id_names个:最后一层场景
|
||||
List<String> all_id_names = JSON.parseObject(item.getScenario(), List.class);
|
||||
|
@ -57,7 +57,7 @@ public abstract class ApiImportAbstractParser<T> implements ApiImportParser<T> {
|
||||
}
|
||||
|
||||
protected String getBodyType(String contentType) {
|
||||
String bodyType = "";
|
||||
String bodyType = StringUtils.EMPTY;
|
||||
if (StringUtils.isBlank(contentType)) {
|
||||
return bodyType;
|
||||
}
|
||||
@ -85,7 +85,7 @@ public abstract class ApiImportAbstractParser<T> implements ApiImportParser<T> {
|
||||
}
|
||||
|
||||
protected void addBodyHeader(MsHTTPSamplerProxy request) {
|
||||
String contentType = "";
|
||||
String contentType = StringUtils.EMPTY;
|
||||
if (request.getBody() != null && StringUtils.isNotBlank(request.getBody().getType())) {
|
||||
switch (request.getBody().getType()) {
|
||||
case Body.WWW_FROM:
|
||||
@ -176,7 +176,7 @@ public abstract class ApiImportAbstractParser<T> implements ApiImportParser<T> {
|
||||
}
|
||||
|
||||
protected void addCookie(List<KeyValue> headers, String key, String value) {
|
||||
addCookie(headers, key, value, "", true);
|
||||
addCookie(headers, key, value, StringUtils.EMPTY, true);
|
||||
}
|
||||
|
||||
protected void addCookie(List<KeyValue> headers, String key, String value, String description, boolean required) {
|
||||
@ -184,17 +184,17 @@ public abstract class ApiImportAbstractParser<T> implements ApiImportParser<T> {
|
||||
for (KeyValue header : headers) {
|
||||
if (StringUtils.equalsIgnoreCase("Cookie", header.getName())) {
|
||||
hasCookie = true;
|
||||
String cookies = Optional.ofNullable(header.getValue()).orElse("");
|
||||
String cookies = Optional.ofNullable(header.getValue()).orElse(StringUtils.EMPTY);
|
||||
header.setValue(cookies + key + "=" + value + ";");
|
||||
}
|
||||
}
|
||||
if (!hasCookie) {
|
||||
addHeader(headers, "Cookie", key + "=" + value + ";", description, "", required);
|
||||
addHeader(headers, "Cookie", key + "=" + value + ";", description, StringUtils.EMPTY, required);
|
||||
}
|
||||
}
|
||||
|
||||
protected void addHeader(List<KeyValue> headers, String key, String value) {
|
||||
addHeader(headers, key, value, "", "", true);
|
||||
addHeader(headers, key, value, "", StringUtils.EMPTY, true);
|
||||
}
|
||||
|
||||
protected void addHeader(List<KeyValue> headers, String key, String value, String description, String contentType, boolean required) {
|
||||
|
@ -147,7 +147,7 @@ public abstract class HarScenarioAbstractParser<T> extends ApiImportAbstractPars
|
||||
}
|
||||
|
||||
private void parseHeaderParameters(HarHeader harHeader, List<KeyValue> headers) {
|
||||
addHeader(headers, harHeader.name, harHeader.value, harHeader.comment, "", false);
|
||||
addHeader(headers, harHeader.name, harHeader.value, harHeader.comment, StringUtils.EMPTY, false);
|
||||
}
|
||||
|
||||
private void addPreScript(MsHTTPSamplerProxy request, List<PostmanEvent> event) {
|
||||
@ -227,7 +227,7 @@ public abstract class HarScenarioAbstractParser<T> extends ApiImportAbstractPars
|
||||
if (options != null) {
|
||||
JsonNode raw = options.get(PostmanRequestBodyMode.RAW.value());
|
||||
if (raw != null) {
|
||||
String bodyType = "";
|
||||
String bodyType = StringUtils.EMPTY;
|
||||
switch (raw.get("language").textValue()) {
|
||||
case "json":
|
||||
bodyType = Body.JSON_STR;
|
||||
@ -244,7 +244,7 @@ public abstract class HarScenarioAbstractParser<T> extends ApiImportAbstractPars
|
||||
}
|
||||
|
||||
private String getDefaultStringValue(String val) {
|
||||
return StringUtils.isBlank(val) ? "" : val;
|
||||
return StringUtils.isBlank(val) ? StringUtils.EMPTY : val;
|
||||
}
|
||||
|
||||
private String getBoundaryFromContentType(String contentType) {
|
||||
|
@ -159,7 +159,7 @@ public class JmeterDocumentParser {
|
||||
u += k + "=" + ScriptEngineUtils.buildFunctionCallString(v);
|
||||
return u;
|
||||
});
|
||||
ele.setTextContent(url + ((params != null && !"?".equals(params)) ? params : ""));
|
||||
ele.setTextContent(url + ((params != null && !"?".equals(params)) ? params : StringUtils.EMPTY));
|
||||
break;
|
||||
case "Argument.value":
|
||||
String textContent = ele.getTextContent();
|
||||
@ -214,7 +214,7 @@ public class JmeterDocumentParser {
|
||||
if (p.contains("=")) {
|
||||
String[] param = p.split("=");
|
||||
if (param.length == 1) {
|
||||
strUrlParas.put(param[0], "");
|
||||
strUrlParas.put(param[0], StringUtils.EMPTY);
|
||||
} else {
|
||||
|
||||
String key = param[0];
|
||||
|
@ -32,8 +32,8 @@ public abstract class PostmanAbstractParserParser<T> extends ApiImportAbstractPa
|
||||
}
|
||||
requestDesc.getAuth(); // todo 认证方式等待优化
|
||||
PostmanUrl url = requestDesc.getUrl();
|
||||
MsHTTPSamplerProxy request = buildRequest(requestItem.getName(), url == null ? "" : url.getRaw(), requestDesc.getMethod(),
|
||||
requestDesc.getBody().get("jsonSchema") == null ? "" : requestDesc.getBody().get("jsonSchema").textValue());
|
||||
MsHTTPSamplerProxy request = buildRequest(requestItem.getName(), url == null ? StringUtils.EMPTY : url.getRaw(), requestDesc.getMethod(),
|
||||
requestDesc.getBody().get("jsonSchema") == null ? StringUtils.EMPTY : requestDesc.getBody().get("jsonSchema").textValue());
|
||||
request.setRest(parseKeyValue(requestDesc.getUrl().getVariable()));
|
||||
if (StringUtils.isNotBlank(request.getPath())) {
|
||||
String path = request.getPath().split("\\?")[0];
|
||||
@ -168,7 +168,7 @@ public abstract class PostmanAbstractParserParser<T> extends ApiImportAbstractPa
|
||||
if (options != null) {
|
||||
JsonNode raw = options.get(PostmanRequestBodyMode.RAW.value());
|
||||
if (raw != null) {
|
||||
String bodyType = "";
|
||||
String bodyType = StringUtils.EMPTY;
|
||||
switch (raw.get("language").textValue()) {
|
||||
case "json":
|
||||
bodyType = Body.JSON_STR;
|
||||
|
@ -3,6 +3,7 @@ package io.metersphere.api.tcp;
|
||||
import io.metersphere.api.tcp.server.TCPServer;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -18,7 +19,7 @@ public class TCPPool {
|
||||
private TCPPool(){}
|
||||
|
||||
public static String createTcp(int port){
|
||||
String returnString = "";
|
||||
String returnString = StringUtils.EMPTY;
|
||||
if(port > 0){
|
||||
TCPServer tcpServer = null;
|
||||
if(serverSockedMap.containsKey(port)){
|
||||
|
@ -207,7 +207,7 @@ public class ApiTestDefinitionDiffUtilImpl implements ApiDefinitionDiffUtil {
|
||||
authColumns.forEach(item -> {
|
||||
Object value = item.getOriginalValue();
|
||||
item.setNewValue(value);
|
||||
item.setOriginalValue("");
|
||||
item.setOriginalValue(StringUtils.EMPTY);
|
||||
});
|
||||
diffMap.put("body_auth", JSON.toJSONString(authColumns));
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package io.metersphere.commons.utils;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
@ -50,7 +52,7 @@ public class FixedCapacityUtil {
|
||||
|
||||
return logMessage;
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
} finally {
|
||||
if (isClear && FixedCapacityUtil.jmeterLogTask.containsKey(reportId)) {
|
||||
FixedCapacityUtil.jmeterLogTask.remove(reportId);
|
||||
|
@ -69,7 +69,7 @@ public class HashTreeUtil {
|
||||
for (String param : params) {
|
||||
String value = envHeadMap.get(param);
|
||||
if (value == null) {
|
||||
value = "";
|
||||
value = StringUtils.EMPTY;
|
||||
}
|
||||
if (returnMap.containsKey(envId)) {
|
||||
returnMap.get(envId).put(param, value);
|
||||
@ -94,7 +94,7 @@ public class HashTreeUtil {
|
||||
for (Object hashTreeKey : hashTree.keySet()) {
|
||||
HashTree itemTree = hashTree.get(hashTreeKey);
|
||||
|
||||
String scriptValue = "";
|
||||
String scriptValue = StringUtils.EMPTY;
|
||||
try {
|
||||
if (hashTreeKey instanceof JSR223PostProcessor) {
|
||||
JSR223PostProcessor postProcessor = (JSR223PostProcessor) hashTreeKey;
|
||||
|
@ -78,7 +78,7 @@ public class JSONSchemaToDocumentUtil {
|
||||
Object value = null;
|
||||
boolean required = requiredList.contains(propertyName);
|
||||
if (object.has(PropertyConstant.DEFAULT)) {
|
||||
value = object.get(PropertyConstant.DEFAULT) != null ? object.get(PropertyConstant.DEFAULT).getAsString() : "";
|
||||
value = object.get(PropertyConstant.DEFAULT) != null ? object.get(PropertyConstant.DEFAULT).getAsString() : StringUtils.EMPTY;
|
||||
concept.add(new DocumentElement(propertyName, propertyObjType, value, required, null));
|
||||
} else if (object.has(PropertyConstant.ENUM)) {
|
||||
try {
|
||||
@ -102,7 +102,7 @@ public class JSONSchemaToDocumentUtil {
|
||||
} else if (propertyObjType.equals(PropertyConstant.STRING)) {
|
||||
// 先设置空值
|
||||
if (object.has(PropertyConstant.DEFAULT)) {
|
||||
value = object.get(PropertyConstant.DEFAULT) != null ? object.get(PropertyConstant.DEFAULT).getAsString() : "";
|
||||
value = object.get(PropertyConstant.DEFAULT) != null ? object.get(PropertyConstant.DEFAULT).getAsString() : StringUtils.EMPTY;
|
||||
}
|
||||
if (object.has(PropertyConstant.MOCK) && object.get(PropertyConstant.MOCK).getAsJsonObject() != null
|
||||
&& StringUtils.isNotEmpty(object.get(PropertyConstant.MOCK).getAsJsonObject().get(PropertyConstant.MOCK).getAsString())) {
|
||||
@ -149,12 +149,12 @@ public class JSONSchemaToDocumentUtil {
|
||||
concept.add(new DocumentElement(propertyName, propertyObjType, value, required, null));
|
||||
} else if (propertyObjType.equals(PropertyConstant.ARRAY)) {
|
||||
List<DocumentElement> elements = new LinkedList<>();
|
||||
concept.add(new DocumentElement(propertyName, propertyObjType, "", requiredList.contains(propertyName), true, elements));
|
||||
concept.add(new DocumentElement(propertyName, propertyObjType, StringUtils.EMPTY, requiredList.contains(propertyName), true, elements));
|
||||
JsonArray jsonArray = object.get(PropertyConstant.ITEMS).getAsJsonArray();
|
||||
analyzeArray(propertyName, jsonArray, elements, requiredList);
|
||||
} else if (propertyObjType.equals(PropertyConstant.OBJECT)) {
|
||||
List<DocumentElement> list = new LinkedList<>();
|
||||
concept.add(new DocumentElement(propertyName, propertyObjType, "", list));
|
||||
concept.add(new DocumentElement(propertyName, propertyObjType, StringUtils.EMPTY, list));
|
||||
analyzeObject(object, list);
|
||||
}
|
||||
}
|
||||
@ -166,7 +166,7 @@ public class JSONSchemaToDocumentUtil {
|
||||
if (obj.isJsonArray()) {
|
||||
JsonArray itemsObject = obj.getAsJsonArray();
|
||||
List<DocumentElement> elements = new LinkedList<>();
|
||||
array.add(new DocumentElement(propertyName, "", "", requiredList.contains("" + i + ""), elements));
|
||||
array.add(new DocumentElement(propertyName, StringUtils.EMPTY, StringUtils.EMPTY, requiredList.contains("" + i + ""), elements));
|
||||
analyzeArray("", itemsObject, elements, requiredList);
|
||||
} else if (obj.isJsonObject()) {
|
||||
List<String> requiredItems = new ArrayList<>();
|
||||
|
@ -20,11 +20,11 @@ public class JSONToDocumentUtil {
|
||||
Object value = array.get(i);
|
||||
if (value instanceof JSONObject) {
|
||||
List<DocumentElement> childrenElements = new LinkedList<>();
|
||||
children.add(new DocumentElement("", PropertyConstant.OBJECT, "", childrenElements));
|
||||
children.add(new DocumentElement(StringUtils.EMPTY, PropertyConstant.OBJECT, StringUtils.EMPTY, childrenElements));
|
||||
jsonDataFormatting((JSONObject) value, childrenElements);
|
||||
} else if (value instanceof JSONArray) {
|
||||
List<DocumentElement> childrenElements = new LinkedList<>();
|
||||
DocumentElement documentElement = new DocumentElement("", PropertyConstant.ARRAY, "", childrenElements);
|
||||
DocumentElement documentElement = new DocumentElement(StringUtils.EMPTY, PropertyConstant.ARRAY, StringUtils.EMPTY, childrenElements);
|
||||
documentElement.setArrayVerification(true);
|
||||
children.add(documentElement);
|
||||
jsonDataFormatting((JSONArray) value, childrenElements);
|
||||
@ -33,7 +33,7 @@ public class JSONToDocumentUtil {
|
||||
if (value != null) {
|
||||
type = DocumentUtils.getType(value);
|
||||
}
|
||||
children.add(new DocumentElement("", type, value, null));
|
||||
children.add(new DocumentElement(StringUtils.EMPTY, type, value, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -43,11 +43,11 @@ public class JSONToDocumentUtil {
|
||||
Object value = object.get(key);
|
||||
if (value instanceof JSONObject) {
|
||||
List<DocumentElement> childrenElements = new LinkedList<>();
|
||||
children.add(new DocumentElement(key, PropertyConstant.OBJECT, "", childrenElements));
|
||||
children.add(new DocumentElement(key, PropertyConstant.OBJECT, StringUtils.EMPTY, childrenElements));
|
||||
jsonDataFormatting((JSONObject) value, childrenElements);
|
||||
} else if (value instanceof JSONArray) {
|
||||
List<DocumentElement> childrenElements = new LinkedList<>();
|
||||
DocumentElement documentElement = new DocumentElement(key, PropertyConstant.ARRAY, "", childrenElements);
|
||||
DocumentElement documentElement = new DocumentElement(key, PropertyConstant.ARRAY, StringUtils.EMPTY, childrenElements);
|
||||
documentElement.setArrayVerification(true);
|
||||
children.add(documentElement);
|
||||
jsonDataFormatting((JSONArray) value, childrenElements);
|
||||
|
@ -339,7 +339,7 @@ public class JmeterDocumentParser implements EngineSourceParser {
|
||||
collectionProp.addAttribute("name", "Asserion.test_strings");
|
||||
//
|
||||
|
||||
appendStringProp(item, "Assertion.custom_message", "");
|
||||
appendStringProp(item, "Assertion.custom_message", StringUtils.EMPTY);
|
||||
appendStringProp(item, "Assertion.test_field", "Assertion.response_code");
|
||||
appendBoolProp(item, "Assertion.assume_success", true);
|
||||
appendIntProp(item, "Assertion.test_type", 40);
|
||||
@ -368,7 +368,7 @@ public class JmeterDocumentParser implements EngineSourceParser {
|
||||
Element collectionProp = responseAssertion.addElement(COLLECTION_PROP);
|
||||
collectionProp.addAttribute("name", "Asserion.test_strings");
|
||||
//
|
||||
appendStringProp(responseAssertion, "Assertion.custom_message", "");
|
||||
appendStringProp(responseAssertion, "Assertion.custom_message", StringUtils.EMPTY);
|
||||
appendStringProp(responseAssertion, "Assertion.test_field", "Assertion.response_code");
|
||||
appendBoolProp(responseAssertion, "Assertion.assume_success", true);
|
||||
appendIntProp(responseAssertion, "Assertion.test_type", 40);
|
||||
@ -462,14 +462,14 @@ public class JmeterDocumentParser implements EngineSourceParser {
|
||||
collectionProp.addAttribute("name", "Arguments.arguments");
|
||||
|
||||
|
||||
appendStringProp(element, "HTTPSampler.domain", "");
|
||||
appendStringProp(element, "HTTPSampler.port", "");
|
||||
appendStringProp(element, "HTTPSampler.protocol", "");
|
||||
appendStringProp(element, "HTTPSampler.contentEncoding", "");
|
||||
appendStringProp(element, "HTTPSampler.path", "");
|
||||
appendStringProp(element, "HTTPSampler.domain", StringUtils.EMPTY);
|
||||
appendStringProp(element, "HTTPSampler.port", StringUtils.EMPTY);
|
||||
appendStringProp(element, "HTTPSampler.protocol", StringUtils.EMPTY);
|
||||
appendStringProp(element, "HTTPSampler.contentEncoding", StringUtils.EMPTY);
|
||||
appendStringProp(element, "HTTPSampler.path", StringUtils.EMPTY);
|
||||
appendStringProp(element, "HTTPSampler.concurrentPool", "6");
|
||||
appendStringProp(element, "HTTPSampler.connect_timeout", "60000");
|
||||
appendStringProp(element, "HTTPSampler.response_timeout", "");
|
||||
appendStringProp(element, "HTTPSampler.response_timeout", StringUtils.EMPTY);
|
||||
|
||||
// 空的 hashTree
|
||||
hashTree.addElement(HASH_TREE_ELEMENT);
|
||||
@ -878,7 +878,7 @@ public class JmeterDocumentParser implements EngineSourceParser {
|
||||
appendStringProp(threadGroup, "RampUp", rampUp);
|
||||
appendStringProp(threadGroup, "Steps", step);
|
||||
appendStringProp(threadGroup, "Hold", hold);
|
||||
appendStringProp(threadGroup, "LogFilename", "");
|
||||
appendStringProp(threadGroup, "LogFilename", StringUtils.EMPTY);
|
||||
// bzm - Concurrency Thread Group "Thread Iterations Limit:" 设置为空
|
||||
// threadGroup.appendChild(createStringProp(document, "Iterations", "1"));
|
||||
appendStringProp(threadGroup, "Unit", "S");
|
||||
|
@ -37,8 +37,8 @@ public class ResultConversionUtil {
|
||||
String resourceId = result.getResourceId();
|
||||
|
||||
ApiScenarioReportResultWithBLOBs report = newScenarioReportResult(reportId, resourceId);
|
||||
report.setTotalAssertions(Long.parseLong(result.getTotalAssertions() + ""));
|
||||
report.setPassAssertions(Long.parseLong(result.getPassAssertions() + ""));
|
||||
report.setTotalAssertions(Long.parseLong(result.getTotalAssertions() + StringUtils.EMPTY));
|
||||
report.setPassAssertions(Long.parseLong(result.getPassAssertions() + StringUtils.EMPTY));
|
||||
String status = result.getError() == 0 ? ApiReportStatus.SUCCESS.name() : ApiReportStatus.ERROR.name();
|
||||
if (CollectionUtils.isNotEmpty(errorCodeDTO.getErrorCodeList())) {
|
||||
report.setErrorCode(errorCodeDTO.getErrorCodeStr());
|
||||
|
@ -2,6 +2,7 @@ package io.metersphere.commons.utils;
|
||||
|
||||
import io.metersphere.api.dto.MsgDTO;
|
||||
import io.metersphere.utils.LoggerUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javax.websocket.RemoteEndpoint;
|
||||
import javax.websocket.Session;
|
||||
@ -28,8 +29,8 @@ public class WebSocketUtil {
|
||||
|
||||
// 单用户推送
|
||||
public static void sendMessageSingle(MsgDTO dto) {
|
||||
sendMessage(ONLINE_USER_SESSIONS.get(Optional.ofNullable(dto.getReportId()).orElse("")), dto.getContent());
|
||||
sendMessage(ONLINE_USER_SESSIONS.get(Optional.ofNullable(dto.getToReport()).orElse("")), dto.getContent());
|
||||
sendMessage(ONLINE_USER_SESSIONS.get(Optional.ofNullable(dto.getReportId()).orElse(StringUtils.EMPTY)), dto.getContent());
|
||||
sendMessage(ONLINE_USER_SESSIONS.get(Optional.ofNullable(dto.getToReport()).orElse(StringUtils.EMPTY)), dto.getContent());
|
||||
}
|
||||
|
||||
// 全用户推送
|
||||
|
@ -67,7 +67,7 @@ public class XMLUtil {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||||
try {
|
||||
jsonToXmlStr(jObj, buffer, new StringBuffer(""));
|
||||
jsonToXmlStr(jObj, buffer, new StringBuffer(StringUtils.EMPTY));
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ public class ExtApiScheduleService {
|
||||
if (list.size() > 0) {
|
||||
return list.get(0).getKey();
|
||||
} else {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ public class ExtProjectApplicationService {
|
||||
public void checkProjectTcpPort(AddProjectRequest project) {
|
||||
//判断端口是否重复
|
||||
if (project.getMockTcpPort() != null && project.getMockTcpPort().intValue() != 0) {
|
||||
String projectId = StringUtils.isEmpty(project.getId()) ? "" : project.getId();
|
||||
String projectId = StringUtils.isEmpty(project.getId()) ? StringUtils.EMPTY : project.getId();
|
||||
ProjectApplicationExample example = new ProjectApplicationExample();
|
||||
example.createCriteria().andTypeEqualTo(ProjectApplicationType.MOCK_TCP_PORT.name()).andTypeValueEqualTo(String.valueOf(project.getMockTcpPort())).andProjectIdNotEqualTo(projectId);
|
||||
if (projectApplicationMapper.countByExample(example) > 0) {
|
||||
|
@ -1001,7 +1001,7 @@ public class PerformanceTestService {
|
||||
LoadTestFileExample example1 = new LoadTestFileExample();
|
||||
example1.createCriteria().andFileIdEqualTo(fileId);
|
||||
List<LoadTestFile> loadTestFiles = loadTestFileMapper.selectByExample(example1);
|
||||
String errorMessage = "";
|
||||
String errorMessage = StringUtils.EMPTY;
|
||||
if (loadTestFiles.size() > 0) {
|
||||
List<String> testIds = loadTestFiles.stream().map(LoadTestFile::getTestId).distinct().collect(Collectors.toList());
|
||||
LoadTestExample example = new LoadTestExample();
|
||||
|
@ -2688,7 +2688,7 @@ public class TestCaseService {
|
||||
fileContentExample.createCriteria().andFileIdIn(fileIds);
|
||||
List<FileContent> allCaseFileContents = fileContentMapper.selectByExample(fileContentExample);
|
||||
entry.getValue().stream().forEach(relation -> {
|
||||
String filename = "";
|
||||
String filename = StringUtils.EMPTY;
|
||||
List<FileMetadata> fileMetadatas = allCaseFileMetadatas.stream().filter(fileMetadata -> fileMetadata.getId().equals(relation.getAttachmentId()))
|
||||
.collect(Collectors.toList());
|
||||
List<FileContent> fileContents = allCaseFileContents.stream().filter(fileContent -> fileContent.getFileId().equals(relation.getAttachmentId()))
|
||||
@ -2699,7 +2699,7 @@ public class TestCaseService {
|
||||
FileAttachmentMetadata fileAttachmentMetadata = new FileAttachmentMetadata();
|
||||
BeanUtils.copyBean(fileAttachmentMetadata, fileMetadata);
|
||||
fileAttachmentMetadata.setId(UUID.randomUUID().toString());
|
||||
fileAttachmentMetadata.setCreator("");
|
||||
fileAttachmentMetadata.setCreator(StringUtils.EMPTY);
|
||||
fileAttachmentMetadata.setFilePath(uploadPath);
|
||||
fileAttachmentMetadataMapper.insert(fileAttachmentMetadata);
|
||||
AttachmentModuleRelation record = new AttachmentModuleRelation();
|
||||
@ -3066,7 +3066,7 @@ public class TestCaseService {
|
||||
return;
|
||||
}
|
||||
if (!StringUtils.equals(demandId, "other")) {
|
||||
demandName = "";
|
||||
demandName = StringUtils.EMPTY;
|
||||
}
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||
TestCaseMapper mapper = sqlSession.getMapper(TestCaseMapper.class);
|
||||
|
@ -119,9 +119,9 @@ public class XmindCaseParser {
|
||||
process.add(Translator.get("test_case_node_level_tip") +
|
||||
TestCaseConstants.MAX_NODE_DEPTH + Translator.get("test_case_node_level"), nodePath);
|
||||
}
|
||||
String path = "";
|
||||
String path = StringUtils.EMPTY;
|
||||
for (int i = 0; i < nodes.length; i++) {
|
||||
if (i != 0 && StringUtils.equals(nodes[i].trim(), "")) {
|
||||
if (i != 0 && StringUtils.equals(nodes[i].trim(), StringUtils.EMPTY)) {
|
||||
process.add(Translator.get("module_not_null"), path);
|
||||
} else if (nodes[i].trim().length() > 100) {
|
||||
process.add(Translator.get("module") + Translator.get("test_track.length_less_than") + "100", path + nodes[i].trim());
|
||||
@ -150,7 +150,7 @@ public class XmindCaseParser {
|
||||
//用例名称判断
|
||||
if (StringUtils.isEmpty(data.getName())) {
|
||||
validatePass = false;
|
||||
process.add("name" + Translator.get("cannot_be_null"), nodePath + "");
|
||||
process.add("name" + Translator.get("cannot_be_null"), nodePath + StringUtils.EMPTY);
|
||||
} else {
|
||||
if (data.getName().length() > 200) {
|
||||
validatePass = false;
|
||||
@ -170,7 +170,7 @@ public class XmindCaseParser {
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < nodes.length; i++) {
|
||||
if (i != 0 && StringUtils.equals(nodes[i].trim(), "")) {
|
||||
if (i != 0 && StringUtils.equals(nodes[i].trim(), StringUtils.EMPTY)) {
|
||||
validatePass = false;
|
||||
process.add(Translator.get("test_case") + Translator.get("module_not_null"), nodePath + data.getName());
|
||||
if (!errorPath.contains(nodePath)) {
|
||||
@ -315,7 +315,7 @@ public class XmindCaseParser {
|
||||
}
|
||||
Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
|
||||
Matcher result = pattern.matcher(str);
|
||||
str = result.replaceAll("");
|
||||
str = result.replaceAll(StringUtils.EMPTY);
|
||||
return str;
|
||||
}
|
||||
|
||||
@ -339,8 +339,8 @@ public class XmindCaseParser {
|
||||
// 保持插入顺序,判断用例是否有相同的steps
|
||||
Map step = new LinkedHashMap();
|
||||
step.put("num", 1);
|
||||
step.put("desc", "");
|
||||
step.put("result", "");
|
||||
step.put("desc", StringUtils.EMPTY);
|
||||
step.put("result", StringUtils.EMPTY);
|
||||
jsonArray.add(step);
|
||||
}
|
||||
return JSON.toJSONString(jsonArray);
|
||||
@ -364,7 +364,7 @@ public class XmindCaseParser {
|
||||
return;
|
||||
}
|
||||
// 用例名称
|
||||
String name = title.replace(tcArrs[0] + ":", "").replace(tcArrs[0] + ":", "");
|
||||
String name = title.replace(tcArrs[0] + ":", StringUtils.EMPTY).replace(tcArrs[0] + ":", StringUtils.EMPTY);
|
||||
testCase.setName(name);
|
||||
testCase.setNodePath(nodePath.trim());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user