refactor(场景自动化): 优化执行场景前环境检查

This commit is contained in:
shiziyuan9527 2021-04-28 16:00:48 +08:00 committed by 刘瑞斌
parent 37e99b3eee
commit ca4900b6a0
1 changed files with 10 additions and 1 deletions

View File

@ -917,6 +917,12 @@ public class ApiAutomationService {
if (StringUtils.isBlank(s)) { if (StringUtils.isBlank(s)) {
isEnv = false; isEnv = false;
break; break;
} else {
ApiTestEnvironmentWithBLOBs env = apiTestEnvironmentMapper.selectByPrimaryKey(s);
if (env == null) {
isEnv = false;
break;
}
} }
} }
} else { } else {
@ -933,9 +939,12 @@ public class ApiAutomationService {
if (!isEnv) { if (!isEnv) {
String envId = scenario.getEnvironmentId(); String envId = scenario.getEnvironmentId();
if (StringUtils.isNotBlank(envId)) { if (StringUtils.isNotBlank(envId)) {
ApiTestEnvironmentWithBLOBs env = apiTestEnvironmentMapper.selectByPrimaryKey(envId);
if (env != null) {
isEnv = true; isEnv = true;
} }
} }
}
return isEnv; return isEnv;
} }