fix(接口定义): 修复自定义tcp没名字时无法执行的缺陷 (#18101)

--bug=1017030 --user=王孝刚 【接口测试】接口自动化自定义请求,TCP请求不填写名称创建后无法运行
https://www.tapd.cn/55049933/s/1247550

Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
MeterSphere Bot 2022-09-20 19:51:58 +08:00 committed by GitHub
parent f6fc250bce
commit 4b2b61eaac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 68 additions and 61 deletions

View File

@ -180,6 +180,9 @@ public class MsDubboSampler extends MsTestElement {
DubboSample sampler = new DubboSample();
sampler.setEnabled(this.isEnable());
sampler.setName(this.getName());
if (StringUtils.isEmpty(this.getName())) {
sampler.setName("DubboSamplerProxy");
}
if (config.isOperating()) {
String[] testNameArr = sampler.getName().split("<->");
if (testNameArr.length > 0) {

View File

@ -285,6 +285,9 @@ public class MsTCPSampler extends MsTestElement {
TCPSampler tcpSampler = new TCPSampler();
tcpSampler.setEnabled(this.isEnable());
tcpSampler.setName(this.getName());
if (StringUtils.isEmpty(this.getName())) {
tcpSampler.setName("TcpSamplerProxy");
}
if (config.isOperating()) {
String[] testNameArr = tcpSampler.getName().split("<->");
if (testNameArr.length > 0) {

View File

@ -1,7 +1,7 @@
<template>
<div>
<el-card>
<el-form :model="request" :rules="rules" label-width="auto" ref="request">
<el-form ref="request" :model="request" label-width="auto">
<el-form-item :label="$t('api_test.request.name')" prop="name">
<el-input v-model="request.name" maxlength="200" show-word-limit size="small"/>
</el-form-item>
@ -13,22 +13,27 @@
</el-form-item>
</el-form>
<!--不同协议请求-->
<ms-debug-http-page :scenario="true" :current-api="request" @saveAs="editApi" :currentProtocol="request.protocol" v-if="request.protocol==='HTTP'"/>
<ms-debug-jdbc-page :scenario="true" :currentProtocol="request.protocol" @saveAs="editApi" v-if="request.protocol==='SQL'"/>
<ms-debug-tcp-page :scenario="true" :currentProtocol="request.protocol" @saveAs="editApi" v-if="request.protocol==='TCP'"/>
<ms-debug-dubbo-page :scenario="true" :currentProtocol="request.protocol" @saveAs="editApi" v-if="request.protocol==='DUBBO'"/>
<ms-debug-http-page v-if="request.protocol==='HTTP'" :current-api="request" :currentProtocol="request.protocol"
:scenario="true"
@saveAs="editApi"/>
<ms-debug-jdbc-page v-if="request.protocol==='SQL'" :currentProtocol="request.protocol" :scenario="true"
@saveAs="editApi"/>
<ms-debug-tcp-page v-if="request.protocol==='TCP'" :currentProtocol="request.protocol" :scenario="true"
@saveAs="editApi"/>
<ms-debug-dubbo-page v-if="request.protocol==='DUBBO'" :currentProtocol="request.protocol" :scenario="true"
@saveAs="editApi"/>
</el-card>
</div>
</template>
<script>
import MsDebugHttpPage from "../../definition/components/debug/DebugHttpPage";
import MsDebugJdbcPage from "../../definition/components/debug/DebugJdbcPage";
import MsDebugTcpPage from "../../definition/components/debug/DebugTcpPage";
import MsDebugDubboPage from "../../definition/components/debug/DebugDubboPage";
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
import MsDebugHttpPage from "../../definition/components/debug/DebugHttpPage";
import MsDebugJdbcPage from "../../definition/components/debug/DebugJdbcPage";
import MsDebugTcpPage from "../../definition/components/debug/DebugTcpPage";
import MsDebugDubboPage from "../../definition/components/debug/DebugDubboPage";
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
export default {
export default {
name: "ApiCustomize",
props: {
node: {},
@ -38,10 +43,6 @@
data() {
return {
loading: false,
rules: {
name: [{required: true, message: this.$t('commons.input_name'), trigger: 'blur'}],
protocol: [{required: true, message: this.$t('commons.please_select'), trigger: 'blur'}],
}
}
},
methods: {
@ -80,7 +81,7 @@
})
},
}
}
}
</script>
<style scoped>