Merge branch 'v1.4'
This commit is contained in:
commit
db65773cb0
|
@ -1,2 +1,2 @@
|
||||||
alter table message_task
|
ALTER TABLE message_task
|
||||||
add create_time bigint(13) null;
|
ADD create_time bigint(13) DEFAULT 0;
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsApiRequestForm",
|
name: "MsApiRequestForm",
|
||||||
components: {MsApiSqlRequestForm, MsRequestResultTail, MsScenarioResults, MsApiDubboRequestForm, MsApiHttpRequestForm},
|
components: {MsApiSqlRequestForm, MsRequestResultTail, MsScenarioResults, MsApiDubboRequestForm, MsApiHttpRequestForm, MsApiTcpRequestForm},
|
||||||
props: {
|
props: {
|
||||||
scenario: Scenario,
|
scenario: Scenario,
|
||||||
request: Request,
|
request: Request,
|
||||||
|
|
|
@ -1020,7 +1020,8 @@ class JMXHttpRequest {
|
||||||
this.domain = environment.config.httpConfig.domain;
|
this.domain = environment.config.httpConfig.domain;
|
||||||
this.port = environment.config.httpConfig.port;
|
this.port = environment.config.httpConfig.port;
|
||||||
this.protocol = environment.config.httpConfig.protocol;
|
this.protocol = environment.config.httpConfig.protocol;
|
||||||
let envPath = environment.config.httpConfig.protocol + "://" + environment.config.httpConfig.socket;
|
let url = new URL(environment.config.httpConfig.protocol + "://" + environment.config.httpConfig.socket);
|
||||||
|
let envPath = url.pathname === '/' ? '' : url.pathname;
|
||||||
this.path = this.getPostQueryParameters(request, decodeURIComponent(envPath + (request.path ? request.path : '')));
|
this.path = this.getPostQueryParameters(request, decodeURIComponent(envPath + (request.path ? request.path : '')));
|
||||||
}
|
}
|
||||||
this.connectTimeout = request.connectTimeout;
|
this.connectTimeout = request.connectTimeout;
|
||||||
|
@ -1158,17 +1159,18 @@ class JMXGenerator {
|
||||||
sampler = new DubboSample(request.name || "", new JMXDubboRequest(request, scenario.dubboConfig));
|
sampler = new DubboSample(request.name || "", new JMXDubboRequest(request, scenario.dubboConfig));
|
||||||
} else if (request instanceof HttpRequest) {
|
} else if (request instanceof HttpRequest) {
|
||||||
sampler = new HTTPSamplerProxy(request.name || "", new JMXHttpRequest(request, scenario.environment));
|
sampler = new HTTPSamplerProxy(request.name || "", new JMXHttpRequest(request, scenario.environment));
|
||||||
this.addRequestHeader(sampler, request);
|
this.addRequestHeader(sampler, request, scenario);
|
||||||
this.addRequestArguments(sampler, request);
|
this.addRequestArguments(sampler, request);
|
||||||
this.addRequestBody(sampler, request, testId);
|
this.addRequestBody(sampler, request, testId);
|
||||||
} else if (request instanceof SqlRequest) {
|
} else if (request instanceof SqlRequest) {
|
||||||
request.dataSource = scenario.databaseConfigMap.get(request.dataSource);
|
request.dataSource = scenario.databaseConfigMap.get(request.dataSource);
|
||||||
sampler = new JDBCSampler(request.name || "", request);
|
sampler = new JDBCSampler(request.name || "", request);
|
||||||
this.addRequestVariables(sampler, request);
|
|
||||||
} else if (request instanceof TCPRequest) {
|
} else if (request instanceof TCPRequest) {
|
||||||
sampler = new TCPSampler(request.name || "", new JMXTCPRequest(request, scenario));
|
sampler = new TCPSampler(request.name || "", new JMXTCPRequest(request, scenario));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.addRequestVariables(sampler, request, scenario);
|
||||||
|
|
||||||
this.addDNSCacheManager(sampler, scenario.environment, request.useEnvironment);
|
this.addDNSCacheManager(sampler, scenario.environment, request.useEnvironment);
|
||||||
|
|
||||||
this.addRequestExtractor(sampler, request);
|
this.addRequestExtractor(sampler, request);
|
||||||
|
@ -1205,20 +1207,13 @@ class JMXGenerator {
|
||||||
envArray = JSON.parse(environments);
|
envArray = JSON.parse(environments);
|
||||||
}
|
}
|
||||||
envArray.forEach(item => {
|
envArray.forEach(item => {
|
||||||
if (item.name && !keys.has(item.name)) {
|
if (item.enable != false && item.name && !keys.has(item.name)) {
|
||||||
target.push(new KeyValue({name: item.name, value: item.value}));
|
target.push(new KeyValue({name: item.name, value: item.value}));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
addScenarioVariables(threadGroup, scenario) {
|
addScenarioVariables(threadGroup, scenario) {
|
||||||
if (scenario.environment) {
|
|
||||||
let config = scenario.environment.config;
|
|
||||||
if (!(scenario.environment.config instanceof Object)) {
|
|
||||||
config = JSON.parse(scenario.environment.config);
|
|
||||||
}
|
|
||||||
this.addEnvironments(config.commonConfig.variables, scenario.variables)
|
|
||||||
}
|
|
||||||
let args = this.filterKV(scenario.variables);
|
let args = this.filterKV(scenario.variables);
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
let name = scenario.name + " Variables";
|
let name = scenario.name + " Variables";
|
||||||
|
@ -1226,11 +1221,23 @@ class JMXGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addRequestVariables(httpSamplerProxy, request) {
|
addRequestVariables(httpSamplerProxy, request, scenario) {
|
||||||
|
if (request.useEnvironment && scenario.environment) {
|
||||||
|
let config = scenario.environment.config;
|
||||||
|
if (!(scenario.environment.config instanceof Object)) {
|
||||||
|
config = JSON.parse(scenario.environment.config);
|
||||||
|
}
|
||||||
|
if (!request.variables) {
|
||||||
|
request.variables = [];
|
||||||
|
}
|
||||||
|
this.addEnvironments(config.commonConfig.variables, request.variables)
|
||||||
|
}
|
||||||
let name = request.name + " Variables";
|
let name = request.name + " Variables";
|
||||||
let variables = this.filterKV(request.variables);
|
if (request.variables) {
|
||||||
if (variables && variables.length > 0) {
|
let variables = this.filterKV(request.variables);
|
||||||
httpSamplerProxy.put(new Arguments(name, variables));
|
if (variables && variables.length > 0) {
|
||||||
|
httpSamplerProxy.put(new Arguments(name, variables));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1291,13 +1298,6 @@ class JMXGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
addScenarioHeaders(threadGroup, scenario) {
|
addScenarioHeaders(threadGroup, scenario) {
|
||||||
if (scenario.environment) {
|
|
||||||
let config = scenario.environment.config;
|
|
||||||
if (!(scenario.environment.config instanceof Object)) {
|
|
||||||
config = JSON.parse(scenario.environment.config);
|
|
||||||
}
|
|
||||||
this.addEnvironments(config.httpConfig.headers, scenario.headers)
|
|
||||||
}
|
|
||||||
let headers = this.filterKV(scenario.headers);
|
let headers = this.filterKV(scenario.headers);
|
||||||
if (headers.length > 0) {
|
if (headers.length > 0) {
|
||||||
let name = scenario.name + " Headers";
|
let name = scenario.name + " Headers";
|
||||||
|
@ -1305,7 +1305,14 @@ class JMXGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addRequestHeader(httpSamplerProxy, request) {
|
addRequestHeader(httpSamplerProxy, request, scenario) {
|
||||||
|
if (request.useEnvironment && scenario.environment) {
|
||||||
|
let config = scenario.environment.config;
|
||||||
|
if (!(scenario.environment.config instanceof Object)) {
|
||||||
|
config = JSON.parse(scenario.environment.config);
|
||||||
|
}
|
||||||
|
this.addEnvironments(config.httpConfig.headers, request.headers)
|
||||||
|
}
|
||||||
let name = request.name + " Headers";
|
let name = request.name + " Headers";
|
||||||
this.addBodyFormat(request);
|
this.addBodyFormat(request);
|
||||||
let headers = this.filterKV(request.headers);
|
let headers = this.filterKV(request.headers);
|
||||||
|
@ -1410,11 +1417,11 @@ class JMXGenerator {
|
||||||
body = this.filterKV(request.body.kvs);
|
body = this.filterKV(request.body.kvs);
|
||||||
this.addRequestBodyFile(httpSamplerProxy, request, testId);
|
this.addRequestBodyFile(httpSamplerProxy, request, testId);
|
||||||
} else {
|
} else {
|
||||||
httpSamplerProxy.boolProp('HTTPSampler.postBodyRaw', true);
|
|
||||||
body.push({name: '', value: request.body.raw, encode: false, enable: true});
|
body.push({name: '', value: request.body.raw, encode: false, enable: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.method !== 'GET') {
|
if (request.method !== 'GET') {
|
||||||
|
httpSamplerProxy.boolProp('HTTPSampler.postBodyRaw', true);
|
||||||
httpSamplerProxy.add(new HTTPSamplerArguments(body));
|
httpSamplerProxy.add(new HTTPSamplerArguments(body));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,12 +286,13 @@
|
||||||
},
|
},
|
||||||
getProject() {
|
getProject() {
|
||||||
if (this.planId) {
|
if (this.planId) {
|
||||||
this.$post("/test/plan/project/", {planId: this.planId}, res => {
|
this.result = this.$post("/test/plan/project/", {planId: this.planId}, res => {
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
if (data) {
|
if (data) {
|
||||||
this.projects = data;
|
this.projects = data;
|
||||||
this.projectId = data[0].id;
|
this.projectId = data[0].id;
|
||||||
this.projectName = data[0].name;
|
this.projectName = data[0].name;
|
||||||
|
this.search();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue