mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-03 04:28:51 +08:00
fix(接口测试): 解决接口测试swagger2导入丢失描述问题以及查询待更新时间限制默认值问题
This commit is contained in:
parent
a4daad9c8a
commit
04e321d5ff
@ -133,6 +133,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||||||
MsHTTPSamplerProxy request = buildRequest(operation, pathName, method.name());
|
MsHTTPSamplerProxy request = buildRequest(operation, pathName, method.name());
|
||||||
request.setFollowRedirects(true);
|
request.setFollowRedirects(true);
|
||||||
ApiDefinitionWithBLOBs apiDefinition = buildApiDefinition(request.getId(), operation, pathName, method.name(), importRequest);
|
ApiDefinitionWithBLOBs apiDefinition = buildApiDefinition(request.getId(), operation, pathName, method.name(), importRequest);
|
||||||
|
apiDefinition.setDescription(operation.getDescription());
|
||||||
parseParameters(operation, request);
|
parseParameters(operation, request);
|
||||||
addBodyHeader(request);
|
addBodyHeader(request);
|
||||||
if (StringUtils.isNotBlank(basePath)) {
|
if (StringUtils.isNotBlank(basePath)) {
|
||||||
|
@ -69,7 +69,6 @@ public class ApiTestCaseController {
|
|||||||
|
|
||||||
@PostMapping("/list/{goPage}/{pageSize}")
|
@PostMapping("/list/{goPage}/{pageSize}")
|
||||||
public Pager<List<ApiTestCaseDTO>> listSimple(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiTestCaseRequest request) {
|
public Pager<List<ApiTestCaseDTO>> listSimple(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiTestCaseRequest request) {
|
||||||
apiTestCaseService.initRequestBySearch(request);
|
|
||||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||||
request.setSelectEnvironment(true);
|
request.setSelectEnvironment(true);
|
||||||
return PageUtils.setPageInfo(page, apiTestCaseService.listSimple(request));
|
return PageUtils.setPageInfo(page, apiTestCaseService.listSimple(request));
|
||||||
|
@ -141,17 +141,21 @@ public class ApiTestCaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<ApiTestCaseDTO> listSimple(ApiTestCaseRequest request) {
|
public List<ApiTestCaseDTO> listSimple(ApiTestCaseRequest request) {
|
||||||
|
//工作台逻辑
|
||||||
|
initRequestBySearch(request);
|
||||||
request = this.initRequest(request, true, true);
|
request = this.initRequest(request, true, true);
|
||||||
List<ApiTestCaseDTO> apiTestCases = extApiTestCaseMapper.listSimple(request);
|
List<ApiTestCaseDTO> apiTestCases = extApiTestCaseMapper.listSimple(request);
|
||||||
if (CollectionUtils.isEmpty(apiTestCases)) {
|
if (CollectionUtils.isEmpty(apiTestCases)) {
|
||||||
return apiTestCases;
|
return apiTestCases;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildUserInfo(apiTestCases, request.isSelectEnvironment());
|
buildUserInfo(apiTestCases, request.isSelectEnvironment());
|
||||||
return apiTestCases;
|
return apiTestCases;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getToBeUpdatedTime(String projectId) {
|
public Long getToBeUpdatedTime(String projectId) {
|
||||||
|
if (StringUtils.isBlank(projectId)) {
|
||||||
|
return getTimeMills(System.currentTimeMillis(), DEFAULT_TIME_DATE);
|
||||||
|
}
|
||||||
ProjectApplicationExample example = new ProjectApplicationExample();
|
ProjectApplicationExample example = new ProjectApplicationExample();
|
||||||
example.createCriteria().andTypeEqualTo(ProjectApplicationType.OPEN_UPDATE_TIME.name()).andProjectIdEqualTo(projectId);
|
example.createCriteria().andTypeEqualTo(ProjectApplicationType.OPEN_UPDATE_TIME.name()).andProjectIdEqualTo(projectId);
|
||||||
List<ProjectApplication> projectApplications = projectApplicationMapper.selectByExample(example);
|
List<ProjectApplication> projectApplications = projectApplicationMapper.selectByExample(example);
|
||||||
@ -1113,20 +1117,17 @@ public class ApiTestCaseService {
|
|||||||
if (!request.isToBeUpdated()) {
|
if (!request.isToBeUpdated()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (StringUtils.isBlank(request.getProjectId())) {
|
|
||||||
long toBeUpdatedTime = getTimeMills(System.currentTimeMillis(), DEFAULT_TIME_DATE);
|
|
||||||
request.setToBeUpdateTime(toBeUpdatedTime);
|
|
||||||
request.setUpdateTime(toBeUpdatedTime);
|
|
||||||
List<String> syncRuleCaseStatus = new ArrayList<>();
|
|
||||||
syncRuleCaseStatus.add(ApiReportStatus.ERROR.name());
|
|
||||||
request.setStatusList(syncRuleCaseStatus);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Long toBeUpdatedTime = this.getToBeUpdatedTime(request.getProjectId());
|
Long toBeUpdatedTime = this.getToBeUpdatedTime(request.getProjectId());
|
||||||
if (toBeUpdatedTime != null) {
|
if (toBeUpdatedTime != null) {
|
||||||
request.setToBeUpdateTime(toBeUpdatedTime);
|
request.setToBeUpdateTime(toBeUpdatedTime);
|
||||||
request.setUpdateTime(toBeUpdatedTime);
|
request.setUpdateTime(toBeUpdatedTime);
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isBlank(request.getProjectId())) {
|
||||||
|
List<String> syncRuleCaseStatus = new ArrayList<>();
|
||||||
|
syncRuleCaseStatus.add(ApiReportStatus.ERROR.name());
|
||||||
|
request.setStatusList(syncRuleCaseStatus);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (request.isNoSearchStatus()) {
|
if (request.isNoSearchStatus()) {
|
||||||
request.setStatusList(new ArrayList<>());
|
request.setStatusList(new ArrayList<>());
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user