fix(接口测试): 修复场景定时任务执行失效问题

This commit is contained in:
fit2-zhao 2021-12-24 11:56:24 +08:00 committed by fit2-zhao
parent d04602ae67
commit 7d39a9228b
1 changed files with 6 additions and 2 deletions

View File

@ -9,6 +9,7 @@ import io.metersphere.commons.constants.ReportTriggerMode;
import io.metersphere.commons.constants.ScheduleGroup;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.constants.RunModeConstants;
import io.metersphere.dto.RunModeConfigDTO;
import org.apache.commons.lang3.StringUtils;
import org.quartz.*;
@ -26,7 +27,7 @@ import java.util.UUID;
*/
public class ApiScenarioTestJob extends MsScheduleJob {
private String projectID;
private String projectID;
private List<String> scenarioIds;
@ -67,12 +68,15 @@ public class ApiScenarioTestJob extends MsScheduleJob {
request.setIds(this.scenarioIds);
request.setReportUserID(this.userId);
request.setRunMode(ApiRunMode.SCHEDULE_SCENARIO.name());
JobDataMap jobDataMap = context.getJobDetail().getJobDataMap();
String config = jobDataMap.getString("config");
if (StringUtils.isNotBlank(config)) {
RunModeConfigDTO runModeConfig = JSONObject.parseObject(config, RunModeConfigDTO.class);
request.setConfig(runModeConfig);
} else {
RunModeConfigDTO runModeConfigDTO = new RunModeConfigDTO();
runModeConfigDTO.setMode(RunModeConstants.PARALLEL.toString());
request.setConfig(runModeConfigDTO);
}
apiAutomationService.run(request);