fix(接口测试): 修复接口同步关联文件时case没有保存文件关系问题

--bug=1023255 --user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001023255
This commit is contained in:
guoyuqi 2023-02-17 16:36:52 +08:00 committed by xiaomeinvG
parent 1036711907
commit 3bff069867
1 changed files with 8 additions and 2 deletions

View File

@ -738,7 +738,7 @@ public class ApiTestCaseService {
JSONObject element = JSONUtil.parseObject(apiTestCase.getRequest());
ElementUtil.dataFormatting(element);
MsHTTPSamplerProxy req = JSON.parseObject(element.toString(), MsHTTPSamplerProxy.class);
if (element != null && StringUtils.isNotEmpty(element.optString(ElementConstants.HASH_TREE))) {
if (StringUtils.isNotEmpty(element.optString(ElementConstants.HASH_TREE))) {
req.setHashTree(JSONUtil.readValue(element.optString(ElementConstants.HASH_TREE)));
}
if (StringUtils.isNotBlank(method)) {
@ -752,11 +752,17 @@ public class ApiTestCaseService {
ApiCaseBatchSyncService apiCaseBatchSyncService = CommonBeanFactory.getBean(ApiCaseBatchSyncService.class);
if (apiCaseBatchSyncService != null) {
apiCaseBatchSyncService.oneClickSyncCase(apiUpdateRule, test, apiTestCase);
// 存储附件关系
JSONObject requestCase = JSONUtil.parseObject(apiTestCase.getRequest());
ElementUtil.dataFormatting(requestCase);
MsHTTPSamplerProxy caseProxy = JSON.parseObject(requestCase.toString(), MsHTTPSamplerProxy.class);
extFileAssociationService.saveApi(apiTestCase.getId(), caseProxy, FileAssociationTypeEnums.CASE.name());
}
batchMapper.updateByPrimaryKeySelective(apiTestCase);
});
sqlSession.flushStatements();
if (sqlSession != null && sqlSessionFactory != null) {
if (sqlSessionFactory != null) {
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
}
}