parent
637739459e
commit
7e9cf5b292
|
@ -33,15 +33,4 @@ public class Schedule implements Serializable {
|
||||||
private String customData;
|
private String customData;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
//定时任务来源: 测试计划/测试场景
|
|
||||||
private String scheduleFrom;
|
|
||||||
|
|
||||||
private String projectId;
|
|
||||||
|
|
||||||
private String moduleId;
|
|
||||||
|
|
||||||
private String modulePath;
|
|
||||||
|
|
||||||
private String modeId;
|
|
||||||
}
|
}
|
|
@ -46,6 +46,7 @@ public class ShiroUtils {
|
||||||
|
|
||||||
public static void ignoreCsrfFilter(Map<String, String> filterChainDefinitionMap) {
|
public static void ignoreCsrfFilter(Map<String, String> filterChainDefinitionMap) {
|
||||||
filterChainDefinitionMap.put("/", "apikey, authc"); // 跳转到 / 不用校验 csrf
|
filterChainDefinitionMap.put("/", "apikey, authc"); // 跳转到 / 不用校验 csrf
|
||||||
|
filterChainDefinitionMap.put("/document", "apikey, authc"); // 跳转到 /document 不用校验 csrf
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Cookie getSessionIdCookie(){
|
public static Cookie getSessionIdCookie(){
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper;
|
||||||
import io.metersphere.api.service.ApiAutomationService;
|
import io.metersphere.api.service.ApiAutomationService;
|
||||||
import io.metersphere.base.domain.Schedule;
|
import io.metersphere.base.domain.Schedule;
|
||||||
import io.metersphere.controller.request.QueryScheduleRequest;
|
import io.metersphere.controller.request.QueryScheduleRequest;
|
||||||
|
import io.metersphere.controller.request.ScheduleRequest;
|
||||||
import io.metersphere.dto.ScheduleDao;
|
import io.metersphere.dto.ScheduleDao;
|
||||||
import io.metersphere.service.ScheduleService;
|
import io.metersphere.service.ScheduleService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -38,7 +39,7 @@ public class ScheduleController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/create")
|
@PostMapping(value = "/create")
|
||||||
public void createSchedule(@RequestBody Schedule request) {
|
public void createSchedule(@RequestBody ScheduleRequest request) {
|
||||||
scheduleService.createSchedule(request);
|
scheduleService.createSchedule(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package io.metersphere.controller.request;
|
||||||
|
|
||||||
|
import io.metersphere.base.domain.Schedule;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author song.tianyang
|
||||||
|
* @Date 2021/3/12 12:57 下午
|
||||||
|
* @Description
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class ScheduleRequest extends Schedule {
|
||||||
|
|
||||||
|
//定时任务来源: 测试计划/测试场景
|
||||||
|
private String scheduleFrom;
|
||||||
|
|
||||||
|
private String projectId;
|
||||||
|
|
||||||
|
private String moduleId;
|
||||||
|
|
||||||
|
private String modulePath;
|
||||||
|
|
||||||
|
private String modeId;
|
||||||
|
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ import io.metersphere.commons.utils.ServiceUtils;
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
import io.metersphere.controller.request.OrderRequest;
|
import io.metersphere.controller.request.OrderRequest;
|
||||||
import io.metersphere.controller.request.QueryScheduleRequest;
|
import io.metersphere.controller.request.QueryScheduleRequest;
|
||||||
|
import io.metersphere.controller.request.ScheduleRequest;
|
||||||
import io.metersphere.dto.ScheduleDao;
|
import io.metersphere.dto.ScheduleDao;
|
||||||
import io.metersphere.job.sechedule.*;
|
import io.metersphere.job.sechedule.*;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -143,7 +144,7 @@ public class ScheduleService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public Schedule buildApiTestSchedule(Schedule request) {
|
public Schedule buildApiTestSchedule(ScheduleRequest request) {
|
||||||
Schedule schedule = new Schedule();
|
Schedule schedule = new Schedule();
|
||||||
schedule.setResourceId(request.getResourceId());
|
schedule.setResourceId(request.getResourceId());
|
||||||
schedule.setEnable(true);
|
schedule.setEnable(true);
|
||||||
|
@ -218,7 +219,7 @@ public class ScheduleService {
|
||||||
return runningTaskInfoList;
|
return runningTaskInfoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createSchedule(Schedule request) {
|
public void createSchedule(ScheduleRequest request) {
|
||||||
Schedule schedule = this.buildApiTestSchedule(request);
|
Schedule schedule = this.buildApiTestSchedule(request);
|
||||||
schedule.setJob(ApiScenarioTestJob.class.getName());
|
schedule.setJob(ApiScenarioTestJob.class.getName());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue