提交 4dc76ffa authored 作者: 黄夏豪's avatar 黄夏豪

fix(base): 修复了环境为空时不报错的情况

上级 e3717b47
...@@ -22,6 +22,7 @@ import org.apache.http.message.BasicNameValuePair; ...@@ -22,6 +22,7 @@ import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.matrix.database.entity.Environment; import org.matrix.database.entity.Environment;
import org.matrix.database.service.IEnvironmentService; import org.matrix.database.service.IEnvironmentService;
import org.matrix.exception.GlobalException;
import org.matrix.exception.HttpRequestException; import org.matrix.exception.HttpRequestException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
...@@ -116,6 +117,13 @@ public class HttpClientActuator implements Actuator { ...@@ -116,6 +117,13 @@ public class HttpClientActuator implements Actuator {
boolean urlMatch = Pattern.matches(PATTERN_URL, httpRequestDetail.getUrl()); boolean urlMatch = Pattern.matches(PATTERN_URL, httpRequestDetail.getUrl());
if (!urlMatch){ if (!urlMatch){
Environment environment = environmentService.getById(envId); Environment environment = environmentService.getById(envId);
if (environment==null){
if (envId==null||envId==-1L){
throw new GlobalException("[HTTP执行器] 未传入执行环境" );
}else {
throw new GlobalException("[HTTP执行器] 执行环境不存在,环境ID: "+envId);
}
}
httpRequestDetail.setUrl(environment.getIp()+httpRequestDetail.getUrl()); httpRequestDetail.setUrl(environment.getIp()+httpRequestDetail.getUrl());
} }
} }
......
...@@ -279,6 +279,7 @@ public class CaseActuator implements Actuator { ...@@ -279,6 +279,7 @@ public class CaseActuator implements Actuator {
RunCaseResult runCaseResult = new RunCaseResult(); RunCaseResult runCaseResult = new RunCaseResult();
runCaseResult.setStartTime(LocalDateTime.now()); runCaseResult.setStartTime(LocalDateTime.now());
runCaseResult.setJobId(caseExecuteVo.getJobId()); runCaseResult.setJobId(caseExecuteVo.getJobId());
runCaseResult.setUniqueKey(uniqueKey);
Long currentThreadId = ThreadUtil.currentThreadId(); Long currentThreadId = ThreadUtil.currentThreadId();
try { try {
if (session != null && session.isOpen()) { if (session != null && session.isOpen()) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论