fix(接口自动化): 定时任务调用节点执行时 错误修复。
This commit is contained in:
parent
3fd1f412ff
commit
160a11f42d
|
@ -306,7 +306,7 @@ public class JMeterService {
|
|||
return multipartFiles;
|
||||
}
|
||||
|
||||
public void runTest(String testId, HashTree hashTree, String runMode, boolean isDebug, RunModeConfig config) {
|
||||
public void runTest(String testId, HashTree hashTree, String runMode, boolean isDebug, String userId, RunModeConfig config) {
|
||||
// 获取JMX使用到的附件
|
||||
List<Object> multipartFiles = getMultipartFiles(hashTree);
|
||||
// 获取JAR
|
||||
|
@ -347,7 +347,12 @@ public class JMeterService {
|
|||
runRequest.setDebug(isDebug);
|
||||
runRequest.setRunMode(runMode);
|
||||
runRequest.setConfig(config);
|
||||
runRequest.setUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
|
||||
if (SessionUtils.getUser() != null) {
|
||||
runRequest.setUserId(SessionUtils.getUser().getId());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(userId)) {
|
||||
runRequest.setUserId(userId);
|
||||
}
|
||||
runRequest.setJmx(new MsTestPlan().getJmx(hashTree));
|
||||
MultiValueMap<String, Object> postParameters = new LinkedMultiValueMap<>();
|
||||
if (CollectionUtils.isEmpty(multipartFiles)) {
|
||||
|
|
|
@ -1259,7 +1259,7 @@ public class ApiAutomationService {
|
|||
try {
|
||||
HashTree hashTree = generateHashTree(apiScenarios, request, reportIds);
|
||||
if (request.getConfig() != null && StringUtils.isNotBlank(request.getConfig().getResourcePoolId())) {
|
||||
jMeterService.runTest(JSON.toJSONString(reportIds), hashTree, runMode, false, request.getConfig());
|
||||
jMeterService.runTest(JSON.toJSONString(reportIds), hashTree, runMode, false, request.getUserId(), request.getConfig());
|
||||
} else {
|
||||
jMeterService.runSerial(JSON.toJSONString(reportIds), hashTree, request.getReportId(), runMode, request.getConfig());
|
||||
}
|
||||
|
@ -1817,7 +1817,7 @@ public class ApiAutomationService {
|
|||
* 1.场景中复制的接口
|
||||
* 2.场景中引用/复制的案例
|
||||
* 3.场景中的自定义路径与接口定义中的匹配
|
||||
*
|
||||
* <p>
|
||||
* 匹配场景中用到的路径
|
||||
*
|
||||
* @param allScenarioInfoList 场景集合(id / scenario大字段 必须有数据)
|
||||
|
@ -1998,7 +1998,6 @@ public class ApiAutomationService {
|
|||
}
|
||||
|
||||
|
||||
|
||||
public ScenarioEnv getApiScenarioProjectId(String id) {
|
||||
ApiScenarioWithBLOBs scenario = apiScenarioMapper.selectByPrimaryKey(id);
|
||||
ScenarioEnv scenarioEnv = new ScenarioEnv();
|
||||
|
@ -2178,7 +2177,8 @@ public class ApiAutomationService {
|
|||
boolean isCustomNumExist = true;
|
||||
try {
|
||||
isCustomNumExist = this.isCustomNumExist(newModel);
|
||||
}catch (Exception e){}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
insertFlag = !isCustomNumExist;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -600,7 +600,7 @@ public class ApiDefinitionService {
|
|||
|
||||
// 调用执行方法
|
||||
if (request.getConfig() != null && StringUtils.isNotBlank(request.getConfig().getResourcePoolId())) {
|
||||
jMeterService.runTest(request.getId(), hashTree, runMode, request.getReportId() != null, request.getConfig());
|
||||
jMeterService.runTest(request.getId(), hashTree, runMode, request.getReportId() != null, null, request.getConfig());
|
||||
} else {
|
||||
jMeterService.runDefinition(request.getId(), hashTree, request.getReportId(), runMode);
|
||||
}
|
||||
|
@ -969,6 +969,7 @@ public class ApiDefinitionService {
|
|||
|
||||
/**
|
||||
* 列表开关切换
|
||||
*
|
||||
* @param request
|
||||
*/
|
||||
public void switchSchedule(Schedule request) {
|
||||
|
|
|
@ -29,7 +29,7 @@ public class ParallelScenarioExecTask<T> implements Callable<T> {
|
|||
public T call() {
|
||||
try {
|
||||
if (request.getConfig() != null && StringUtils.isNotBlank(request.getConfig().getResourcePoolId())) {
|
||||
jMeterService.runTest(id, hashTree, request.getRunMode(), false, request.getConfig());
|
||||
jMeterService.runTest(id, hashTree, request.getRunMode(), false, request.getUserId(), request.getConfig());
|
||||
} else {
|
||||
jMeterService.runSerial(id, hashTree, request.getReportId(), request.getRunMode(), request.getConfig());
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public class SerialScenarioExecTask<T> implements Callable<T> {
|
|||
public T call() {
|
||||
try {
|
||||
if (request.getConfig() != null && StringUtils.isNotBlank(request.getConfig().getResourcePoolId())) {
|
||||
jMeterService.runTest(id, hashTree, request.getRunMode(), false, request.getConfig());
|
||||
jMeterService.runTest(id, hashTree, request.getRunMode(), false, request.getUserId(), request.getConfig());
|
||||
} else {
|
||||
jMeterService.runSerial(id, hashTree, request.getReportId(), request.getRunMode(), request.getConfig());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue