mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-05 05:29:29 +08:00
fix(测试跟踪): 测试计划定时任务执行获取subject报错问题
This commit is contained in:
parent
459e53cdf9
commit
4661bcbb21
@ -8,6 +8,8 @@ import io.metersphere.plan.dto.ExecutionWay;
|
||||
import io.metersphere.plan.service.TestPlanService;
|
||||
import io.metersphere.sechedule.MsScheduleJob;
|
||||
import io.metersphere.service.BaseUserService;
|
||||
import org.apache.shiro.mgt.DefaultSecurityManager;
|
||||
import org.apache.shiro.util.ThreadContext;
|
||||
import org.quartz.*;
|
||||
|
||||
/**
|
||||
@ -24,6 +26,8 @@ public class TestPlanTestJob extends MsScheduleJob {
|
||||
|
||||
private BaseUserService baseUserService;
|
||||
|
||||
private static DefaultSecurityManager defaultSecurityManager = new DefaultSecurityManager();
|
||||
|
||||
public TestPlanTestJob() {
|
||||
this.testPlanService = CommonBeanFactory.getBean(TestPlanService.class);
|
||||
this.baseUserService = CommonBeanFactory.getBean(BaseUserService.class);
|
||||
@ -45,6 +49,8 @@ public class TestPlanTestJob extends MsScheduleJob {
|
||||
this.expression = jobDataMap.getString("expression");
|
||||
this.projectID = jobDataMap.getString("projectId");
|
||||
|
||||
// 业务中涉及远程调用, 需在定时任务中获取subject.
|
||||
ThreadContext.bind(defaultSecurityManager);
|
||||
businessExecute(context);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user