refactor: "" -> StringUtils.EMPTY

This commit is contained in:
liqiang-fit2cloud 2022-10-17 18:24:28 +08:00
parent 671f609866
commit 75e70435d7
19 changed files with 53 additions and 53 deletions

View File

@ -194,7 +194,7 @@ public abstract class ApiImportAbstractParser<T> implements ApiImportParser<T> {
} }
protected void addHeader(List<KeyValue> headers, String key, String value) { protected void addHeader(List<KeyValue> headers, String key, String value) {
addHeader(headers, key, value, "", StringUtils.EMPTY, true); addHeader(headers, key, value, StringUtils.EMPTY, StringUtils.EMPTY, true);
} }
protected void addHeader(List<KeyValue> headers, String key, String value, String description, String contentType, boolean required) { protected void addHeader(List<KeyValue> headers, String key, String value, String description, String contentType, boolean required) {

View File

@ -370,7 +370,7 @@ public class ApiTestDefinitionDiffUtilImpl implements ApiDefinitionDiffUtil {
OperatingLogDetails detailsOld = new OperatingLogDetails(); OperatingLogDetails detailsOld = new OperatingLogDetails();
detailsOld.setColumns(columnsOld); detailsOld.setColumns(columnsOld);
List<DetailColumn> diffColumns = ReflexObjectUtil.compared(detailsOld, detailsNew, ""); List<DetailColumn> diffColumns = ReflexObjectUtil.compared(detailsOld, detailsNew, StringUtils.EMPTY);
return diffColumns; return diffColumns;
} }

View File

@ -166,8 +166,8 @@ public class JSONSchemaToDocumentUtil {
if (obj.isJsonArray()) { if (obj.isJsonArray()) {
JsonArray itemsObject = obj.getAsJsonArray(); JsonArray itemsObject = obj.getAsJsonArray();
List<DocumentElement> elements = new LinkedList<>(); List<DocumentElement> elements = new LinkedList<>();
array.add(new DocumentElement(propertyName, StringUtils.EMPTY, StringUtils.EMPTY, requiredList.contains("" + i + ""), elements)); array.add(new DocumentElement(propertyName, StringUtils.EMPTY, StringUtils.EMPTY, requiredList.contains(StringUtils.EMPTY + i + StringUtils.EMPTY), elements));
analyzeArray("", itemsObject, elements, requiredList); analyzeArray(StringUtils.EMPTY, itemsObject, elements, requiredList);
} else if (obj.isJsonObject()) { } else if (obj.isJsonObject()) {
List<String> requiredItems = new ArrayList<>(); List<String> requiredItems = new ArrayList<>();
if (obj.getAsJsonObject().get(PropertyConstant.REQUIRED) != null) { if (obj.getAsJsonObject().get(PropertyConstant.REQUIRED) != null) {
@ -179,7 +179,7 @@ public class JSONSchemaToDocumentUtil {
analyzeProperty(array, String.valueOf(i), obj.getAsJsonObject(), CollectionUtils.isNotEmpty(requiredItems) ? requiredItems : requiredList); analyzeProperty(array, String.valueOf(i), obj.getAsJsonObject(), CollectionUtils.isNotEmpty(requiredItems) ? requiredItems : requiredList);
} else { } else {
JsonPrimitive primitive = (JsonPrimitive) obj; JsonPrimitive primitive = (JsonPrimitive) obj;
array.add(new DocumentElement(propertyName, primitive.getAsString(), "", requiredList.contains(propertyName), null)); array.add(new DocumentElement(propertyName, primitive.getAsString(), StringUtils.EMPTY, requiredList.contains(propertyName), null));
} }
} }
} }

View File

@ -326,8 +326,8 @@ public class ApiHomeController {
dataDTO.setId(selectData.getId()); dataDTO.setId(selectData.getId());
dataDTO.setTestPlanDTOList(selectData.getTestPlanDTOList()); dataDTO.setTestPlanDTOList(selectData.getTestPlanDTOList());
} else { } else {
dataDTO.setCaseName(""); dataDTO.setCaseName(StringUtils.EMPTY);
dataDTO.setTestPlan(""); dataDTO.setTestPlan(StringUtils.EMPTY);
} }
returnList.add(dataDTO); returnList.add(dataDTO);
} }

View File

@ -208,8 +208,8 @@ public class ApiDefinitionExecResultService {
public void editStatus(ApiDefinitionExecResult saveResult, String type, String status, Long time, String reportId, String testId) { public void editStatus(ApiDefinitionExecResult saveResult, String type, String status, Long time, String reportId, String testId) {
String name = testId; String name = testId;
String version = ""; String version = StringUtils.EMPTY;
String projectId = ""; String projectId = StringUtils.EMPTY;
if (StringUtils.equalsAnyIgnoreCase(type, ApiRunMode.API_PLAN.name(), ApiRunMode.SCHEDULE_API_PLAN.name(), ApiRunMode.JENKINS_API_PLAN.name(), ApiRunMode.MANUAL_PLAN.name())) { if (StringUtils.equalsAnyIgnoreCase(type, ApiRunMode.API_PLAN.name(), ApiRunMode.SCHEDULE_API_PLAN.name(), ApiRunMode.JENKINS_API_PLAN.name(), ApiRunMode.MANUAL_PLAN.name())) {
TestPlanApiCase testPlanApiCase = testPlanApiCaseMapper.selectByPrimaryKey(testId); TestPlanApiCase testPlanApiCase = testPlanApiCaseMapper.selectByPrimaryKey(testId);
ApiTestCaseWithBLOBs caseWithBLOBs = null; ApiTestCaseWithBLOBs caseWithBLOBs = null;
@ -291,7 +291,7 @@ public class ApiDefinitionExecResultService {
reportResult.setUserId(String.valueOf(dto.getExtendedParameters().get("userId"))); reportResult.setUserId(String.valueOf(dto.getExtendedParameters().get("userId")));
} }
String status = item.isSuccess() ? ApiReportStatus.SUCCESS.name() : ApiReportStatus.ERROR.name(); String status = item.isSuccess() ? ApiReportStatus.SUCCESS.name() : ApiReportStatus.ERROR.name();
String triggerMode = ""; String triggerMode = StringUtils.EMPTY;
if (reportResult != null) { if (reportResult != null) {
status = reportResult.getStatus(); status = reportResult.getStatus();
triggerMode = reportResult.getTriggerMode(); triggerMode = reportResult.getTriggerMode();

View File

@ -215,7 +215,7 @@ public class ApiDefinitionService {
resList.forEach(i -> { resList.forEach(i -> {
Project project = projectMapper.selectByPrimaryKey(i.getProjectId()); Project project = projectMapper.selectByPrimaryKey(i.getProjectId());
if (project == null) { if (project == null) {
i.setProjectName(""); i.setProjectName(StringUtils.EMPTY);
i.setVersionEnable(false); i.setVersionEnable(false);
} else { } else {
i.setProjectName(project.getName()); i.setProjectName(project.getName());
@ -582,7 +582,7 @@ public class ApiDefinitionService {
} }
if (StringUtils.isEmpty(moduleId)) { if (StringUtils.isEmpty(moduleId)) {
moduleId = ""; moduleId = StringUtils.EMPTY;
} }
if (nodeMap.containsKey(moduleId)) { if (nodeMap.containsKey(moduleId)) {
nodeMap.get(moduleId).add(apiDefinition); nodeMap.get(moduleId).add(apiDefinition);
@ -729,7 +729,7 @@ public class ApiDefinitionService {
if (StringUtils.isNotEmpty(request.getTags()) && !StringUtils.equals(request.getTags(), "[]")) { if (StringUtils.isNotEmpty(request.getTags()) && !StringUtils.equals(request.getTags(), "[]")) {
test.setTags(request.getTags()); test.setTags(request.getTags());
} else { } else {
test.setTags(""); test.setTags(StringUtils.EMPTY);
} }
this.setModule(test); this.setModule(test);
@ -884,7 +884,7 @@ public class ApiDefinitionService {
if (StringUtils.isNotEmpty(request.getTags()) && !StringUtils.equals(request.getTags(), "[]")) { if (StringUtils.isNotEmpty(request.getTags()) && !StringUtils.equals(request.getTags(), "[]")) {
test.setTags(request.getTags()); test.setTags(request.getTags());
} else { } else {
test.setTags(""); test.setTags(StringUtils.EMPTY);
} }
if (apiDefinitionMapper.selectByPrimaryKey(test.getId()) == null) { if (apiDefinitionMapper.selectByPrimaryKey(test.getId()) == null) {
apiDefinitionMapper.insert(test); apiDefinitionMapper.insert(test);
@ -1016,7 +1016,7 @@ public class ApiDefinitionService {
if (StringUtils.isBlank(apiTestCaseWithBLOBs.getPriority())) { if (StringUtils.isBlank(apiTestCaseWithBLOBs.getPriority())) {
apiTestCaseWithBLOBs.setPriority("P0"); apiTestCaseWithBLOBs.setPriority("P0");
} }
apiTestCaseWithBLOBs.setStatus(""); apiTestCaseWithBLOBs.setStatus(StringUtils.EMPTY);
if (StringUtils.isNotBlank(apiTestCaseWithBLOBs.getId())) { if (StringUtils.isNotBlank(apiTestCaseWithBLOBs.getId())) {
BeanUtils.copyBean(apiTestCaseDTO, apiTestCaseWithBLOBs); BeanUtils.copyBean(apiTestCaseDTO, apiTestCaseWithBLOBs);
@ -1351,7 +1351,7 @@ public class ApiDefinitionService {
} }
if (!StringUtils.equals(apiDefinition.getTags(), existApi.getTags())) { if (!StringUtils.equals(apiDefinition.getTags(), existApi.getTags())) {
if (apiDefinition.getTags() != null && Objects.equals(apiDefinition.getTags(), "") && existApi.getTags() != null && Objects.equals(existApi.getTags(), "")) { if (apiDefinition.getTags() != null && Objects.equals(apiDefinition.getTags(), StringUtils.EMPTY) && existApi.getTags() != null && Objects.equals(existApi.getTags(), StringUtils.EMPTY)) {
return true; return true;
} }
} }
@ -1611,7 +1611,7 @@ public class ApiDefinitionService {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("url", request.getSwaggerUrl()); paramMap.put("url", request.getSwaggerUrl());
NoticeModel noticeModel = NoticeModel.builder().operator(project.getCreateUser()).context(context).testId(scheduleId).subject(Translator.get("swagger_url_scheduled_import_notification")).paramMap(paramMap).event(NoticeConstants.Event.EXECUTE_SUCCESSFUL).build(); NoticeModel noticeModel = NoticeModel.builder().operator(project.getCreateUser()).context(context).testId(scheduleId).subject(Translator.get("swagger_url_scheduled_import_notification")).paramMap(paramMap).event(NoticeConstants.Event.EXECUTE_SUCCESSFUL).build();
noticeSendService.send(NoticeConstants.Mode.SCHEDULE, "", noticeModel); noticeSendService.send(NoticeConstants.Mode.SCHEDULE, StringUtils.EMPTY, noticeModel);
} }
if (!StringUtils.equals(request.getType(), SCHEDULE) && CollectionUtils.isNotEmpty(apiImportSendNoticeDTOS)) { if (!StringUtils.equals(request.getType(), SCHEDULE) && CollectionUtils.isNotEmpty(apiImportSendNoticeDTOS)) {
for (ApiImportSendNoticeDTO apiImportSendNoticeDTO : apiImportSendNoticeDTOS) { for (ApiImportSendNoticeDTO apiImportSendNoticeDTO : apiImportSendNoticeDTOS) {
@ -1649,7 +1649,7 @@ public class ApiDefinitionService {
paramMap.put("url", request.getSwaggerUrl()); paramMap.put("url", request.getSwaggerUrl());
paramMap.put("projectId", request.getProjectId()); paramMap.put("projectId", request.getProjectId());
NoticeModel noticeModel = NoticeModel.builder().operator(project.getCreateUser()).context(context).testId(scheduleId).subject(Translator.get("swagger_url_scheduled_import_notification")).paramMap(paramMap).event(NoticeConstants.Event.EXECUTE_FAILED).build(); NoticeModel noticeModel = NoticeModel.builder().operator(project.getCreateUser()).context(context).testId(scheduleId).subject(Translator.get("swagger_url_scheduled_import_notification")).paramMap(paramMap).event(NoticeConstants.Event.EXECUTE_FAILED).build();
noticeSendService.send(NoticeConstants.Mode.SCHEDULE, "", noticeModel); noticeSendService.send(NoticeConstants.Mode.SCHEDULE, StringUtils.EMPTY, noticeModel);
} }
} }

View File

@ -448,7 +448,7 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
MSException.throwException(Translator.get("node_deep_limit")); MSException.throwException(Translator.get("node_deep_limit"));
} }
if (PropertyConstant.ROOT.equals(rootNode.getId())) { if (PropertyConstant.ROOT.equals(rootNode.getId())) {
rootPath = ""; rootPath = StringUtils.EMPTY;
} }
ApiModule apiDefinitionNode = new ApiModule(); ApiModule apiDefinitionNode = new ApiModule();
apiDefinitionNode.setId(rootNode.getId()); apiDefinitionNode.setId(rootNode.getId());
@ -1149,7 +1149,7 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
} }
private void removeRepeatOrigin(List<ApiDefinitionWithBLOBs> data, Boolean fullCoverage, List<ApiDefinitionWithBLOBs> optionDatas) { private void removeRepeatOrigin(List<ApiDefinitionWithBLOBs> data, Boolean fullCoverage, List<ApiDefinitionWithBLOBs> optionDatas) {
LinkedHashMap<String, List<ApiDefinitionWithBLOBs>> methodPathMap = data.stream().collect(Collectors.groupingBy(t -> t.getName() + (t.getModulePath() == null ? "" : t.getModulePath()), LinkedHashMap::new, Collectors.toList())); LinkedHashMap<String, List<ApiDefinitionWithBLOBs>> methodPathMap = data.stream().collect(Collectors.groupingBy(t -> t.getName() + (t.getModulePath() == null ? StringUtils.EMPTY : t.getModulePath()), LinkedHashMap::new, Collectors.toList()));
if (fullCoverage) { if (fullCoverage) {
methodPathMap.forEach((k, v) -> optionDatas.add(v.get(v.size() - 1))); methodPathMap.forEach((k, v) -> optionDatas.add(v.get(v.size() - 1)));
} else { } else {
@ -1159,7 +1159,7 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
private void removeHttpRepeat(List<ApiDefinitionWithBLOBs> data, Boolean fullCoverage, boolean urlRepeat, List<ApiDefinitionWithBLOBs> optionDatas) { private void removeHttpRepeat(List<ApiDefinitionWithBLOBs> data, Boolean fullCoverage, boolean urlRepeat, List<ApiDefinitionWithBLOBs> optionDatas) {
if (urlRepeat) { if (urlRepeat) {
LinkedHashMap<String, List<ApiDefinitionWithBLOBs>> methodPathMap = data.stream().collect(Collectors.groupingBy(t -> t.getName() + t.getMethod() + t.getPath() + (t.getModulePath() == null ? "" : t.getModulePath()), LinkedHashMap::new, Collectors.toList())); LinkedHashMap<String, List<ApiDefinitionWithBLOBs>> methodPathMap = data.stream().collect(Collectors.groupingBy(t -> t.getName() + t.getMethod() + t.getPath() + (t.getModulePath() == null ? StringUtils.EMPTY : t.getModulePath()), LinkedHashMap::new, Collectors.toList()));
if (fullCoverage) { if (fullCoverage) {
methodPathMap.forEach((k, v) -> optionDatas.add(v.get(v.size() - 1))); methodPathMap.forEach((k, v) -> optionDatas.add(v.get(v.size() - 1)));
} else { } else {

View File

@ -431,7 +431,7 @@ public class ApiTestCaseService {
test.setVersion(request.getVersion() == null ? 0 : request.getVersion() + 1); test.setVersion(request.getVersion() == null ? 0 : request.getVersion() + 1);
test.setVersionId(request.getVersionId()); test.setVersionId(request.getVersionId());
if (StringUtils.equals("[]", request.getTags())) { if (StringUtils.equals("[]", request.getTags())) {
test.setTags(""); test.setTags(StringUtils.EMPTY);
} else { } else {
test.setTags(request.getTags()); test.setTags(request.getTags());
} }
@ -474,7 +474,7 @@ public class ApiTestCaseService {
final ApiTestCaseWithBLOBs test = new ApiTestCaseWithBLOBs(); final ApiTestCaseWithBLOBs test = new ApiTestCaseWithBLOBs();
test.setId(request.getId()); test.setId(request.getId());
test.setName(request.getName()); test.setName(request.getName());
test.setStatus(""); test.setStatus(StringUtils.EMPTY);
test.setCaseStatus(request.getCaseStatus()); test.setCaseStatus(request.getCaseStatus());
if (StringUtils.isEmpty(request.getCaseStatus())) { if (StringUtils.isEmpty(request.getCaseStatus())) {
test.setCaseStatus(ApiTestDataStatus.UNDERWAY.getValue()); test.setCaseStatus(ApiTestDataStatus.UNDERWAY.getValue());
@ -492,7 +492,7 @@ public class ApiTestCaseService {
test.setOrder(ServiceUtils.getNextOrder(request.getProjectId(), extApiTestCaseMapper::getLastOrder)); test.setOrder(ServiceUtils.getNextOrder(request.getProjectId(), extApiTestCaseMapper::getLastOrder));
test.setVersionId(request.getVersionId()); test.setVersionId(request.getVersionId());
if (StringUtils.equals("[]", request.getTags())) { if (StringUtils.equals("[]", request.getTags())) {
test.setTags(""); test.setTags(StringUtils.EMPTY);
} else { } else {
test.setTags(request.getTags()); test.setTags(request.getTags());
} }

View File

@ -122,13 +122,13 @@ public class EsbApiParamService {
returnObj = JSONUtil.parseObject(requestString); returnObj = JSONUtil.parseObject(requestString);
JSONArray esbDataArray = JSONUtil.parseArray(esbParamBlobs.getDataStruct()); JSONArray esbDataArray = JSONUtil.parseArray(esbParamBlobs.getDataStruct());
if (esbDataArray == null) { if (esbDataArray == null) {
returnObj.put("esbDataStruct", ""); returnObj.put("esbDataStruct", StringUtils.EMPTY);
} else { } else {
returnObj.put("esbDataStruct", esbDataArray); returnObj.put("esbDataStruct", esbDataArray);
} }
JSONArray responseDataArray = JSONUtil.parseArray(esbParamBlobs.getResponseDataStruct()); JSONArray responseDataArray = JSONUtil.parseArray(esbParamBlobs.getResponseDataStruct());
if (responseDataArray == null) { if (responseDataArray == null) {
returnObj.put("backEsbDataStruct", ""); returnObj.put("backEsbDataStruct", StringUtils.EMPTY);
} else { } else {
returnObj.put("backEsbDataStruct", responseDataArray); returnObj.put("backEsbDataStruct", responseDataArray);
} }
@ -297,7 +297,7 @@ public class EsbApiParamService {
//通过报文模版中的变量参数解析报文数据结构生成对应的xml数据 //通过报文模版中的变量参数解析报文数据结构生成对应的xml数据
private String genValueFromEsbDataStructByParam(List<EsbDataStruct> dataStructRequestList, String param) { private String genValueFromEsbDataStructByParam(List<EsbDataStruct> dataStructRequestList, String param) {
String returnValue = ""; String returnValue = StringUtils.EMPTY;
if (StringUtils.isNotEmpty(param)) { if (StringUtils.isNotEmpty(param)) {
//多层结构使用"."来表示aaa.bb.cc 代表的是dataStructRequestList中aaa节点下bb节点下的cc节点数据 //多层结构使用"."来表示aaa.bb.cc 代表的是dataStructRequestList中aaa节点下bb节点下的cc节点数据
String[] paramArr = param.split("\\."); String[] paramArr = param.split("\\.");

View File

@ -245,7 +245,7 @@ public class TestPlanScenarioCaseService {
ScenarioEnv scenarioEnv = apiAutomationService.getApiScenarioProjectId(id); ScenarioEnv scenarioEnv = apiAutomationService.getApiScenarioProjectId(id);
list = new ArrayList<>(scenarioEnv.getProjectIds()); list = new ArrayList<>(scenarioEnv.getProjectIds());
} }
list.forEach(l -> newEnvMap.put(l, envMap == null ? "" : envMap.getOrDefault(l, ""))); list.forEach(l -> newEnvMap.put(l, envMap == null ? StringUtils.EMPTY : envMap.getOrDefault(l, StringUtils.EMPTY)));
TestPlanApiScenario testPlanApiScenario = new TestPlanApiScenario(); TestPlanApiScenario testPlanApiScenario = new TestPlanApiScenario();
testPlanApiScenario.setId(UUID.randomUUID().toString()); testPlanApiScenario.setId(UUID.randomUUID().toString());
testPlanApiScenario.setCreateUser(SessionUtils.getUserId()); testPlanApiScenario.setCreateUser(SessionUtils.getUserId());

View File

@ -272,7 +272,7 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
List<ApiScenarioDTO> apiScenarios = queryByModuleIds(request); List<ApiScenarioDTO> apiScenarios = queryByModuleIds(request);
apiScenarios.forEach(apiScenario -> { apiScenarios.forEach(apiScenario -> {
String modulePath = apiScenario.getModulePath(); String modulePath = apiScenario.getModulePath();
StringBuilder path = new StringBuilder(modulePath == null ? "" : modulePath); StringBuilder path = new StringBuilder(modulePath == null ? StringUtils.EMPTY : modulePath);
List<String> pathLists = Arrays.asList(path.toString().split("/")); List<String> pathLists = Arrays.asList(path.toString().split("/"));
if (pathLists.size() > request.getLevel()) { if (pathLists.size() > request.getLevel()) {
pathLists.set(request.getLevel(), request.getName()); pathLists.set(request.getLevel(), request.getName());
@ -380,7 +380,7 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
MSException.throwException(Translator.get("node_deep_limit")); MSException.throwException(Translator.get("node_deep_limit"));
} }
if (PropertyConstant.ROOT.equals(rootNode.getId())) { if (PropertyConstant.ROOT.equals(rootNode.getId())) {
rootPath = ""; rootPath = StringUtils.EMPTY;
} }
ApiScenarioModule apiScenarioModule = new ApiScenarioModule(); ApiScenarioModule apiScenarioModule = new ApiScenarioModule();
apiScenarioModule.setId(rootNode.getId()); apiScenarioModule.setId(rootNode.getId());
@ -527,7 +527,7 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
List<ApiScenarioWithBLOBs> optionData = new ArrayList<>(); List<ApiScenarioWithBLOBs> optionData = new ArrayList<>();
//覆盖模式留重复的最后一个不覆盖留第一个 //覆盖模式留重复的最后一个不覆盖留第一个
LinkedHashMap<String, List<ApiScenarioWithBLOBs>> nameModuleMapList = data.stream().collect(Collectors.groupingBy(t -> t.getName() + (t.getModulePath() == null ? "" : t.getModulePath()), LinkedHashMap::new, Collectors.toList())); LinkedHashMap<String, List<ApiScenarioWithBLOBs>> nameModuleMapList = data.stream().collect(Collectors.groupingBy(t -> t.getName() + (t.getModulePath() == null ? StringUtils.EMPTY : t.getModulePath()), LinkedHashMap::new, Collectors.toList()));
removeRepeatOrigin(fullCoverage, optionData, nameModuleMapList); removeRepeatOrigin(fullCoverage, optionData, nameModuleMapList);
//处理模块 //处理模块
@ -550,7 +550,7 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
repeatDataMap = repeatApiScenarioWithBLOBs.stream().filter(t -> t.getApiScenarioModuleId().equals(chooseModuleId)).collect(Collectors.toMap(t -> t.getName() + t.getModulePath(), scenario -> scenario)); repeatDataMap = repeatApiScenarioWithBLOBs.stream().filter(t -> t.getApiScenarioModuleId().equals(chooseModuleId)).collect(Collectors.toMap(t -> t.getName() + t.getModulePath(), scenario -> scenario));
} }
} else { } else {
nameModuleMap = optionData.stream().collect(Collectors.toMap(t -> t.getName() + (t.getModulePath() == null ? "" : t.getModulePath()), scenario -> scenario)); nameModuleMap = optionData.stream().collect(Collectors.toMap(t -> t.getName() + (t.getModulePath() == null ? StringUtils.EMPTY : t.getModulePath()), scenario -> scenario));
repeatDataMap = repeatApiScenarioWithBLOBs.stream().collect(Collectors.toMap(t -> t.getName() + t.getModulePath(), scenario -> scenario)); repeatDataMap = repeatApiScenarioWithBLOBs.stream().collect(Collectors.toMap(t -> t.getName() + t.getModulePath(), scenario -> scenario));
} }
//处理数据 //处理数据

View File

@ -216,7 +216,7 @@ public class ApiScenarioReportStructureService {
children.setAllIndex(dto.getAllIndex() + "_" + (children.getIndex() == 0 ? (i + 1) : children.getIndex())); children.setAllIndex(dto.getAllIndex() + "_" + (children.getIndex() == 0 ? (i + 1) : children.getIndex()));
children.setResourceId(resourceId + "_" + children.getAllIndex()); children.setResourceId(resourceId + "_" + children.getAllIndex());
} else { } else {
children.setAllIndex("" + (children.getIndex() == 0 ? (i + 1) : children.getIndex())); children.setAllIndex(StringUtils.EMPTY + (children.getIndex() == 0 ? (i + 1) : children.getIndex()));
children.setResourceId(resourceId + "_" + children.getAllIndex()); children.setResourceId(resourceId + "_" + children.getAllIndex());
} }
dto.getChildren().add(children); dto.getChildren().add(children);

View File

@ -211,7 +211,7 @@ public class ApiScenarioService {
if (MapUtils.isNotEmpty(request.getFilters()) if (MapUtils.isNotEmpty(request.getFilters())
&& request.getFilters().containsKey(ApiTestConstants.LAST_RESULT)) { && request.getFilters().containsKey(ApiTestConstants.LAST_RESULT)) {
if (request.getFilters().get(ApiTestConstants.LAST_RESULT) != null && request.getFilters().get(ApiTestConstants.LAST_RESULT).contains(ApiReportStatus.PENDING.name())) { if (request.getFilters().get(ApiTestConstants.LAST_RESULT) != null && request.getFilters().get(ApiTestConstants.LAST_RESULT).contains(ApiReportStatus.PENDING.name())) {
request.getFilters().get(ApiTestConstants.LAST_RESULT).add(""); request.getFilters().get(ApiTestConstants.LAST_RESULT).add(StringUtils.EMPTY);
} }
if (request.getFilters().get(ApiTestConstants.LAST_RESULT) != null && request.getFilters().get(ApiTestConstants.LAST_RESULT).contains(ApiTestConstants.FAKE_ERROR)) { if (request.getFilters().get(ApiTestConstants.LAST_RESULT) != null && request.getFilters().get(ApiTestConstants.LAST_RESULT).contains(ApiTestConstants.FAKE_ERROR)) {
request.getFilters().get(ApiTestConstants.LAST_RESULT).add(ApiReportStatus.FAKE_ERROR.name()); request.getFilters().get(ApiTestConstants.LAST_RESULT).add(ApiReportStatus.FAKE_ERROR.name());
@ -267,7 +267,7 @@ public class ApiScenarioService {
checkScenarioNum(request); checkScenarioNum(request);
final ApiScenarioWithBLOBs scenario = buildSaveScenario(request); final ApiScenarioWithBLOBs scenario = buildSaveScenario(request);
scenario.setVersion(0); scenario.setVersion(0);
scenario.setLastResult(""); scenario.setLastResult(StringUtils.EMPTY);
scenario.setCreateTime(System.currentTimeMillis()); scenario.setCreateTime(System.currentTimeMillis());
scenario.setNum(nextNum); scenario.setNum(nextNum);
scenario.setOrder(ServiceUtils.getNextOrder(scenario.getProjectId(), extApiScenarioMapper::getLastOrder)); scenario.setOrder(ServiceUtils.getNextOrder(scenario.getProjectId(), extApiScenarioMapper::getLastOrder));
@ -447,7 +447,7 @@ public class ApiScenarioService {
scenario.setProjectId(request.getProjectId()); scenario.setProjectId(request.getProjectId());
scenario.setCustomNum(request.getCustomNum()); scenario.setCustomNum(request.getCustomNum());
if (StringUtils.equals(request.getTags(), "[]")) { if (StringUtils.equals(request.getTags(), "[]")) {
scenario.setTags(""); scenario.setTags(StringUtils.EMPTY);
} else { } else {
scenario.setTags(request.getTags()); scenario.setTags(request.getTags());
} }
@ -644,7 +644,7 @@ public class ApiScenarioService {
checkNameExist(apiScenarioRequest, false); checkNameExist(apiScenarioRequest, false);
} }
if (StringUtils.isEmpty(moduleId)) { if (StringUtils.isEmpty(moduleId)) {
moduleId = ""; moduleId = StringUtils.EMPTY;
} }
if (nodeMap.containsKey(moduleId)) { if (nodeMap.containsKey(moduleId)) {
nodeMap.get(moduleId).add(api); nodeMap.get(moduleId).add(api);
@ -1037,7 +1037,7 @@ public class ApiScenarioService {
ScenarioToPerformanceInfoDTO returnDTO = new ScenarioToPerformanceInfoDTO(); ScenarioToPerformanceInfoDTO returnDTO = new ScenarioToPerformanceInfoDTO();
List<String> ids = request.getIds(); List<String> ids = request.getIds();
List<ApiScenarioDTO> apiScenarios = extApiScenarioMapper.selectIds(ids); List<ApiScenarioDTO> apiScenarios = extApiScenarioMapper.selectIds(ids);
String id = ""; String id = StringUtils.EMPTY;
if (!apiScenarios.isEmpty()) { if (!apiScenarios.isEmpty()) {
id = apiScenarios.get(0).getId(); id = apiScenarios.get(0).getId();
} }
@ -1239,7 +1239,7 @@ public class ApiScenarioService {
scenarioWithBLOBs.setUserId(request.getUserId()); scenarioWithBLOBs.setUserId(request.getUserId());
} }
scenarioWithBLOBs.setDescription(request.getDescription()); scenarioWithBLOBs.setDescription(request.getDescription());
scenarioWithBLOBs.setLastResult(""); scenarioWithBLOBs.setLastResult(StringUtils.EMPTY);
Boolean openCustomNum = apiTestImportRequest.getOpenCustomNum(); Boolean openCustomNum = apiTestImportRequest.getOpenCustomNum();
List<ApiScenario> list = new ArrayList<>(); List<ApiScenario> list = new ArrayList<>();

View File

@ -24,7 +24,7 @@ public class SystemParameterService {
public String getValue(String key) { public String getValue(String key) {
SystemParameter param = systemParameterMapper.selectByPrimaryKey(key); SystemParameter param = systemParameterMapper.selectByPrimaryKey(key);
if (param == null || StringUtils.isBlank(param.getParamValue())) { if (param == null || StringUtils.isBlank(param.getParamValue())) {
return ""; return StringUtils.EMPTY;
} }
return param.getParamValue(); return param.getParamValue();
} }

View File

@ -233,7 +233,7 @@ public class UserLoginService {
user.setLastProjectId(projects.get(0).getId()); user.setLastProjectId(projects.get(0).getId());
} }
} else { } else {
user.setLastProjectId(""); user.setLastProjectId(StringUtils.EMPTY);
} }
} }
// 执行变更 // 执行变更

View File

@ -82,7 +82,7 @@ public class Body {
} else { } else {
if (StringUtils.isNotEmpty(this.getRaw()) || this.getJsonSchema() != null) { if (StringUtils.isNotEmpty(this.getRaw()) || this.getJsonSchema() != null) {
parseJonBodyMock(); parseJonBodyMock();
KeyValue keyValue = new KeyValue("", "JSON-SCHEMA", this.getRaw(), true, true); KeyValue keyValue = new KeyValue(StringUtils.EMPTY, "JSON-SCHEMA", this.getRaw(), true, true);
sampler.setPostBodyRaw(true); sampler.setPostBodyRaw(true);
keyValue.setEnable(true); keyValue.setEnable(true);
keyValue.setUrlEncode(false); keyValue.setUrlEncode(false);
@ -163,7 +163,7 @@ public class Body {
if (StringUtils.isBlank(mimetype)) { if (StringUtils.isBlank(mimetype)) {
mimetype = ContentType.APPLICATION_OCTET_STREAM.getMimeType(); mimetype = ContentType.APPLICATION_OCTET_STREAM.getMimeType();
} }
list.add(new HTTPFileArg(path, isBinary ? "" : paramName, mimetype)); list.add(new HTTPFileArg(path, isBinary ? StringUtils.EMPTY : paramName, mimetype));
}); });
} }
} }
@ -181,9 +181,9 @@ public class Body {
} }
public void init() { public void init() {
this.type = ""; this.type = StringUtils.EMPTY;
this.raw = ""; this.raw = StringUtils.EMPTY;
this.format = ""; this.format = StringUtils.EMPTY;
} }
public void initKvs() { public void initKvs() {

View File

@ -55,7 +55,7 @@ public class KeyValue {
} }
public KeyValue(String name, String value, String description, boolean required) { public KeyValue(String name, String value, String description, boolean required) {
this(name, value, description, "", required); this(name, value, description, StringUtils.EMPTY, required);
} }
public boolean valueIsNotEmpty() { public boolean valueIsNotEmpty() {

View File

@ -141,19 +141,19 @@ public class FileRepositoryService {
} else if (StringUtils.equals(fileAssociation.getType(), FileAssociationType.CASE.name())) { } else if (StringUtils.equals(fileAssociation.getType(), FileAssociationType.CASE.name())) {
ApiTestCase testCase = apiCaseMap.get(fileAssociation.getSourceId()); ApiTestCase testCase = apiCaseMap.get(fileAssociation.getSourceId());
if (testCase != null) { if (testCase != null) {
caseId = testCase.getNum() == null ? "" : testCase.getNum().toString(); caseId = testCase.getNum() == null ? StringUtils.EMPTY : testCase.getNum().toString();
caseName = testCase.getName(); caseName = testCase.getName();
} }
} else if (StringUtils.equals(fileAssociation.getType(), FileAssociationType.SCENARIO.name())) { } else if (StringUtils.equals(fileAssociation.getType(), FileAssociationType.SCENARIO.name())) {
ApiScenario testCase = scenarioMap.get(fileAssociation.getSourceId()); ApiScenario testCase = scenarioMap.get(fileAssociation.getSourceId());
if (testCase != null) { if (testCase != null) {
caseId = testCase.getNum() == null ? "" : testCase.getNum().toString(); caseId = testCase.getNum() == null ? StringUtils.EMPTY : testCase.getNum().toString();
caseName = testCase.getName(); caseName = testCase.getName();
} }
} else if (StringUtils.equals(fileAssociation.getType(), "TEST_CASE")) { } else if (StringUtils.equals(fileAssociation.getType(), "TEST_CASE")) {
TestCase testCase = testCaseMap.get(fileAssociation.getSourceId()); TestCase testCase = testCaseMap.get(fileAssociation.getSourceId());
if (testCase != null) { if (testCase != null) {
caseId = testCase.getNum() == null ? "" : testCase.getNum().toString(); caseId = testCase.getNum() == null ? StringUtils.EMPTY : testCase.getNum().toString();
caseName = testCase.getName(); caseName = testCase.getName();
} }
} }
@ -166,7 +166,7 @@ public class FileRepositoryService {
for (LoadTestFileDTO loadTestFile : loadTestFileList) { for (LoadTestFileDTO loadTestFile : loadTestFileList) {
LoadTest loadTest = loadTestFile.getLoadTest(); LoadTest loadTest = loadTestFile.getLoadTest();
if (loadTest != null) { if (loadTest != null) {
FileRelevanceCaseDTO dto = new FileRelevanceCaseDTO(loadTestFile.getFileId(), loadTest.getNum() + "", loadTest.getName(), "LOAD_CASE" FileRelevanceCaseDTO dto = new FileRelevanceCaseDTO(loadTestFile.getFileId(), loadTest.getNum() + StringUtils.EMPTY, loadTest.getName(), "LOAD_CASE"
, fileCommitIdMap.get(loadTestFile.getFileId())); , fileCommitIdMap.get(loadTestFile.getFileId()));
list.add(dto); list.add(dto);
} }

View File

@ -407,7 +407,7 @@ public class IssueTemplateService extends TemplateBaseService {
options.removeIf(sourceOption -> StringUtils.contains(tarCustomField.getOptions(), sourceOption.getText().toString())); options.removeIf(sourceOption -> StringUtils.contains(tarCustomField.getOptions(), sourceOption.getText().toString()));
if (CollectionUtils.isNotEmpty(options)) { if (CollectionUtils.isNotEmpty(options)) {
optionsStr = JSON.toJSONString(options); optionsStr = JSON.toJSONString(options);
optionsStr = StringUtils.replace(tarCustomField.getOptions(), "]", ",") + StringUtils.replace(optionsStr, "[", ""); optionsStr = StringUtils.replace(tarCustomField.getOptions(), "]", ",") + StringUtils.replace(optionsStr, "[", StringUtils.EMPTY);
} else { } else {
optionsStr = tarCustomField.getOptions(); optionsStr = tarCustomField.getOptions();
} }
@ -434,7 +434,7 @@ public class IssueTemplateService extends TemplateBaseService {
if (sourceCustomFieldTemplate.getDefaultValue() != null && tarCustomField.getOptions().contains(sourceCustomFieldTemplate.getDefaultValue())) { if (sourceCustomFieldTemplate.getDefaultValue() != null && tarCustomField.getOptions().contains(sourceCustomFieldTemplate.getDefaultValue())) {
defaultValue = sourceCustomFieldTemplate.getDefaultValue(); defaultValue = sourceCustomFieldTemplate.getDefaultValue();
} else { } else {
defaultValue = ""; defaultValue = StringUtils.EMPTY;
} }
tarCustomFieldTemplate.setDefaultValue(defaultValue); tarCustomFieldTemplate.setDefaultValue(defaultValue);
customFieldTemplateRecords.add(tarCustomFieldTemplate); customFieldTemplateRecords.add(tarCustomFieldTemplate);