Merge branch 'v1.4'

This commit is contained in:
chenjianxing 2020-11-02 14:37:36 +08:00
commit 870f9f9388
5 changed files with 23 additions and 19 deletions

View File

@ -250,7 +250,7 @@
<dependency>
<groupId>io.metersphere</groupId>
<artifactId>jmeter-plugins-dubbo</artifactId>
<version>2.7.11</version>
<version>2.7.12</version>
</dependency>
<!-- LDAP Module -->
@ -362,14 +362,6 @@
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
<build>

View File

@ -61,7 +61,7 @@ public class MsParser extends ApiImportAbstractParser {
Object body = requestObject.get("body");
if (body instanceof JSONArray) {
JSONArray bodies = requestObject.getJSONArray("body");
if (StringUtils.equalsIgnoreCase(requestObject.getString("method"), "POST") && bodies != null) {
if (bodies != null) {
StringBuilder bodyStr = new StringBuilder();
for (int i = 0; i < bodies.size(); i++) {
String tmp = bodies.getString(i);
@ -74,7 +74,7 @@ public class MsParser extends ApiImportAbstractParser {
}
} else if (body instanceof JSONObject) {
JSONObject bodyObj = requestObject.getJSONObject("body");
if (StringUtils.equalsIgnoreCase(requestObject.getString("method"), "POST") && bodyObj != null) {
if (bodyObj != null) {
JSONArray kvs = new JSONArray();
bodyObj.keySet().forEach(key -> {
JSONObject kv = new JSONObject();

View File

@ -1,6 +1,7 @@
package io.metersphere.performance.notice;
import io.metersphere.base.domain.LoadTestReportWithBLOBs;
import io.metersphere.base.mapper.LoadTestReportMapper;
import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.constants.PerformanceTestStatus;
import io.metersphere.commons.utils.LogUtil;
@ -34,6 +35,9 @@ public class PerformanceNoticeTask {
private MailService mailService;
@Resource
private SystemParameterService systemParameterService;
@Resource
private LoadTestReportMapper loadTestReportMapper;
private final ExecutorService executorService = Executors.newFixedThreadPool(20);
private boolean isRunning = true;
@ -45,14 +49,16 @@ public class PerformanceNoticeTask {
public void registerNoticeTask(LoadTestReportWithBLOBs loadTestReport) {
executorService.submit(() -> {
while (isRunning) {
if (StringUtils.equals(loadTestReport.getStatus(), PerformanceTestStatus.Completed.name())) {
LoadTestReportWithBLOBs loadTestReportFromDatabase = loadTestReportMapper.selectByPrimaryKey(loadTestReport.getId());
if (StringUtils.equals(loadTestReportFromDatabase.getStatus(), PerformanceTestStatus.Completed.name())) {
isRunning = false;
sendSuccessNotice(loadTestReport);
sendSuccessNotice(loadTestReportFromDatabase);
return;
}
if (StringUtils.equals(loadTestReport.getStatus(), PerformanceTestStatus.Error.name())) {
if (StringUtils.equals(loadTestReportFromDatabase.getStatus(), PerformanceTestStatus.Error.name())) {
isRunning = false;
sendFailNotice(loadTestReport);
sendFailNotice(loadTestReportFromDatabase);
return;
}
try {

View File

@ -162,9 +162,11 @@ export default {
break;
}
},
getColor(enable, method) {
if (enable) {
getColor(requestEnable, method) {
if (this.scenario.enable && requestEnable) {
return this.methodColorMap.get(method);
} else {
return '#909399';
}
},
select(request) {

View File

@ -1363,15 +1363,19 @@ class JMXGenerator {
}
addContentType(request, type) {
let hasContentType = false;
for (let index in request.headers) {
if (request.headers.hasOwnProperty(index)) {
if (request.headers[index].name === 'Content-Type') {
if (request.headers[index].name === 'Content-Type' && request.headers[index].enable != false) {
request.headers.splice(index, 1);
hasContentType = true;
break;
}
}
}
request.headers.push(new KeyValue({name: 'Content-Type', value: type}));
if (!hasContentType) {
request.headers.push(new KeyValue({name: 'Content-Type', value: type}));
}
}
addRequestArguments(httpSamplerProxy, request) {