fix: 修复引用的场景无法复制的问题

修复引用的场景无法复制的问题
This commit is contained in:
song-tianyang 2021-06-16 18:54:18 +08:00 committed by fit2-zhao
parent 6247454d0b
commit ea1ae44dd3
3 changed files with 40 additions and 14 deletions

View File

@ -238,18 +238,23 @@ public class MsTCPSampler extends MsTestElement {
this.parameters.forEach(item -> {
names.add(new StringProperty(new Integer(new Random().nextInt(1000000)).toString(), item.getName()));
String value = item.getValue();
value = this.formatMockValue(value);
if(StringUtils.isNotEmpty(this.getConnectEncoding())){
if(StringUtils.equalsIgnoreCase("utf-8",this.getConnectEncoding())){
value = new String(value.getBytes(),StandardCharsets.UTF_8);
}else if(StringUtils.equalsIgnoreCase("gbk",this.getConnectEncoding())){
try {
value = new String(value.getBytes(),"GBK");
}catch (Exception e){
if(StringUtils.isNotEmpty(value)){
value = this.formatMockValue(value);
if(StringUtils.isNotEmpty(this.getConnectEncoding())){
if(StringUtils.equalsIgnoreCase("utf-8",this.getConnectEncoding())){
try {
value = new String(value.getBytes(),StandardCharsets.UTF_8);
}catch (Exception e){
}
}else if(StringUtils.equalsIgnoreCase("gbk",this.getConnectEncoding())){
try {
value = new String(value.getBytes(),"GBK");
}catch (Exception e){
}
}
}
threadValues.add(new StringProperty(new Integer(new Random().nextInt(1000000)).toString(), value));
}
threadValues.add(new StringProperty(new Integer(new Random().nextInt(1000000)).toString(), value));
});
}
userParameters.setNames(new CollectionProperty(UserParameters.NAMES, names));

View File

@ -31,25 +31,33 @@
<template v-slot:request>
<customize-req-info :is-customize-req="isCustomizeReq" :request="request"/>
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
<legend style="width: 100%">
<ms-api-request-form v-if="request.protocol==='HTTP' || request.type==='HTTPSamplerProxy'"
:isShowEnable="true"
:referenced="true"
:headers="request.headers "
:is-read-only="isCompReadOnly"
:request="request"/>
<esb-definition v-if="showXpackCompnent&&request.esbDataStruct!=null"
v-xpack
:request="request"
:showScript="false"
:is-read-only="isCompReadOnly"
ref="esbDefinition"/>
<ms-tcp-basis-parameters v-if="(request.protocol==='TCP'|| request.type==='TCPSampler')&& request.esbDataStruct==null "
:request="request"
:is-read-only="isCompReadOnly"
:showScript="false"/>
<ms-sql-basis-parameters v-if="request.protocol==='SQL'|| request.type==='JDBCSampler'"
:request="request"
:is-read-only="isCompReadOnly"
:showScript="false"/>
<ms-dubbo-basis-parameters v-if="request.protocol==='DUBBO' || request.protocol==='dubbo://'|| request.type==='DubboSampler'"
:request="request"
:is-read-only="isCompReadOnly"
:showScript="false"/>
</legend>
</template>
<!-- 执行结果内容 -->
<template v-slot:result>
@ -192,6 +200,17 @@ export default {
}
return {};
},
isCompReadOnly(){
if(this.request){
if(this.request.disabled){
return this.request.disabled;
}else {
return false;
}
}else {
return false;
}
},
displayTitle() {
if (this.isApiImport) {
return this.$t('api_test.automation.api_list_import');

View File

@ -11,11 +11,13 @@
:background-color="backgroundColor"
:title="title" v-loading="loading">
<jsr233-processor-content
:jsr223-processor="jsr223Processor"
:is-pre-processor="isPreProcessor"
:node="node"
:is-read-only="isReadOnly"/>
<legend style="width: 100%">
<jsr233-processor-content
:jsr223-processor="jsr223Processor"
:is-pre-processor="isPreProcessor"
:node="node"
:is-read-only="this.jsr223Processor.disabled"/>
</legend>
</api-base-component>
</template>