From 3d302ac30b34a9b798f6375e97136e991e33e583 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Mon, 21 Dec 2020 19:28:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=E4=BF=AE=E5=A4=8DDUBBO=20=E5=8D=8F=E8=AE=AE?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../request/sampler/MsDubboSampler.java | 7 ++----- .../api/definition/components/ApiConfig.vue | 6 +++++- .../components/request/dubbo/Interface.vue | 16 +++++++++------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsDubboSampler.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsDubboSampler.java index 424ed45e26..6d97c94cc3 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsDubboSampler.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsDubboSampler.java @@ -19,7 +19,6 @@ import org.apache.jmeter.config.ConfigTestElement; import org.apache.jmeter.save.SaveService; import org.apache.jmeter.testelement.TestElement; import org.apache.jorphan.collections.HashTree; -import org.apache.jorphan.collections.ListedHashTree; import java.util.List; import java.util.stream.Collectors; @@ -65,9 +64,7 @@ public class MsDubboSampler extends MsTestElement { this.getRefElement(this); } - final HashTree testPlanTree = new ListedHashTree(); - testPlanTree.add(dubboConfig()); - tree.set(dubboSample(), testPlanTree); + final HashTree testPlanTree = tree.add(dubboSample()); if (CollectionUtils.isNotEmpty(hashTree)) { hashTree.forEach(el -> { el.toHashTree(testPlanTree, el.getHashTree(), config); @@ -115,7 +112,7 @@ public class MsDubboSampler extends MsTestElement { private ConfigTestElement configCenter(MsConfigCenter configCenter) { ConfigTestElement configTestElement = new ConfigTestElement(); - if (configCenter != null) { + if (configCenter != null && configCenter.getProtocol() != null && configCenter.getUsername() != null && configCenter.getPassword() != null) { Constants.setConfigCenterProtocol(configCenter.getProtocol(), configTestElement); Constants.setConfigCenterGroup(configCenter.getGroup(), configTestElement); Constants.setConfigCenterNamespace(configCenter.getNamespace(), configTestElement); diff --git a/frontend/src/business/components/api/definition/components/ApiConfig.vue b/frontend/src/business/components/api/definition/components/ApiConfig.vue index 9bb913bbdc..cb26c7cb23 100644 --- a/frontend/src/business/components/api/definition/components/ApiConfig.vue +++ b/frontend/src/business/components/api/definition/components/ApiConfig.vue @@ -166,7 +166,11 @@ data.protocol = this.currentProtocol; data.request = this.request; data.request.name = data.name; - data.request.protocol = this.currentProtocol; + if (this.currentProtocol === "DUBBO" || this.currentProtocol === "dubbo://") { + data.request.protocol = "dubbo://"; + } else { + data.request.protocol = this.currentProtocol; + } data.id = data.request.id; data.response = this.response; }, diff --git a/frontend/src/business/components/api/definition/components/request/dubbo/Interface.vue b/frontend/src/business/components/api/definition/components/request/dubbo/Interface.vue index 6676c9b5f8..398a7d6b94 100644 --- a/frontend/src/business/components/api/definition/components/request/dubbo/Interface.vue +++ b/frontend/src/business/components/api/definition/components/request/dubbo/Interface.vue @@ -77,14 +77,16 @@ this.request.method = value; }, getProviderList() { - if (this.request.registryCenter === undefined || this.request.dubboConfig ===undefined) { - return; + let param = {}; + if (this.request.registryCenter) { + param.protocol = this.request.registryCenter.protocol; + param.address = this.request.registryCenter.address; + param.group = this.request.registryCenter.group; + } else if (this.request.dubboConfig.registryCenter) { + param.protocol = this.request.dubboConfig.registryCenter.protocol; + param.address = this.request.dubboConfig.registryCenter.address; + param.group = this.request.dubboConfig.registryCenter.group; } - let param = { - protocol: this.request.registryCenter.protocol || this.request.dubboConfig.registryCenter.protocol, - address: this.request.registryCenter.address || this.request.dubboConfig.registryCenter.address, - group: this.request.registryCenter.group || this.request.dubboConfig.registryCenter.group, - }; this.loading = true; this.$post("/api/dubbo/providers", param).then(response => {