Merge remote-tracking branch 'origin/master'

This commit is contained in:
Captain.B 2021-03-12 15:07:58 +08:00
commit 56110bfa5b
14 changed files with 59 additions and 27 deletions

View File

@ -20,6 +20,7 @@ import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.QueryScheduleRequest;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.dto.ScheduleDao;
import io.metersphere.performance.service.PerformanceTestService;
import io.metersphere.service.CheckPermissionService;
@ -104,7 +105,7 @@ public class APITestController {
}
@PostMapping(value = "/schedule/create")
public void createSchedule(@RequestBody Schedule request) {
public void createSchedule(@RequestBody ScheduleRequest request) {
apiTestService.createSchedule(request);
}

View File

@ -16,6 +16,7 @@ import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
import io.metersphere.track.request.testplan.FileOperationRequest;
import org.apache.shiro.authz.annotation.Logical;
@ -149,7 +150,7 @@ public class ApiAutomationController {
}
@PostMapping(value = "/schedule/create")
public void createSchedule(@RequestBody Schedule request) {
public void createSchedule(@RequestBody ScheduleRequest request) {
apiAutomationService.createSchedule(request);
}

View File

@ -20,6 +20,7 @@ import io.metersphere.commons.utils.CronUtils;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.service.CheckPermissionService;
import io.metersphere.service.ScheduleService;
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
@ -156,7 +157,7 @@ public class ApiDefinitionController {
//定时任务创建
@PostMapping(value = "/schedule/create")
public void createSchedule(@RequestBody Schedule request) {
public void createSchedule(@RequestBody ScheduleRequest request) {
apiDefinitionService.createSchedule(request);
}
@PostMapping(value = "/schedule/update")

View File

@ -21,6 +21,7 @@ import io.metersphere.commons.constants.ScheduleType;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.QueryScheduleRequest;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.dto.ScheduleDao;
import io.metersphere.i18n.Translator;
import io.metersphere.job.sechedule.ApiTestJob;
@ -328,12 +329,12 @@ public class APITestService {
addOrUpdateApiTestCronJob(request);
}
public void createSchedule(Schedule request) {
public void createSchedule(ScheduleRequest request) {
scheduleService.addSchedule(buildApiTestSchedule(request));
addOrUpdateApiTestCronJob(request);
}
private Schedule buildApiTestSchedule(Schedule request) {
private Schedule buildApiTestSchedule(ScheduleRequest request) {
Schedule schedule = scheduleService.buildApiTestSchedule(request);
schedule.setJob(ApiTestJob.class.getName());
schedule.setGroup(ScheduleGroup.API_TEST.name());

View File

@ -31,6 +31,7 @@ import io.metersphere.base.mapper.ext.ExtTestPlanScenarioCaseMapper;
import io.metersphere.commons.constants.*;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.i18n.Translator;
import io.metersphere.job.sechedule.ApiScenarioTestJob;
import io.metersphere.job.sechedule.TestPlanTestJob;
@ -717,7 +718,7 @@ public class ApiAutomationService {
return apiScenarioMapper.selectByExampleWithBLOBs(example);
}
public void createSchedule(Schedule request) {
public void createSchedule(ScheduleRequest request) {
Schedule schedule = scheduleService.buildApiTestSchedule(request);
schedule.setJob(ApiScenarioTestJob.class.getName());
schedule.setGroup(ScheduleGroup.API_SCENARIO_TEST.name());

View File

@ -28,6 +28,7 @@ import io.metersphere.base.mapper.ext.*;
import io.metersphere.commons.constants.*;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.i18n.Translator;
import io.metersphere.job.sechedule.SwaggerUrlImportJob;
import io.metersphere.service.FileService;
@ -702,7 +703,7 @@ public class ApiDefinitionService {
}
/*swagger定时导入*/
public void createSchedule(Schedule request) {
public void createSchedule(ScheduleRequest request) {
/*保存swaggerUrl*/
SwaggerUrlProject swaggerUrlProject = new SwaggerUrlProject();
swaggerUrlProject.setId(UUID.randomUUID().toString());

View File

@ -33,15 +33,4 @@ public class Schedule implements Serializable {
private String customData;
private static final long serialVersionUID = 1L;
//定时任务来源 测试计划/测试场景
private String scheduleFrom;
private String projectId;
private String moduleId;
private String modulePath;
private String modeId;
}

View File

@ -46,6 +46,7 @@ public class ShiroUtils {
public static void ignoreCsrfFilter(Map<String, String> filterChainDefinitionMap) {
filterChainDefinitionMap.put("/", "apikey, authc"); // 跳转到 / 不用校验 csrf
filterChainDefinitionMap.put("/document", "apikey, authc"); // 跳转到 /document 不用校验 csrf
}
public static Cookie getSessionIdCookie(){

View File

@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper;
import io.metersphere.api.service.ApiAutomationService;
import io.metersphere.base.domain.Schedule;
import io.metersphere.controller.request.QueryScheduleRequest;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.dto.ScheduleDao;
import io.metersphere.service.ScheduleService;
import org.springframework.web.bind.annotation.*;
@ -38,7 +39,7 @@ public class ScheduleController {
}
@PostMapping(value = "/create")
public void createSchedule(@RequestBody Schedule request) {
public void createSchedule(@RequestBody ScheduleRequest request) {
scheduleService.createSchedule(request);
}

View File

@ -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;
}

View File

@ -10,6 +10,7 @@ import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.QueryScheduleRequest;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.dto.DashboardTestDTO;
import io.metersphere.dto.LoadTestDTO;
import io.metersphere.dto.ScheduleDao;
@ -175,7 +176,7 @@ public class PerformanceTestController {
}
@PostMapping(value = "/schedule/create")
public void createSchedule(@RequestBody Schedule request) {
public void createSchedule(@RequestBody ScheduleRequest request) {
performanceTestService.createSchedule(request);
}

View File

@ -14,6 +14,7 @@ import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.config.KafkaProperties;
import io.metersphere.controller.request.OrderRequest;
import io.metersphere.controller.request.QueryScheduleRequest;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.dto.DashboardTestDTO;
import io.metersphere.dto.LoadTestDTO;
import io.metersphere.dto.ScheduleDao;
@ -465,12 +466,12 @@ public class PerformanceTestService {
addOrUpdatePerformanceTestCronJob(request);
}
public void createSchedule(Schedule request) {
public void createSchedule(ScheduleRequest request) {
scheduleService.addSchedule(buildPerformanceTestSchedule(request));
addOrUpdatePerformanceTestCronJob(request);
}
private Schedule buildPerformanceTestSchedule(Schedule request) {
private Schedule buildPerformanceTestSchedule(ScheduleRequest request) {
Schedule schedule = scheduleService.buildApiTestSchedule(request);
schedule.setJob(PerformanceTestJob.class.getName());
schedule.setGroup(ScheduleGroup.PERFORMANCE_TEST.name());

View File

@ -17,6 +17,7 @@ import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.OrderRequest;
import io.metersphere.controller.request.QueryScheduleRequest;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.dto.ScheduleDao;
import io.metersphere.job.sechedule.*;
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.setResourceId(request.getResourceId());
schedule.setEnable(true);
@ -218,7 +219,7 @@ public class ScheduleService {
return runningTaskInfoList;
}
public void createSchedule(Schedule request) {
public void createSchedule(ScheduleRequest request) {
Schedule schedule = this.buildApiTestSchedule(request);
schedule.setJob(ApiScenarioTestJob.class.getName());

View File

@ -78,14 +78,19 @@ alter table test_case
alter table test_case
add demand_name varchar(999) null;
alter table test_case
add follow_people varchar(100) null;
-- test_case_review add column
ALTER TABLE test_case_review ADD tags VARCHAR(2000) NULL;
ALTER TABLE test_case_review
ADD tags VARCHAR(2000) NULL;
-- alter test_plan_api_scenario
alter table test_plan_api_scenario change environment_id environment longtext null comment 'Relevance environment';
alter table test_plan_api_scenario
change environment_id environment longtext null comment 'Relevance environment';
-- file add sort column
alter table file_metadata add sort int default 0;
alter table file_metadata
add sort int default 0;
-- add Original state
alter table api_definition add original_state varchar(64);