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.system.valid.EnumValue;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
@ -29,7 +28,6 @@ public class JsonSchemaItem {
|
|||
/**
|
||||
* 参数ID
|
||||
*/
|
||||
@NotBlank
|
||||
private String id;
|
||||
/**
|
||||
* 参数名称
|
||||
|
|
|
@ -608,9 +608,13 @@ public class ApiDefinitionImportUtilService {
|
|||
Body dbbody = dbRequest.getBody();
|
||||
Body importBody = importRequest.getBody();
|
||||
if (dbbody != null && importBody != null) {
|
||||
if (!StringUtils.equals(dbbody.getBodyType(), importBody.getBodyType())) {
|
||||
return false;
|
||||
}
|
||||
//判断null类型
|
||||
StringUtils.equals(String.valueOf(dbbody.getNoneBody()), String.valueOf(importBody.getNoneBody()));
|
||||
//判断form类型
|
||||
if (StringUtils.equals(dbbody.getBodyType(), Body.BodyType.FORM_DATA.name())) {
|
||||
FormDataBody formDataBody = dbbody.getFormDataBody();
|
||||
FormDataBody importFormDataBody = importBody.getFormDataBody();
|
||||
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类型
|
||||
WWWFormBody wwwBody = dbbody.getWwwFormBody();
|
||||
WWWFormBody importWwwBody = importBody.getWwwFormBody();
|
||||
|
@ -638,19 +644,25 @@ public class ApiDefinitionImportUtilService {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO 判断binary类型
|
||||
|
||||
//判断raw类型
|
||||
if (StringUtils.equals(dbbody.getBodyType(), Body.BodyType.RAW.name())) {
|
||||
RawBody rawBody = dbbody.getRawBody();
|
||||
RawBody importRawBody = importBody.getRawBody();
|
||||
if (ObjectUtils.isNotEmpty(rawBody) || ObjectUtils.isNotEmpty(importRawBody)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//判断json类型
|
||||
if (StringUtils.equals(dbbody.getBodyType(), Body.BodyType.JSON.name())) {
|
||||
//判断json类型
|
||||
JsonBody jsonBody = dbbody.getJsonBody();
|
||||
JsonBody importJsonBody = importBody.getJsonBody();
|
||||
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;
|
||||
}
|
||||
//判断jsonschema
|
||||
|
@ -662,6 +674,7 @@ public class ApiDefinitionImportUtilService {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return same;
|
||||
|
|
Loading…
Reference in New Issue