refactor: "" -> StringUtils.EMPTY
This commit is contained in:
parent
5621516b13
commit
b4b2dca27a
|
@ -254,7 +254,7 @@ public class MockConfigService {
|
|||
List<String> savedExpectNumber = extMockExpectConfigMapper.selectExlectNumByMockConfigId(mockConfigId);
|
||||
String apiNum = extMockExpectConfigMapper.selectApiNumberByMockConfigId(mockConfigId);
|
||||
if (StringUtils.isEmpty(apiNum)) {
|
||||
apiNum = "";
|
||||
apiNum = StringUtils.EMPTY;
|
||||
} else {
|
||||
apiNum = apiNum + "_";
|
||||
}
|
||||
|
@ -427,8 +427,8 @@ public class MockConfigService {
|
|||
JSONArray jsonArray = mockExpectRequestObj.optJSONArray("variables");
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
JSONObject object = jsonArray.optJSONObject(i);
|
||||
String name = "";
|
||||
String value = "";
|
||||
String name = StringUtils.EMPTY;
|
||||
String value = StringUtils.EMPTY;
|
||||
if (object.has("name")) {
|
||||
name = String.valueOf(object.get("name")).trim();
|
||||
}
|
||||
|
@ -550,8 +550,8 @@ public class MockConfigService {
|
|||
JSONArray jsonArray = requestObj.optJSONArray("variables");
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
JSONObject object = jsonArray.optJSONObject(i);
|
||||
String name = "";
|
||||
String value = "";
|
||||
String name = StringUtils.EMPTY;
|
||||
String value = StringUtils.EMPTY;
|
||||
if (object.has("name")) {
|
||||
name = String.valueOf(object.get("name")).trim();
|
||||
}
|
||||
|
@ -570,7 +570,7 @@ public class MockConfigService {
|
|||
}
|
||||
|
||||
public String updateHttpServletResponse(String projectId, MockExpectConfigResponse finalExpectConfig, String url, Map<String, String> headerMap, RequestMockParams requestMockParams, HttpServletResponse response) {
|
||||
String returnStr = "";
|
||||
String returnStr = StringUtils.EMPTY;
|
||||
try {
|
||||
//设置响应头和响应码
|
||||
JSONObject responseObj = JSONUtil.parseObject(JSON.toJSONString(finalExpectConfig.getResponse()));
|
||||
|
@ -622,7 +622,7 @@ public class MockConfigService {
|
|||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
JSONObject object = jsonArray.optJSONObject(i);
|
||||
String name = null;
|
||||
String value = "";
|
||||
String value = StringUtils.EMPTY;
|
||||
if (object.has("name")) {
|
||||
name = String.valueOf(object.get("name")).trim();
|
||||
}
|
||||
|
@ -851,7 +851,7 @@ public class MockConfigService {
|
|||
}
|
||||
|
||||
public String checkReturnWithMockExpectByBodyParam(String method, Map<String, String> requestHeaderMap, Project project, HttpServletRequest request, HttpServletResponse response) {
|
||||
String returnStr = "";
|
||||
String returnStr = StringUtils.EMPTY;
|
||||
boolean matchApi = false;
|
||||
String url = request.getRequestURL().toString();
|
||||
if (project != null) {
|
||||
|
@ -884,7 +884,7 @@ public class MockConfigService {
|
|||
}
|
||||
|
||||
public String checkReturnWithMockExpectByUrlParam(String method, Map<String, String> requestHeaderMap, Project project, HttpServletRequest request, HttpServletResponse response) {
|
||||
String returnStr = "";
|
||||
String returnStr = StringUtils.EMPTY;
|
||||
boolean matchApi = false;
|
||||
String url = request.getRequestURL().toString();
|
||||
List<ApiDefinitionWithBLOBs> aualifiedApiList = new ArrayList<>();
|
||||
|
@ -1344,7 +1344,7 @@ public class MockConfigService {
|
|||
}
|
||||
|
||||
public String getMockInfo(String projectId) {
|
||||
String returnStr = "";
|
||||
String returnStr = StringUtils.EMPTY;
|
||||
ApiTestEnvironmentWithBLOBs mockEnv = baseEnvironmentService.getMockEnvironmentByProjectId(projectId);
|
||||
if (mockEnv != null && mockEnv.getConfig() != null) {
|
||||
try {
|
||||
|
|
|
@ -174,7 +174,7 @@ public class MsHashTreeService {
|
|||
if (StringUtils.equalsIgnoreCase(element.optString(REFERENCED), REF)) {
|
||||
element.put(ENABLE, false);
|
||||
}
|
||||
element.put(NUM, "");
|
||||
element.put(NUM, StringUtils.EMPTY);
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ public class MsHashTreeService {
|
|||
if (StringUtils.equalsIgnoreCase(element.optString(REFERENCED), REF)) {
|
||||
element.put(ENABLE, false);
|
||||
}
|
||||
element.put(NUM, "");
|
||||
element.put(NUM, StringUtils.EMPTY);
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ public class ShareInfoService extends BaseShareInfoService {
|
|||
apiInfoDTO.setCreateUser(userIdMap.get(apiModel.getCreateUser()) == null ? apiModel.getCreateUser() : userIdMap.get(apiModel.getCreateUser()).getName());
|
||||
apiInfoDTO.setDesc(apiModel.getDescription());
|
||||
if (MapUtils.isNotEmpty(moduleMap)) {
|
||||
apiInfoDTO.setModules(moduleMap.containsKey(apiModel.getModuleId()) ? moduleMap.get(apiModel.getModuleId()) : "");
|
||||
apiInfoDTO.setModules(moduleMap.containsKey(apiModel.getModuleId()) ? moduleMap.get(apiModel.getModuleId()) : StringUtils.EMPTY);
|
||||
} else {
|
||||
ApiModuleService apiModuleService = CommonBeanFactory.getBean(ApiModuleService.class);
|
||||
apiInfoDTO.setModules(apiModuleService.getModuleNameById(apiModel.getModuleId()));
|
||||
|
@ -290,7 +290,7 @@ public class ShareInfoService extends BaseShareInfoService {
|
|||
for (int i = 0; i < kvsArr.size(); i++) {
|
||||
JsonNode kv = kvsArr.get(i);
|
||||
if (this.isObjectHasKey(kv, "name")) {
|
||||
String value = "";
|
||||
String value = StringUtils.EMPTY;
|
||||
if (kv.has("value")) {
|
||||
value = String.valueOf(kv.get("value"));
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ public class ShareInfoService extends BaseShareInfoService {
|
|||
Map<String, String> bodyMap = new HashMap<>();
|
||||
String name = kv.get("description").asText();
|
||||
ArrayNode fileArr = kv.withArray("files");
|
||||
String value = "";
|
||||
String value = StringUtils.EMPTY;
|
||||
for (int j = 0; j < fileArr.size(); j++) {
|
||||
JsonNode fileObj = fileArr.get(j);
|
||||
if (this.isObjectHasKey(fileObj, "name")) {
|
||||
|
@ -413,7 +413,7 @@ public class ShareInfoService extends BaseShareInfoService {
|
|||
|
||||
String name = kv.get("description").asText();
|
||||
ArrayNode fileArr = kv.withArray("files");
|
||||
String value = "";
|
||||
String value = StringUtils.EMPTY;
|
||||
for (int j = 0; j < fileArr.size(); j++) {
|
||||
JsonNode fileObj = fileArr.get(j);
|
||||
if (this.isObjectHasKey(fileObj, "name")) {
|
||||
|
|
|
@ -152,11 +152,11 @@ public class TestResultService {
|
|||
if (scenarioRunModes.contains(dto.getRunMode())) {
|
||||
ApiScenarioReport scenarioReport = apiScenarioReportService.testEnded(dto);
|
||||
if (scenarioReport != null) {
|
||||
String environment = "";
|
||||
String environment = StringUtils.EMPTY;
|
||||
//执行人
|
||||
String userName = "";
|
||||
String userName = StringUtils.EMPTY;
|
||||
//负责人
|
||||
String principal = "";
|
||||
String principal = StringUtils.EMPTY;
|
||||
|
||||
ApiScenarioWithBLOBs apiScenario = apiScenarioMapper.selectByPrimaryKey(scenarioReport.getScenarioId());
|
||||
if (apiScenario != null) {
|
||||
|
@ -211,8 +211,8 @@ public class TestResultService {
|
|||
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
|
||||
String reportUrl = baseSystemConfigDTO.getUrl() + "/#/api/automation/report/view/" + report.getId();
|
||||
|
||||
String subject = "";
|
||||
String event = "";
|
||||
String subject = StringUtils.EMPTY;
|
||||
String event = StringUtils.EMPTY;
|
||||
String successContext = "${operator}执行接口自动化成功: ${name}" + ", 报告: ${reportUrl}";
|
||||
String failedContext = "${operator}执行接口自动化失败: ${name}" + ", 报告: ${reportUrl}";
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package io.metersphere.consul;
|
|||
import io.metersphere.commons.utils.JSON;
|
||||
import io.metersphere.controller.handler.annotation.NoResultHolder;
|
||||
import org.apache.commons.lang3.RandomUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
@ -50,7 +51,7 @@ public class CatalogApi {
|
|||
int index = RandomUtils.nextInt(1000, 20000);
|
||||
responseHeaders.set("X-Consul-Default-Acl-Policy", "allow");
|
||||
responseHeaders.set("X-Consul-Effective-Consistency", "leader");
|
||||
responseHeaders.set("X-Consul-Index", index + "");
|
||||
responseHeaders.set("X-Consul-Index", index + StringUtils.EMPTY);
|
||||
responseHeaders.set("X-Consul-Knownleader", "true");
|
||||
responseHeaders.set("X-Consul-Lastcontact", "0");
|
||||
|
||||
|
@ -67,7 +68,7 @@ public class CatalogApi {
|
|||
int index = RandomUtils.nextInt(1000, 20000);
|
||||
HttpHeaders responseHeaders = new HttpHeaders();
|
||||
responseHeaders.set("X-Consul-Default-Acl-Policy", "allow");
|
||||
responseHeaders.set("X-Consul-Index", index + "");
|
||||
responseHeaders.set("X-Consul-Index", index + StringUtils.EMPTY);
|
||||
responseHeaders.set("X-Consul-Knownleader", "true");
|
||||
responseHeaders.set("X-Consul-Lastcontact", "0");
|
||||
|
||||
|
|
|
@ -174,9 +174,9 @@ public abstract class AbstractEngine implements Engine {
|
|||
|
||||
Map<String, String> env = new HashMap<>();
|
||||
env.put("RATIO", StringUtils.join(ratios, ","));
|
||||
env.put("RESOURCE_INDEX", "" + resourceIndex);
|
||||
env.put("RESOURCE_INDEX", StringUtils.EMPTY + resourceIndex);
|
||||
env.put("METERSPHERE_URL", metersphereUrl);
|
||||
env.put("START_TIME", "" + System.currentTimeMillis());
|
||||
env.put("START_TIME", StringUtils.EMPTY + System.currentTimeMillis());
|
||||
env.put("TEST_ID", this.loadTestReport.getTestId());
|
||||
env.put("REPORT_ID", this.loadTestReport.getId());
|
||||
env.put("BOOTSTRAP_SERVERS", kafkaProperties.getBootstrapServers());
|
||||
|
@ -200,7 +200,7 @@ public abstract class AbstractEngine implements Engine {
|
|||
completeCount.setId(UUID.randomUUID().toString());
|
||||
completeCount.setReportId(loadTestReport.getId());
|
||||
completeCount.setReportKey(ReportKeys.ReportCompleteCount.name());
|
||||
completeCount.setReportValue("" + ratios.length); // 初始化一个 completeCount, 这个值用在data-streaming中
|
||||
completeCount.setReportValue(StringUtils.EMPTY + ratios.length); // 初始化一个 completeCount, 这个值用在data-streaming中
|
||||
LoadTestReportResultMapper loadTestReportResultMapper = CommonBeanFactory.getBean(LoadTestReportResultMapper.class);
|
||||
loadTestReportResultMapper.insertSelective(completeCount);
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ public class PerformanceNoticeEvent implements LoadTestFinishEvent {
|
|||
|
||||
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
|
||||
String reportUrl = baseSystemConfigDTO.getUrl() + "/#/performance/report/view/" + loadTestReport.getId();
|
||||
String subject = "";
|
||||
String event = "";
|
||||
String subject = StringUtils.EMPTY;
|
||||
String event = StringUtils.EMPTY;
|
||||
String successContext = "${operator}执行性能测试成功: ${name}, 报告: ${reportUrl}";
|
||||
String failedContext = "${operator}执行性能测试失败: ${name}, 报告: ${reportUrl}";
|
||||
if (StringUtils.equals(ReportTriggerMode.API.name(), loadTestReport.getTriggerMode())) {
|
||||
|
|
|
@ -61,7 +61,7 @@ public class EngineSourceParserFactory {
|
|||
List<Node> nodes = document.selectNodes("//text()[normalize-space(.)='']");
|
||||
nodes.forEach(node -> {
|
||||
if (node.getText().contains("\n")) {
|
||||
node.setText("");
|
||||
node.setText(StringUtils.EMPTY);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -522,7 +522,7 @@ public class PerformanceReportService {
|
|||
if (testResourcePool != null) {
|
||||
return testResourcePool.getType();
|
||||
}
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
public List<LoadTestExportJmx> getJmxContent(String reportId) {
|
||||
|
|
|
@ -135,7 +135,7 @@ public class FileRepositoryService {
|
|||
if (StringUtils.equals(fileAssociation.getType(), FileAssociationType.API.name())) {
|
||||
ApiDefinition apiDefinition = apiMap.get(fileAssociation.getSourceId());
|
||||
if (apiDefinition != null) {
|
||||
caseId = apiDefinition.getNum() == null ? "" : apiDefinition.getNum().toString();
|
||||
caseId = apiDefinition.getNum() == null ? StringUtils.EMPTY : apiDefinition.getNum().toString();
|
||||
caseName = apiDefinition.getName();
|
||||
}
|
||||
} else if (StringUtils.equals(fileAssociation.getType(), FileAssociationType.CASE.name())) {
|
||||
|
|
|
@ -235,7 +235,7 @@ public class ProjectService {
|
|||
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) {
|
||||
|
|
|
@ -257,7 +257,7 @@ public class TestCaseTemplateService extends TemplateBaseService {
|
|||
List<DetailColumn> columns = ReflexObjectUtil.getColumns(templateWithBLOBs, SystemReference.caseFieldColumns);
|
||||
columns.forEach(item -> {
|
||||
if (item.getColumnName().equals("steps") && item.getOriginalValue().toString().equals("[{\"num\":1,\"desc\":\"\",\"result\":\"\"}]")) {
|
||||
item.setOriginalValue("");
|
||||
item.setOriginalValue(StringUtils.EMPTY);
|
||||
}
|
||||
});
|
||||
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(templateWithBLOBs.getId()), null, templateWithBLOBs.getName(), templateWithBLOBs.getCreateUser(), columns);
|
||||
|
|
|
@ -296,7 +296,7 @@ public class SystemProjectService {
|
|||
public void checkProjectTcpPort(AddProjectRequest project) {
|
||||
//判断端口是否重复
|
||||
if (project.getMockTcpPort() != null && project.getMockTcpPort() != 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) {
|
||||
|
|
|
@ -375,7 +375,7 @@ public class UserService {
|
|||
user.setLastProjectId(projects.get(0).getId());
|
||||
}
|
||||
} else {
|
||||
user.setLastProjectId("");
|
||||
user.setLastProjectId(StringUtils.EMPTY);
|
||||
}
|
||||
}
|
||||
// 执行变更
|
||||
|
@ -454,7 +454,7 @@ public class UserService {
|
|||
.andGroupIdIn(groupIds);
|
||||
User user = userMapper.selectByPrimaryKey(userId);
|
||||
if (StringUtils.equals(workspaceId, user.getLastWorkspaceId())) {
|
||||
user.setLastWorkspaceId("");
|
||||
user.setLastWorkspaceId(StringUtils.EMPTY);
|
||||
userMapper.updateByPrimaryKeySelective(user);
|
||||
}
|
||||
|
||||
|
@ -489,10 +489,10 @@ public class UserService {
|
|||
UserDTO user = getUserDTO(sessionUser.getId());
|
||||
User newUser = new User();
|
||||
if (StringUtils.equals("organization", sign)) {
|
||||
user.setLastWorkspaceId("");
|
||||
user.setLastWorkspaceId(StringUtils.EMPTY);
|
||||
}
|
||||
if (StringUtils.equals("workspace", sign) && StringUtils.equals(sourceId, user.getLastWorkspaceId())) {
|
||||
user.setLastWorkspaceId("");
|
||||
user.setLastWorkspaceId(StringUtils.EMPTY);
|
||||
}
|
||||
|
||||
BeanUtils.copyProperties(user, newUser);
|
||||
|
@ -1075,7 +1075,7 @@ public class UserService {
|
|||
.andGroupIdIn(groupIds);
|
||||
User user = userMapper.selectByPrimaryKey(userId);
|
||||
if (StringUtils.equals(projectId, user.getLastProjectId())) {
|
||||
user.setLastProjectId("");
|
||||
user.setLastProjectId(StringUtils.EMPTY);
|
||||
userMapper.updateByPrimaryKeySelective(user);
|
||||
}
|
||||
|
||||
|
@ -1115,7 +1115,7 @@ public class UserService {
|
|||
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
if (list.contains(user.getLastWorkspaceId())) {
|
||||
user.setLastWorkspaceId("");
|
||||
user.setLastWorkspaceId(StringUtils.EMPTY);
|
||||
userMapper.updateByPrimaryKeySelective(user);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere.utils;
|
||||
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.Iterator;
|
||||
|
@ -137,7 +138,7 @@ public class TypeUtils {
|
|||
return null;
|
||||
}
|
||||
if (strVal.indexOf(',') != -1) {
|
||||
strVal = strVal.replaceAll(",", "");
|
||||
strVal = strVal.replaceAll(",", StringUtils.EMPTY);
|
||||
}
|
||||
return Float.parseFloat(strVal);
|
||||
}
|
||||
|
@ -165,7 +166,7 @@ public class TypeUtils {
|
|||
return null;
|
||||
}
|
||||
if (strVal.indexOf(',') != -1) {
|
||||
strVal = strVal.replaceAll(",", "");
|
||||
strVal = strVal.replaceAll(",", StringUtils.EMPTY);
|
||||
}
|
||||
return Double.parseDouble(strVal);
|
||||
}
|
||||
|
@ -208,7 +209,7 @@ public class TypeUtils {
|
|||
return null;
|
||||
}
|
||||
if (strVal.indexOf(',') != -1) {
|
||||
strVal = strVal.replaceAll(",", "");
|
||||
strVal = strVal.replaceAll(",", StringUtils.EMPTY);
|
||||
}
|
||||
try {
|
||||
return Long.parseLong(strVal);
|
||||
|
@ -370,7 +371,7 @@ public class TypeUtils {
|
|||
return null;
|
||||
}
|
||||
if (strVal.indexOf(',') != -1) {
|
||||
strVal = strVal.replaceAll(",", "");
|
||||
strVal = strVal.replaceAll(",", StringUtils.EMPTY);
|
||||
}
|
||||
return Integer.parseInt(strVal);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import io.metersphere.plan.reuest.function.TestPlanFuncCaseBatchRequest;
|
|||
import io.metersphere.plan.reuest.function.TestPlanFuncCaseEditRequest;
|
||||
import io.metersphere.plan.service.TestPlanTestCaseService;
|
||||
import io.metersphere.request.ResetOrderRequest;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -70,7 +71,7 @@ public class TestPlanTestCaseController {
|
|||
|
||||
@GetMapping("/list/node/all/{planId}/{nodePaths}")
|
||||
public List<TestPlanCaseDTO> getTestPlanCasesByNodePaths(@PathVariable String planId, @PathVariable String nodePaths) {
|
||||
String nodePath = nodePaths.replace("f", "");
|
||||
String nodePath = nodePaths.replace("f", StringUtils.EMPTY);
|
||||
String[] array = nodePath.split(",");
|
||||
List<String> list = Arrays.asList(array);
|
||||
QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest();
|
||||
|
|
|
@ -40,10 +40,10 @@ public class TrackStatisticsDTO {
|
|||
*/
|
||||
private long p3CaseCountNumber = 0;
|
||||
|
||||
private String p0CountStr = "";
|
||||
private String p1CountStr = "";
|
||||
private String p2CountStr = "";
|
||||
private String p3CountStr = "";
|
||||
private String p0CountStr = StringUtils.EMPTY;
|
||||
private String p1CountStr = StringUtils.EMPTY;
|
||||
private String p2CountStr = StringUtils.EMPTY;
|
||||
private String p3CountStr = StringUtils.EMPTY;
|
||||
|
||||
/**
|
||||
* 关联用例数量统计
|
||||
|
@ -66,9 +66,9 @@ public class TrackStatisticsDTO {
|
|||
private long performanceCaseCount = 0;
|
||||
|
||||
|
||||
private String apiCaseCountStr = "";
|
||||
private String scenarioCaseStr = "";
|
||||
private String performanceCaseCountStr = "";
|
||||
private String apiCaseCountStr = StringUtils.EMPTY;
|
||||
private String scenarioCaseStr = StringUtils.EMPTY;
|
||||
private String performanceCaseCountStr = StringUtils.EMPTY;
|
||||
|
||||
/**
|
||||
* 本周新增数量
|
||||
|
|
|
@ -19,7 +19,7 @@ import io.metersphere.xpack.track.dto.request.IssuesUpdateRequest;
|
|||
import io.metersphere.service.issue.platform.IssueFactory;
|
||||
import io.metersphere.xmind.utils.FileUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
|
@ -190,7 +190,7 @@ public class AttachmentService {
|
|||
List<AttachmentModuleRelation> attachmentModuleRelations = attachmentModuleRelationMapper.selectByExample(example);
|
||||
Map<String, String> relationMap = attachmentModuleRelations.stream()
|
||||
.collect(Collectors.toMap(AttachmentModuleRelation::getAttachmentId,
|
||||
relation -> relation.getFileMetadataRefId() == null ? "" : relation.getFileMetadataRefId()));
|
||||
relation -> relation.getFileMetadataRefId() == null ? StringUtils.EMPTY : relation.getFileMetadataRefId()));
|
||||
List<String> attachmentIds = attachmentModuleRelations.stream().map(AttachmentModuleRelation::getAttachmentId)
|
||||
.filter(StringUtils::isNotEmpty)
|
||||
.collect(Collectors.toList());
|
||||
|
@ -255,8 +255,8 @@ public class AttachmentService {
|
|||
FileAttachmentMetadata fileAttachmentMetadata = new FileAttachmentMetadata();
|
||||
BeanUtils.copyBean(fileAttachmentMetadata, fileMetadata);
|
||||
fileAttachmentMetadata.setId(record.getAttachmentId());
|
||||
fileAttachmentMetadata.setCreator(fileMetadata.getCreateUser() == null ? "" : fileMetadata.getCreateUser());
|
||||
fileAttachmentMetadata.setFilePath(fileMetadata.getPath() == null ? "" : fileMetadata.getPath());
|
||||
fileAttachmentMetadata.setCreator(fileMetadata.getCreateUser() == null ? StringUtils.EMPTY : fileMetadata.getCreateUser());
|
||||
fileAttachmentMetadata.setFilePath(fileMetadata.getPath() == null ? StringUtils.EMPTY : fileMetadata.getPath());
|
||||
fileAttachmentMetadataBatchMapper.insert(fileAttachmentMetadata);
|
||||
// 缺陷类型的附件, 关联时需单独同步第三方平台
|
||||
if (AttachmentType.ISSUE.type().equals(request.getBelongType())) {
|
||||
|
@ -520,7 +520,7 @@ public class AttachmentService {
|
|||
|
||||
private String getFileTypeWithoutEnum(String filename) {
|
||||
if (org.apache.commons.lang3.StringUtils.isEmpty(filename)) {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
int s = filename.lastIndexOf(".") + 1;
|
||||
String type = filename.substring(s);
|
||||
|
|
|
@ -190,8 +190,8 @@ public class IssuesService {
|
|||
FileAttachmentMetadata fileAttachmentMetadata = new FileAttachmentMetadata();
|
||||
BeanUtils.copyBean(fileAttachmentMetadata, fileMetadata);
|
||||
fileAttachmentMetadata.setId(relation.getAttachmentId());
|
||||
fileAttachmentMetadata.setCreator(fileMetadata.getCreateUser() == null ? "" : fileMetadata.getCreateUser());
|
||||
fileAttachmentMetadata.setFilePath(fileMetadata.getPath() == null ? "" : fileMetadata.getPath());
|
||||
fileAttachmentMetadata.setCreator(fileMetadata.getCreateUser() == null ? StringUtils.EMPTY : fileMetadata.getCreateUser());
|
||||
fileAttachmentMetadata.setFilePath(fileMetadata.getPath() == null ? StringUtils.EMPTY : fileMetadata.getPath());
|
||||
fileAttachmentMetadataBatchMapper.insert(fileAttachmentMetadata);
|
||||
// 下载文件管理文件, 同步到第三方平台
|
||||
File refFile = attachmentService.downloadMetadataFile(filemetaId, fileMetadata.getName());
|
||||
|
@ -305,7 +305,7 @@ public class IssuesService {
|
|||
return;
|
||||
}
|
||||
for (IssuesDao issue : issues) {
|
||||
issue.setStatus(statusMap.getOrDefault(issue.getId(), "").replaceAll("\"", ""));
|
||||
issue.setStatus(statusMap.getOrDefault(issue.getId(), StringUtils.EMPTY).replaceAll("\"", StringUtils.EMPTY));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -928,7 +928,7 @@ public class IssuesService {
|
|||
if (StringUtils.isBlank(item.getStatusValue())) {
|
||||
item.setStatusValue(IssuesStatus.NEW.toString());
|
||||
} else {
|
||||
item.setStatusValue(item.getStatusValue().replace("\"", ""));
|
||||
item.setStatusValue(item.getStatusValue().replace("\"", StringUtils.EMPTY));
|
||||
}
|
||||
});
|
||||
return countByStatus;
|
||||
|
|
|
@ -99,7 +99,7 @@ public class TestCaseCommentService {
|
|||
if (!sTime.equals("null")) {
|
||||
start = sdf.format(new Date(Long.parseLong(sTime)));
|
||||
}
|
||||
String context = "";
|
||||
String context = StringUtils.EMPTY;
|
||||
context = "测试评审任务通知:" + user.getName() + "在" + start + "为" + "'" + testCaseWithBLOBs.getName() + "'" + "添加评论:" + testCaseComment.getDescription();
|
||||
return context;
|
||||
}
|
||||
|
|
|
@ -403,7 +403,7 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
|
|||
}
|
||||
}
|
||||
if (!hasNode) {
|
||||
createNodeByPath(itemIterator, rootNodeName, null, projectId, 1, "", pathMap);
|
||||
createNodeByPath(itemIterator, rootNodeName, null, projectId, 1, StringUtils.EMPTY, pathMap);
|
||||
}
|
||||
}
|
||||
return pathMap;
|
||||
|
|
|
@ -483,7 +483,7 @@ public class TestCaseReviewService {
|
|||
Map<String, String> userMap = baseUserService.getProjectMemberList(queryMemberRequest)
|
||||
.stream().collect(Collectors.toMap(User::getId, User::getName));
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
String name = "";
|
||||
String name = StringUtils.EMPTY;
|
||||
|
||||
if (userIds.size() > 0) {
|
||||
for (String id : userIds) {
|
||||
|
@ -519,11 +519,11 @@ public class TestCaseReviewService {
|
|||
} else {
|
||||
start = "未设置";
|
||||
}
|
||||
String context = "";
|
||||
String context = StringUtils.EMPTY;
|
||||
if (StringUtils.equals(NoticeConstants.Event.CREATE, type)) {
|
||||
context = "测试评审任务通知:" + user.getName() + "发起的" + "'" + reviewRequest.getName() + "'" + "待开始,计划开始时间是" + start + "计划结束时间为" + end + "请跟进";
|
||||
} else if (StringUtils.equals(NoticeConstants.Event.UPDATE, type)) {
|
||||
String status = "";
|
||||
String status = StringUtils.EMPTY;
|
||||
if (StringUtils.equals(TestPlanStatus.Underway.name(), reviewRequest.getStatus())) {
|
||||
status = "进行中";
|
||||
} else if (StringUtils.equals(TestPlanStatus.Prepare.name(), reviewRequest.getStatus())) {
|
||||
|
|
|
@ -393,7 +393,7 @@ public class TestCaseService {
|
|||
addDemandHyperLink(testCase, "edit");
|
||||
|
||||
if (StringUtils.isEmpty(testCase.getDemandId())) {
|
||||
testCase.setDemandId("");
|
||||
testCase.setDemandId(StringUtils.EMPTY);
|
||||
}
|
||||
createNewVersionOrNot(testCase, example);
|
||||
|
||||
|
@ -572,13 +572,13 @@ public class TestCaseService {
|
|||
|
||||
// 如果上边字段全部相同,去检查 remark 和 steps
|
||||
if (!CollectionUtils.isEmpty(caseList)) {
|
||||
String caseRemark = testCase.getRemark() == null ? "" : testCase.getRemark();
|
||||
String caseSteps = testCase.getSteps() == null ? "" : testCase.getSteps();
|
||||
String casePrerequisite = testCase.getPrerequisite() == null ? "" : testCase.getPrerequisite();
|
||||
String caseRemark = testCase.getRemark() == null ? StringUtils.EMPTY : testCase.getRemark();
|
||||
String caseSteps = testCase.getSteps() == null ? StringUtils.EMPTY : testCase.getSteps();
|
||||
String casePrerequisite = testCase.getPrerequisite() == null ? StringUtils.EMPTY : testCase.getPrerequisite();
|
||||
for (TestCaseWithBLOBs tc : caseList) {
|
||||
String steps = tc.getSteps() == null ? "" : tc.getSteps();
|
||||
String remark = tc.getRemark() == null ? "" : tc.getRemark();
|
||||
String prerequisite = tc.getPrerequisite() == null ? "" : tc.getPrerequisite();
|
||||
String steps = tc.getSteps() == null ? StringUtils.EMPTY : tc.getSteps();
|
||||
String remark = tc.getRemark() == null ? StringUtils.EMPTY : tc.getRemark();
|
||||
String prerequisite = tc.getPrerequisite() == null ? StringUtils.EMPTY : tc.getPrerequisite();
|
||||
if (StringUtils.equals(steps, caseSteps) && StringUtils.equals(remark, caseRemark) && StringUtils.equals(prerequisite, casePrerequisite)) {
|
||||
//MSException.throwException(Translator.get("test_case_already_exists"));
|
||||
return tc;
|
||||
|
@ -1402,7 +1402,7 @@ public class TestCaseService {
|
|||
for (int i = 1; i <= 4; i++) {
|
||||
path.append("/" + Translator.get("module") + i);
|
||||
TestCaseDTO testCaseDTO = new TestCaseDTO();
|
||||
testCaseDTO.setCustomNum("");
|
||||
testCaseDTO.setCustomNum(StringUtils.EMPTY);
|
||||
testCaseDTO.setName(Translator.get("test_case") + i);
|
||||
testCaseDTO.setNodePath(path.toString());
|
||||
testCaseDTO.setPriority("P" + i % 4);
|
||||
|
@ -1575,7 +1575,7 @@ public class TestCaseService {
|
|||
value = otherFieldMaps.get(head);
|
||||
}
|
||||
if (value == null) {
|
||||
value = "";
|
||||
value = StringUtils.EMPTY;
|
||||
}
|
||||
fields.add(value);
|
||||
}
|
||||
|
@ -1670,7 +1670,7 @@ public class TestCaseService {
|
|||
if (converter != null) {
|
||||
otherFields.put(header.getName(), converter.parse(t));
|
||||
} else {
|
||||
otherFields.put(header.getName(), "");
|
||||
otherFields.put(header.getName(), StringUtils.EMPTY);
|
||||
}
|
||||
});
|
||||
data.setOtherFields(otherFields);
|
||||
|
@ -1681,7 +1681,7 @@ public class TestCaseService {
|
|||
data.setCustomNum(t.getCustomNum());
|
||||
} else {
|
||||
if (t.getNum() == null) {
|
||||
data.setCustomNum("");
|
||||
data.setCustomNum(StringUtils.EMPTY);
|
||||
} else {
|
||||
data.setCustomNum(String.valueOf(t.getNum()));
|
||||
}
|
||||
|
@ -1777,8 +1777,8 @@ public class TestCaseService {
|
|||
String stepDesc = item.get("desc").toString();
|
||||
String stepResult = item.get("result").toString();
|
||||
if (StringUtils.isNotBlank(stepDesc) || StringUtils.isNotBlank(stepResult)) {
|
||||
stepDescList.add(Optional.ofNullable(stepDesc).orElse(""));
|
||||
stepResultList.add(Optional.ofNullable(stepResult).orElse(""));
|
||||
stepDescList.add(Optional.ofNullable(stepDesc).orElse(StringUtils.EMPTY));
|
||||
stepResultList.add(Optional.ofNullable(stepResult).orElse(StringUtils.EMPTY));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2139,8 +2139,8 @@ public class TestCaseService {
|
|||
FileAttachmentMetadata fileAttachmentMetadata = new FileAttachmentMetadata();
|
||||
BeanUtils.copyBean(fileAttachmentMetadata, fileMetadata);
|
||||
fileAttachmentMetadata.setId(record.getAttachmentId());
|
||||
fileAttachmentMetadata.setCreator(fileMetadata.getCreateUser() == null ? "" : fileMetadata.getCreateUser());
|
||||
fileAttachmentMetadata.setFilePath(fileMetadata.getPath() == null ? "" : fileMetadata.getPath());
|
||||
fileAttachmentMetadata.setCreator(fileMetadata.getCreateUser() == null ? StringUtils.EMPTY : fileMetadata.getCreateUser());
|
||||
fileAttachmentMetadata.setFilePath(fileMetadata.getPath() == null ? StringUtils.EMPTY : fileMetadata.getPath());
|
||||
fileAttachmentMetadataBatchMapper.insert(fileAttachmentMetadata);
|
||||
});
|
||||
sqlSession.flushStatements();
|
||||
|
@ -2216,7 +2216,7 @@ public class TestCaseService {
|
|||
|
||||
for (TestCaseMinderEditRequest.TestCaseMinderEditItem item : data) {
|
||||
if (StringUtils.isBlank(item.getNodeId()) || item.getNodeId().equals("root")) {
|
||||
item.setNodeId("");
|
||||
item.setNodeId(StringUtils.EMPTY);
|
||||
}
|
||||
item.setProjectId(request.getProjectId());
|
||||
if (item.getIsEdit()) {
|
||||
|
|
|
@ -131,7 +131,7 @@ public class TestReviewTestCaseService {
|
|||
List<String> userIds = testCaseReviewService.getTestCaseReviewerIds(reviewId);
|
||||
String currentId = SessionUtils.getUser().getId();
|
||||
TestCaseReview caseReview = testCaseReviewMapper.selectByPrimaryKey(reviewId);
|
||||
String creator = "";
|
||||
String creator = StringUtils.EMPTY;
|
||||
if (caseReview != null) {
|
||||
creator = caseReview.getCreator();
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ public class TrackService {
|
|||
return issueIds.size();
|
||||
}
|
||||
return (int) issueIds.stream()
|
||||
.filter(id -> !StringUtils.equals(statusMap.getOrDefault(id, "").replaceAll("\"", ""), "closed"))
|
||||
.filter(id -> !StringUtils.equals(statusMap.getOrDefault(id, StringUtils.EMPTY).replaceAll("\"", StringUtils.EMPTY), "closed"))
|
||||
.count();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere.utils;
|
||||
|
||||
import io.metersphere.dto.MsgDTO;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javax.websocket.RemoteEndpoint;
|
||||
import javax.websocket.Session;
|
||||
|
@ -27,8 +28,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());
|
||||
}
|
||||
|
||||
// 全用户推送
|
||||
|
|
|
@ -56,7 +56,7 @@ public abstract class AbstractCustomFieldValidator {
|
|||
.replace("]", "\"]")
|
||||
.replace(",", "\",\"")
|
||||
.replace(",", "\",\"")
|
||||
.replace(" ", "");
|
||||
.replace(" ", StringUtils.EMPTY);
|
||||
}
|
||||
return JSON.parseArray(value, String.class);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -27,7 +27,7 @@ public class CustomFieldMultipleMemberValidator extends CustomFieldMemberValidat
|
|||
@Override
|
||||
public Object parse2Key(String keyOrValuesStr, CustomFieldDao customField) {
|
||||
if (StringUtils.isBlank(keyOrValuesStr)) {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
List<String> keyOrValues = parse2Array(keyOrValuesStr);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public class CustomFieldMultipleSelectValidator extends CustomFieldSelectValidat
|
|||
@Override
|
||||
public Object parse2Key(String keyOrValuesStr, CustomFieldDao customField) {
|
||||
if (StringUtils.isBlank(keyOrValuesStr)) {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
List<String> keyOrValues = parse2Array(keyOrValuesStr);
|
||||
Map<String, String> nameMap = optionTextMapCache.get(customField.getId());
|
||||
|
|
Loading…
Reference in New Issue