refactor: "" -> StringUtils.EMPTY
This commit is contained in:
parent
b350aaa281
commit
cdde929c6f
|
@ -22,7 +22,7 @@ public class ApiScenarioExportJmxDTO {
|
|||
private Map<String, List<String>> projectEnvMap;
|
||||
|
||||
public ApiScenarioExportJmxDTO(String name, String jmx) {
|
||||
this.name = StringUtils.replace(name, "/", "");
|
||||
this.name = StringUtils.replace(name, "/", StringUtils.EMPTY);
|
||||
this.jmx = jmx;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,59 +32,64 @@ public class EsbDataStruct {
|
|||
private boolean required;
|
||||
private String description;
|
||||
private List<EsbDataStruct> children;
|
||||
private String status = "";
|
||||
private String status = StringUtils.EMPTY;
|
||||
|
||||
public void init(){
|
||||
public void init() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
this.systemName = "";
|
||||
this.description = "";
|
||||
this.value="";
|
||||
this.systemName = StringUtils.EMPTY;
|
||||
this.description = StringUtils.EMPTY;
|
||||
this.value = StringUtils.EMPTY;
|
||||
this.required = true;
|
||||
this.contentType = "";
|
||||
this.type = "";
|
||||
this.contentType = StringUtils.EMPTY;
|
||||
this.type = StringUtils.EMPTY;
|
||||
this.children = new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean initDefaultData(String name, String typeLength,String chineseName,String desc){
|
||||
public boolean initDefaultData(String name, String typeLength, String chineseName, String desc) {
|
||||
this.init();
|
||||
if(StringUtils.isEmpty(name)){return false; }
|
||||
if(typeLength == null){
|
||||
typeLength = "";
|
||||
}else{
|
||||
if (StringUtils.isEmpty(name)) {
|
||||
return false;
|
||||
}
|
||||
if (typeLength == null) {
|
||||
typeLength = StringUtils.EMPTY;
|
||||
} else {
|
||||
typeLength = typeLength.trim();
|
||||
typeLength = typeLength.toLowerCase();
|
||||
}
|
||||
|
||||
this.name = name;
|
||||
|
||||
if(typeLength.startsWith(PropertyConstant.STRING)){
|
||||
if (typeLength.startsWith(PropertyConstant.STRING)) {
|
||||
this.type = PropertyConstant.STRING;
|
||||
String lengthStr = typeLength.substring(6);
|
||||
if(lengthStr.startsWith("(") && lengthStr.endsWith(")")){
|
||||
if (lengthStr.startsWith("(") && lengthStr.endsWith(")")) {
|
||||
try {
|
||||
int length = Integer.parseInt(lengthStr.substring(1,lengthStr.length()-1));
|
||||
int length = Integer.parseInt(lengthStr.substring(1, lengthStr.length() - 1));
|
||||
this.contentType = String.valueOf(length);
|
||||
}catch (Exception e){ }
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
}
|
||||
}else if(typeLength.startsWith(PropertyConstant.ARRAY)){
|
||||
} else if (typeLength.startsWith(PropertyConstant.ARRAY)) {
|
||||
this.type = PropertyConstant.ARRAY;
|
||||
}else{
|
||||
} else {
|
||||
this.type = PropertyConstant.OBJECT;
|
||||
}
|
||||
|
||||
if(StringUtils.isEmpty(desc)){desc = "";}
|
||||
if(StringUtils.isNotEmpty(chineseName)){
|
||||
this.description = chineseName+":"+desc;
|
||||
}else{
|
||||
this.description =desc;
|
||||
if (StringUtils.isEmpty(desc)) {
|
||||
desc = StringUtils.EMPTY;
|
||||
}
|
||||
if (StringUtils.isNotEmpty(chineseName)) {
|
||||
this.description = chineseName + ":" + desc;
|
||||
} else {
|
||||
this.description = desc;
|
||||
}
|
||||
|
||||
if(this.description.endsWith(":")){
|
||||
this.description = this.description.substring(0,this.description.length()-1);
|
||||
if (this.description.endsWith(":")) {
|
||||
this.description = this.description.substring(0, this.description.length() - 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public EsbDataStruct copy(boolean copyChildren) {
|
||||
|
@ -115,7 +120,7 @@ public class EsbDataStruct {
|
|||
try {
|
||||
element = document.addElement(this.name);
|
||||
if (StringUtils.equalsAnyIgnoreCase(type, PropertyConstant.STRING, PropertyConstant.ARRAY)) {
|
||||
String attrString = "";
|
||||
String attrString = StringUtils.EMPTY;
|
||||
if (StringUtils.equalsIgnoreCase(this.type, PropertyConstant.STRING)) {
|
||||
attrString = "s," + contentType;
|
||||
} else if (StringUtils.equalsIgnoreCase(this.type, PropertyConstant.ARRAY)) {
|
||||
|
@ -129,8 +134,8 @@ public class EsbDataStruct {
|
|||
|
||||
if (element != null) {
|
||||
if (this.children == null || this.children.isEmpty()) {
|
||||
if(this.value == null ){
|
||||
this.value = "";
|
||||
if (this.value == null) {
|
||||
this.value = StringUtils.EMPTY;
|
||||
}
|
||||
element.addText(this.value);
|
||||
} else {
|
||||
|
@ -153,7 +158,7 @@ public class EsbDataStruct {
|
|||
try {
|
||||
element = document.addElement(this.name);
|
||||
if (StringUtils.equalsAnyIgnoreCase(type, PropertyConstant.STRING, PropertyConstant.ARRAY)) {
|
||||
String attrString = "";
|
||||
String attrString = StringUtils.EMPTY;
|
||||
if (StringUtils.equalsIgnoreCase(this.type, PropertyConstant.STRING)) {
|
||||
attrString = "s," + contentType;
|
||||
} else if (StringUtils.equalsIgnoreCase(this.type, PropertyConstant.ARRAY)) {
|
||||
|
@ -179,14 +184,14 @@ public class EsbDataStruct {
|
|||
|
||||
public List<String> getNameDeep() {
|
||||
List<String> returnList = new ArrayList<>();
|
||||
if(StringUtils.isNotEmpty(this.name)){
|
||||
if (StringUtils.isNotEmpty(this.name)) {
|
||||
returnList.add(this.name);
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(this.children)){
|
||||
for (EsbDataStruct child :this.children) {
|
||||
if (CollectionUtils.isNotEmpty(this.children)) {
|
||||
for (EsbDataStruct child : this.children) {
|
||||
List<String> itemNameList = child.getNameDeep();
|
||||
for (String itemName :itemNameList) {
|
||||
if(!returnList.contains(itemName)){
|
||||
for (String itemName : itemNameList) {
|
||||
if (!returnList.contains(itemName)) {
|
||||
returnList.add(itemName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,16 +33,16 @@ public class TcpTreeTableDataStruct {
|
|||
private boolean required;
|
||||
private String description;
|
||||
private List<TcpTreeTableDataStruct> children;
|
||||
private String status = "";
|
||||
private String status = StringUtils.EMPTY;
|
||||
|
||||
public void init(){
|
||||
public void init() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
this.systemName = "";
|
||||
this.description = "";
|
||||
this.value="";
|
||||
this.systemName = StringUtils.EMPTY;
|
||||
this.description = StringUtils.EMPTY;
|
||||
this.value = StringUtils.EMPTY;
|
||||
this.required = true;
|
||||
this.contentType = "";
|
||||
this.type = "";
|
||||
this.contentType = StringUtils.EMPTY;
|
||||
this.type = StringUtils.EMPTY;
|
||||
this.children = new ArrayList<>();
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class TcpTreeTableDataStruct {
|
|||
try {
|
||||
element = document.addElement(this.name);
|
||||
if (StringUtils.equalsAnyIgnoreCase(type, PropertyConstant.STRING, PropertyConstant.ARRAY)) {
|
||||
String attrString = "";
|
||||
String attrString = StringUtils.EMPTY;
|
||||
if (StringUtils.equalsIgnoreCase(this.type, PropertyConstant.STRING)) {
|
||||
attrString = "s," + contentType;
|
||||
} else if (StringUtils.equalsIgnoreCase(this.type, PropertyConstant.ARRAY)) {
|
||||
|
@ -88,8 +88,8 @@ public class TcpTreeTableDataStruct {
|
|||
|
||||
if (element != null) {
|
||||
if (this.children == null || this.children.isEmpty()) {
|
||||
if(this.value == null ){
|
||||
this.value = "";
|
||||
if (this.value == null) {
|
||||
this.value = StringUtils.EMPTY;
|
||||
}
|
||||
element.addText(this.value);
|
||||
} else {
|
||||
|
@ -112,7 +112,7 @@ public class TcpTreeTableDataStruct {
|
|||
try {
|
||||
element = document.addElement(this.name);
|
||||
if (StringUtils.equalsAnyIgnoreCase(type, PropertyConstant.STRING, PropertyConstant.ARRAY)) {
|
||||
String attrString = "";
|
||||
String attrString = StringUtils.EMPTY;
|
||||
if (StringUtils.equalsIgnoreCase(this.type, PropertyConstant.STRING)) {
|
||||
attrString = "s," + contentType;
|
||||
} else if (StringUtils.equalsIgnoreCase(this.type, PropertyConstant.ARRAY)) {
|
||||
|
@ -126,9 +126,9 @@ public class TcpTreeTableDataStruct {
|
|||
|
||||
if (element != null) {
|
||||
if (this.children == null || this.children.isEmpty()) {
|
||||
if(this.value == null){
|
||||
element.addText("");
|
||||
}else {
|
||||
if (this.value == null) {
|
||||
element.addText(StringUtils.EMPTY);
|
||||
} else {
|
||||
element.addText(this.value);
|
||||
}
|
||||
} else {
|
||||
|
@ -142,14 +142,14 @@ public class TcpTreeTableDataStruct {
|
|||
|
||||
public List<String> getNameDeep() {
|
||||
List<String> returnList = new ArrayList<>();
|
||||
if(StringUtils.isNotEmpty(this.name)){
|
||||
if (StringUtils.isNotEmpty(this.name)) {
|
||||
returnList.add(this.name);
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(this.children)){
|
||||
for (TcpTreeTableDataStruct child :this.children) {
|
||||
if (CollectionUtils.isNotEmpty(this.children)) {
|
||||
for (TcpTreeTableDataStruct child : this.children) {
|
||||
List<String> itemNameList = child.getNameDeep();
|
||||
for (String itemName :itemNameList) {
|
||||
if(!returnList.contains(itemName)){
|
||||
for (String itemName : itemNameList) {
|
||||
if (!returnList.contains(itemName)) {
|
||||
returnList.add(itemName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package io.metersphere.api.dto.datacount;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
|
@ -11,8 +13,8 @@ public class ApiMethodUrlDTO {
|
|||
public String method;
|
||||
|
||||
public ApiMethodUrlDTO(String url, String method) {
|
||||
this.url = url == null ? "" : url;
|
||||
this.method = method == null ? "" : method;
|
||||
this.url = url == null ? StringUtils.EMPTY : url;
|
||||
this.method = method == null ? StringUtils.EMPTY : method;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -82,7 +82,7 @@ public class Body {
|
|||
} else {
|
||||
if (StringUtils.isNotEmpty(this.getRaw()) || this.getJsonSchema() != null) {
|
||||
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);
|
||||
keyValue.setEnable(true);
|
||||
keyValue.setUrlEncode(false);
|
||||
|
@ -166,7 +166,7 @@ public class Body {
|
|||
if (StringUtils.isBlank(mimetype)) {
|
||||
mimetype = ContentType.APPLICATION_OCTET_STREAM.getMimeType();
|
||||
}
|
||||
HTTPFileArg fileArg = new HTTPFileArg(path, isBinary ? "" : paramName, mimetype);
|
||||
HTTPFileArg fileArg = new HTTPFileArg(path, isBinary ? StringUtils.EMPTY : paramName, mimetype);
|
||||
fileArg.setProperty("isRef", isRef);
|
||||
fileArg.setProperty("fileId", fileId);
|
||||
list.add(fileArg);
|
||||
|
@ -187,9 +187,9 @@ public class Body {
|
|||
}
|
||||
|
||||
public void init() {
|
||||
this.type = "";
|
||||
this.raw = "";
|
||||
this.format = "";
|
||||
this.type = StringUtils.EMPTY;
|
||||
this.raw = StringUtils.EMPTY;
|
||||
this.format = StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
public void initKvs() {
|
||||
|
|
|
@ -55,7 +55,7 @@ public class KeyValue {
|
|||
}
|
||||
|
||||
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() {
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
package io.metersphere.api.dto.scenario;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@Data
|
||||
public class TCPConfig {
|
||||
private String classname = "";
|
||||
private String server = "";
|
||||
private String classname = StringUtils.EMPTY;
|
||||
private String server = StringUtils.EMPTY;
|
||||
private int port = 0;
|
||||
private String ctimeout = "";
|
||||
private String timeout = "";
|
||||
private String ctimeout = StringUtils.EMPTY;
|
||||
private String timeout = StringUtils.EMPTY;
|
||||
private boolean reUseConnection = true;
|
||||
private boolean nodelay;
|
||||
private boolean closeConnection;
|
||||
private String soLinger = "";
|
||||
private String eolByte = "";
|
||||
private String username = "";
|
||||
private String password = "";
|
||||
private String description = "";
|
||||
private String soLinger = StringUtils.EMPTY;
|
||||
private String eolByte = StringUtils.EMPTY;
|
||||
private String username = StringUtils.EMPTY;
|
||||
private String password = StringUtils.EMPTY;
|
||||
private String description = StringUtils.EMPTY;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public class EngineSourceParserFactory {
|
|||
List<Node> nodes = document.selectNodes("//text()[normalize-space(.)='']");
|
||||
nodes.forEach(node -> {
|
||||
if (node.getText().contains(StringUtils.LF)) {
|
||||
node.setText("");
|
||||
node.setText(StringUtils.EMPTY);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ public class JSONSchemaGenerator {
|
|||
|
||||
private static void analyzeProperty(JSONObject concept, String propertyName, JsonObject object) {
|
||||
if (object.has(PropertyConstant.TYPE)) {
|
||||
String propertyObjType = "";
|
||||
String propertyObjType = StringUtils.EMPTY;
|
||||
if (object.get(PropertyConstant.TYPE) instanceof JsonPrimitive) {
|
||||
propertyObjType = object.get(PropertyConstant.TYPE).getAsString();
|
||||
} else if (object.get(PropertyConstant.TYPE) instanceof JsonArray) {
|
||||
|
@ -94,11 +94,11 @@ public class JSONSchemaGenerator {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
concept.put(propertyName, "");
|
||||
concept.put(propertyName, StringUtils.EMPTY);
|
||||
}
|
||||
} else if (propertyObjType.equals(PropertyConstant.STRING)) {
|
||||
// 先设置空值
|
||||
concept.put(propertyName, "");
|
||||
concept.put(propertyName, StringUtils.EMPTY);
|
||||
if (object.has("format")) {
|
||||
String propertyFormat = object.get("format").getAsString();
|
||||
if (propertyFormat.equals("date-time")) {
|
||||
|
@ -158,7 +158,7 @@ public class JSONSchemaGenerator {
|
|||
try {
|
||||
if (StringUtils.isNotEmpty(value)) {
|
||||
if (value.indexOf("\"") != -1) {
|
||||
value = value.replaceAll("\"", "");
|
||||
value = value.replaceAll("\"", StringUtils.EMPTY);
|
||||
}
|
||||
concept.put(propertyName, Boolean.valueOf(value));
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ public class JSONSchemaGenerator {
|
|||
String value = ScriptEngineUtils.buildFunctionCallString(jsonObject.get(PropertyConstant.MOCK).getAsJsonObject().get(PropertyConstant.MOCK).getAsString());
|
||||
array.add(value);
|
||||
} else {
|
||||
array.add("");
|
||||
array.add(StringUtils.EMPTY);
|
||||
}
|
||||
} else if (jsonObject.has(PropertyConstant.TYPE) && jsonObject.get(PropertyConstant.TYPE).getAsString().equals(PropertyConstant.NUMBER)) {
|
||||
if (jsonObject.has(PropertyConstant.DEFAULT)) {
|
||||
|
@ -240,7 +240,7 @@ public class JSONSchemaGenerator {
|
|||
concept.put(propertyName, obj);
|
||||
analyzeObject(object, obj);
|
||||
} else if (StringUtils.equalsIgnoreCase(propertyObjType, "null")) {
|
||||
concept.put(propertyName, "");
|
||||
concept.put(propertyName, StringUtils.EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ public class JSONSchemaRunTest {
|
|||
String value = ScriptEngineUtils.buildFunctionCallString(object.get(PropertyConstant.MOCK).getAsJsonObject().get(PropertyConstant.MOCK).toString());
|
||||
if (StringUtils.isNotEmpty(value)) {
|
||||
if (value.indexOf("\"") != -1) {
|
||||
value = value.replaceAll("\"", "");
|
||||
value = value.replaceAll("\"", StringUtils.EMPTY);
|
||||
}
|
||||
if (isBoolean(value)) {
|
||||
concept.put(propertyName, Boolean.valueOf(value));
|
||||
|
@ -184,7 +184,7 @@ public class JSONSchemaRunTest {
|
|||
if (object.has(PropertyConstant.ITEMS)) {
|
||||
if (isMock(itemsObject)) {
|
||||
try {
|
||||
String type = "";
|
||||
String type = StringUtils.EMPTY;
|
||||
if (itemsObject.has(PropertyConstant.TYPE)) {
|
||||
type = itemsObject.get(PropertyConstant.TYPE).getAsString();
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ public class JSONSchemaRunTest {
|
|||
concept.put(propertyName, obj);
|
||||
analyzeObject(object, obj, map);
|
||||
} else if (StringUtils.equalsIgnoreCase(propertyObjType, "null")) {
|
||||
concept.put(propertyName, "");
|
||||
concept.put(propertyName, StringUtils.EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@ public class JSONSchemaRunTest {
|
|||
} catch (Exception e) {
|
||||
return object.get(PropertyConstant.MOCK).getAsJsonObject().get(PropertyConstant.MOCK);
|
||||
}
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
private static void analyzeDefinitions(JsonObject object, Map<String, String> map) {
|
||||
|
|
|
@ -78,7 +78,7 @@ public class ExecThreadPoolExecutor {
|
|||
* 保留两位小数
|
||||
*/
|
||||
private String divide(int num1, int num2) {
|
||||
return String.format("%1.2f%%", Double.parseDouble(num1 + "") / Double.parseDouble(num2 + "") * 100);
|
||||
return String.format("%1.2f%%", Double.parseDouble(num1 + StringUtils.EMPTY) / Double.parseDouble(num2 + StringUtils.EMPTY) * 100);
|
||||
}
|
||||
|
||||
public void outApiThreadPoolExecutorLogger(String message) {
|
||||
|
|
|
@ -106,7 +106,7 @@ public class ESBParser extends EsbAbstractParser {
|
|||
style.setBorderRight(BorderStyle.THIN);
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
|
||||
String name = "";
|
||||
String name = StringUtils.EMPTY;
|
||||
if (colorIndex == IndexedColors.LIGHT_GREEN.getIndex()) {
|
||||
style.setFillForegroundColor(new XSSFColor(new java.awt.Color(204, 255, 204), null));
|
||||
name = "green";
|
||||
|
@ -155,78 +155,47 @@ public class ESBParser extends EsbAbstractParser {
|
|||
XSSFRow row1 = sheet.createRow(0);
|
||||
setCellValue("交易码", row1.createCell(0), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("交易名称", row1.createCell(1), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row1.createCell(2), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row1.createCell(3), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row1.createCell(2), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row1.createCell(3), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// if (isHead) {
|
||||
setCellValue("", row1.createCell(4), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row1.createCell(4), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("服务名称", row1.createCell(5), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("服务场景", row1.createCell(6), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row1.createCell(7), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row1.createCell(8), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row1.createCell(9), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
|
||||
// } else {
|
||||
// setCellValue("", row1.createCell(4), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row1.createCell(5), font, cellStyleMap.get("pop"));
|
||||
// setCellValue("服务名称", row1.createCell(6), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("服务场景", row1.createCell(7), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row1.createCell(8), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row1.createCell(9), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row1.createCell(10), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// }
|
||||
setCellValue(StringUtils.EMPTY, row1.createCell(7), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row1.createCell(8), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row1.createCell(9), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
|
||||
|
||||
XSSFRow row2 = sheet.createRow(1);
|
||||
setCellValue("请输入交易码(必填)", row2.createCell(0), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("请输入交易名称(必填)", row2.createCell(1), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row2.createCell(2), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row2.createCell(3), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row2.createCell(2), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row2.createCell(3), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// if (isHead) {
|
||||
setCellValue("", row2.createCell(4), font, cellStyleMap.get("pop"));
|
||||
setCellValue(StringUtils.EMPTY, row2.createCell(4), font, cellStyleMap.get("pop"));
|
||||
setCellValue("请输入服务名称(如果不填,则以交易名称为主)", row2.createCell(5), font, null);
|
||||
setCellValue("请输入服务场景(选填)", row2.createCell(6), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row2.createCell(7), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row2.createCell(8), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row2.createCell(9), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// } else {
|
||||
// setCellValue("", row2.createCell(4), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row2.createCell(5), font, cellStyleMap.get("pop"));
|
||||
// setCellValue("请输入服务名称(如果不填,则以交易名称为主)", row2.createCell(6), font, null);
|
||||
// setCellValue("请输入服务场景(选填)", row2.createCell(7), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row2.createCell(8), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row2.createCell(9), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row2.createCell(10), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// }
|
||||
setCellValue(StringUtils.EMPTY, row2.createCell(7), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row2.createCell(8), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row2.createCell(9), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
|
||||
|
||||
XSSFRow row3 = sheet.createRow(2);
|
||||
setCellValue("", row3.createCell(0), font, cellStyleMap.get("yellow"));
|
||||
setCellValue("", row3.createCell(1), font, cellStyleMap.get("yellow"));
|
||||
setCellValue("", row3.createCell(2), font, cellStyleMap.get("yellow"));
|
||||
setCellValue("", row3.createCell(3), font, cellStyleMap.get("yellow"));
|
||||
setCellValue(StringUtils.EMPTY, row3.createCell(0), font, cellStyleMap.get("yellow"));
|
||||
setCellValue(StringUtils.EMPTY, row3.createCell(1), font, cellStyleMap.get("yellow"));
|
||||
setCellValue(StringUtils.EMPTY, row3.createCell(2), font, cellStyleMap.get("yellow"));
|
||||
setCellValue(StringUtils.EMPTY, row3.createCell(3), font, cellStyleMap.get("yellow"));
|
||||
// if (isHead) {
|
||||
setCellValue("", row3.createCell(4), font, cellStyleMap.get("yellow"));
|
||||
setCellValue(StringUtils.EMPTY, row3.createCell(4), font, cellStyleMap.get("yellow"));
|
||||
setCellValue("请输入系统名称", row3.createCell(5), font, cellStyleMap.get("yellow"));
|
||||
setCellValue("", row3.createCell(6), font, cellStyleMap.get("yellow"));
|
||||
setCellValue("", row3.createCell(7), font, cellStyleMap.get("yellow"));
|
||||
setCellValue("", row3.createCell(8), font, cellStyleMap.get("yellow"));
|
||||
setCellValue("", row3.createCell(9), font, cellStyleMap.get("yellow"));
|
||||
setCellValue(StringUtils.EMPTY, row3.createCell(6), font, cellStyleMap.get("yellow"));
|
||||
setCellValue(StringUtils.EMPTY, row3.createCell(7), font, cellStyleMap.get("yellow"));
|
||||
setCellValue(StringUtils.EMPTY, row3.createCell(8), font, cellStyleMap.get("yellow"));
|
||||
setCellValue(StringUtils.EMPTY, row3.createCell(9), font, cellStyleMap.get("yellow"));
|
||||
CellRangeAddress region1 = new CellRangeAddress(2, 2, 0, 3);
|
||||
sheet.addMergedRegion(region1);
|
||||
CellRangeAddress region2 = new CellRangeAddress(2, 2, 5, 9);
|
||||
sheet.addMergedRegion(region2);
|
||||
// } else {
|
||||
// setCellValue("", row3.createCell(4), font, cellStyleMap.get("yellow"));
|
||||
// setCellValue("", row3.createCell(5), font, cellStyleMap.get("yellow"));
|
||||
// setCellValue("请输入系统名称", row3.createCell(6), font, cellStyleMap.get("yellow"));
|
||||
// setCellValue("", row3.createCell(7), font, cellStyleMap.get("yellow"));
|
||||
// setCellValue("", row3.createCell(8), font, cellStyleMap.get("yellow"));
|
||||
// setCellValue("", row3.createCell(9), font, cellStyleMap.get("yellow"));
|
||||
// setCellValue("", row3.createCell(10), font, cellStyleMap.get("yellow"));
|
||||
// CellRangeAddress region1 = new CellRangeAddress(2, 2, 0, 4);
|
||||
// sheet.addMergedRegion(region1);
|
||||
// CellRangeAddress region2 = new CellRangeAddress(2, 2, 6, 10);
|
||||
// sheet.addMergedRegion(region2);
|
||||
// }
|
||||
|
||||
XSSFRow row4 = sheet.createRow(3);
|
||||
setCellValue("英文名称", row4.createCell(0), font, cellStyleMap.get("yellow"));
|
||||
|
@ -234,121 +203,78 @@ public class ESBParser extends EsbAbstractParser {
|
|||
setCellValue("数据类型/长度", row4.createCell(2), font, cellStyleMap.get("yellow"));
|
||||
// if (isHead) {
|
||||
setCellValue("备注", row4.createCell(3), font, cellStyleMap.get("yellow"));
|
||||
setCellValue("", row4.createCell(4), font, cellStyleMap.get("pop"));
|
||||
setCellValue(StringUtils.EMPTY, row4.createCell(4), font, cellStyleMap.get("pop"));
|
||||
setCellValue("英文名称", row4.createCell(5), font, cellStyleMap.get("yellow"));
|
||||
setCellValue("数据类型/长度", row4.createCell(6), font, cellStyleMap.get("yellow"));
|
||||
setCellValue("中文名称", row4.createCell(7), font, cellStyleMap.get("yellow"));
|
||||
setCellValue("备注", row4.createCell(8), font, cellStyleMap.get("yellow"));
|
||||
setCellValue("所在报文位置", row4.createCell(9), font, cellStyleMap.get("yellow"));
|
||||
// } else {
|
||||
// setCellValue("是否必输", row4.createCell(3), font, cellStyleMap.get("yellow"));
|
||||
// setCellValue("备注", row4.createCell(4), font, cellStyleMap.get("yellow"));
|
||||
// setCellValue("", row4.createCell(5), font, cellStyleMap.get("pop"));
|
||||
// setCellValue("英文名称", row4.createCell(6), font, cellStyleMap.get("yellow"));
|
||||
// setCellValue("数据类型/长度", row4.createCell(7), font, cellStyleMap.get("yellow"));
|
||||
// setCellValue("中文名称", row4.createCell(8), font, cellStyleMap.get("yellow"));
|
||||
// setCellValue("备注", row4.createCell(9), font, cellStyleMap.get("yellow"));
|
||||
// setCellValue("所在报文位置", row4.createCell(10), font, cellStyleMap.get("yellow"));
|
||||
// }
|
||||
|
||||
XSSFRow row5 = sheet.createRow(4);
|
||||
setCellValue("输入", row5.createCell(0), font, cellStyleMap.get("green"));
|
||||
setCellValue("", row5.createCell(1), font, cellStyleMap.get("green"));
|
||||
setCellValue("", row5.createCell(2), font, cellStyleMap.get("green"));
|
||||
setCellValue("", row5.createCell(3), font, cellStyleMap.get("green"));
|
||||
setCellValue("", row5.createCell(4), font, cellStyleMap.get("green"));
|
||||
setCellValue("", row5.createCell(5), font, cellStyleMap.get("green"));
|
||||
setCellValue("", row5.createCell(6), font, cellStyleMap.get("green"));
|
||||
setCellValue("", row5.createCell(7), font, cellStyleMap.get("green"));
|
||||
setCellValue("", row5.createCell(8), font, cellStyleMap.get("green"));
|
||||
setCellValue("", row5.createCell(9), font, cellStyleMap.get("green"));
|
||||
// if (!isHead) {
|
||||
// setCellValue("", row5.createCell(10), font, cellStyleMap.get("green"));
|
||||
// }
|
||||
setCellValue(StringUtils.EMPTY, row5.createCell(1), font, cellStyleMap.get("green"));
|
||||
setCellValue(StringUtils.EMPTY, row5.createCell(2), font, cellStyleMap.get("green"));
|
||||
setCellValue(StringUtils.EMPTY, row5.createCell(3), font, cellStyleMap.get("green"));
|
||||
setCellValue(StringUtils.EMPTY, row5.createCell(4), font, cellStyleMap.get("green"));
|
||||
setCellValue(StringUtils.EMPTY, row5.createCell(5), font, cellStyleMap.get("green"));
|
||||
setCellValue(StringUtils.EMPTY, row5.createCell(6), font, cellStyleMap.get("green"));
|
||||
setCellValue(StringUtils.EMPTY, row5.createCell(7), font, cellStyleMap.get("green"));
|
||||
setCellValue(StringUtils.EMPTY, row5.createCell(8), font, cellStyleMap.get("green"));
|
||||
setCellValue(StringUtils.EMPTY, row5.createCell(9), font, cellStyleMap.get("green"));
|
||||
|
||||
XSSFRow row6 = sheet.createRow(5);
|
||||
setCellValue("", row6.createCell(0), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row6.createCell(1), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row6.createCell(0), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row6.createCell(1), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("请输入STRING(具体长度) 或 ARRAY", row6.createCell(2), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row6.createCell(3), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row6.createCell(3), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// if (isHead) {
|
||||
setCellValue("", row6.createCell(4), font, cellStyleMap.get("pop"));
|
||||
setCellValue("", row6.createCell(5), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row6.createCell(4), font, cellStyleMap.get("pop"));
|
||||
setCellValue(StringUtils.EMPTY, row6.createCell(5), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("请输入STRING(具体长度) 或 ARRAY", row6.createCell(6), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row6.createCell(7), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row6.createCell(8), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row6.createCell(9), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// } else {
|
||||
// setCellValue("", row6.createCell(4), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row6.createCell(5), font, cellStyleMap.get("pop"));
|
||||
// setCellValue("", row6.createCell(6), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("请输入STRING(具体长度) 或 ARRAY", row6.createCell(7), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row6.createCell(8), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row6.createCell(9), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row6.createCell(10), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// }
|
||||
setCellValue(StringUtils.EMPTY, row6.createCell(7), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row6.createCell(8), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row6.createCell(9), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
|
||||
|
||||
|
||||
XSSFRow row7 = sheet.createRow(6);
|
||||
setCellValue("", row7.createCell(1), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row7.createCell(2), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row7.createCell(3), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row7.createCell(1), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row7.createCell(2), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row7.createCell(3), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// if (isHead) {
|
||||
setCellValue("", row7.createCell(4), font, cellStyleMap.get("pop"));
|
||||
setCellValue("", row7.createCell(5), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row7.createCell(6), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row7.createCell(7), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row7.createCell(8), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row7.createCell(9), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// } else {
|
||||
// setCellValue("", row7.createCell(4), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row7.createCell(5), font, cellStyleMap.get("pop"));
|
||||
// setCellValue("", row7.createCell(6), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row7.createCell(7), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row7.createCell(8), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row7.createCell(9), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row7.createCell(10), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// }
|
||||
setCellValue(StringUtils.EMPTY, row7.createCell(4), font, cellStyleMap.get("pop"));
|
||||
setCellValue(StringUtils.EMPTY, row7.createCell(5), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row7.createCell(6), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row7.createCell(7), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row7.createCell(8), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row7.createCell(9), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
|
||||
|
||||
XSSFRow row8 = sheet.createRow(7);
|
||||
setCellValue("输出", row8.createCell(0), font, cellStyleMap.get("green"));
|
||||
setCellValue("", row8.createCell(1), font, cellStyleMap.get("green"));
|
||||
setCellValue("", row8.createCell(2), font, cellStyleMap.get("green"));
|
||||
setCellValue("", row8.createCell(3), font, cellStyleMap.get("green"));
|
||||
setCellValue("", row8.createCell(4), font, cellStyleMap.get("green"));
|
||||
setCellValue("", row8.createCell(5), font, cellStyleMap.get("green"));
|
||||
setCellValue("", row8.createCell(6), font, cellStyleMap.get("green"));
|
||||
setCellValue("", row8.createCell(7), font, cellStyleMap.get("green"));
|
||||
setCellValue("", row8.createCell(8), font, cellStyleMap.get("green"));
|
||||
setCellValue("", row8.createCell(9), font, cellStyleMap.get("green"));
|
||||
// if (!isHead) {
|
||||
// setCellValue("", row8.createCell(10), font, cellStyleMap.get("green"));
|
||||
// }
|
||||
setCellValue(StringUtils.EMPTY, row8.createCell(1), font, cellStyleMap.get("green"));
|
||||
setCellValue(StringUtils.EMPTY, row8.createCell(2), font, cellStyleMap.get("green"));
|
||||
setCellValue(StringUtils.EMPTY, row8.createCell(3), font, cellStyleMap.get("green"));
|
||||
setCellValue(StringUtils.EMPTY, row8.createCell(4), font, cellStyleMap.get("green"));
|
||||
setCellValue(StringUtils.EMPTY, row8.createCell(5), font, cellStyleMap.get("green"));
|
||||
setCellValue(StringUtils.EMPTY, row8.createCell(6), font, cellStyleMap.get("green"));
|
||||
setCellValue(StringUtils.EMPTY, row8.createCell(7), font, cellStyleMap.get("green"));
|
||||
setCellValue(StringUtils.EMPTY, row8.createCell(8), font, cellStyleMap.get("green"));
|
||||
setCellValue(StringUtils.EMPTY, row8.createCell(9), font, cellStyleMap.get("green"));
|
||||
|
||||
|
||||
XSSFRow row9 = sheet.createRow(8);
|
||||
setCellValue("", row9.createCell(0), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row9.createCell(1), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row9.createCell(0), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row9.createCell(1), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("请输入STRING(具体长度) 或 ARRAY", row9.createCell(2), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row9.createCell(3), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row9.createCell(3), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// if (isHead) {
|
||||
setCellValue("", row9.createCell(4), font, cellStyleMap.get("pop"));
|
||||
setCellValue("", row9.createCell(5), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row9.createCell(4), font, cellStyleMap.get("pop"));
|
||||
setCellValue(StringUtils.EMPTY, row9.createCell(5), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("请输入STRING(具体长度) 或 ARRAY", row9.createCell(6), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row9.createCell(7), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row9.createCell(8), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue("", row9.createCell(9), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// } else {
|
||||
// setCellValue("", row9.createCell(4), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row9.createCell(5), font, cellStyleMap.get("pop"));
|
||||
// setCellValue("", row9.createCell(6), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("请输入STRING(具体长度) 或 ARRAY", row9.createCell(7), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row9.createCell(7), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row9.createCell(8), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row9.createCell(9), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// setCellValue("", row9.createCell(10), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
// }
|
||||
setCellValue(StringUtils.EMPTY, row9.createCell(7), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row9.createCell(8), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
setCellValue(StringUtils.EMPTY, row9.createCell(9), font, cellStyleMap.get(PropertyConstant.DEFAULT));
|
||||
|
||||
}
|
||||
|
||||
|
@ -494,20 +420,20 @@ public class ESBParser extends EsbAbstractParser {
|
|||
if (cell != null) {
|
||||
returnArray.add(getCellValue(cell));
|
||||
} else {
|
||||
returnArray.add("");
|
||||
returnArray.add(StringUtils.EMPTY);
|
||||
}
|
||||
}
|
||||
return returnArray;
|
||||
}
|
||||
|
||||
private String getCellValue(Cell cell) {
|
||||
String returnCellValue = "";
|
||||
String returnCellValue = StringUtils.EMPTY;
|
||||
if (cell.getCellType() == CellType.BLANK) {
|
||||
returnCellValue = "";
|
||||
returnCellValue = StringUtils.EMPTY;
|
||||
} else if (cell.getCellType() == CellType.BOOLEAN) {
|
||||
returnCellValue = String.valueOf(cell.getBooleanCellValue());
|
||||
} else if (cell.getCellType() == CellType.ERROR) {
|
||||
returnCellValue = "";
|
||||
returnCellValue = StringUtils.EMPTY;
|
||||
} else if (cell.getCellType() == CellType.NUMERIC) {
|
||||
returnCellValue = getValueOfNumericCell(cell);
|
||||
} else if (cell.getCellType() == CellType.FORMULA) {
|
||||
|
@ -525,7 +451,7 @@ public class ESBParser extends EsbAbstractParser {
|
|||
returnCellValue = cell.getRichStringCellValue().getString();
|
||||
}
|
||||
if (returnCellValue == null) {
|
||||
returnCellValue = "";
|
||||
returnCellValue = StringUtils.EMPTY;
|
||||
}
|
||||
return returnCellValue;
|
||||
}
|
||||
|
@ -563,7 +489,7 @@ public class ESBParser extends EsbAbstractParser {
|
|||
Pattern p = Pattern.compile(".0$");
|
||||
java.util.regex.Matcher m = p.matcher(doubleStr);
|
||||
if (m.find()) {
|
||||
doubleStr = doubleStr.replace(".0", "");
|
||||
doubleStr = doubleStr.replace(".0", StringUtils.EMPTY);
|
||||
}
|
||||
}
|
||||
return doubleStr;
|
||||
|
@ -752,7 +678,7 @@ public class ESBParser extends EsbAbstractParser {
|
|||
}
|
||||
|
||||
private String getDefaultStringValue(String val) {
|
||||
return StringUtils.isBlank(val) ? "" : val;
|
||||
return StringUtils.isBlank(val) ? StringUtils.EMPTY : val;
|
||||
}
|
||||
|
||||
private ESBExcelSheetInfo getEsbExcelSheetInfo(Sheet sheet) {
|
||||
|
|
|
@ -95,7 +95,7 @@ public class HarParser extends HarAbstractParser {
|
|||
}
|
||||
|
||||
//默认取路径的最后一块
|
||||
String reqName = "";
|
||||
String reqName = StringUtils.EMPTY;
|
||||
if (harRequest.url != null) {
|
||||
String[] nameArr = url.split("/");
|
||||
reqName = nameArr[nameArr.length - 1];
|
||||
|
@ -110,17 +110,6 @@ public class HarParser extends HarAbstractParser {
|
|||
addBodyHeader(request);
|
||||
apiDefinition.setRequest(JSON.toJSONString(request));
|
||||
apiDefinition.setResponse(JSON.toJSONString(parseResponse(entry.response)));
|
||||
/*if (selectModule == null) {
|
||||
apiDefinition.setModuleId("default-module");
|
||||
|
||||
} else {
|
||||
apiDefinition.setModuleId(selectModule.getId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(selectModulePath)) {
|
||||
apiDefinition.setModulePath(selectModulePath);
|
||||
} else {
|
||||
apiDefinition.setModulePath("/未规划接口");
|
||||
}*/
|
||||
results.add(apiDefinition);
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +134,7 @@ public class HarParser extends HarAbstractParser {
|
|||
|
||||
|
||||
private String getDefaultStringValue(String val) {
|
||||
return StringUtils.isBlank(val) ? "" : val;
|
||||
return StringUtils.isBlank(val) ? StringUtils.EMPTY : val;
|
||||
}
|
||||
|
||||
private void parseCookieParameters(HarCookie harCookie, List<KeyValue> headers) {
|
||||
|
@ -153,7 +142,7 @@ public class HarParser extends HarAbstractParser {
|
|||
}
|
||||
|
||||
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 HttpResponse parseResponse(HarResponse response) {
|
||||
|
|
|
@ -579,14 +579,14 @@ public class JmeterDefinitionParser extends ApiImportAbstractParser<ApiDefinitio
|
|||
msTCPSampler.setName(tcpSampler.getName());
|
||||
msTCPSampler.setType("TCPSampler");
|
||||
msTCPSampler.setServer(tcpSampler.getServer());
|
||||
msTCPSampler.setPort(tcpSampler.getPort() + "");
|
||||
msTCPSampler.setCtimeout(tcpSampler.getConnectTimeout() + "");
|
||||
msTCPSampler.setPort(tcpSampler.getPort() + StringUtils.EMPTY);
|
||||
msTCPSampler.setCtimeout(tcpSampler.getConnectTimeout() + StringUtils.EMPTY);
|
||||
msTCPSampler.setClassname(tcpSampler.getProperty(TCPSampler.CLASSNAME).getStringValue());
|
||||
msTCPSampler.setReUseConnection(tcpSampler.getProperty(TCPSampler.RE_USE_CONNECTION).getBooleanValue());
|
||||
msTCPSampler.setNodelay(tcpSampler.getProperty(TCPSampler.NODELAY).getBooleanValue());
|
||||
msTCPSampler.setCloseConnection(tcpSampler.isCloseConnection());
|
||||
msTCPSampler.setSoLinger(tcpSampler.getSoLinger() + "");
|
||||
msTCPSampler.setEolByte(tcpSampler.getEolByte() + "");
|
||||
msTCPSampler.setSoLinger(tcpSampler.getSoLinger() + StringUtils.EMPTY);
|
||||
msTCPSampler.setEolByte(tcpSampler.getEolByte() + StringUtils.EMPTY);
|
||||
msTCPSampler.setRequest(tcpSampler.getRequestData());
|
||||
msTCPSampler.setUsername(tcpSampler.getProperty(ConfigTestElement.USERNAME).getStringValue());
|
||||
msTCPSampler.setPassword(tcpSampler.getProperty(ConfigTestElement.PASSWORD).getStringValue());
|
||||
|
@ -738,8 +738,8 @@ public class JmeterDefinitionParser extends ApiImportAbstractParser<ApiDefinitio
|
|||
samplerProxy.getBody().setKvs(keyValues);
|
||||
}
|
||||
samplerProxy.setProtocol(RequestTypeConstants.HTTP);
|
||||
samplerProxy.setConnectTimeout(source.getConnectTimeout() + "");
|
||||
samplerProxy.setResponseTimeout(source.getResponseTimeout() + "");
|
||||
samplerProxy.setConnectTimeout(source.getConnectTimeout() + StringUtils.EMPTY);
|
||||
samplerProxy.setResponseTimeout(source.getResponseTimeout() + StringUtils.EMPTY);
|
||||
samplerProxy.setPort(source.getPropertyAsString("HTTPSampler.port"));
|
||||
String bodyType = this.getBodyType(samplerProxy.getHeaders());
|
||||
if (source.getArguments() != null) {
|
||||
|
|
|
@ -111,7 +111,7 @@ public class MsDefinitionParser extends MsAbstractParser<ApiDefinitionImport> {
|
|||
requestObj.put("path", path);
|
||||
}
|
||||
}
|
||||
requestObj.put("url", "");
|
||||
requestObj.put("url", StringUtils.EMPTY);
|
||||
apiDefinition.setRequest(requestObj.toString());
|
||||
}
|
||||
apiDefinition.setCreateUser(SessionUtils.getUserId());
|
||||
|
@ -152,8 +152,8 @@ public class MsDefinitionParser extends MsAbstractParser<ApiDefinitionImport> {
|
|||
return null;
|
||||
}
|
||||
JSONObject requestObj = JSONUtil.parseObject(request);
|
||||
requestObj.put("useEnvironment", "");
|
||||
requestObj.put("environmentId", "");
|
||||
requestObj.put("useEnvironment", StringUtils.EMPTY);
|
||||
requestObj.put("environmentId", StringUtils.EMPTY);
|
||||
requestObj.put("projectId", projectId);
|
||||
return requestObj;
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -36,7 +36,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||
@Override
|
||||
public ApiDefinitionImport parse(InputStream source, ApiTestImportRequest request) {
|
||||
Swagger swagger = null;
|
||||
String sourceStr = "";
|
||||
String sourceStr = StringUtils.EMPTY;
|
||||
List<AuthorizationValue> auths = setAuths(request);
|
||||
if (StringUtils.isNotBlank(request.getSwaggerUrl())) {
|
||||
try {
|
||||
|
@ -164,7 +164,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||
|
||||
private String getModulePath(List<String> tagTree, StringBuilder modulePath) {
|
||||
if (tagTree == null) {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
for (String s : tagTree) {
|
||||
if (s.contains("/")) {
|
||||
|
@ -182,7 +182,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||
}
|
||||
|
||||
private ApiDefinitionWithBLOBs buildApiDefinition(String id, Operation operation, String path, String method, ApiTestImportRequest importRequest) {
|
||||
String name = "";
|
||||
String name = StringUtils.EMPTY;
|
||||
if (StringUtils.isNotBlank(operation.getSummary())) {
|
||||
name = operation.getSummary();
|
||||
} else if (StringUtils.isNotBlank(operation.getOperationId())) {
|
||||
|
@ -194,7 +194,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||
}
|
||||
|
||||
private MsHTTPSamplerProxy buildRequest(Operation operation, String path, String method) {
|
||||
String name = "";
|
||||
String name = StringUtils.EMPTY;
|
||||
if (StringUtils.isNotBlank(operation.getSummary())) {
|
||||
name = operation.getSummary();
|
||||
} else {
|
||||
|
@ -262,11 +262,11 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||
if (parameter.getDefault() != null) {
|
||||
return getDefaultStringValue(parameter.getDefault().toString());
|
||||
}
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
private String getDefaultStringValue(String val) {
|
||||
return StringUtils.isBlank(val) ? "" : val;
|
||||
return StringUtils.isBlank(val) ? StringUtils.EMPTY : val;
|
||||
}
|
||||
|
||||
private void parseCookieParameters(Parameter parameter, List<KeyValue> headers) {
|
||||
|
@ -277,7 +277,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||
private void parseHeaderParameters(Parameter parameter, List<KeyValue> headers) {
|
||||
HeaderParameter headerParameter = (HeaderParameter) parameter;
|
||||
addHeader(headers, headerParameter.getName(), getDefaultValue(headerParameter), getDefaultStringValue(headerParameter.getDescription()),
|
||||
"", parameter.getRequired());
|
||||
StringUtils.EMPTY, parameter.getRequired());
|
||||
}
|
||||
|
||||
private HttpResponse parseResponse(Operation operation, Map<String, Response> responses) {
|
||||
|
@ -391,7 +391,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||
if (property.getExample() != null) {
|
||||
item.getMock().put(PropertyConstant.MOCK, property.getExample());
|
||||
} else {
|
||||
item.getMock().put(PropertyConstant.MOCK, "");
|
||||
item.getMock().put(PropertyConstant.MOCK, StringUtils.EMPTY);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||
Map<String, Property> headers = response.getHeaders();
|
||||
if (headers != null) {
|
||||
headers.forEach((k, v) -> {
|
||||
msHeaders.add(new KeyValue(k, "", v.getDescription()));
|
||||
msHeaders.add(new KeyValue(k, StringUtils.EMPTY, v.getDescription()));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||
if (schema.getExample() != null) {
|
||||
item.getMock().put(PropertyConstant.MOCK, schema.getExample());
|
||||
} else {
|
||||
item.getMock().put(PropertyConstant.MOCK, "");
|
||||
item.getMock().put(PropertyConstant.MOCK, StringUtils.EMPTY);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
@ -470,7 +470,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||
RefModel refModel = (RefModel) schema;
|
||||
String originalRef = refModel.getOriginalRef();
|
||||
if (refModel.getOriginalRef().split("/").length > 3) {
|
||||
simpleRef = originalRef.replace("#/definitions/", "");
|
||||
simpleRef = originalRef.replace("#/definitions/", StringUtils.EMPTY);
|
||||
} else {
|
||||
simpleRef = refModel.getSimpleRef();
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||
if (value.getExample() != null) {
|
||||
item.getMock().put(PropertyConstant.MOCK, value.getExample());
|
||||
} else {
|
||||
item.getMock().put(PropertyConstant.MOCK, "");
|
||||
item.getMock().put(PropertyConstant.MOCK, StringUtils.EMPTY);
|
||||
}
|
||||
JsonSchemaProperties.put(key, item);
|
||||
});
|
||||
|
@ -602,7 +602,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||
return bodyParameters.toString();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
private JSONObject getBodyParameters(Map<String, Property> properties, HashSet<String> refSet) {
|
||||
|
|
|
@ -48,7 +48,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
|
||||
@Override
|
||||
public ApiDefinitionImport parse(InputStream source, ApiTestImportRequest request) {
|
||||
String sourceStr = "";
|
||||
String sourceStr = StringUtils.EMPTY;
|
||||
if (StringUtils.isBlank(request.getSwaggerUrl())) {
|
||||
sourceStr = getApiTestStr(source);
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
}
|
||||
|
||||
private MsHTTPSamplerProxy buildRequest(Operation operation, String path, String method) {
|
||||
String name = "";
|
||||
String name = StringUtils.EMPTY;
|
||||
if (StringUtils.isNotBlank(operation.getSummary())) {
|
||||
name = operation.getSummary();
|
||||
} else {
|
||||
|
@ -230,7 +230,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
}
|
||||
|
||||
private String getDefaultStringValue(String val) {
|
||||
return StringUtils.isBlank(val) ? "" : val;
|
||||
return StringUtils.isBlank(val) ? StringUtils.EMPTY : val;
|
||||
}
|
||||
|
||||
private void parseCookieParameters(Parameter parameter, List<KeyValue> headers) {
|
||||
|
@ -240,7 +240,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
|
||||
private void parseHeaderParameters(Parameter parameter, List<KeyValue> headers) {
|
||||
HeaderParameter headerParameter = (HeaderParameter) parameter;
|
||||
addHeader(headers, headerParameter.getName(), String.valueOf(headerParameter.getExample()), getDefaultStringValue(headerParameter.getDescription()), "", parameter.getRequired());
|
||||
addHeader(headers, headerParameter.getName(), String.valueOf(headerParameter.getExample()), getDefaultStringValue(headerParameter.getDescription()), StringUtils.EMPTY, parameter.getRequired());
|
||||
}
|
||||
|
||||
private HttpResponse parseResponse(ApiResponses responses) {
|
||||
|
@ -448,7 +448,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
private void parseKvBodyItem(Object schemaObject, Body body, String name, Map<String, Schema> infoMap) {
|
||||
Schema schema = (Schema) schemaObject;
|
||||
if (schema == null) return;
|
||||
KeyValue kv = new KeyValue(name, String.valueOf(schema.getExample() == null ? "" : schema.getExample()), schema.getDescription());
|
||||
KeyValue kv = new KeyValue(name, String.valueOf(schema.getExample() == null ? StringUtils.EMPTY : schema.getExample()), schema.getDescription());
|
||||
Schema schemaInfo = infoMap.get(name);
|
||||
if (schemaInfo != null) {
|
||||
if (schemaInfo instanceof BinarySchema) {
|
||||
|
@ -481,7 +481,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
return null;
|
||||
}
|
||||
if (ref.split("/").length > 3) {
|
||||
ref = ref.replace("#/components/schemas/", "");
|
||||
ref = ref.replace("#/components/schemas/", StringUtils.EMPTY);
|
||||
}
|
||||
if (this.components.getSchemas() != null) return this.components.getSchemas().get(ref);
|
||||
return null;
|
||||
|
@ -525,7 +525,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
if (schema.getExample() != null) {
|
||||
item.getMock().put(PropertyConstant.MOCK, schema.getExample());
|
||||
} else {
|
||||
item.getMock().put(PropertyConstant.MOCK, "");
|
||||
item.getMock().put(PropertyConstant.MOCK, StringUtils.EMPTY);
|
||||
}
|
||||
item.setDescription(schema.getDescription());
|
||||
item.setPattern(schema.getPattern());
|
||||
|
@ -562,7 +562,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
} else if (value instanceof NumberSchema) {
|
||||
return example == null ? 0.0 : example;
|
||||
} else if (value instanceof StringSchema || StringUtils.equals(PropertyConstant.STRING, value.getType())) {
|
||||
return example == null ? "" : example;
|
||||
return example == null ? StringUtils.EMPTY : example;
|
||||
} else {// todo 其他类型?
|
||||
return getDefaultStringValue(value.getDescription());
|
||||
}
|
||||
|
@ -617,8 +617,8 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
SwaggerInfo swaggerInfo = new SwaggerInfo();
|
||||
swaggerInfo.setVersion("1.0.1");
|
||||
swaggerInfo.setTitle("ms-" + project.getName());
|
||||
swaggerInfo.setDescription("");
|
||||
swaggerInfo.setTermsOfService("");
|
||||
swaggerInfo.setDescription(StringUtils.EMPTY);
|
||||
swaggerInfo.setTermsOfService(StringUtils.EMPTY);
|
||||
result.setInfo(swaggerInfo);
|
||||
result.setInfo(new SwaggerInfo());
|
||||
result.setServers(new ArrayList<>());
|
||||
|
@ -850,7 +850,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
JSONObject parsedParam = new JSONObject();
|
||||
if (param instanceof String) {
|
||||
parsedParam.put(PropertyConstant.TYPE, PropertyConstant.STRING);
|
||||
parsedParam.put("example", param == null ? "" : param);
|
||||
parsedParam.put("example", param == null ? StringUtils.EMPTY : param);
|
||||
} else if (param instanceof Integer) {
|
||||
parsedParam.put(PropertyConstant.TYPE, PropertyConstant.INTEGER);
|
||||
parsedParam.put("format", "int64");
|
||||
|
@ -958,7 +958,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
statusCodeInfo.put("headers", headers);
|
||||
|
||||
statusCodeInfo.put("content", buildContent(response));
|
||||
statusCodeInfo.put("description", "");
|
||||
statusCodeInfo.put("description", StringUtils.EMPTY);
|
||||
// 返回code
|
||||
JSONArray statusCode = response.optJSONArray("statusCode");
|
||||
responseBody.put(statusCode.toString(), statusCodeInfo);
|
||||
|
|
|
@ -180,8 +180,8 @@ public class ApiScenarioImportUtil {
|
|||
object.put("id", sameCase.getId());
|
||||
object.put("resourceId", sameCase.getId());
|
||||
object.put("projectId", projectId);
|
||||
object.put("useEnvironment", "");
|
||||
object.put("environmentId", "");
|
||||
object.put("useEnvironment", StringUtils.EMPTY);
|
||||
object.put("environmentId", StringUtils.EMPTY);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -238,9 +238,9 @@ public class ApiScenarioImportUtil {
|
|||
object.put("id", test.getId());
|
||||
object.put("resourceId", test.getId());
|
||||
object.put("projectId", projectId);
|
||||
object.put("useEnvironment", "");
|
||||
object.put("environmentId", "");
|
||||
object.put("url", "");
|
||||
object.put("useEnvironment", StringUtils.EMPTY);
|
||||
object.put("environmentId", StringUtils.EMPTY);
|
||||
object.put("url", StringUtils.EMPTY);
|
||||
JSONObject objectNew = JSONUtil.parseObject(object.toString());
|
||||
objectNew.remove("refType");
|
||||
objectNew.remove("referenced");
|
||||
|
@ -293,8 +293,8 @@ public class ApiScenarioImportUtil {
|
|||
object.put("id", apiTestCase.getId());
|
||||
object.put("resourceId", apiTestCase.getId());
|
||||
object.put("projectId", projectId);
|
||||
object.put("useEnvironment", "");
|
||||
object.put("environmentId", "");
|
||||
object.put("useEnvironment", StringUtils.EMPTY);
|
||||
object.put("environmentId", StringUtils.EMPTY);
|
||||
JSONObject objectNew = JSONUtil.parseObject(object.toString());
|
||||
objectNew.remove("refType");
|
||||
objectNew.remove("referenced");
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.List;
|
|||
*/
|
||||
public class EsbDataParser {
|
||||
public static String esbData2XmlByParamStruct(List<EsbDataStruct> esbDataList, String[] paramArr) {
|
||||
String xmlString = "";
|
||||
String xmlString = StringUtils.EMPTY;
|
||||
try {
|
||||
if (esbDataList == null || esbDataList.isEmpty()) {
|
||||
return xmlString;
|
||||
|
@ -63,9 +63,9 @@ public class EsbDataParser {
|
|||
LogUtil.error(e);
|
||||
}
|
||||
if (StringUtils.isEmpty(xmlString)) {
|
||||
xmlString = "";
|
||||
xmlString = StringUtils.EMPTY;
|
||||
} else {
|
||||
xmlString = xmlString.replaceAll(" ", "");
|
||||
xmlString = xmlString.replaceAll(" ", StringUtils.EMPTY);
|
||||
}
|
||||
return xmlString;
|
||||
}
|
||||
|
|
|
@ -260,8 +260,8 @@ public class MsJmeterParser extends ApiImportAbstractParser<ScenarioImport> {
|
|||
samplerProxy.getBody().setKvs(keyValues);
|
||||
}
|
||||
samplerProxy.setProtocol(RequestTypeConstants.HTTP);
|
||||
samplerProxy.setConnectTimeout(source.getConnectTimeout() + "");
|
||||
samplerProxy.setResponseTimeout(source.getResponseTimeout() + "");
|
||||
samplerProxy.setConnectTimeout(source.getConnectTimeout() + StringUtils.EMPTY);
|
||||
samplerProxy.setResponseTimeout(source.getResponseTimeout() + StringUtils.EMPTY);
|
||||
samplerProxy.setPort(source.getPropertyAsString("HTTPSampler.port"));
|
||||
samplerProxy.setDomain(source.getDomain());
|
||||
String bodyType = this.getBodyType(samplerProxy.getHeaders());
|
||||
|
@ -342,12 +342,12 @@ public class MsJmeterParser extends ApiImportAbstractParser<ScenarioImport> {
|
|||
msTCPSampler.setType(ElementConstants.TCP_SAMPLER);
|
||||
msTCPSampler.setServer(tcpSampler.getServer());
|
||||
msTCPSampler.setPort(tcpSampler.getPropertyAsString(TCPSampler.PORT));
|
||||
msTCPSampler.setCtimeout(tcpSampler.getConnectTimeout() + "");
|
||||
msTCPSampler.setCtimeout(tcpSampler.getConnectTimeout() + StringUtils.EMPTY);
|
||||
msTCPSampler.setReUseConnection(tcpSampler.getProperty(TCPSampler.RE_USE_CONNECTION).getBooleanValue());
|
||||
msTCPSampler.setNodelay(tcpSampler.getProperty(TCPSampler.NODELAY).getBooleanValue());
|
||||
msTCPSampler.setCloseConnection(tcpSampler.isCloseConnection());
|
||||
msTCPSampler.setSoLinger(tcpSampler.getSoLinger() + "");
|
||||
msTCPSampler.setEolByte(tcpSampler.getEolByte() + "");
|
||||
msTCPSampler.setSoLinger(tcpSampler.getSoLinger() + StringUtils.EMPTY);
|
||||
msTCPSampler.setEolByte(tcpSampler.getEolByte() + StringUtils.EMPTY);
|
||||
msTCPSampler.setRequest(tcpSampler.getRequestData());
|
||||
msTCPSampler.setUsername(tcpSampler.getProperty(ConfigTestElement.USERNAME).getStringValue());
|
||||
msTCPSampler.setPassword(tcpSampler.getProperty(ConfigTestElement.PASSWORD).getStringValue());
|
||||
|
@ -828,7 +828,7 @@ public class MsJmeterParser extends ApiImportAbstractParser<ScenarioImport> {
|
|||
elementNode.setEnable(((TestElement) key).isEnabled());
|
||||
elementNode.setResourceId(UUID.randomUUID().toString());
|
||||
elementNode.setId(UUID.randomUUID().toString());
|
||||
elementNode.setIndex(scenario.getHashTree().size() + 1 + "");
|
||||
elementNode.setIndex(scenario.getHashTree().size() + 1 + StringUtils.EMPTY);
|
||||
// 提取参数
|
||||
if (elementNode instanceof MsExtract) {
|
||||
if (CollectionUtils.isNotEmpty(((MsExtract) elementNode).getJson()) || CollectionUtils.isNotEmpty(((MsExtract) elementNode).getRegex()) || CollectionUtils.isNotEmpty(((MsExtract) elementNode).getXpath())) {
|
||||
|
|
|
@ -36,7 +36,7 @@ public class TcpTreeTableDataParser {
|
|||
public static final String DATA_TYPE_OBJECT = PropertyConstant.OBJECT;
|
||||
|
||||
public static String treeTableData2Xml(List<TcpTreeTableDataStruct> treeDataList) {
|
||||
String xmlString = "";
|
||||
String xmlString = StringUtils.EMPTY;
|
||||
try {
|
||||
if (treeDataList == null || treeDataList.isEmpty()) {
|
||||
return xmlString;
|
||||
|
@ -85,9 +85,9 @@ public class TcpTreeTableDataParser {
|
|||
LogUtil.error(e);
|
||||
}
|
||||
if (StringUtils.isEmpty(xmlString)) {
|
||||
xmlString = "";
|
||||
xmlString = StringUtils.EMPTY;
|
||||
} else {
|
||||
xmlString = xmlString.replaceAll(" ", "");
|
||||
xmlString = xmlString.replaceAll(" ", StringUtils.EMPTY);
|
||||
}
|
||||
return xmlString;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import io.metersphere.service.MockConfigService;
|
|||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.JSONUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
@ -25,8 +26,8 @@ public class TCPService {
|
|||
|
||||
public void run() {
|
||||
byte[] b = new byte[1024];
|
||||
String returnMsg = "";
|
||||
String message = "";
|
||||
String returnMsg = StringUtils.EMPTY;
|
||||
String message = StringUtils.EMPTY;
|
||||
try {
|
||||
is = s.getInputStream();
|
||||
os = s.getOutputStream();
|
||||
|
@ -45,7 +46,7 @@ public class TCPService {
|
|||
LogUtil.info("TCP-Mock start. port: " + this.port + "; Message:" + message);
|
||||
MockConfigService mockConfigService = CommonBeanFactory.getBean(MockConfigService.class);
|
||||
MockExpectConfigDTO matchdMockExpectDTO = mockConfigService.matchTcpMockExpect(message, this.port);
|
||||
String returnMsg = "";
|
||||
String returnMsg = StringUtils.EMPTY;
|
||||
if (matchdMockExpectDTO != null && matchdMockExpectDTO.getMockExpectConfig() != null) {
|
||||
String response = matchdMockExpectDTO.getMockExpectConfig().getResponse();
|
||||
JSONObject responseObj = JSONUtil.parseObject(response);
|
||||
|
@ -65,7 +66,7 @@ public class TCPService {
|
|||
if (respResultObj.has("usePostScript")) {
|
||||
useScript = respResultObj.getBoolean("usePostScript");
|
||||
}
|
||||
returnMsg = mockApiUtils.getResultByResponseResult(matchdMockExpectDTO.getProjectId(), respResultObj.optJSONObject("body"), "", null, null, useScript);
|
||||
returnMsg = mockApiUtils.getResultByResponseResult(matchdMockExpectDTO.getProjectId(), respResultObj.optJSONObject("body"), StringUtils.EMPTY, null, null, useScript);
|
||||
}
|
||||
try {
|
||||
if (respResultObj.has("delayed")) {
|
||||
|
|
|
@ -81,7 +81,7 @@ public class MockApiUtils {
|
|||
}
|
||||
}
|
||||
|
||||
String jsonString = "";
|
||||
String jsonString = StringUtils.EMPTY;
|
||||
if (isJsonSchema) {
|
||||
if (bodyObj.has("jsonSchema")) {
|
||||
String bodyRetunStr = bodyObj.optJSONObject("jsonSchema").toString();
|
||||
|
@ -123,7 +123,7 @@ public class MockApiUtils {
|
|||
if (kv.has("name")) {
|
||||
String values = kv.optString("value");
|
||||
if (StringUtils.isEmpty(values)) {
|
||||
values = "";
|
||||
values = StringUtils.EMPTY;
|
||||
} else {
|
||||
try {
|
||||
values = values.startsWith("@") ? ScriptEngineUtils.buildFunctionCallString(values) : values;
|
||||
|
@ -170,7 +170,7 @@ public class MockApiUtils {
|
|||
JSONObject respObj = JSONUtil.parseObject(response);
|
||||
if (respObj != null) {
|
||||
if (respObj.has("body")) {
|
||||
String returnStr = "";
|
||||
String returnStr = StringUtils.EMPTY;
|
||||
JSONObject bodyObj = respObj.optJSONObject("body");
|
||||
if (bodyObj.has(PropertyConstant.TYPE)) {
|
||||
String type = bodyObj.optString(PropertyConstant.TYPE);
|
||||
|
@ -207,7 +207,7 @@ public class MockApiUtils {
|
|||
if (kv.has("name")) {
|
||||
String values = kv.optString("value");
|
||||
if (StringUtils.isEmpty(values)) {
|
||||
values = "";
|
||||
values = StringUtils.EMPTY;
|
||||
} else {
|
||||
try {
|
||||
values = values.startsWith("@") ? ScriptEngineUtils.buildFunctionCallString(values) : values;
|
||||
|
@ -292,9 +292,9 @@ public class MockApiUtils {
|
|||
requestMockParams = new RequestMockParams();
|
||||
}
|
||||
if (bodyObj == null && bodyObj == null) {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
} else {
|
||||
String returnStr = "";
|
||||
String returnStr = StringUtils.EMPTY;
|
||||
if (bodyObj.has(PropertyConstant.TYPE)) {
|
||||
String type = bodyObj.optString(PropertyConstant.TYPE);
|
||||
if (StringUtils.equals(type, "JSON")) {
|
||||
|
@ -460,7 +460,7 @@ public class MockApiUtils {
|
|||
String param = pathArr[i];
|
||||
if (param.startsWith("{") && param.endsWith("}")) {
|
||||
param = param.substring(1, param.length() - 1);
|
||||
String value = "";
|
||||
String value = StringUtils.EMPTY;
|
||||
if (sendParamArr.length > i) {
|
||||
value = sendParamArr[i];
|
||||
}
|
||||
|
@ -473,7 +473,7 @@ public class MockApiUtils {
|
|||
}
|
||||
|
||||
private static String readBody(HttpServletRequest request) {
|
||||
String result = "";
|
||||
String result = StringUtils.EMPTY;
|
||||
try {
|
||||
InputStream inputStream = request.getInputStream();
|
||||
ByteArrayOutputStream outSteam = new ByteArrayOutputStream();
|
||||
|
|
|
@ -85,7 +85,7 @@ public class MockScriptEngineUtils {
|
|||
if (StringUtils.isEmpty(scriptLanguage)) {
|
||||
return null;
|
||||
}
|
||||
String preScript = "";
|
||||
String preScript = StringUtils.EMPTY;
|
||||
if (StringUtils.equalsIgnoreCase(scriptLanguage, "beanshell")) {
|
||||
ScriptEngineManager scriptEngineFactory = new ScriptEngineManager();
|
||||
engine = scriptEngineFactory.getEngineByName("beanshell");
|
||||
|
|
|
@ -38,7 +38,7 @@ public class MockTestDataUtil {
|
|||
if(length > 1){
|
||||
return RandomStringUtils.randomAlphanumeric(length-1);
|
||||
}else {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
} else if (StringUtils.equals(MockApiUtils.parseCondition(request.getCondition()), MockParamConditionEnums.REGULAR_MATCH.name())) {
|
||||
if (StringUtils.isNotEmpty(request.getValue())) {
|
||||
|
@ -46,10 +46,10 @@ public class MockTestDataUtil {
|
|||
String randomStr = generex.random();
|
||||
return randomStr;
|
||||
}else {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
} else {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class MockTestDataUtil {
|
|||
if(length > 1){
|
||||
return RandomStringUtils.randomAlphanumeric(length);
|
||||
}else {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
} else if (StringUtils.equals(MockApiUtils.parseCondition(condition.getCondition()), MockParamConditionEnums.REGULAR_MATCH.name())) {
|
||||
if (StringUtils.isNotEmpty(condition.getValue())) {
|
||||
|
@ -77,10 +77,10 @@ public class MockTestDataUtil {
|
|||
String randomStr = generex.random();
|
||||
return randomStr;
|
||||
}else {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
} else {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2177,7 +2177,7 @@ public class ApiDefinitionService {
|
|||
criteria.andModuleIdEqualTo(swaggerUrlRequest.getModuleId());
|
||||
}
|
||||
List<SwaggerUrlProject> list = swaggerUrlProjectMapper.selectByExample(swaggerUrlProjectExample);
|
||||
String resourceId = "";
|
||||
String resourceId = StringUtils.EMPTY;
|
||||
if (list.size() == 1) {
|
||||
resourceId = list.get(0).getId();
|
||||
}
|
||||
|
@ -2259,7 +2259,7 @@ public class ApiDefinitionService {
|
|||
}
|
||||
String[] urlParams = urlSuffix.split("/");
|
||||
if (urlSuffixEndEmpty) {
|
||||
urlParams[urlParams.length - 1] = "";
|
||||
urlParams[urlParams.length - 1] = StringUtils.EMPTY;
|
||||
}
|
||||
for (ApiDefinition api : apiList) {
|
||||
if (StringUtils.equalsAny(api.getPath(), baseUrlSuffix, "/" + baseUrlSuffix)) {
|
||||
|
|
|
@ -180,7 +180,7 @@ public class JSONSchemaRunTest {
|
|||
if (object.has("items")) {
|
||||
if (isMock(itemsObject)) {
|
||||
try {
|
||||
String type = "";
|
||||
String type = StringUtils.EMPTY;
|
||||
if (itemsObject.has(BasicConstant.TYPE)) {
|
||||
type = itemsObject.get(BasicConstant.TYPE).getAsString();
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ public class JSONSchemaRunTest {
|
|||
} catch (Exception e) {
|
||||
return object.get(BasicConstant.MOCK).getAsJsonObject().get(BasicConstant.MOCK);
|
||||
}
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
private static void analyzeDefinitions(JsonObject object, Map<String, String> map) {
|
||||
|
|
|
@ -29,7 +29,7 @@ public class SessionUser extends UserDTO implements Serializable {
|
|||
SessionUser sessionUser = new SessionUser();
|
||||
BeanUtils.copyProperties(user, sessionUser);
|
||||
|
||||
List<String> infos = Arrays.asList(user.getId(), RandomStringUtils.randomAlphabetic(6), sessionId, "" + System.currentTimeMillis());
|
||||
List<String> infos = Arrays.asList(user.getId(), RandomStringUtils.randomAlphabetic(6), sessionId, StringUtils.EMPTY + System.currentTimeMillis());
|
||||
sessionUser.csrfToken = CodingUtil.aesEncrypt(StringUtils.join(infos, "|"), secret, iv);
|
||||
sessionUser.sessionId = sessionId;
|
||||
return sessionUser;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere.commons.utils;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
@ -45,7 +46,7 @@ public class CompressUtils {
|
|||
public static File getFile(String fileName) throws IOException {
|
||||
// 创建文件对象
|
||||
File file;
|
||||
if (ZIP_PATH != null && !ZIP_PATH.equals("")) {
|
||||
if (ZIP_PATH != null && !ZIP_PATH.equals(StringUtils.EMPTY)) {
|
||||
file = new File(ZIP_PATH, fileName);
|
||||
} else {
|
||||
file = new File(fileName);
|
||||
|
|
|
@ -47,7 +47,7 @@ public class LogUtil {
|
|||
}
|
||||
} else {
|
||||
if (logger != null && logger.isErrorEnabled()) {
|
||||
logger.error("");
|
||||
logger.error(StringUtils.EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ public class LoginController {
|
|||
@MsAuditLog(module = OperLogModule.AUTH_TITLE, beforeEvent = "#msClass.getUserId(id)", type = OperLogConstants.LOGIN, title = "登出", msClass = SessionUtils.class)
|
||||
public ResultHolder logout() throws Exception {
|
||||
SecurityUtils.getSubject().logout();
|
||||
return ResultHolder.success("");
|
||||
return ResultHolder.success(StringUtils.EMPTY);
|
||||
}
|
||||
|
||||
/*Get default language*/
|
||||
|
|
|
@ -36,14 +36,14 @@ public class OperatingLogService {
|
|||
private SqlSessionFactory sqlSessionFactory;
|
||||
|
||||
public void create(OperatingLogWithBLOBs log, String sourceIds) {
|
||||
log.setSourceId("");
|
||||
log.setSourceId(StringUtils.EMPTY);
|
||||
operatingLogMapper.insert(log);
|
||||
if (StringUtils.isNotEmpty(sourceIds)) {
|
||||
List<String> ids = new ArrayList<>();
|
||||
if (sourceIds.startsWith("[")) {
|
||||
ids = JSON.parseArray(sourceIds, String.class);
|
||||
} else {
|
||||
ids.add(sourceIds.replace("\"", ""));
|
||||
ids.add(sourceIds.replace("\"", StringUtils.EMPTY));
|
||||
}
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||
OperatingLogResourceMapper batchMapper = sqlSession.getMapper(OperatingLogResourceMapper.class);
|
||||
|
@ -78,14 +78,14 @@ public class OperatingLogService {
|
|||
List<OperatingLogDTO> logDtoArr = baseOperatingLogMapper.findSourceIdByLogIds(logIds);
|
||||
// 如果重复是批量操作,置空sourceID
|
||||
sourceMap = logDtoArr.stream()
|
||||
.collect(Collectors.toMap(OperatingLogDTO::getOperatingLogId, OperatingLogDTO::getSourceId, (val1, val2) -> ""));
|
||||
.collect(Collectors.toMap(OperatingLogDTO::getOperatingLogId, OperatingLogDTO::getSourceId, (val1, val2) -> StringUtils.EMPTY));
|
||||
}
|
||||
Map<String, String> userNameMap = ServiceUtils.getUserNameMap(userIds);
|
||||
Map<String, String> workspaceNameMap = ServiceUtils.getWorkspaceNameByProjectIds(projectIds);
|
||||
for (OperatingLogDTO dto : list) {
|
||||
dto.setUserName(userNameMap.getOrDefault(dto.getOperUser(), ""));
|
||||
dto.setWorkspaceName(workspaceNameMap.getOrDefault(dto.getProjectId(), ""));
|
||||
dto.setSourceId(sourceMap.getOrDefault(dto.getId(), ""));
|
||||
dto.setUserName(userNameMap.getOrDefault(dto.getOperUser(), StringUtils.EMPTY));
|
||||
dto.setWorkspaceName(workspaceNameMap.getOrDefault(dto.getProjectId(), StringUtils.EMPTY));
|
||||
dto.setSourceId(sourceMap.getOrDefault(dto.getId(), StringUtils.EMPTY));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
|
|
@ -57,7 +57,7 @@ public class ReflexObjectUtil {
|
|||
if (StatusReference.statusMap.containsKey(String.valueOf(val))) {
|
||||
val = StatusReference.statusMap.get(String.valueOf(val));
|
||||
}
|
||||
DetailColumn column = new DetailColumn(columns.get(f.getName()), f.getName(), val, "");
|
||||
DetailColumn column = new DetailColumn(columns.get(f.getName()), f.getName(), val, StringUtils.EMPTY);
|
||||
if (dffColumns.contains(f.getName())) {
|
||||
column.setDepthDff(true);
|
||||
column.setOriginalValue(formatJson(val));
|
||||
|
@ -111,7 +111,7 @@ public class ReflexObjectUtil {
|
|||
f.setAccessible(true);
|
||||
try {
|
||||
Object val = f.get(obj);
|
||||
DetailColumn column = new DetailColumn(f.getName(), f.getName(), val, "");
|
||||
DetailColumn column = new DetailColumn(f.getName(), f.getName(), val, StringUtils.EMPTY);
|
||||
columnList.add(column);
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
|
|
|
@ -63,7 +63,7 @@ public abstract class AbstractNoticeSender implements NoticeSender {
|
|||
return getContent(messageDetail.getTemplate(), noticeModel.getParamMap());
|
||||
}
|
||||
// 处理 WeCom Ding context
|
||||
String context = "";
|
||||
String context = StringUtils.EMPTY;
|
||||
switch (messageDetail.getEvent()) {
|
||||
case NoticeConstants.Event.EXECUTE_FAILED:
|
||||
context = noticeModel.getFailedContext();
|
||||
|
@ -86,7 +86,7 @@ public abstract class AbstractNoticeSender implements NoticeSender {
|
|||
// 处理 null
|
||||
context.forEach((k, v) -> {
|
||||
if (v == null) {
|
||||
context.put(k, "");
|
||||
context.put(k, StringUtils.EMPTY);
|
||||
}
|
||||
});
|
||||
// 处理时间格式的数据
|
||||
|
|
|
@ -55,7 +55,7 @@ public class AfterReturningNoticeSendService {
|
|||
* 有些默认的值,避免通知里出现 ${key}
|
||||
*/
|
||||
private void handleDefaultValues(Map paramMap) {
|
||||
paramMap.put("planShareUrl", ""); // 占位符
|
||||
paramMap.put("planShareUrl", StringUtils.EMPTY); // 占位符
|
||||
}
|
||||
|
||||
private String getContext(SendNotice sendNotice, Map<String, Object> paramMap) {
|
||||
|
|
|
@ -31,7 +31,7 @@ public class OrderRequest {
|
|||
|
||||
public String getPrefix() {
|
||||
if (checkSqlInjection(prefix)) {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
return prefix;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public class ApiKeySessionHandler {
|
|||
|
||||
for (i$ = 0; i$ < len$; ++i$) {
|
||||
String s = arr$[i$];
|
||||
if (s != null && !"".equals(s)) {
|
||||
if (s != null && !StringUtils.EMPTY.equals(s)) {
|
||||
remainSessionIdSet.add(s.toLowerCase());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public class BaseCustomFieldService {
|
|||
resource.setFieldId(dto.getId());
|
||||
if (StringUtils.isNotBlank(dto.getType()) &&
|
||||
StringUtils.equalsAny(dto.getType(), CustomFieldType.RICH_TEXT.getValue(), CustomFieldType.TEXTAREA.getValue())) {
|
||||
resource.setTextValue(dto.getValue() == null ? "" : dto.getValue().toString());
|
||||
resource.setTextValue(dto.getValue() == null ? StringUtils.EMPTY : dto.getValue().toString());
|
||||
} else {
|
||||
resource.setValue(JSON.toJSONString(dto.getValue()));
|
||||
}
|
||||
|
|
|
@ -241,7 +241,7 @@ public class BaseScheduleService {
|
|||
if (list.size() > 0) {
|
||||
return list.get(0).getKey();
|
||||
} else {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -229,7 +229,7 @@ public class BaseUserService {
|
|||
user.setLastProjectId(projects.get(0).getId());
|
||||
}
|
||||
} else {
|
||||
user.setLastProjectId("");
|
||||
user.setLastProjectId(StringUtils.EMPTY);
|
||||
}
|
||||
}
|
||||
// 执行变更
|
||||
|
@ -251,7 +251,7 @@ public class BaseUserService {
|
|||
if (projects.size() > 0) {
|
||||
user.setLastProjectId(projects.get(0).getId());
|
||||
} else {
|
||||
user.setLastProjectId("");
|
||||
user.setLastProjectId(StringUtils.EMPTY);
|
||||
}
|
||||
}
|
||||
BeanUtils.copyProperties(user, newUser);
|
||||
|
@ -349,7 +349,7 @@ public class BaseUserService {
|
|||
public ResultHolder login(LoginRequest request) {
|
||||
String login = (String) SecurityUtils.getSubject().getSession().getAttribute("authenticate");
|
||||
String username = StringUtils.trim(request.getUsername());
|
||||
String password = "";
|
||||
String password = StringUtils.EMPTY;
|
||||
if (!StringUtils.equals(login, UserSource.LDAP.name())) {
|
||||
password = StringUtils.trim(request.getPassword());
|
||||
if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) {
|
||||
|
@ -420,8 +420,8 @@ public class BaseUserService {
|
|||
switchUserResource("workspace", wsId, user);
|
||||
} else {
|
||||
// 用户登录之后没有项目和工作空间的权限就把值清空
|
||||
user.setLastWorkspaceId("");
|
||||
user.setLastProjectId("");
|
||||
user.setLastWorkspaceId(StringUtils.EMPTY);
|
||||
user.setLastProjectId(StringUtils.EMPTY);
|
||||
updateUser(user);
|
||||
}
|
||||
} else {
|
||||
|
@ -614,7 +614,7 @@ public class BaseUserService {
|
|||
.andGroupIdIn(groupIds);
|
||||
User user = userMapper.selectByPrimaryKey(userId);
|
||||
if (StringUtils.equals(projectId, user.getLastProjectId())) {
|
||||
user.setLastProjectId("");
|
||||
user.setLastProjectId(StringUtils.EMPTY);
|
||||
userMapper.updateByPrimaryKeySelective(user);
|
||||
}
|
||||
|
||||
|
@ -714,7 +714,7 @@ public class BaseUserService {
|
|||
if (!CollectionUtils.isEmpty(users)) {
|
||||
User user = users.get(0);
|
||||
String seleniumServer = request.getSeleniumServer();
|
||||
user.setSeleniumServer(StringUtils.isBlank(seleniumServer) ? "" : seleniumServer.trim());
|
||||
user.setSeleniumServer(StringUtils.isBlank(seleniumServer) ? StringUtils.EMPTY : seleniumServer.trim());
|
||||
user.setUpdateTime(System.currentTimeMillis());
|
||||
//更新session seleniumServer 信息
|
||||
SessionUser sessionUser = SessionUtils.getUser();
|
||||
|
|
|
@ -373,7 +373,7 @@ public class NodeTreeService<T extends TreeNodeDTO> {
|
|||
|
||||
|
||||
public String insertNode(String nodeName, String pId, String projectId, Integer level, String path) {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
public void updatePos(String id, Double pos) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.service;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -25,7 +26,7 @@ public class RemoteService {
|
|||
*/
|
||||
public Object get(String url) {
|
||||
// 返回null,前端会报错
|
||||
return Optional.ofNullable(microService.getForData(serviceName, url)).orElse("");
|
||||
return Optional.ofNullable(microService.getForData(serviceName, url)).orElse(StringUtils.EMPTY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,6 +35,6 @@ public class RemoteService {
|
|||
* @return
|
||||
*/
|
||||
public Object post(String url, Object param) {
|
||||
return Optional.ofNullable(microService.postForData(serviceName, url, param)).orElse("");
|
||||
return Optional.ofNullable(microService.postForData(serviceName, url, param)).orElse(StringUtils.EMPTY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ public class SystemParameterService {
|
|||
public String getValue(String key) {
|
||||
SystemParameter param = systemParameterMapper.selectByPrimaryKey(key);
|
||||
if (param == null || StringUtils.isBlank(param.getParamValue())) {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
return param.getParamValue();
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package io.metersphere.websocket;
|
|||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.task.dto.TaskCenterRequest;
|
||||
import io.metersphere.task.service.TaskService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -97,7 +98,7 @@ public class TaskCenterWebSocket {
|
|||
if (!session.isOpen()) {
|
||||
return;
|
||||
}
|
||||
session.getBasicRemote().sendText(taskTotal + "");
|
||||
session.getBasicRemote().sendText(taskTotal + StringUtils.EMPTY);
|
||||
if (taskTotal == 0) {
|
||||
session.close();
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class ApiScenarioExportJmxDTO {
|
|||
private Map<String, List<String>> projectEnvMap;
|
||||
|
||||
public ApiScenarioExportJmxDTO(String name, String jmx) {
|
||||
this.name = StringUtils.replace(name, "/", "");
|
||||
this.name = StringUtils.replace(name, "/", StringUtils.EMPTY);
|
||||
this.jmx = jmx;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,13 +28,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) {
|
||||
|
|
|
@ -24,7 +24,7 @@ public class LoadReportStatusEvent implements LoadTestFinishEvent {
|
|||
String reportId = loadTestReport.getId();
|
||||
String status = loadTestReport.getStatus();
|
||||
if (StringUtils.isNotBlank(reportId)) {
|
||||
String result = "";
|
||||
String result = StringUtils.EMPTY;
|
||||
if (StringUtils.equals(PerformanceTestStatus.Error.name(), status)) {
|
||||
result = TestPlanLoadCaseStatus.error.name();
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ public class TestPlanLoadCaseService {
|
|||
if (CollectionUtils.isEmpty(loadTestReports)) {
|
||||
TestPlanLoadCaseWithBLOBs testPlanLoadCase = new TestPlanLoadCaseWithBLOBs();
|
||||
testPlanLoadCase.setId(testPlanLoadCaseId);
|
||||
testPlanLoadCase.setLoadReportId("");
|
||||
testPlanLoadCase.setLoadReportId(StringUtils.EMPTY);
|
||||
testPlanLoadCaseMapper.updateByPrimaryKeySelective(testPlanLoadCase);
|
||||
return false;
|
||||
}
|
||||
|
@ -402,25 +402,25 @@ public class TestPlanLoadCaseService {
|
|||
|
||||
public String getPlanLoadCaseConfig(String loadCaseId) {
|
||||
if (StringUtils.isBlank(loadCaseId)) {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
TestPlanLoadCaseWithBLOBs testPlanLoadCase = testPlanLoadCaseMapper.selectByPrimaryKey(loadCaseId);
|
||||
if (testPlanLoadCase != null) {
|
||||
return testPlanLoadCase.getLoadConfiguration();
|
||||
}
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
|
||||
public String getAdvancedConfiguration(String loadCaseId) {
|
||||
if (StringUtils.isBlank(loadCaseId)) {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
TestPlanLoadCaseWithBLOBs testPlanLoadCase = testPlanLoadCaseMapper.selectByPrimaryKey(loadCaseId);
|
||||
if (testPlanLoadCase != null) {
|
||||
return testPlanLoadCase.getAdvancedConfiguration();
|
||||
}
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
public TestPlanLoadCase getTestPlanLoadCase(String loadCaseId) {
|
||||
|
|
|
@ -12,6 +12,7 @@ import io.metersphere.reportstatistics.service.remote.track.TestCaseRemoteServic
|
|||
import io.metersphere.request.ProjectRequest;
|
||||
import io.metersphere.service.BaseProjectService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
@ -66,7 +67,7 @@ public class TestAnalysisService {
|
|||
List<TestAnalysisChartResult> createResults = testCaseRemoteService.countCaseByTypeAndRequest("create", request);
|
||||
// 获取修改的用例统计报表
|
||||
List<TestAnalysisChartResult> updateResults = testCaseRemoteService.countCaseByTypeAndRequest("update", request);
|
||||
formatXaxisSeries(xAxis, seriesList, "", dto, createResults, updateResults);
|
||||
formatXaxisSeries(xAxis, seriesList, StringUtils.EMPTY, dto, createResults, updateResults);
|
||||
formatTable(dtos, createResults, updateResults);
|
||||
} else {
|
||||
List<String> users = request.getUsers();
|
||||
|
|
|
@ -55,7 +55,7 @@ public enum TestCaseImportFiled {
|
|||
}
|
||||
|
||||
private static String parseTags(TestCaseExcelData excelData) {
|
||||
String tags = "";
|
||||
String tags = StringUtils.EMPTY;
|
||||
try {
|
||||
if (excelData.getTags() != null) {
|
||||
List arr = JSON.parseArray(excelData.getTags());
|
||||
|
|
|
@ -43,7 +43,7 @@ public class TestCaseExportCommendConverter implements TestCaseExportConverter {
|
|||
caseComments.forEach(comment -> {
|
||||
String authorName = comment.getAuthorName();
|
||||
String type = getFromMapOfNullableWithTranslate(commendTypeMap, comment.getType());
|
||||
String status = "";
|
||||
String status = StringUtils.EMPTY;
|
||||
if (StringUtils.equals(comment.getType(), TestCaseCommentType.PLAN.name())) {
|
||||
status = getFromMapOfNullableWithTranslate(planCaseStatusMap, comment.getStatus());
|
||||
status = "[".concat(status).concat("]");
|
||||
|
|
|
@ -18,7 +18,7 @@ public interface TestCaseExportConverter {
|
|||
if (StringUtils.isNotBlank(key)) {
|
||||
return map.get(key);
|
||||
}
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
default String getFromMapOfNullableWithTranslate(Map<String, String> map, String key) {
|
||||
|
|
|
@ -439,7 +439,7 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
|
|||
}
|
||||
//模块名不能为空
|
||||
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)) {
|
||||
stringBuilder.append(Translator.get("module_not_null"))
|
||||
.append(ERROR_MSG_SEPARATOR);
|
||||
break;
|
||||
|
@ -670,8 +670,8 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
|
|||
for (int i = 0; i < data.getMergeStepDesc().size(); i++) {
|
||||
Map<String, Object> step = new LinkedHashMap<>();
|
||||
step.put("num", i + 1);
|
||||
step.put("desc", Optional.ofNullable(data.getMergeStepDesc().get(i)).orElse(""));
|
||||
step.put("result", Optional.ofNullable(data.getMergeStepResult().get(i)).orElse(""));
|
||||
step.put("desc", Optional.ofNullable(data.getMergeStepDesc().get(i)).orElse(StringUtils.EMPTY));
|
||||
step.put("result", Optional.ofNullable(data.getMergeStepResult().get(i)).orElse(StringUtils.EMPTY));
|
||||
jsonArray.add(step);
|
||||
}
|
||||
return JSON.toJSONString(jsonArray);
|
||||
|
@ -691,7 +691,7 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
|
|||
rowNums.add(rowIndex++);
|
||||
}
|
||||
} else {
|
||||
stepDescList.add("");
|
||||
stepDescList.add(StringUtils.EMPTY);
|
||||
}
|
||||
|
||||
if (data.getStepResult() != null) {
|
||||
|
@ -704,7 +704,7 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
|
|||
lastStepIndex++;
|
||||
}
|
||||
} else {
|
||||
stepResList.add("");
|
||||
stepResList.add(StringUtils.EMPTY);
|
||||
}
|
||||
|
||||
int index = stepDescList.size() > stepResList.size() ? stepDescList.size() : stepResList.size();
|
||||
|
@ -717,13 +717,13 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
|
|||
if (i < stepDescList.size()) {
|
||||
step.put("desc", stepDescList.get(i));
|
||||
} else {
|
||||
step.put("desc", "");
|
||||
step.put("desc", StringUtils.EMPTY);
|
||||
}
|
||||
|
||||
if (i < stepResList.size()) {
|
||||
step.put("result", stepResList.get(i));
|
||||
} else {
|
||||
step.put("result", "");
|
||||
step.put("result", StringUtils.EMPTY);
|
||||
}
|
||||
|
||||
jsonArray.add(step);
|
||||
|
@ -764,7 +764,7 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
|
|||
}
|
||||
rowInfo.index = index;
|
||||
if (rowMessage == null) {
|
||||
rowMessage = "";
|
||||
rowMessage = StringUtils.EMPTY;
|
||||
}
|
||||
rowInfo.rowInfo = rowMessage;
|
||||
return rowInfo;
|
||||
|
@ -796,7 +796,7 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
|
|||
for (Map.Entry<Integer, String> headEntry : headMap.entrySet()) {
|
||||
Integer index = headEntry.getKey();
|
||||
String field = headEntry.getValue();
|
||||
String value = StringUtils.isEmpty(row.get(index)) ? "" : row.get(index);
|
||||
String value = StringUtils.isEmpty(row.get(index)) ? StringUtils.EMPTY : row.get(index);
|
||||
|
||||
if (excelHeadToFieldNameDic.containsKey(field)) {
|
||||
field = excelHeadToFieldNameDic.get(field);
|
||||
|
|
|
@ -122,7 +122,7 @@ public class TestPlanMessageService {
|
|||
assert noticeSendService != null;
|
||||
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
|
||||
String url = baseSystemConfigDTO.getUrl() + "/#/track/testPlan/reportList";
|
||||
String subject = "";
|
||||
String subject = StringUtils.EMPTY;
|
||||
String successContext = "${operator}执行的 ${name} 测试计划运行成功, 报告: ${planShareUrl}";
|
||||
String failedContext = "${operator}执行的 ${name} 测试计划运行失败, 报告: ${planShareUrl}";
|
||||
String context = "${operator}完成了测试计划: ${name}, 报告: ${planShareUrl}";
|
||||
|
|
|
@ -459,9 +459,9 @@ public class TestPlanReportService {
|
|||
|
||||
private String getPrincipalName(String planId) {
|
||||
if (StringUtils.isBlank(planId)) {
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
String principalName = "";
|
||||
String principalName = StringUtils.EMPTY;
|
||||
TestPlanPrincipalExample example = new TestPlanPrincipalExample();
|
||||
example.createCriteria().andTestPlanIdEqualTo(planId);
|
||||
List<TestPlanPrincipal> principals = testPlanPrincipalMapper.selectByExample(example);
|
||||
|
|
|
@ -697,7 +697,7 @@ public class TestPlanService {
|
|||
|
||||
List<Project> projects = projectMapper.selectByExample(projectExample);
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
String projectName = "";
|
||||
String projectName = StringUtils.EMPTY;
|
||||
|
||||
if (projects.size() > 0) {
|
||||
for (Project project : projects) {
|
||||
|
@ -796,7 +796,7 @@ public class TestPlanService {
|
|||
//测试计划准备执行,取消测试计划的实际结束时间
|
||||
extTestPlanMapper.updateActualEndTimeIsNullById(testPlanID);
|
||||
|
||||
LoggerUtil.info("预生成测试计划报告【" + reportInfoDTO.getTestPlanReport() != null ? reportInfoDTO.getTestPlanReport().getName() : "" + "】计划报告ID[" + planReportId + "]");
|
||||
LoggerUtil.info("预生成测试计划报告【" + reportInfoDTO.getTestPlanReport() != null ? reportInfoDTO.getTestPlanReport().getName() : StringUtils.EMPTY + "】计划报告ID[" + planReportId + "]");
|
||||
|
||||
Map<String, String> apiCaseReportMap = null;
|
||||
Map<String, String> scenarioReportMap = null;
|
||||
|
|
|
@ -31,8 +31,8 @@ public class XmindLegacy {
|
|||
*/
|
||||
public static List<String> getContent(String xmlContent, String xmlComments) throws IOException, DocumentException {
|
||||
// 删除content.xml里面不能识别的字符串
|
||||
xmlContent = xmlContent.replace("xmlns=\"urn:xmind:xmap:xmlns:content:2.0\"", "");
|
||||
xmlContent = xmlContent.replace("xmlns:fo=\"http://www.w3.org/1999/XSL/Format\"", "");
|
||||
xmlContent = xmlContent.replace("xmlns=\"urn:xmind:xmap:xmlns:content:2.0\"", StringUtils.EMPTY);
|
||||
xmlContent = xmlContent.replace("xmlns:fo=\"http://www.w3.org/1999/XSL/Format\"", StringUtils.EMPTY);
|
||||
|
||||
try {
|
||||
xmlContent = removeTopicsFromString(xmlContent);
|
||||
|
@ -47,7 +47,7 @@ public class XmindLegacy {
|
|||
|
||||
if (xmlComments != null) {
|
||||
// 删除comments.xml里面不能识别的字符串
|
||||
xmlComments = xmlComments.replace("xmlns=\"urn:xmind:xmap:xmlns:comments:2.0\"", "");
|
||||
xmlComments = xmlComments.replace("xmlns=\"urn:xmind:xmap:xmlns:comments:2.0\"", StringUtils.EMPTY);
|
||||
|
||||
// 添加评论到content中
|
||||
Document commentDocument = XmlUtils.getDocument(new ByteArrayInputStream(xmlComments.getBytes(StandardCharsets.UTF_8.name())));
|
||||
|
|
|
@ -235,7 +235,7 @@ public class XmindExportUtil {
|
|||
if (dto.getTags() != null) {
|
||||
try {
|
||||
List<String> arr = JSON.parseArray(dto.getTags());
|
||||
String tagStr = "";
|
||||
String tagStr = StringUtils.EMPTY;
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
tagStr = tagStr + arr.get(i) + ",";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue