fix(接口测试):解决接口导入覆盖内容变化更新时间不变问题
--bug=1024797 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001024797
This commit is contained in:
parent
abb3dd0f55
commit
4e92b54153
|
@ -267,7 +267,7 @@ public class ApiDefinitionImportUtilService {
|
|||
if (item.getVersionId() == null || (!item.getVersionId().equals("new") && !item.getVersionId().equals("update"))) {
|
||||
item.setNum(num++);
|
||||
}
|
||||
//如果EsbData需要存储,则需要进行接口是否更新的判断
|
||||
|
||||
ApiDefinitionImportParamDTO apiDefinitionImportParam = new ApiDefinitionImportParamDTO(item, request, apiImport.getMocks(), toUpdateList, caseList);
|
||||
apiDefinitionImportParam.setRepeatList(sameRefIds);
|
||||
ApiImportSendNoticeDTO apiImportSendNoticeDTO = importCreate(batchMapper, apiDefinitionImportParam);
|
||||
|
@ -754,17 +754,13 @@ public class ApiDefinitionImportUtilService {
|
|||
if (CollectionUtils.isEmpty(repeatList)) {
|
||||
return;
|
||||
}
|
||||
if (apiDefinition.getLatest()) {
|
||||
for (ApiDefinitionWithBLOBs apiDefinitionWithBLOBs : repeatList) {
|
||||
if (apiDefinitionWithBLOBs.getLatest() && !apiDefinition.getId().equalsIgnoreCase(apiDefinitionWithBLOBs.getId())) {
|
||||
if (!apiDefinition.getId().equalsIgnoreCase(apiDefinitionWithBLOBs.getId())) {
|
||||
if (apiDefinition.getLatest() && apiDefinitionWithBLOBs.getLatest()) {
|
||||
apiDefinitionWithBLOBs.setLatest(false);
|
||||
}
|
||||
batchMapper.updateByPrimaryKey(apiDefinitionWithBLOBs);
|
||||
}
|
||||
} else {
|
||||
for (ApiDefinitionWithBLOBs apiDefinitionWithBLOBs : repeatList) {
|
||||
batchMapper.updateByPrimaryKey(apiDefinitionWithBLOBs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -947,7 +943,9 @@ public class ApiDefinitionImportUtilService {
|
|||
Map<String, ApiDefinitionWithBLOBs> methodPathMap, Map<String, List<ApiDefinitionWithBLOBs>> repeatDataMap,
|
||||
String updateVersionId, List<ApiTestCaseWithBLOBs> optionDataCases,
|
||||
Map<String, List<ApiTestCaseWithBLOBs>> oldCaseMap) {
|
||||
//要去覆盖接口的集合
|
||||
List<ApiDefinitionWithBLOBs> coverApiList = new ArrayList<>();
|
||||
//记录已存在数据可以被更新的集合
|
||||
List<ApiDefinitionWithBLOBs> updateApiList = new ArrayList<>();
|
||||
repeatDataMap.forEach((k, v) -> {
|
||||
ApiDefinitionWithBLOBs apiDefinitionWithBLOBs = methodPathMap.get(k);
|
||||
|
@ -956,11 +954,13 @@ public class ApiDefinitionImportUtilService {
|
|||
Map<String, List<ApiTestCaseWithBLOBs>> definitionIdCaseMAp = optionDataCases.stream().collect(Collectors.groupingBy(ApiTestCase::getApiDefinitionId));
|
||||
Map<String, ApiTestCaseWithBLOBs> caseNameMap = getDistinctCaseNameMap(definitionIdCaseMAp, apiDefinitionWithBLOBs);
|
||||
int i = 0;
|
||||
//定义最新版本
|
||||
ApiDefinitionWithBLOBs latestApi = null;
|
||||
for (ApiDefinitionWithBLOBs definitionWithBLOBs : v) {
|
||||
if (definitionWithBLOBs.getLatest()) {
|
||||
latestApi = definitionWithBLOBs;
|
||||
}
|
||||
//为了记录指定版本是否有数据
|
||||
if (!definitionWithBLOBs.getVersionId().equals(updateVersionId)) {
|
||||
i += 1;
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue