refactor(接口测试): 优化接口导入选择覆盖数据,全部数据被更新的缺陷
This commit is contained in:
parent
eae3398f94
commit
af684b2b8e
|
@ -5,7 +5,6 @@ import io.metersphere.project.constants.PropertyConstant;
|
||||||
import io.metersphere.sdk.constants.ValueEnum;
|
import io.metersphere.sdk.constants.ValueEnum;
|
||||||
import io.metersphere.system.valid.EnumValue;
|
import io.metersphere.system.valid.EnumValue;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -29,7 +28,6 @@ public class JsonSchemaItem {
|
||||||
/**
|
/**
|
||||||
* 参数ID
|
* 参数ID
|
||||||
*/
|
*/
|
||||||
@NotBlank
|
|
||||||
private String id;
|
private String id;
|
||||||
/**
|
/**
|
||||||
* 参数名称
|
* 参数名称
|
||||||
|
|
|
@ -608,9 +608,13 @@ public class ApiDefinitionImportUtilService {
|
||||||
Body dbbody = dbRequest.getBody();
|
Body dbbody = dbRequest.getBody();
|
||||||
Body importBody = importRequest.getBody();
|
Body importBody = importRequest.getBody();
|
||||||
if (dbbody != null && importBody != null) {
|
if (dbbody != null && importBody != null) {
|
||||||
|
if (!StringUtils.equals(dbbody.getBodyType(), importBody.getBodyType())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
//判断null类型
|
//判断null类型
|
||||||
StringUtils.equals(String.valueOf(dbbody.getNoneBody()), String.valueOf(importBody.getNoneBody()));
|
StringUtils.equals(String.valueOf(dbbody.getNoneBody()), String.valueOf(importBody.getNoneBody()));
|
||||||
//判断form类型
|
//判断form类型
|
||||||
|
if (StringUtils.equals(dbbody.getBodyType(), Body.BodyType.FORM_DATA.name())) {
|
||||||
FormDataBody formDataBody = dbbody.getFormDataBody();
|
FormDataBody formDataBody = dbbody.getFormDataBody();
|
||||||
FormDataBody importFormDataBody = importBody.getFormDataBody();
|
FormDataBody importFormDataBody = importBody.getFormDataBody();
|
||||||
if (ObjectUtils.isNotEmpty(formDataBody) || ObjectUtils.isNotEmpty(importFormDataBody)) {
|
if (ObjectUtils.isNotEmpty(formDataBody) || ObjectUtils.isNotEmpty(importFormDataBody)) {
|
||||||
|
@ -624,6 +628,8 @@ public class ApiDefinitionImportUtilService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (StringUtils.equals(dbbody.getBodyType(), Body.BodyType.WWW_FORM.name())) {
|
||||||
//判读www类型
|
//判读www类型
|
||||||
WWWFormBody wwwBody = dbbody.getWwwFormBody();
|
WWWFormBody wwwBody = dbbody.getWwwFormBody();
|
||||||
WWWFormBody importWwwBody = importBody.getWwwFormBody();
|
WWWFormBody importWwwBody = importBody.getWwwFormBody();
|
||||||
|
@ -638,19 +644,25 @@ public class ApiDefinitionImportUtilService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//TODO 判断binary类型
|
//TODO 判断binary类型
|
||||||
|
|
||||||
//判断raw类型
|
//判断raw类型
|
||||||
|
if (StringUtils.equals(dbbody.getBodyType(), Body.BodyType.RAW.name())) {
|
||||||
RawBody rawBody = dbbody.getRawBody();
|
RawBody rawBody = dbbody.getRawBody();
|
||||||
RawBody importRawBody = importBody.getRawBody();
|
RawBody importRawBody = importBody.getRawBody();
|
||||||
if (ObjectUtils.isNotEmpty(rawBody) || ObjectUtils.isNotEmpty(importRawBody)) {
|
if (ObjectUtils.isNotEmpty(rawBody) || ObjectUtils.isNotEmpty(importRawBody)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
//判断json类型
|
||||||
|
if (StringUtils.equals(dbbody.getBodyType(), Body.BodyType.JSON.name())) {
|
||||||
//判断json类型
|
//判断json类型
|
||||||
JsonBody jsonBody = dbbody.getJsonBody();
|
JsonBody jsonBody = dbbody.getJsonBody();
|
||||||
JsonBody importJsonBody = importBody.getJsonBody();
|
JsonBody importJsonBody = importBody.getJsonBody();
|
||||||
if (ObjectUtils.isNotEmpty(jsonBody) || ObjectUtils.isNotEmpty(importJsonBody)) {
|
if (ObjectUtils.isNotEmpty(jsonBody) || ObjectUtils.isNotEmpty(importJsonBody)) {
|
||||||
if (StringUtils.isNotBlank(jsonBody.getJsonValue()) || StringUtils.isNotBlank(importJsonBody.getJsonValue())) {
|
if (!StringUtils.equals(jsonBody.getJsonValue(), importJsonBody.getJsonValue())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//判断jsonschema
|
//判断jsonschema
|
||||||
|
@ -662,6 +674,7 @@ public class ApiDefinitionImportUtilService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return same;
|
return same;
|
||||||
|
|
Loading…
Reference in New Issue