mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-02 03:58:33 +08:00
refactor: "\n" -> StringUtils.LF
This commit is contained in:
parent
97922fba73
commit
259b4ab918
@ -644,7 +644,7 @@ public class ElementUtil {
|
||||
if (arguments != null) {
|
||||
for (int i = 0; i < arguments.getArguments().size(); ++i) {
|
||||
String argValue = arguments.getArgument(i).getValue();
|
||||
script.append("vars.put(\"" + arguments.getArgument(i).getName() + "\",\"" + argValue + "\");").append("\n");
|
||||
script.append("vars.put(\"" + arguments.getArgument(i).getName() + "\",\"" + argValue + "\");").append(StringUtils.LF);
|
||||
}
|
||||
processor.setProperty("script", script.toString());
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ public class MsLoopController extends MsTestElement {
|
||||
}
|
||||
|
||||
private String script() {
|
||||
String script = "\n" + "import java.util.*;\n" + "import java.text.SimpleDateFormat;\n" + "import org.apache.jmeter.threads.JMeterContextService;\n" + "\n" + "// 循环控制器超时后结束循环\n" + "try{\n" + "\tString ms_current_timer = vars.get(\"" + ms_current_timer + "\");\n" + "\tlong _nowTime = System.currentTimeMillis(); \n" + "\tif(ms_current_timer == null ){\n" + "\t\tvars.put(\"" + ms_current_timer + "\",_nowTime.toString());\n" + "\t}\n" + "\tlong time = Long.parseLong(vars.get(\"" + ms_current_timer + "\"));\n" + "\t if((_nowTime - time) > " + this.whileController.getTimeout() + " ){\n" + "\t \tvars.put(\"" + ms_current_timer + "\", \"stop\");\n" + "\t \tlog.info( \"结束循环\");\n" + "\t }\n" + "}catch (Exception e){\n" + "\tlog.info( e.getMessage());\n" + "\tvars.put(\"" + ms_current_timer + "\", \"stop\");\n" + "}\n";
|
||||
String script = StringUtils.LF + "import java.util.*;\n" + "import java.text.SimpleDateFormat;\n" + "import org.apache.jmeter.threads.JMeterContextService;\n" + "\n" + "// 循环控制器超时后结束循环\n" + "try{\n" + "\tString ms_current_timer = vars.get(\"" + ms_current_timer + "\");\n" + "\tlong _nowTime = System.currentTimeMillis(); \n" + "\tif(ms_current_timer == null ){\n" + "\t\tvars.put(\"" + ms_current_timer + "\",_nowTime.toString());\n" + "\t}\n" + "\tlong time = Long.parseLong(vars.get(\"" + ms_current_timer + "\"));\n" + "\t if((_nowTime - time) > " + this.whileController.getTimeout() + " ){\n" + "\t \tvars.put(\"" + ms_current_timer + "\", \"stop\");\n" + "\t \tlog.info( \"结束循环\");\n" + "\t }\n" + "}catch (Exception e){\n" + "\tlog.info( e.getMessage());\n" + "\tvars.put(\"" + ms_current_timer + "\", \"stop\");\n" + "}\n";
|
||||
|
||||
return script;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class EngineSourceParserFactory {
|
||||
// 删除空白的行
|
||||
List<Node> nodes = document.selectNodes("//text()[normalize-space(.)='']");
|
||||
nodes.forEach(node -> {
|
||||
if (node.getText().contains("\n")) {
|
||||
if (node.getText().contains(StringUtils.LF)) {
|
||||
node.setText("");
|
||||
}
|
||||
});
|
||||
|
@ -51,8 +51,8 @@ public class KubernetesTestEngine extends AbstractEngine {
|
||||
Pod pod = KubernetesApiExec.getExecPod(clientCredential, client);
|
||||
|
||||
StringBuffer logMsg = new StringBuffer("当前报告:【" + runRequest.getReportId() + "】资源:【" + runRequest.getTestId() + "】")
|
||||
.append("\n").append("namespace:").append(clientCredential.getNamespace())
|
||||
.append("\n").append("Pod信息:【 ")
|
||||
.append(StringUtils.LF).append("namespace:").append(clientCredential.getNamespace())
|
||||
.append(StringUtils.LF).append("Pod信息:【 ")
|
||||
.append(JSON.toJSONString(pod.getMetadata())).append(" 】");
|
||||
LoggerUtil.info(logMsg);
|
||||
// 拼接CURL执行命令
|
||||
|
@ -83,15 +83,15 @@ public class ExecThreadPoolExecutor {
|
||||
|
||||
public void outApiThreadPoolExecutorLogger(String message) {
|
||||
ArrayBlockingQueue queue = (ArrayBlockingQueue) threadPool.getQueue();
|
||||
StringBuffer buffer = new StringBuffer("\n" + message);
|
||||
buffer.append("\n").append("线程池详情:").append("\n");
|
||||
buffer.append(" 核心线程数:" + threadPool.getCorePoolSize()).append("\n");
|
||||
buffer.append(" 活动线程数:" + threadPool.getActiveCount()).append(" (略有波动非精确数据)").append("\n");
|
||||
buffer.append(" 最大线程数:" + threadPool.getMaximumPoolSize()).append("\n");
|
||||
buffer.append(" 线程池活跃度:" + divide(threadPool.getActiveCount(), threadPool.getMaximumPoolSize())).append("\n");
|
||||
buffer.append(" 最大队列数:" + (queue.size() + queue.remainingCapacity())).append("\n");
|
||||
buffer.append(" 当前排队线程数:" + (msRejectedExecutionHandler.getBufferQueue().size() + queue.size())).append("\n");
|
||||
buffer.append(" 执行中队列大小:" + PoolExecBlockingQueueUtil.queue.size()).append("\n");
|
||||
StringBuffer buffer = new StringBuffer(org.apache.commons.lang3.StringUtils.LF + message);
|
||||
buffer.append("\n").append("线程池详情:").append(org.apache.commons.lang3.StringUtils.LF);
|
||||
buffer.append(" 核心线程数:" + threadPool.getCorePoolSize()).append(org.apache.commons.lang3.StringUtils.LF);
|
||||
buffer.append(" 活动线程数:" + threadPool.getActiveCount()).append(" (略有波动非精确数据)").append(org.apache.commons.lang3.StringUtils.LF);
|
||||
buffer.append(" 最大线程数:" + threadPool.getMaximumPoolSize()).append(org.apache.commons.lang3.StringUtils.LF);
|
||||
buffer.append(" 线程池活跃度:" + divide(threadPool.getActiveCount(), threadPool.getMaximumPoolSize())).append(org.apache.commons.lang3.StringUtils.LF);
|
||||
buffer.append(" 最大队列数:" + (queue.size() + queue.remainingCapacity())).append(org.apache.commons.lang3.StringUtils.LF);
|
||||
buffer.append(" 当前排队线程数:" + (msRejectedExecutionHandler.getBufferQueue().size() + queue.size())).append(org.apache.commons.lang3.StringUtils.LF);
|
||||
buffer.append(" 执行中队列大小:" + PoolExecBlockingQueueUtil.queue.size()).append(org.apache.commons.lang3.StringUtils.LF);
|
||||
buffer.append(" 队列使用度:" + divide(queue.size(), queue.size() + queue.remainingCapacity()));
|
||||
|
||||
LoggerUtil.info(buffer.toString());
|
||||
@ -172,7 +172,7 @@ public class ExecThreadPoolExecutor {
|
||||
workerQueue.forEach(item -> {
|
||||
ExecTask task = (ExecTask) item;
|
||||
if (task.getRequest() != null) {
|
||||
buffer.append("等待队列报告:【 " + task.getRequest().getReportId() + "】资源:【 " + task.getRequest().getTestId() + "】").append("\n");
|
||||
buffer.append("等待队列报告:【 " + task.getRequest().getReportId() + "】资源:【 " + task.getRequest().getTestId() + "】").append(org.apache.commons.lang3.StringUtils.LF);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class ApiEnvironmentRunningParamService {
|
||||
}
|
||||
|
||||
public void parseEvn(String envStr) {
|
||||
String[] envStringArr = envStr.split("\n");
|
||||
String[] envStringArr = envStr.split(StringUtils.LF);
|
||||
Map<String, Map<String, String>> envVarsMap = new HashMap<>();
|
||||
for (String env : envStringArr) {
|
||||
if (StringUtils.contains(env, "=")) {
|
||||
|
@ -17,14 +17,14 @@ public class JMeterLoggerAppender extends UnsynchronizedAppenderBase<ILoggingEve
|
||||
message.append(DateUtils.getTimeStr(event.getTimeStamp())).append(StringUtils.SPACE)
|
||||
.append(event.getLevel()).append(StringUtils.SPACE)
|
||||
.append(event.getThreadName()).append(StringUtils.SPACE)
|
||||
.append(event.getFormattedMessage()).append("\n");
|
||||
.append(event.getFormattedMessage()).append(StringUtils.LF);
|
||||
|
||||
if (event.getThrowableProxy() != null) {
|
||||
message.append(event.getThrowableProxy().getMessage()).append("\n");
|
||||
message.append(event.getThrowableProxy().getClassName()).append("\n");
|
||||
message.append(event.getThrowableProxy().getMessage()).append(StringUtils.LF);
|
||||
message.append(event.getThrowableProxy().getClassName()).append(StringUtils.LF);
|
||||
if (event.getThrowableProxy().getStackTraceElementProxyArray() != null) {
|
||||
for (StackTraceElementProxy stackTraceElementProxy : event.getThrowableProxy().getStackTraceElementProxyArray()) {
|
||||
message.append(" ").append(stackTraceElementProxy.getSTEAsString()).append("\n");
|
||||
message.append(" ").append(stackTraceElementProxy.getSTEAsString()).append(StringUtils.LF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ public class MsDebugListener extends AbstractListenerElement implements SampleLi
|
||||
if (variables != null && CollectionUtils.isNotEmpty(variables.entrySet())) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (Map.Entry<String, Object> entry : variables.entrySet()) {
|
||||
builder.append(entry.getKey()).append(":").append(entry.getValue()).append("\n");
|
||||
builder.append(entry.getKey()).append(":").append(entry.getValue()).append(StringUtils.LF);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(builder)) {
|
||||
result.setExtVars(builder.toString());
|
||||
|
@ -6,6 +6,7 @@ import io.metersphere.commons.utils.NamedThreadFactory;
|
||||
import io.metersphere.service.ApiExecutionQueueService;
|
||||
import io.metersphere.service.TestResultService;
|
||||
import io.metersphere.utils.LoggerUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.kafka.annotation.KafkaListener;
|
||||
@ -65,19 +66,19 @@ public class MsKafkaListener {
|
||||
|
||||
public void outKafkaPoolLogger() {
|
||||
StringBuffer buffer = new StringBuffer()
|
||||
.append("\n")
|
||||
.append(StringUtils.LF)
|
||||
.append("KAFKA Consume 线程池详情:")
|
||||
.append("\n")
|
||||
.append(StringUtils.LF)
|
||||
.append(" KAFKA Consume 核心线程数:" + threadPool.getCorePoolSize())
|
||||
.append("\n")
|
||||
.append(StringUtils.LF)
|
||||
.append(" KAFKA Consume 活动线程数:" + threadPool.getActiveCount())
|
||||
.append("\n")
|
||||
.append(StringUtils.LF)
|
||||
.append(" KAFKA Consume 最大线程数:" + threadPool.getMaximumPoolSize())
|
||||
.append("\n")
|
||||
.append(StringUtils.LF)
|
||||
.append(" KAFKA Consume 最大队列数:" + (threadPool.getQueue().size() + threadPool.getQueue().remainingCapacity()))
|
||||
.append("\n")
|
||||
.append(StringUtils.LF)
|
||||
.append(" KAFKA Consume 当前排队线程数:" + (threadPool.getQueue().size()))
|
||||
.append("\n");
|
||||
.append(StringUtils.LF);
|
||||
LoggerUtil.info(buffer.toString());
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ public abstract class HarScenarioAbstractParser<T> extends ApiImportAbstractPars
|
||||
if (CollectionUtils.isNotEmpty(exec)) {
|
||||
exec.forEach(col -> {
|
||||
if (StringUtils.isNotEmpty(col)) {
|
||||
scriptStr.append(col + "\n");
|
||||
scriptStr.append(col + StringUtils.LF);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ public class JmeterDocumentParser implements EngineSourceParser {
|
||||
if (content == null) {
|
||||
return;
|
||||
}
|
||||
StringTokenizer tokenizer = new StringTokenizer(new String(content), "\n");
|
||||
StringTokenizer tokenizer = new StringTokenizer(new String(content), StringUtils.LF);
|
||||
if (!tokenizer.hasMoreTokens()) {
|
||||
return;
|
||||
}
|
||||
@ -268,7 +268,7 @@ public class JmeterDocumentParser implements EngineSourceParser {
|
||||
boolean csvHasHeader = ((JSONObject) (config)).getBoolean("csvHasHeader");
|
||||
if (csvHasHeader) {
|
||||
String header = tokenizer.nextToken();
|
||||
csv.append(header).append("\n");
|
||||
csv.append(header).append(StringUtils.LF);
|
||||
}
|
||||
int count = tokenizer.countTokens();
|
||||
|
||||
@ -289,7 +289,7 @@ public class JmeterDocumentParser implements EngineSourceParser {
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
if (current == 0) { // 节点一个都没有分到,把所有的数据都给这个节点(极端情况)
|
||||
String line = tokenizer.nextToken();
|
||||
csv.append(line).append("\n");
|
||||
csv.append(line).append(StringUtils.LF);
|
||||
} else {
|
||||
if (index <= offset) {
|
||||
tokenizer.nextToken();
|
||||
@ -300,7 +300,7 @@ public class JmeterDocumentParser implements EngineSourceParser {
|
||||
break;
|
||||
}
|
||||
String line = tokenizer.nextToken();
|
||||
csv.append(line).append("\n");
|
||||
csv.append(line).append(StringUtils.LF);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
@ -77,13 +77,13 @@ public class ApiAppStartListener implements ApplicationRunner {
|
||||
LogUtil.info("starting quartz");
|
||||
StringBuffer buffer = new StringBuffer("定时任务相关设置:");
|
||||
buffer.append("quartz.acquireTriggersWithinLock :")
|
||||
.append(acquireTriggersWithinLock).append("\n")
|
||||
.append(acquireTriggersWithinLock).append(StringUtils.LF)
|
||||
.append("quartz.enabled ")
|
||||
.append(quartzEnable).append("\n")
|
||||
.append(quartzEnable).append(StringUtils.LF)
|
||||
.append("quartz.scheduler-name ")
|
||||
.append(quartzScheduleName).append("\n")
|
||||
.append(quartzScheduleName).append(StringUtils.LF)
|
||||
.append("quartz.thread-count ")
|
||||
.append(quartzThreadCount).append("\n");
|
||||
.append(quartzThreadCount).append(StringUtils.LF);
|
||||
|
||||
LogUtil.info(buffer.toString());
|
||||
scheduleService.startEnableSchedules(ScheduleGroup.API_SCENARIO_TEST);
|
||||
|
@ -184,7 +184,7 @@ public class RemakeReportService {
|
||||
// 全局并发队列
|
||||
PoolExecBlockingQueueUtil.offer(dto.getReportId());
|
||||
String consoleMsg = FixedCapacityUtil.getJmeterLogger(dto.getReportId(), true);
|
||||
dto.setConsole(consoleMsg + "\n" + errorMsg);
|
||||
dto.setConsole(consoleMsg + StringUtils.LF + errorMsg);
|
||||
// 整体执行结束更新资源状态
|
||||
CommonBeanFactory.getBean(TestResultService.class).testEnded(dto);
|
||||
|
||||
|
@ -4,6 +4,7 @@ import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import io.metersphere.commons.json.BasicConstant;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@ -22,7 +23,7 @@ public class EnumPropertyUtil {
|
||||
jsonStr = object.get(BasicConstant.ENUM).getAsString();
|
||||
}
|
||||
if (jsonStr != null && list.isEmpty()) {
|
||||
String[] arrays = jsonStr.split("\n");
|
||||
String[] arrays = jsonStr.split(StringUtils.LF);
|
||||
for (String str : arrays) {
|
||||
list.add(str);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.metersphere.commons.utils;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -260,9 +261,9 @@ public class LogUtil {
|
||||
StackTraceElement[] stackElements = e.getStackTrace();
|
||||
for (StackTraceElement stackTraceElement : stackElements) {
|
||||
sb.append(stackTraceElement.toString());
|
||||
sb.append("\n");
|
||||
sb.append(StringUtils.LF);
|
||||
}
|
||||
sb.append("\n");
|
||||
sb.append(StringUtils.LF);
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import io.metersphere.log.utils.diff.json.jsonwrap.JzonArray;
|
||||
import io.metersphere.log.utils.diff.json.jsonwrap.JzonElement;
|
||||
import io.metersphere.log.utils.diff.json.jsonwrap.JzonObject;
|
||||
import io.metersphere.log.utils.diff.json.jsonwrap.Wrapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
@ -378,7 +379,7 @@ class Leaf implements Comparable<Leaf> {
|
||||
bld.append("_ORPHAN");
|
||||
}
|
||||
bld.append(">");
|
||||
bld.append("\n");
|
||||
bld.append(StringUtils.LF);
|
||||
|
||||
return bld.toString();
|
||||
|
||||
|
@ -561,7 +561,7 @@ public class BaseUserService {
|
||||
List<String> names = users.stream().map(User::getName).collect(Collectors.toList());
|
||||
|
||||
StringBuilder nameBuilder = new StringBuilder();
|
||||
nameBuilder.append(String.join(",", names)).append("\n");
|
||||
nameBuilder.append(String.join(",", names)).append(StringUtils.LF);
|
||||
for (String userId : ids) {
|
||||
UserGroupExample userGroupExample = new UserGroupExample();
|
||||
userGroupExample.createCriteria().andUserIdEqualTo(userId).andSourceIdEqualTo(id);
|
||||
|
@ -221,7 +221,7 @@ public class EngineFactory {
|
||||
if (!(Boolean) prop.get("enable")) {
|
||||
continue;
|
||||
}
|
||||
dns.append(prop.get("ip")).append(StringUtils.SPACE).append(prop.get("domain")).append("\n");
|
||||
dns.append(prop.get("ip")).append(StringUtils.SPACE).append(prop.get("domain")).append(StringUtils.LF);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +240,7 @@ public class EngineFactory {
|
||||
if (!(Boolean) prop.get("enable")) {
|
||||
continue;
|
||||
}
|
||||
props.append(prop.get("name")).append("=").append(prop.get("value")).append("\n");
|
||||
props.append(prop.get("name")).append("=").append(prop.get("value")).append(StringUtils.LF);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -259,7 +259,7 @@ public class EngineFactory {
|
||||
if (!(Boolean) prop.get("enable")) {
|
||||
continue;
|
||||
}
|
||||
props.append(prop.get("name")).append("=").append(prop.get("value")).append("\n");
|
||||
props.append(prop.get("name")).append("=").append(prop.get("value")).append(StringUtils.LF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class EngineSourceParserFactory {
|
||||
// 删除空白的行
|
||||
List<Node> nodes = document.selectNodes("//text()[normalize-space(.)='']");
|
||||
nodes.forEach(node -> {
|
||||
if (node.getText().contains("\n")) {
|
||||
if (node.getText().contains(StringUtils.LF)) {
|
||||
node.setText(StringUtils.EMPTY);
|
||||
}
|
||||
});
|
||||
|
@ -253,7 +253,7 @@ public class JmeterDocumentParser implements EngineSourceParser {
|
||||
if (content == null) {
|
||||
return;
|
||||
}
|
||||
StringTokenizer tokenizer = new StringTokenizer(new String(content), "\n");
|
||||
StringTokenizer tokenizer = new StringTokenizer(new String(content), StringUtils.LF);
|
||||
if (!tokenizer.hasMoreTokens()) {
|
||||
return;
|
||||
}
|
||||
@ -266,7 +266,7 @@ public class JmeterDocumentParser implements EngineSourceParser {
|
||||
boolean csvHasHeader = (Boolean) ((Map) (config)).get("csvHasHeader");
|
||||
if (csvHasHeader) {
|
||||
String header = tokenizer.nextToken();
|
||||
csv.append(header).append("\n");
|
||||
csv.append(header).append(StringUtils.LF);
|
||||
}
|
||||
int count = tokenizer.countTokens();
|
||||
|
||||
@ -287,7 +287,7 @@ public class JmeterDocumentParser implements EngineSourceParser {
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
if (current == 0) { // 节点一个都没有分到,把所有的数据都给这个节点(极端情况)
|
||||
String line = tokenizer.nextToken();
|
||||
csv.append(line).append("\n");
|
||||
csv.append(line).append(StringUtils.LF);
|
||||
} else {
|
||||
if (index <= offset) {
|
||||
tokenizer.nextToken();
|
||||
@ -298,7 +298,7 @@ public class JmeterDocumentParser implements EngineSourceParser {
|
||||
break;
|
||||
}
|
||||
String line = tokenizer.nextToken();
|
||||
csv.append(line).append("\n");
|
||||
csv.append(line).append(StringUtils.LF);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
@ -453,7 +453,7 @@ public class PerformanceTestService {
|
||||
reportDetail.setPart(1L);
|
||||
loadTestReportDetailMapper.insertSelective(reportDetail);
|
||||
// append \n
|
||||
extLoadTestReportDetailMapper.appendLine(testReport.getId(), "\n");
|
||||
extLoadTestReportDetailMapper.appendLine(testReport.getId(), StringUtils.LF);
|
||||
// 保存一个 reportStatus
|
||||
LoadTestReportResult reportResult = new LoadTestReportResult();
|
||||
reportResult.setId(UUID.randomUUID().toString());
|
||||
@ -1008,7 +1008,7 @@ public class PerformanceTestService {
|
||||
example.createCriteria().andIdIn(testIds);
|
||||
List<LoadTest> loadTests = loadTestMapper.selectByExample(example);
|
||||
errorMessage += Translator.get("load_test") + ": " + StringUtils.join(loadTests.stream().map(LoadTest::getName).toArray(), ",");
|
||||
errorMessage += "\n";
|
||||
errorMessage += StringUtils.LF;
|
||||
}
|
||||
if (StringUtils.isNotBlank(errorMessage)) {
|
||||
MSException.throwException(errorMessage + Translator.get("project_file_in_use"));
|
||||
|
@ -18,14 +18,14 @@ public class JMeterLoggerAppender extends UnsynchronizedAppenderBase<ILoggingEve
|
||||
message.append(DateUtils.getTimeStr(event.getTimeStamp())).append(StringUtils.SPACE)
|
||||
.append(event.getLevel()).append(StringUtils.SPACE)
|
||||
.append(event.getThreadName()).append(StringUtils.SPACE)
|
||||
.append(event.getFormattedMessage()).append("\n");
|
||||
.append(event.getFormattedMessage()).append(StringUtils.LF);
|
||||
|
||||
if (event.getThrowableProxy() != null) {
|
||||
message.append(event.getThrowableProxy().getMessage()).append("\n");
|
||||
message.append(event.getThrowableProxy().getClassName()).append("\n");
|
||||
message.append(event.getThrowableProxy().getMessage()).append(StringUtils.LF);
|
||||
message.append(event.getThrowableProxy().getClassName()).append(StringUtils.LF);
|
||||
if (event.getThrowableProxy().getStackTraceElementProxyArray() != null) {
|
||||
for (StackTraceElementProxy stackTraceElementProxy : event.getThrowableProxy().getStackTraceElementProxyArray()) {
|
||||
message.append(" ").append(stackTraceElementProxy.getSTEAsString()).append("\n");
|
||||
message.append(" ").append(stackTraceElementProxy.getSTEAsString()).append(StringUtils.LF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ public class MsDebugListener extends AbstractListenerElement implements SampleLi
|
||||
if (variables != null && CollectionUtils.isNotEmpty(variables.entrySet())) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (Map.Entry<String, Object> entry : variables.entrySet()) {
|
||||
builder.append(entry.getKey()).append(":").append(entry.getValue()).append("\n");
|
||||
builder.append(entry.getKey()).append(":").append(entry.getValue()).append(StringUtils.LF);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(builder)) {
|
||||
result.setExtVars(builder.toString());
|
||||
|
@ -354,7 +354,7 @@ public class EnterpriseTestReportService {
|
||||
|
||||
for (EnterpriseReportContentStep step : stepList) {
|
||||
String title = "<div style=\"background-color: #783887;font-size: 16px;color: white;margin: 5px;width: 100%; line-height:30px\">\n" +
|
||||
"<span style=\"margin-left: 5px\">" + step.getName() + "\n" +
|
||||
"<span style=\"margin-left: 5px\">" + step.getName() + StringUtils.LF +
|
||||
"</span>\n" +
|
||||
"</div>";
|
||||
returnReportContentBuffer.append(title);
|
||||
|
@ -126,7 +126,7 @@ public class UserDataListener extends EasyExcelListener<UserExcelData> {
|
||||
private String checkWorkSpace(String userRoleInExcel, String workspaceInfoInExcel) {
|
||||
String result = null;
|
||||
if (StringUtils.equalsIgnoreCase(Translator.get("options_yes"), userRoleInExcel)) {
|
||||
String[] workspaceArr = workspaceInfoInExcel.split("\n");
|
||||
String[] workspaceArr = workspaceInfoInExcel.split(StringUtils.LF);
|
||||
for (String workspace :
|
||||
workspaceArr) {
|
||||
if (!workspaceNameMap.containsKey(workspace)) {
|
||||
@ -151,7 +151,7 @@ public class UserDataListener extends EasyExcelListener<UserExcelData> {
|
||||
private String checkProject(String userGroupInExcel, String projectInfoInExcel) {
|
||||
String result = null;
|
||||
if (StringUtils.equalsAnyIgnoreCase(Translator.get("options_yes"), userGroupInExcel)) {
|
||||
String[] projectNameArr = projectInfoInExcel.split("\n");
|
||||
String[] projectNameArr = projectInfoInExcel.split(StringUtils.LF);
|
||||
for (String projectName : projectNameArr) {
|
||||
if (!projectNameMap.containsKey(projectName)) {
|
||||
if (result == null) {
|
||||
@ -176,7 +176,7 @@ public class UserDataListener extends EasyExcelListener<UserExcelData> {
|
||||
private List<String> getIdByExcelInfoAndIdDic(String userRoleInExcel, String nameStringInExce, Map<String, String> idDic) {
|
||||
List<String> resultList = new ArrayList<>();
|
||||
if (StringUtils.equalsIgnoreCase(Translator.get("options_yes"), userRoleInExcel)) {
|
||||
String[] nameArr = nameStringInExce.split("\n");
|
||||
String[] nameArr = nameStringInExce.split(StringUtils.LF);
|
||||
for (String name : nameArr) {
|
||||
if (idDic.containsKey(name)) {
|
||||
resultList.add(idDic.get(name));
|
||||
|
@ -950,7 +950,7 @@ public class UserService {
|
||||
List<String> names = users.stream().map(User::getName).collect(Collectors.toList());
|
||||
|
||||
StringBuilder nameBuilder = new StringBuilder();
|
||||
nameBuilder.append(String.join(",", names)).append("\n");
|
||||
nameBuilder.append(String.join(",", names)).append(StringUtils.LF);
|
||||
for (String userId : ids) {
|
||||
UserGroupExample userGroupExample = new UserGroupExample();
|
||||
userGroupExample.createCriteria().andUserIdEqualTo(userId).andSourceIdEqualTo(id);
|
||||
@ -1019,7 +1019,7 @@ public class UserService {
|
||||
List<User> users = userMapper.selectByExample(example);
|
||||
if (users != null) {
|
||||
List<String> names = users.stream().map(User::getName).collect(Collectors.toList());
|
||||
String roles = "\n" + "成员角色:\n" + this.getRoles(users.get(0).getId());
|
||||
String roles = StringUtils.LF + "成员角色:\n" + this.getRoles(users.get(0).getId());
|
||||
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(userIdList), null, String.join(",", names) + roles, null, new LinkedList<>());
|
||||
return JSON.toJSONString(details);
|
||||
}
|
||||
|
@ -1311,7 +1311,7 @@ public class TestPlanService {
|
||||
if (line.contains("\"#report\"")) {
|
||||
line = line.replace("\"#report\"", new Gson().toJson(report));
|
||||
}
|
||||
line += "\n";
|
||||
line += StringUtils.LF;
|
||||
byte[] lineBytes = line.getBytes(StandardCharsets.UTF_8);
|
||||
int start = 0;
|
||||
while (start < lineBytes.length) {
|
||||
|
@ -2341,21 +2341,21 @@ public class TestCaseService {
|
||||
List<ApiTestCase> testCases = relevanceApiCaseService.getApiCaseByIds(testCaseIds);
|
||||
List<String> caseNames = testCases.stream().map(ApiTestCase::getName).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(caseNames)) {
|
||||
nameBuilder.append("接口用例:").append("\n").append(caseNames).append("\n");
|
||||
nameBuilder.append("接口用例:").append(StringUtils.LF).append(caseNames).append(StringUtils.LF);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(performanceIds)) {
|
||||
List<LoadTest> loadTests = relevanceLoadCaseService.getLoadCaseByIds(performanceIds);
|
||||
List<String> caseNames = loadTests.stream().map(LoadTest::getName).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(caseNames)) {
|
||||
nameBuilder.append("性能用例:").append("\n").append(caseNames).append("\n");
|
||||
nameBuilder.append("性能用例:").append(StringUtils.LF).append(caseNames).append(StringUtils.LF);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(automationIds)) {
|
||||
List<ApiScenario> scenarios = relevanceApiCaseService.getScenarioCaseByIds(automationIds);
|
||||
List<String> caseNames = scenarios.stream().map(ApiScenario::getName).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(caseNames)) {
|
||||
nameBuilder.append("自动化用例:").append("\n").append(caseNames).append("\n");
|
||||
nameBuilder.append("自动化用例:").append(StringUtils.LF).append(caseNames).append(StringUtils.LF);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2393,7 +2393,7 @@ public class TestCaseService {
|
||||
if (CollectionUtils.isNotEmpty(dtos)) {
|
||||
names = dtos.stream().map(TestCaseCommentDTO::getDescription).collect(Collectors.toList());
|
||||
}
|
||||
DetailColumn detailColumn = new DetailColumn("评论", "comment", String.join("\n", names), null);
|
||||
DetailColumn detailColumn = new DetailColumn("评论", "comment", String.join(StringUtils.LF, names), null);
|
||||
columns.add(detailColumn);
|
||||
|
||||
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(id), bloBs.getProjectId(), bloBs.getName(), bloBs.getCreateUser(), columns);
|
||||
@ -2412,7 +2412,7 @@ public class TestCaseService {
|
||||
List<TestCaseCommentDTO> dtos = testCaseCommentService.getCaseComments(id);
|
||||
if (CollectionUtils.isNotEmpty(dtos)) {
|
||||
List<String> names = dtos.stream().map(TestCaseCommentDTO::getDescription).collect(Collectors.toList());
|
||||
DetailColumn detailColumn = new DetailColumn("评论", "comment", String.join("\n", names), null);
|
||||
DetailColumn detailColumn = new DetailColumn("评论", "comment", String.join(StringUtils.LF, names), null);
|
||||
columns.add(detailColumn);
|
||||
}
|
||||
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(testCaseWithBLOBs.getId()), testCaseWithBLOBs.getProjectId(), testCaseWithBLOBs.getName(), testCaseWithBLOBs.getCreateUser(), columns);
|
||||
|
@ -240,7 +240,7 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
||||
document.outputSettings(new Document.OutputSettings().prettyPrint(false));
|
||||
document.select("br").append("\\n");
|
||||
document.select("p").prepend("\\n\\n");
|
||||
desc = document.html().replaceAll("\\\\n", "\n");
|
||||
desc = document.html().replaceAll("\\\\n", StringUtils.LF);
|
||||
desc = Jsoup.clean(desc, "", Safelist.none(), new Document.OutputSettings().prettyPrint(false));
|
||||
return desc.replace(" ", "");
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||
private String appendMoreImage(String description, Map<String, String> fileContentMap) {
|
||||
for (String key: fileContentMap.keySet()) {
|
||||
// 同步jira上传的附件
|
||||
description += "\n" + fileContentMap.get(key);
|
||||
description += StringUtils.LF + fileContentMap.get(key);
|
||||
}
|
||||
return description;
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ public class XmindCaseParser {
|
||||
testCase.setPrerequisite(replace(item.getTitle(), PC_REGEX));
|
||||
} else if (isAvailable(item.getTitle(), RC_REGEX)) {
|
||||
rc.append(replace(item.getTitle(), RC_REGEX));
|
||||
rc.append("\n");
|
||||
rc.append(StringUtils.LF);
|
||||
} else if (isAvailable(item.getTitle(), TAG_REGEX)) {
|
||||
String tag = replace(item.getTitle(), TAG_REGEX);
|
||||
if (StringUtils.isNotEmpty(tag)) {
|
||||
|
Loading…
Reference in New Issue
Block a user