fix(接口自动化):修复DUBBO 协议执行缺陷

This commit is contained in:
fit2-zhao 2020-12-21 19:28:06 +08:00
parent 60d40f48ab
commit 3d302ac30b
3 changed files with 16 additions and 13 deletions

View File

@ -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);

View File

@ -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;
},

View File

@ -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 => {