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(); DubboSample sampler = new DubboSample();
sampler.setEnabled(this.isEnable()); sampler.setEnabled(this.isEnable());
sampler.setName(this.getName()); sampler.setName(this.getName());
if (StringUtils.isEmpty(this.getName())) {
sampler.setName("DubboSamplerProxy");
}
if (config.isOperating()) { if (config.isOperating()) {
String[] testNameArr = sampler.getName().split("<->"); String[] testNameArr = sampler.getName().split("<->");
if (testNameArr.length > 0) { if (testNameArr.length > 0) {

View File

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

View File

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