refactor(接口测试): 忽略部分getxxx方法的序列化
This commit is contained in:
parent
87583d3943
commit
f20fff9b9f
|
@ -1,5 +1,6 @@
|
||||||
package io.metersphere.api.dto.request.http.body;
|
package io.metersphere.api.dto.request.http.body;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -79,10 +80,12 @@ public class Body {
|
||||||
bodyTypeClassMap.put(BodyType.BINARY, BinaryBody.class);
|
bodyTypeClassMap.put(BodyType.BINARY, BinaryBody.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public Class getBodyClassByType() {
|
public Class getBodyClassByType() {
|
||||||
return bodyTypeClassMap.get(BodyType.valueOf(bodyType));
|
return bodyTypeClassMap.get(BodyType.valueOf(bodyType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public Object getBodyDataByType() {
|
public Object getBodyDataByType() {
|
||||||
Map<BodyType, Object> boadyDataMap = new HashMap<>();
|
Map<BodyType, Object> boadyDataMap = new HashMap<>();
|
||||||
boadyDataMap.put(BodyType.NONE, noneBody);
|
boadyDataMap.put(BodyType.NONE, noneBody);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.metersphere.api.dto.request.http.body;
|
package io.metersphere.api.dto.request.http.body;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import io.metersphere.api.dto.ApiFile;
|
import io.metersphere.api.dto.ApiFile;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -27,6 +28,7 @@ public class FormDataKV extends WWWFormKV {
|
||||||
*/
|
*/
|
||||||
private String contentType;
|
private String contentType;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean isFile() {
|
public boolean isFile() {
|
||||||
return StringUtils.equalsIgnoreCase(getParamType(), BodyParamType.FILE.getValue());
|
return StringUtils.equalsIgnoreCase(getParamType(), BodyParamType.FILE.getValue());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.metersphere.project.api;
|
package io.metersphere.project.api;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
@ -19,10 +20,12 @@ public class KeyValueParam {
|
||||||
*/
|
*/
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
return StringUtils.isNotBlank(key);
|
return StringUtils.isNotBlank(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean isNotBlankValue() {
|
public boolean isNotBlankValue() {
|
||||||
return StringUtils.isNotBlank(value);
|
return StringUtils.isNotBlank(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.metersphere.project.api.assertion;
|
package io.metersphere.project.api.assertion;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
import io.metersphere.project.api.assertion.body.MsDocumentAssertion;
|
import io.metersphere.project.api.assertion.body.MsDocumentAssertion;
|
||||||
import io.metersphere.project.api.assertion.body.MsJSONPathAssertion;
|
import io.metersphere.project.api.assertion.body.MsJSONPathAssertion;
|
||||||
|
@ -62,10 +63,12 @@ public class MsResponseBodyAssertion extends MsAssertion {
|
||||||
bodyAssertionClassMap.put(MsBodyAssertionType.XPATH, MsXPathAssertion.class);
|
bodyAssertionClassMap.put(MsBodyAssertionType.XPATH, MsXPathAssertion.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public Class getBodyAssertionClassByType() {
|
public Class getBodyAssertionClassByType() {
|
||||||
return bodyAssertionClassMap.get(MsBodyAssertionType.valueOf(assertionBodyType));
|
return bodyAssertionClassMap.get(MsBodyAssertionType.valueOf(assertionBodyType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public Object getBodyAssertionDataByType() {
|
public Object getBodyAssertionDataByType() {
|
||||||
Map<MsBodyAssertionType, Object> boadyAssertionMap = new HashMap<>();
|
Map<MsBodyAssertionType, Object> boadyAssertionMap = new HashMap<>();
|
||||||
boadyAssertionMap.put(MsBodyAssertionType.JSON_PATH, jsonPathAssertion);
|
boadyAssertionMap.put(MsBodyAssertionType.JSON_PATH, jsonPathAssertion);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.metersphere.project.api.assertion;
|
package io.metersphere.project.api.assertion;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
import io.metersphere.project.constants.ScriptLanguageType;
|
import io.metersphere.project.constants.ScriptLanguageType;
|
||||||
import io.metersphere.project.dto.CommonScriptInfo;
|
import io.metersphere.project.dto.CommonScriptInfo;
|
||||||
|
@ -36,6 +37,7 @@ public class MsScriptAssertion extends MsAssertion {
|
||||||
@Valid
|
@Valid
|
||||||
private CommonScriptInfo commonScriptInfo;
|
private CommonScriptInfo commonScriptInfo;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
if (isEnableCommonScript()) {
|
if (isEnableCommonScript()) {
|
||||||
return commonScriptInfo != null && StringUtils.isNotBlank(commonScriptInfo.getId());
|
return commonScriptInfo != null && StringUtils.isNotBlank(commonScriptInfo.getId());
|
||||||
|
@ -44,6 +46,7 @@ public class MsScriptAssertion extends MsAssertion {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean isEnableCommonScript() {
|
public boolean isEnableCommonScript() {
|
||||||
return BooleanUtils.isTrue(enableCommonScript);
|
return BooleanUtils.isTrue(enableCommonScript);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.metersphere.project.api.assertion.body;
|
package io.metersphere.project.api.assertion.body;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import io.metersphere.sdk.constants.MsAssertionCondition;
|
import io.metersphere.sdk.constants.MsAssertionCondition;
|
||||||
import io.metersphere.sdk.valid.EnumValue;
|
import io.metersphere.sdk.valid.EnumValue;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
@ -31,6 +32,7 @@ public class MsJSONPathAssertionItem extends MsBodyAssertionItem {
|
||||||
*/
|
*/
|
||||||
private String expectedValue;
|
private String expectedValue;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
return StringUtils.isNotBlank(expression)
|
return StringUtils.isNotBlank(expression)
|
||||||
&& StringUtils.isNotBlank(condition)
|
&& StringUtils.isNotBlank(condition)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.metersphere.project.api.assertion.body;
|
package io.metersphere.project.api.assertion.body;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
@ -15,6 +16,7 @@ public class MsRegexAssertionItem extends MsBodyAssertionItem {
|
||||||
*/
|
*/
|
||||||
private String expression;
|
private String expression;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
return StringUtils.isNotBlank(expression) && Boolean.TRUE.equals(this.getEnable());
|
return StringUtils.isNotBlank(expression) && Boolean.TRUE.equals(this.getEnable());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package io.metersphere.project.api.assertion.body;
|
package io.metersphere.project.api.assertion.body;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
@ -20,6 +21,7 @@ public class MsXPathAssertionItem extends MsBodyAssertionItem {
|
||||||
*/
|
*/
|
||||||
private String expectedValue;
|
private String expectedValue;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
return StringUtils.isNotBlank(expression) && Boolean.TRUE.equals(this.getEnable());
|
return StringUtils.isNotBlank(expression) && Boolean.TRUE.equals(this.getEnable());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.metersphere.project.api.processor;
|
package io.metersphere.project.api.processor;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
import io.metersphere.project.constants.ScriptLanguageType;
|
import io.metersphere.project.constants.ScriptLanguageType;
|
||||||
import io.metersphere.project.dto.CommonScriptInfo;
|
import io.metersphere.project.dto.CommonScriptInfo;
|
||||||
|
@ -44,7 +45,7 @@ public class ScriptProcessor extends MsProcessor {
|
||||||
@Valid
|
@Valid
|
||||||
private CommonScriptInfo commonScriptInfo;
|
private CommonScriptInfo commonScriptInfo;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
if (isEnableCommonScript()) {
|
if (isEnableCommonScript()) {
|
||||||
return commonScriptInfo != null && StringUtils.isNotBlank(commonScriptInfo.getId());
|
return commonScriptInfo != null && StringUtils.isNotBlank(commonScriptInfo.getId());
|
||||||
|
@ -53,6 +54,7 @@ public class ScriptProcessor extends MsProcessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean isEnableCommonScript() {
|
public boolean isEnableCommonScript() {
|
||||||
return BooleanUtils.isTrue(enableCommonScript);
|
return BooleanUtils.isTrue(enableCommonScript);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.metersphere.project.api.processor.extract;
|
package io.metersphere.project.api.processor.extract;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
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.sdk.valid.EnumValue;
|
import io.metersphere.sdk.valid.EnumValue;
|
||||||
|
@ -51,6 +52,7 @@ public abstract class MsExtract {
|
||||||
*/
|
*/
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
return StringUtils.isNotBlank(variableName) && StringUtils.isNotBlank(expression);
|
return StringUtils.isNotBlank(variableName) && StringUtils.isNotBlank(expression);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue