fix(接口测试): 接口自动化编辑导入导出不检查数据

--user=郭雨琦 接口自动化编辑导入导出不检查数据
This commit is contained in:
guoyuqi 2022-03-11 16:55:26 +08:00 committed by fit2-zhao
parent cb5c5a507f
commit 5a25fc5123
1 changed files with 3 additions and 21 deletions

View File

@ -238,14 +238,7 @@ public class ApiAutomationService {
request.setCustomNum(String.valueOf(nextNum)); request.setCustomNum(String.valueOf(nextNum));
} }
checkScenarioNum(request); checkScenarioNum(request);
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH); final ApiScenarioWithBLOBs scenario = buildSaveScenario(request);
ApiTestCaseMapper apiTestCaseMapper = sqlSession.getMapper(ApiTestCaseMapper.class);
ApiDefinitionMapper apiDefinitionMapper = sqlSession.getMapper(ApiDefinitionMapper.class);
final ApiScenarioWithBLOBs scenario = buildSaveScenario(request,apiTestCaseMapper,apiDefinitionMapper);
sqlSession.flushStatements();
if (sqlSession != null && sqlSessionFactory != null) {
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
}
scenario.setVersion(0); scenario.setVersion(0);
scenario.setCreateTime(System.currentTimeMillis()); scenario.setCreateTime(System.currentTimeMillis());
@ -351,17 +344,7 @@ public class ApiAutomationService {
esbApiParamService.checkScenarioRequests(request); esbApiParamService.checkScenarioRequests(request);
//如果场景有TCP步骤的话也要做参数计算处理 //如果场景有TCP步骤的话也要做参数计算处理
tcpApiParamService.checkTestElement(request.getScenarioDefinition()); tcpApiParamService.checkTestElement(request.getScenarioDefinition());
final ApiScenarioWithBLOBs scenario = buildSaveScenario(request);
//检查是否要增加引用的步骤的CASE类型的数据
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
ApiTestCaseMapper apiTestCaseMapper = sqlSession.getMapper(ApiTestCaseMapper.class);
ApiDefinitionMapper apiDefinitionMapper = sqlSession.getMapper(ApiDefinitionMapper.class);
final ApiScenarioWithBLOBs scenario = buildSaveScenario(request,apiTestCaseMapper,apiDefinitionMapper);
sqlSession.flushStatements();
if (sqlSession != null && sqlSessionFactory != null) {
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
}
ApiScenarioWithBLOBs beforeScenario = apiScenarioMapper.selectByPrimaryKey(request.getId()); ApiScenarioWithBLOBs beforeScenario = apiScenarioMapper.selectByPrimaryKey(request.getId());
Integer version = beforeScenario.getVersion(); Integer version = beforeScenario.getVersion();
@ -454,7 +437,7 @@ public class ApiAutomationService {
.map(MsHTTPSamplerProxy::getId).collect(Collectors.toSet()); .map(MsHTTPSamplerProxy::getId).collect(Collectors.toSet());
} }
public ApiScenarioWithBLOBs buildSaveScenario(SaveApiScenarioRequest request,ApiTestCaseMapper apiTestCaseMapper,ApiDefinitionMapper apiDefinitionMapper) { public ApiScenarioWithBLOBs buildSaveScenario(SaveApiScenarioRequest request) {
ApiScenarioWithBLOBs scenario = new ApiScenarioWithBLOBs(); ApiScenarioWithBLOBs scenario = new ApiScenarioWithBLOBs();
scenario.setId(request.getId()); scenario.setId(request.getId());
scenario.setName(request.getName()); scenario.setName(request.getName());
@ -503,7 +486,6 @@ public class ApiAutomationService {
} else { } else {
scenario.setVersionId(request.getVersionId()); scenario.setVersionId(request.getVersionId());
} }
checkReferenceCase(scenario,apiTestCaseMapper,apiDefinitionMapper);
return scenario; return scenario;
} }