Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
45629caa27
|
@ -24,7 +24,6 @@ import org.apache.jmeter.testelement.TestElement;
|
|||
import org.apache.jorphan.collections.HashTree;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
@ -51,7 +50,7 @@ public class MsJDBCSampler extends MsTestElement {
|
|||
@JSONField(ordinal = 28)
|
||||
private String dataSourceId;
|
||||
@JSONField(ordinal = 29)
|
||||
private String protocol="SQL";
|
||||
private String protocol = "SQL";
|
||||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
|
@ -62,7 +61,8 @@ public class MsJDBCSampler extends MsTestElement {
|
|||
this.getRefElement(this);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(dataSourceId)) {
|
||||
initDataSource();
|
||||
this.dataSource = null;
|
||||
this.initDataSource();
|
||||
}
|
||||
if (this.dataSource == null) {
|
||||
MSException.throwException("数据源为空无法执行");
|
||||
|
@ -79,14 +79,16 @@ public class MsJDBCSampler extends MsTestElement {
|
|||
|
||||
private void initDataSource() {
|
||||
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
|
||||
ApiTestEnvironmentWithBLOBs environment = environmentService.get(this.dataSourceId);
|
||||
ApiTestEnvironmentWithBLOBs environment = environmentService.get(environmentId);
|
||||
if (environment != null && environment.getConfig() != null) {
|
||||
EnvironmentConfig config = JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class);
|
||||
if (CollectionUtils.isNotEmpty(config.getDatabaseConfigs())) {
|
||||
List<DatabaseConfig> databaseConfigs = config.getDatabaseConfigs().stream().filter((DatabaseConfig d) -> this.dataSourceId.equals(d.getId())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(databaseConfigs)) {
|
||||
this.dataSource = databaseConfigs.get(0);
|
||||
}
|
||||
EnvironmentConfig envConfig = JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class);
|
||||
if (CollectionUtils.isNotEmpty(envConfig.getDatabaseConfigs())) {
|
||||
envConfig.getDatabaseConfigs().forEach(item -> {
|
||||
if (item.getId().equals(this.dataSourceId)) {
|
||||
this.dataSource = item;
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -297,6 +297,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
|
|||
requestResult.setHeaders(result.getRequestHeaders());
|
||||
requestResult.setRequestSize(result.getSentBytes());
|
||||
requestResult.setStartTime(result.getStartTime());
|
||||
requestResult.setEndTime(result.getEndTime());
|
||||
requestResult.setTotalAssertions(result.getAssertionResults().length);
|
||||
requestResult.setSuccess(result.isSuccessful());
|
||||
requestResult.setError(result.getErrorCount());
|
||||
|
|
|
@ -18,6 +18,8 @@ public class RequestResult {
|
|||
|
||||
private long startTime;
|
||||
|
||||
private long endTime;
|
||||
|
||||
private int error;
|
||||
|
||||
private boolean success;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 387ca56312b62ae5edb3d7f34afa08946d86d621
|
||||
Subproject commit a641c1331e1813b5294a1d0e380b8682a78754e1
|
|
@ -118,6 +118,7 @@
|
|||
throw e;
|
||||
}
|
||||
this.getFails();
|
||||
this.computeTotalTime();
|
||||
this.loading = false;
|
||||
} else {
|
||||
setTimeout(this.getReport, 2000)
|
||||
|
@ -146,12 +147,30 @@
|
|||
failScenario.requestResults.push(failRequest);
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
computeTotalTime() {
|
||||
if (this.content.scenarios) {
|
||||
let startTime = 99991611737506593;
|
||||
let endTime = 0;
|
||||
this.content.scenarios.forEach((scenario) => {
|
||||
scenario.requestResults.forEach((request) => {
|
||||
if (request.startTime && Number(request.startTime) < startTime) {
|
||||
startTime = request.startTime;
|
||||
}
|
||||
if (request.endTime && Number(request.endTime) > endTime) {
|
||||
endTime = request.endTime;
|
||||
}
|
||||
})
|
||||
})
|
||||
if (startTime < endTime) {
|
||||
this.totalTime = endTime - startTime + 100;
|
||||
}
|
||||
}
|
||||
},
|
||||
requestResult(requestResult) {
|
||||
this.active();
|
||||
this.isRequestResult = false;
|
||||
|
|
|
@ -1,17 +1,21 @@
|
|||
<template>
|
||||
<div class="request-result">
|
||||
<div>
|
||||
<el-row :gutter="10" type="flex" align="middle" class="info">
|
||||
<el-row :gutter="8" type="flex" align="middle" class="info">
|
||||
<el-col :span="2">
|
||||
<div class="method">
|
||||
{{request.method}}
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-col :span="8">
|
||||
<el-tooltip effect="dark" :content="request.url" placement="bottom" :open-delay="800">
|
||||
<div class="url">{{request.url}}</div>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="url"> {{$t('api_report.start_time')}}:{{request.startTime | timestampFormatDate(true) }}
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<el-collapse-transition>
|
||||
|
@ -19,7 +23,7 @@
|
|||
<el-tabs v-model="activeName" v-show="isActive" v-if="hasSub">
|
||||
<el-tab-pane :label="$t('api_report.sub_result')" name="sub">
|
||||
<ms-request-sub-result class="sub-result" v-for="(sub, index) in request.subRequestResults"
|
||||
:key="index" :indexNumber="index" :request="sub"/>
|
||||
:key="index" :indexNumber="index" :request="sub"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('api_report.request_result')" name="result">
|
||||
<ms-response-text :request-type="requestType" :response="request.responseResult" :request="request"/>
|
||||
|
@ -43,7 +47,7 @@
|
|||
|
||||
export default {
|
||||
name: "MsRequestResultTail",
|
||||
components: {MsResponseText, MsRequestText, MsAssertionResults, MsRequestMetric, MsRequestResult,MsRequestSubResult},
|
||||
components: {MsResponseText, MsRequestText, MsAssertionResults, MsRequestMetric, MsRequestResult, MsRequestSubResult},
|
||||
props: {
|
||||
request: Object,
|
||||
scenarioName: String,
|
||||
|
|
Loading…
Reference in New Issue