This commit is contained in:
fit2-zhao 2020-10-09 15:38:00 +08:00
commit a98717517d
5 changed files with 38 additions and 77 deletions

View File

@ -243,7 +243,7 @@
<dependency> <dependency>
<groupId>io.metersphere</groupId> <groupId>io.metersphere</groupId>
<artifactId>jmeter-plugins-dubbo</artifactId> <artifactId>jmeter-plugins-dubbo</artifactId>
<version>2.7.10</version> <version>2.7.11</version>
</dependency> </dependency>
<!-- LDAP Module --> <!-- LDAP Module -->

View File

@ -4,30 +4,22 @@ import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.annotation.JSONType; import com.alibaba.fastjson.annotation.JSONType;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import io.metersphere.api.dto.scenario.KeyValue; import io.metersphere.api.dto.scenario.KeyValue;
import io.metersphere.api.dto.scenario.assertions.Assertions;
import io.metersphere.api.dto.scenario.controller.IfController;
import io.metersphere.api.dto.scenario.extract.Extract;
import io.metersphere.api.dto.scenario.processor.BeanShellPostProcessor; import io.metersphere.api.dto.scenario.processor.BeanShellPostProcessor;
import io.metersphere.api.dto.scenario.processor.BeanShellPreProcessor; import io.metersphere.api.dto.scenario.processor.BeanShellPreProcessor;
import io.metersphere.api.dto.scenario.processor.JSR223PostProcessor;
import io.metersphere.api.dto.scenario.processor.JSR223PreProcessor;
import io.metersphere.api.dto.scenario.request.dubbo.ConfigCenter; import io.metersphere.api.dto.scenario.request.dubbo.ConfigCenter;
import io.metersphere.api.dto.scenario.request.dubbo.ConsumerAndService; import io.metersphere.api.dto.scenario.request.dubbo.ConsumerAndService;
import io.metersphere.api.dto.scenario.request.dubbo.RegistryCenter; import io.metersphere.api.dto.scenario.request.dubbo.RegistryCenter;
import io.metersphere.api.dto.scenario.timer.ConstantTimer;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List; import java.util.List;
@Data @Data
@EqualsAndHashCode(callSuper = true)
@JSONType(typeName = RequestType.DUBBO) @JSONType(typeName = RequestType.DUBBO)
public class DubboRequest implements Request { public class DubboRequest extends Request {
// type 必须放最前面以便能够转换正确的类 // type 必须放最前面以便能够转换正确的类
private String type = RequestType.DUBBO; private String type = RequestType.DUBBO;
@JSONField(ordinal = 1)
private String id;
@JSONField(ordinal = 1)
private String name;
@JSONField(ordinal = 2) @JSONField(ordinal = 2)
private String protocol; private String protocol;
@JsonProperty(value = "interface") @JsonProperty(value = "interface")
@ -47,22 +39,8 @@ public class DubboRequest implements Request {
private List<KeyValue> args; private List<KeyValue> args;
@JSONField(ordinal = 9) @JSONField(ordinal = 9)
private List<KeyValue> attachmentArgs; private List<KeyValue> attachmentArgs;
@JSONField(ordinal = 10)
private Assertions assertions;
@JSONField(ordinal = 11)
private Extract extract;
@JSONField(ordinal = 12) @JSONField(ordinal = 12)
private BeanShellPreProcessor beanShellPreProcessor; private BeanShellPreProcessor beanShellPreProcessor;
@JSONField(ordinal = 13) @JSONField(ordinal = 13)
private BeanShellPostProcessor beanShellPostProcessor; private BeanShellPostProcessor beanShellPostProcessor;
@JSONField(ordinal = 14)
private Boolean enable;
@JSONField(ordinal = 15)
private JSR223PreProcessor jsr223PreProcessor;
@JSONField(ordinal = 16)
private JSR223PostProcessor jsr223PostProcessor;
@JSONField(ordinal = 17)
private IfController controller;
@JSONField(ordinal = 18)
private ConstantTimer timer;
} }

View File

@ -4,27 +4,19 @@ import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.annotation.JSONType; import com.alibaba.fastjson.annotation.JSONType;
import io.metersphere.api.dto.scenario.Body; import io.metersphere.api.dto.scenario.Body;
import io.metersphere.api.dto.scenario.KeyValue; import io.metersphere.api.dto.scenario.KeyValue;
import io.metersphere.api.dto.scenario.assertions.Assertions;
import io.metersphere.api.dto.scenario.controller.IfController;
import io.metersphere.api.dto.scenario.extract.Extract;
import io.metersphere.api.dto.scenario.processor.BeanShellPostProcessor; import io.metersphere.api.dto.scenario.processor.BeanShellPostProcessor;
import io.metersphere.api.dto.scenario.processor.BeanShellPreProcessor; import io.metersphere.api.dto.scenario.processor.BeanShellPreProcessor;
import io.metersphere.api.dto.scenario.processor.JSR223PostProcessor;
import io.metersphere.api.dto.scenario.processor.JSR223PreProcessor;
import io.metersphere.api.dto.scenario.timer.ConstantTimer;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List; import java.util.List;
@Data @Data
@EqualsAndHashCode(callSuper = true)
@JSONType(typeName = RequestType.HTTP) @JSONType(typeName = RequestType.HTTP)
public class HttpRequest implements Request { public class HttpRequest extends Request {
// type 必须放最前面以便能够转换正确的类 // type 必须放最前面以便能够转换正确的类
private String type = RequestType.HTTP; private String type = RequestType.HTTP;
@JSONField(ordinal = 1)
private String id;
@JSONField(ordinal = 1)
private String name;
@JSONField(ordinal = 2) @JSONField(ordinal = 2)
private String url; private String url;
@JSONField(ordinal = 3) @JSONField(ordinal = 3)
@ -39,28 +31,14 @@ public class HttpRequest implements Request {
private List<KeyValue> headers; private List<KeyValue> headers;
@JSONField(ordinal = 8) @JSONField(ordinal = 8)
private Body body; private Body body;
@JSONField(ordinal = 9)
private Assertions assertions;
@JSONField(ordinal = 10)
private Extract extract;
@JSONField(ordinal = 11) @JSONField(ordinal = 11)
private BeanShellPreProcessor beanShellPreProcessor; private BeanShellPreProcessor beanShellPreProcessor;
@JSONField(ordinal = 12) @JSONField(ordinal = 12)
private BeanShellPostProcessor beanShellPostProcessor; private BeanShellPostProcessor beanShellPostProcessor;
@JSONField(ordinal = 13)
private Boolean enable;
@JSONField(ordinal = 14) @JSONField(ordinal = 14)
private Long connectTimeout; private Long connectTimeout;
@JSONField(ordinal = 15) @JSONField(ordinal = 15)
private Long responseTimeout; private Long responseTimeout;
@JSONField(ordinal = 16) @JSONField(ordinal = 16)
private Boolean followRedirects; private Boolean followRedirects;
@JSONField(ordinal = 17)
private JSR223PreProcessor jsr223PreProcessor;
@JSONField(ordinal = 18)
private JSR223PostProcessor jsr223PostProcessor;
@JSONField(ordinal = 19)
private IfController controller;
@JSONField(ordinal = 20)
private ConstantTimer timer;
} }

View File

@ -1,8 +1,16 @@
package io.metersphere.api.dto.scenario.request; package io.metersphere.api.dto.scenario.request;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.annotation.JSONType; import com.alibaba.fastjson.annotation.JSONType;
import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo;
import io.metersphere.api.dto.scenario.assertions.Assertions;
import io.metersphere.api.dto.scenario.controller.IfController;
import io.metersphere.api.dto.scenario.extract.Extract;
import io.metersphere.api.dto.scenario.processor.JSR223PostProcessor;
import io.metersphere.api.dto.scenario.processor.JSR223PreProcessor;
import io.metersphere.api.dto.scenario.timer.ConstantTimer;
import lombok.Data;
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type") @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type")
@JsonSubTypes({ @JsonSubTypes({
@ -11,5 +19,24 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo;
@JsonSubTypes.Type(value = SqlRequest.class, name = RequestType.SQL) @JsonSubTypes.Type(value = SqlRequest.class, name = RequestType.SQL)
}) })
@JSONType(seeAlso = {HttpRequest.class, DubboRequest.class, SqlRequest.class}, typeKey = "type") @JSONType(seeAlso = {HttpRequest.class, DubboRequest.class, SqlRequest.class}, typeKey = "type")
public interface Request { @Data
public abstract class Request {
@JSONField(ordinal = 1)
private String id;
@JSONField(ordinal = 2)
private String name;
@JSONField(ordinal = 3)
private Boolean enable;
@JSONField(ordinal = 4)
private Assertions assertions;
@JSONField(ordinal = 5)
private Extract extract;
@JSONField(ordinal = 6)
private JSR223PreProcessor jsr223PreProcessor;
@JSONField(ordinal = 7)
private JSR223PostProcessor jsr223PostProcessor;
@JSONField(ordinal = 8)
private IfController controller;
@JSONField(ordinal = 9)
private ConstantTimer timer;
} }

View File

@ -2,23 +2,15 @@ package io.metersphere.api.dto.scenario.request;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.annotation.JSONType; import com.alibaba.fastjson.annotation.JSONType;
import io.metersphere.api.dto.scenario.assertions.Assertions;
import io.metersphere.api.dto.scenario.controller.IfController;
import io.metersphere.api.dto.scenario.extract.Extract;
import io.metersphere.api.dto.scenario.processor.JSR223PostProcessor;
import io.metersphere.api.dto.scenario.processor.JSR223PreProcessor;
import io.metersphere.api.dto.scenario.timer.ConstantTimer;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data @Data
@JSONType(typeName = RequestType.SQL) @JSONType(typeName = RequestType.SQL)
public class SqlRequest implements Request { public class SqlRequest extends Request {
// type 必须放最前面以便能够转换正确的类 // type 必须放最前面以便能够转换正确的类
private String type = RequestType.SQL; private String type = RequestType.SQL;
@JSONField(ordinal = 1)
private String id;
@JSONField(ordinal = 2)
private String name;
@JSONField(ordinal = 3) @JSONField(ordinal = 3)
private String dataSource; private String dataSource;
@JSONField(ordinal = 4) @JSONField(ordinal = 4)
@ -28,23 +20,9 @@ public class SqlRequest implements Request {
@JSONField(ordinal = 6) @JSONField(ordinal = 6)
private Boolean useEnvironment; private Boolean useEnvironment;
@JSONField(ordinal = 7) @JSONField(ordinal = 7)
private Assertions assertions;
@JSONField(ordinal = 8)
private Extract extract;
@JSONField(ordinal = 9)
private Boolean enable;
@JSONField(ordinal = 10)
private Boolean followRedirects; private Boolean followRedirects;
@JSONField(ordinal = 11)
private JSR223PreProcessor jsr223PreProcessor;
@JSONField(ordinal = 12)
private JSR223PostProcessor jsr223PostProcessor;
@JSONField(ordinal = 13) @JSONField(ordinal = 13)
private String resultVariable; private String resultVariable;
@JSONField(ordinal = 14) @JSONField(ordinal = 14)
private String variableNames; private String variableNames;
@JSONField(ordinal = 15)
private IfController controller;
@JSONField(ordinal = 16)
private ConstantTimer timer;
} }