mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-04 13:09:28 +08:00
feat(接口自动化): 统一样式风格及统一执行处理
This commit is contained in:
parent
a812d83c76
commit
70c22f57e8
@ -44,6 +44,9 @@ public class MsScenario extends MsTestElement {
|
||||
private List<KeyValue> variables;
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (!this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
if (environmentId != null) {
|
||||
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
|
||||
ApiTestEnvironmentWithBLOBs environment = environmentService.get(environmentId);
|
||||
|
@ -75,6 +75,9 @@ public abstract class MsTestElement {
|
||||
@JSONField(ordinal = 7)
|
||||
private String index;
|
||||
@JSONField(ordinal = 8)
|
||||
private boolean enable = true;
|
||||
|
||||
@JSONField(ordinal = 9)
|
||||
private LinkedList<MsTestElement> hashTree;
|
||||
|
||||
// 公共环境逐层传递,如果自身有环境 以自身引用环境为准否则以公共环境作为请求环境
|
||||
|
@ -25,7 +25,9 @@ public class MsAssertions extends MsTestElement {
|
||||
private String type = "Assertions";
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
addAssertions(tree);
|
||||
if (this.isEnable()) {
|
||||
addAssertions(tree);
|
||||
}
|
||||
}
|
||||
|
||||
private void addAssertions(HashTree hashTree) {
|
||||
|
@ -52,6 +52,9 @@ public class MsAuthManager extends MsTestElement {
|
||||
private String environment;
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (!this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
AuthManager authManager = new AuthManager();
|
||||
authManager.setEnabled(true);
|
||||
authManager.setName(this.getUsername() + "AuthManager");
|
||||
|
@ -26,6 +26,9 @@ public class MsHeaderManager extends MsTestElement {
|
||||
private List<KeyValue> headers;
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (!this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
HeaderManager headerManager = new HeaderManager();
|
||||
headerManager.setEnabled(true);
|
||||
headerManager.setName(this.getName() + "Headers");
|
||||
|
@ -20,12 +20,14 @@ import java.util.List;
|
||||
public class MsIfController extends MsTestElement {
|
||||
private String type = "IfController";
|
||||
private String id;
|
||||
private boolean enable = true;
|
||||
private String variable;
|
||||
private String operator;
|
||||
private String value;
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (!this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
final HashTree groupTree = tree.add(ifController());
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
hashTree.forEach(el -> {
|
||||
|
@ -25,6 +25,9 @@ import java.util.List;
|
||||
public class MsDNSCacheManager extends MsTestElement {
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (!this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
for (MsTestElement el : hashTree) {
|
||||
el.toHashTree(tree, el.getHashTree(), config);
|
||||
}
|
||||
|
@ -25,6 +25,9 @@ public class MsExtract extends MsTestElement {
|
||||
private String type = "Extract";
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (!this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
addRequestExtractors(tree);
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,9 @@ public class MsJSR223Processor extends MsTestElement {
|
||||
private String scriptLanguage;
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (!this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
JSR223Sampler processor = new JSR223Sampler();
|
||||
processor.setEnabled(true);
|
||||
processor.setName(this.getName() + "JSR223Processor");
|
||||
|
@ -28,6 +28,9 @@ public class MsJSR223PostProcessor extends MsTestElement {
|
||||
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (!this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
JSR223PostProcessor processor = new JSR223PostProcessor();
|
||||
processor.setEnabled(true);
|
||||
processor.setName(this.getName() + "JSR223PostProcessor");
|
||||
|
@ -27,6 +27,9 @@ public class MsJSR223PreProcessor extends MsTestElement {
|
||||
private String scriptLanguage;
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (!this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
JSR223PreProcessor processor = new JSR223PreProcessor();
|
||||
processor.setEnabled(true);
|
||||
processor.setName(this.getName() + "JSR223PreProcessor");
|
||||
|
@ -52,6 +52,9 @@ public class MsDubboSampler extends MsTestElement {
|
||||
private List<KeyValue> attachmentArgs;
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (!this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
if (this.getReferenced() != null && this.getReferenced().equals("Deleted")) {
|
||||
return;
|
||||
}
|
||||
|
@ -86,6 +86,9 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||
private List<KeyValue> arguments;
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (!this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
if (this.getReferenced() != null && this.getReferenced().equals("REF")) {
|
||||
this.getRefElement(this);
|
||||
}
|
||||
|
@ -40,6 +40,9 @@ public class MsJDBCSampler extends MsTestElement {
|
||||
private String environmentId;
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (!this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
if (this.getReferenced() != null && this.getReferenced().equals("REF")) {
|
||||
this.getRefElement(this);
|
||||
}
|
||||
|
@ -50,6 +50,9 @@ public class MsTCPSampler extends MsTestElement {
|
||||
private String request;
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (!this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
if (this.getReferenced() != null && this.getReferenced().equals("REF")) {
|
||||
this.getRefElement(this);
|
||||
}
|
||||
|
@ -22,11 +22,12 @@ public class MsConstantTimer extends MsTestElement {
|
||||
@JSONField(ordinal = 10)
|
||||
private String id;
|
||||
@JSONField(ordinal = 11)
|
||||
private boolean enable = true;
|
||||
@JSONField(ordinal = 12)
|
||||
private String delay;
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (!this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
final HashTree groupTree = tree.add(constantTimer());
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
hashTree.forEach(el -> {
|
||||
|
@ -4,9 +4,13 @@
|
||||
<el-row>
|
||||
<div>
|
||||
<el-button class="ms-left-buttion" size="small" :style="styleType" style="color: #B8741A;background-color: #F9F1EA">{{title}}</el-button>
|
||||
<i class="icon el-icon-arrow-right" :class="{'is-active': active}" @click="changeActive" style="margin-left: 20px"/>
|
||||
<el-input size="small" v-model="jsr223ProcessorData.name" class="ms-api-header-select" style="width: 380px"/>
|
||||
<el-button size="mini" icon="el-icon-delete" circle @click="remove" style="margin-right: 20px; float: right"/>
|
||||
|
||||
<div style="margin-right: 20px; float: right">
|
||||
<i class="icon el-icon-arrow-right" :class="{'is-active': active}" @click="changeActive"/>
|
||||
<el-switch v-model="jsr223ProcessorData.enable" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-delete" circle @click="remove" style="margin-left: 10px;"/>
|
||||
</div>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-collapse-transition>
|
||||
@ -197,6 +201,7 @@
|
||||
.icon.is-active {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
/deep/ .el-card__body {
|
||||
padding: 15px;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user