feat(任务中心): 系统&组织&项目后台任务列表更新cron表达式
This commit is contained in:
parent
196037b7d4
commit
104f5406ae
|
@ -8,6 +8,7 @@ import io.metersphere.system.dto.taskhub.ResourcePoolOptionsDTO;
|
||||||
import io.metersphere.system.dto.taskhub.TaskHubDTO;
|
import io.metersphere.system.dto.taskhub.TaskHubDTO;
|
||||||
import io.metersphere.system.dto.taskhub.TaskHubItemDTO;
|
import io.metersphere.system.dto.taskhub.TaskHubItemDTO;
|
||||||
import io.metersphere.system.dto.taskhub.TaskHubScheduleDTO;
|
import io.metersphere.system.dto.taskhub.TaskHubScheduleDTO;
|
||||||
|
import io.metersphere.system.dto.taskhub.request.ScheduleRequest;
|
||||||
import io.metersphere.system.dto.taskhub.request.TaskHubItemBatchRequest;
|
import io.metersphere.system.dto.taskhub.request.TaskHubItemBatchRequest;
|
||||||
import io.metersphere.system.dto.taskhub.request.TaskHubItemRequest;
|
import io.metersphere.system.dto.taskhub.request.TaskHubItemRequest;
|
||||||
import io.metersphere.system.dto.taskhub.response.TaskStatisticsResponse;
|
import io.metersphere.system.dto.taskhub.response.TaskStatisticsResponse;
|
||||||
|
@ -173,4 +174,11 @@ public class ProjectTaskHubController {
|
||||||
public void batchDisable(@Validated @RequestBody TableBatchProcessDTO request) {
|
public void batchDisable(@Validated @RequestBody TableBatchProcessDTO request) {
|
||||||
baseTaskHubService.scheduleBatchOperation(request, SessionUtils.getUserId(), null, "/project/task-center/schedule/batch-disable", OperationLogModule.PROJECT_MANAGEMENT_TASK_CENTER, false, List.of(SessionUtils.getCurrentProjectId()));
|
baseTaskHubService.scheduleBatchOperation(request, SessionUtils.getUserId(), null, "/project/task-center/schedule/batch-disable", OperationLogModule.PROJECT_MANAGEMENT_TASK_CENTER, false, List.of(SessionUtils.getCurrentProjectId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/schedule/update-cron")
|
||||||
|
@Operation(summary = "项目-任务中心-后台任务更新cron表达式")
|
||||||
|
@RequiresPermissions(PermissionConstants.PROJECT_SCHEDULE_TASK_CENTER_READ_UPDATE)
|
||||||
|
public void updateValue(@PathVariable ScheduleRequest request) {
|
||||||
|
baseTaskHubService.updateCron(request);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import io.metersphere.system.base.BaseTest;
|
||||||
import io.metersphere.system.controller.handler.ResultHolder;
|
import io.metersphere.system.controller.handler.ResultHolder;
|
||||||
import io.metersphere.system.dto.sdk.BasePageRequest;
|
import io.metersphere.system.dto.sdk.BasePageRequest;
|
||||||
import io.metersphere.system.dto.table.TableBatchProcessDTO;
|
import io.metersphere.system.dto.table.TableBatchProcessDTO;
|
||||||
|
import io.metersphere.system.dto.taskhub.request.ScheduleRequest;
|
||||||
import io.metersphere.system.dto.taskhub.request.TaskHubItemBatchRequest;
|
import io.metersphere.system.dto.taskhub.request.TaskHubItemBatchRequest;
|
||||||
import io.metersphere.system.dto.taskhub.request.TaskHubItemRequest;
|
import io.metersphere.system.dto.taskhub.request.TaskHubItemRequest;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
@ -38,6 +39,7 @@ public class ProjectTaskHubControllerTests extends BaseTest {
|
||||||
public static final String PROJECT_SCHEDULE_TASK_SWITCH = "/project/task-center/schedule/switch/";
|
public static final String PROJECT_SCHEDULE_TASK_SWITCH = "/project/task-center/schedule/switch/";
|
||||||
public static final String PROJECT_SCHEDULE_TASK_BATCH_ENABLE = "/project/task-center/schedule/batch-enable";
|
public static final String PROJECT_SCHEDULE_TASK_BATCH_ENABLE = "/project/task-center/schedule/batch-enable";
|
||||||
public static final String PROJECT_SCHEDULE_TASK_BATCH_DISABLE = "/project/task-center/schedule/batch-disable";
|
public static final String PROJECT_SCHEDULE_TASK_BATCH_DISABLE = "/project/task-center/schedule/batch-disable";
|
||||||
|
public static final String PROJECT_SCHEDULE_TASK_UPDATE_CRON = "/organization/task-center/schedule/update-cron";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(1)
|
@Order(1)
|
||||||
|
@ -127,13 +129,10 @@ public class ProjectTaskHubControllerTests extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
@Order(6)
|
@Order(6)
|
||||||
public void projectTaskStop() throws Exception {
|
public void projectTaskStop() throws Exception {
|
||||||
|
mockPost("/api/task/item/stop", "");
|
||||||
this.requestGet(PROJECT_TASK_STOP + "pro_1");
|
this.requestGet(PROJECT_TASK_STOP + "pro_1");
|
||||||
MvcResult mvcResult = this.requestGetWithOkAndReturn(PROJECT_TASK_STOP + "pro_2");
|
mockPost("/api/task/stop", "");
|
||||||
// 获取返回值
|
this.requestGet(PROJECT_TASK_STOP + "pro_2");
|
||||||
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
|
||||||
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
|
||||||
// 返回请求正常
|
|
||||||
Assertions.assertNotNull(resultHolder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -142,6 +141,7 @@ public class ProjectTaskHubControllerTests extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
@Order(23)
|
@Order(23)
|
||||||
public void projectTaskBatchStop() throws Exception {
|
public void projectTaskBatchStop() throws Exception {
|
||||||
|
mockPost("/api/task/item/stop", "");
|
||||||
TableBatchProcessDTO request = new TableBatchProcessDTO();
|
TableBatchProcessDTO request = new TableBatchProcessDTO();
|
||||||
request.setSelectAll(true);
|
request.setSelectAll(true);
|
||||||
this.requestPost(PROJECT_TASK_BATCH_STOP, request);
|
this.requestPost(PROJECT_TASK_BATCH_STOP, request);
|
||||||
|
@ -192,6 +192,7 @@ public class ProjectTaskHubControllerTests extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
@Order(4)
|
@Order(4)
|
||||||
public void projectTaskItemStop() throws Exception {
|
public void projectTaskItemStop() throws Exception {
|
||||||
|
mockPost("/api/task/item/stop", "");
|
||||||
this.requestGet(PROJECT_TASK_ITEM_STOP + "pro_1");
|
this.requestGet(PROJECT_TASK_ITEM_STOP + "pro_1");
|
||||||
MvcResult mvcResult = this.requestGetWithOkAndReturn(PROJECT_TASK_ITEM_STOP + "pro_2");
|
MvcResult mvcResult = this.requestGetWithOkAndReturn(PROJECT_TASK_ITEM_STOP + "pro_2");
|
||||||
// 获取返回值
|
// 获取返回值
|
||||||
|
@ -205,6 +206,7 @@ public class ProjectTaskHubControllerTests extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
@Order(4)
|
@Order(4)
|
||||||
public void projectTaskItemBatchStop() throws Exception {
|
public void projectTaskItemBatchStop() throws Exception {
|
||||||
|
mockPost("/api/task/item/stop", "");
|
||||||
TaskHubItemBatchRequest request = new TaskHubItemBatchRequest();
|
TaskHubItemBatchRequest request = new TaskHubItemBatchRequest();
|
||||||
request.setSelectAll(false);
|
request.setSelectAll(false);
|
||||||
request.setSelectIds(List.of("pro_1", "pro_2"));
|
request.setSelectIds(List.of("pro_1", "pro_2"));
|
||||||
|
@ -253,4 +255,13 @@ public class ProjectTaskHubControllerTests extends BaseTest {
|
||||||
request.setSelectAll(true);
|
request.setSelectAll(true);
|
||||||
this.requestPost(PROJECT_SCHEDULE_TASK_BATCH_DISABLE, request);
|
this.requestPost(PROJECT_SCHEDULE_TASK_BATCH_DISABLE, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(9)
|
||||||
|
public void projectScheduleUpdateCron() throws Exception {
|
||||||
|
ScheduleRequest request = new ScheduleRequest();
|
||||||
|
request.setCron("0 0 0 1 * ?");
|
||||||
|
request.setId("pro_wx_1");
|
||||||
|
this.requestPost(PROJECT_SCHEDULE_TASK_UPDATE_CRON, request);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import io.metersphere.system.dto.taskhub.ResourcePoolOptionsDTO;
|
||||||
import io.metersphere.system.dto.taskhub.TaskHubDTO;
|
import io.metersphere.system.dto.taskhub.TaskHubDTO;
|
||||||
import io.metersphere.system.dto.taskhub.TaskHubItemDTO;
|
import io.metersphere.system.dto.taskhub.TaskHubItemDTO;
|
||||||
import io.metersphere.system.dto.taskhub.TaskHubScheduleDTO;
|
import io.metersphere.system.dto.taskhub.TaskHubScheduleDTO;
|
||||||
|
import io.metersphere.system.dto.taskhub.request.ScheduleRequest;
|
||||||
import io.metersphere.system.dto.taskhub.request.TaskHubItemBatchRequest;
|
import io.metersphere.system.dto.taskhub.request.TaskHubItemBatchRequest;
|
||||||
import io.metersphere.system.dto.taskhub.request.TaskHubItemRequest;
|
import io.metersphere.system.dto.taskhub.request.TaskHubItemRequest;
|
||||||
import io.metersphere.system.dto.taskhub.response.TaskStatisticsResponse;
|
import io.metersphere.system.dto.taskhub.response.TaskStatisticsResponse;
|
||||||
|
@ -181,10 +182,18 @@ public class OrganizationTaskHubController {
|
||||||
|
|
||||||
@PostMapping("/schedule/batch-disable")
|
@PostMapping("/schedule/batch-disable")
|
||||||
@Operation(summary = "组织-任务中心-后台任务-批量关闭")
|
@Operation(summary = "组织-任务中心-后台任务-批量关闭")
|
||||||
@RequiresPermissions(PermissionConstants.SYSTEM_SCHEDULE_TASK_CENTER_READ_UPDATE)
|
@RequiresPermissions(PermissionConstants.ORGANIZATION_SCHEDULE_TASK_CENTER_READ_UPDATE)
|
||||||
public void batchDisable(@Validated @RequestBody TableBatchProcessDTO request) {
|
public void batchDisable(@Validated @RequestBody TableBatchProcessDTO request) {
|
||||||
List<OptionDTO> projectList = baseProjectMapper.getProjectOptionsByOrgId(SessionUtils.getCurrentOrganizationId());
|
List<OptionDTO> projectList = baseProjectMapper.getProjectOptionsByOrgId(SessionUtils.getCurrentOrganizationId());
|
||||||
List<String> projectIds = projectList.stream().map(OptionDTO::getId).toList();
|
List<String> projectIds = projectList.stream().map(OptionDTO::getId).toList();
|
||||||
baseTaskHubService.scheduleBatchOperation(request, SessionUtils.getUserId(), null, "/organization/task-center/schedule/batch-disable", OperationLogModule.SETTING_ORGANIZATION_TASK_CENTER, false, projectIds);
|
baseTaskHubService.scheduleBatchOperation(request, SessionUtils.getUserId(), null, "/organization/task-center/schedule/batch-disable", OperationLogModule.SETTING_ORGANIZATION_TASK_CENTER, false, projectIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/schedule/update-cron")
|
||||||
|
@Operation(summary = "组织-任务中心-后台任务更新cron表达式")
|
||||||
|
@RequiresPermissions(PermissionConstants.ORGANIZATION_SCHEDULE_TASK_CENTER_READ_UPDATE)
|
||||||
|
public void updateValue(@PathVariable ScheduleRequest request) {
|
||||||
|
baseTaskHubService.updateCron(request);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,14 @@ import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
import io.metersphere.system.dto.sdk.BasePageRequest;
|
import io.metersphere.system.dto.sdk.BasePageRequest;
|
||||||
import io.metersphere.system.dto.table.TableBatchProcessDTO;
|
import io.metersphere.system.dto.table.TableBatchProcessDTO;
|
||||||
import io.metersphere.system.dto.taskhub.*;
|
import io.metersphere.system.dto.taskhub.*;
|
||||||
|
import io.metersphere.system.dto.taskhub.request.ScheduleRequest;
|
||||||
import io.metersphere.system.dto.taskhub.request.TaskHubItemBatchRequest;
|
import io.metersphere.system.dto.taskhub.request.TaskHubItemBatchRequest;
|
||||||
import io.metersphere.system.dto.taskhub.request.TaskHubItemRequest;
|
import io.metersphere.system.dto.taskhub.request.TaskHubItemRequest;
|
||||||
import io.metersphere.system.dto.taskhub.response.TaskStatisticsResponse;
|
import io.metersphere.system.dto.taskhub.response.TaskStatisticsResponse;
|
||||||
import io.metersphere.system.log.annotation.Log;
|
import io.metersphere.system.log.annotation.Log;
|
||||||
import io.metersphere.system.log.constants.OperationLogModule;
|
import io.metersphere.system.log.constants.OperationLogModule;
|
||||||
import io.metersphere.system.log.constants.OperationLogType;
|
import io.metersphere.system.log.constants.OperationLogType;
|
||||||
|
import io.metersphere.system.security.CheckOwner;
|
||||||
import io.metersphere.system.service.BaseTaskHubLogService;
|
import io.metersphere.system.service.BaseTaskHubLogService;
|
||||||
import io.metersphere.system.service.BaseTaskHubService;
|
import io.metersphere.system.service.BaseTaskHubService;
|
||||||
import io.metersphere.system.utils.Pager;
|
import io.metersphere.system.utils.Pager;
|
||||||
|
@ -185,5 +187,12 @@ public class SystemTaskHubController {
|
||||||
baseTaskHubService.scheduleBatchOperation(request, SessionUtils.getUserId(), null, "/system/task-center/schedule/batch-disable", OperationLogModule.SETTING_SYSTEM_TASK_CENTER, false, null);
|
baseTaskHubService.scheduleBatchOperation(request, SessionUtils.getUserId(), null, "/system/task-center/schedule/batch-disable", OperationLogModule.SETTING_SYSTEM_TASK_CENTER, false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO 系统&组织&项目 后台任务操作:删除 批量开启 批量关闭
|
|
||||||
|
@PostMapping("/schedule/update-cron")
|
||||||
|
@Operation(summary = "系统-任务中心-后台任务更新cron表达式")
|
||||||
|
@RequiresPermissions(PermissionConstants.SYSTEM_SCHEDULE_TASK_CENTER_READ_UPDATE)
|
||||||
|
public void updateValue(@PathVariable ScheduleRequest request) {
|
||||||
|
baseTaskHubService.updateCron(request);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package io.metersphere.system.dto.taskhub.request;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wx
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ScheduleRequest implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(description = "列表id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "cron表达式")
|
||||||
|
private String cron;
|
||||||
|
}
|
|
@ -27,6 +27,7 @@ import io.metersphere.system.dto.sdk.OptionDTO;
|
||||||
import io.metersphere.system.dto.table.TableBatchProcessDTO;
|
import io.metersphere.system.dto.table.TableBatchProcessDTO;
|
||||||
import io.metersphere.system.dto.taskcenter.enums.ScheduleTagType;
|
import io.metersphere.system.dto.taskcenter.enums.ScheduleTagType;
|
||||||
import io.metersphere.system.dto.taskhub.*;
|
import io.metersphere.system.dto.taskhub.*;
|
||||||
|
import io.metersphere.system.dto.taskhub.request.ScheduleRequest;
|
||||||
import io.metersphere.system.dto.taskhub.request.TaskHubItemBatchRequest;
|
import io.metersphere.system.dto.taskhub.request.TaskHubItemBatchRequest;
|
||||||
import io.metersphere.system.dto.taskhub.request.TaskHubItemRequest;
|
import io.metersphere.system.dto.taskhub.request.TaskHubItemRequest;
|
||||||
import io.metersphere.system.dto.taskhub.response.TaskStatisticsResponse;
|
import io.metersphere.system.dto.taskhub.response.TaskStatisticsResponse;
|
||||||
|
@ -117,6 +118,7 @@ public class BaseTaskHubService {
|
||||||
@Resource
|
@Resource
|
||||||
ApiScheduleNoticeService apiScheduleNoticeService;
|
ApiScheduleNoticeService apiScheduleNoticeService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统-获取执行任务列表
|
* 系统-获取执行任务列表
|
||||||
*
|
*
|
||||||
|
@ -824,4 +826,16 @@ public class BaseTaskHubService {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateCron(ScheduleRequest request) {
|
||||||
|
Schedule schedule = checkScheduleExit(request.getId());
|
||||||
|
schedule.setValue(request.getCron());
|
||||||
|
scheduleService.editSchedule(schedule);
|
||||||
|
try {
|
||||||
|
scheduleService.addOrUpdateCronJob(schedule, new JobKey(schedule.getKey(), schedule.getJob()),
|
||||||
|
new TriggerKey(schedule.getKey(), schedule.getJob()), Class.forName(schedule.getJob()));
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
LogUtils.error(e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.metersphere.system.controller;
|
package io.metersphere.system.controller;
|
||||||
|
|
||||||
|
import io.metersphere.sdk.constants.SessionConstants;
|
||||||
import io.metersphere.sdk.util.JSON;
|
import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.system.base.BaseTest;
|
import io.metersphere.system.base.BaseTest;
|
||||||
import io.metersphere.system.controller.handler.ResultHolder;
|
import io.metersphere.system.controller.handler.ResultHolder;
|
||||||
|
@ -7,6 +8,7 @@ import io.metersphere.system.domain.ExecTask;
|
||||||
import io.metersphere.system.domain.ExecTaskItem;
|
import io.metersphere.system.domain.ExecTaskItem;
|
||||||
import io.metersphere.system.dto.sdk.BasePageRequest;
|
import io.metersphere.system.dto.sdk.BasePageRequest;
|
||||||
import io.metersphere.system.dto.table.TableBatchProcessDTO;
|
import io.metersphere.system.dto.table.TableBatchProcessDTO;
|
||||||
|
import io.metersphere.system.dto.taskhub.request.ScheduleRequest;
|
||||||
import io.metersphere.system.dto.taskhub.request.TaskHubItemBatchRequest;
|
import io.metersphere.system.dto.taskhub.request.TaskHubItemBatchRequest;
|
||||||
import io.metersphere.system.dto.taskhub.request.TaskHubItemRequest;
|
import io.metersphere.system.dto.taskhub.request.TaskHubItemRequest;
|
||||||
import io.metersphere.system.mapper.TestResourcePoolMapper;
|
import io.metersphere.system.mapper.TestResourcePoolMapper;
|
||||||
|
@ -15,15 +17,20 @@ import jakarta.annotation.Resource;
|
||||||
import org.junit.jupiter.api.*;
|
import org.junit.jupiter.api.*;
|
||||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.test.context.jdbc.Sql;
|
import org.springframework.test.context.jdbc.Sql;
|
||||||
import org.springframework.test.context.jdbc.SqlConfig;
|
import org.springframework.test.context.jdbc.SqlConfig;
|
||||||
import org.springframework.test.web.servlet.MvcResult;
|
import org.springframework.test.web.servlet.MvcResult;
|
||||||
|
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||||
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
|
|
||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||||
|
@ -55,6 +62,7 @@ public class BaseTaskHubControllerTests extends BaseTest {
|
||||||
public static final String SYSTEM_SCHEDULE_TASK_SWITCH = "/system/task-center/schedule/switch/";
|
public static final String SYSTEM_SCHEDULE_TASK_SWITCH = "/system/task-center/schedule/switch/";
|
||||||
public static final String SYSTEM_SCHEDULE_TASK_BATCH_ENABLE = "/system/task-center/schedule/batch-enable";
|
public static final String SYSTEM_SCHEDULE_TASK_BATCH_ENABLE = "/system/task-center/schedule/batch-enable";
|
||||||
public static final String SYSTEM_SCHEDULE_TASK_BATCH_DISABLE = "/system/task-center/schedule/batch-disable";
|
public static final String SYSTEM_SCHEDULE_TASK_BATCH_DISABLE = "/system/task-center/schedule/batch-disable";
|
||||||
|
public static final String SYSTEM_SCHEDULE_TASK_UPDATE_CRON = "/system/task-center/schedule/update-cron";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(1)
|
@Order(1)
|
||||||
|
@ -162,13 +170,10 @@ public class BaseTaskHubControllerTests extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
@Order(4)
|
@Order(4)
|
||||||
public void systemTaskStop() throws Exception {
|
public void systemTaskStop() throws Exception {
|
||||||
|
mockPost("/api/task/item/stop", "");
|
||||||
this.requestGet(SYSTEM_TASK_STOP + "1");
|
this.requestGet(SYSTEM_TASK_STOP + "1");
|
||||||
MvcResult mvcResult = this.requestGetWithOkAndReturn(SYSTEM_TASK_STOP + "2");
|
mockPost("/api/task/stop", "");
|
||||||
// 获取返回值
|
this.requestGet(SYSTEM_TASK_STOP + "2");
|
||||||
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
|
||||||
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
|
||||||
// 返回请求正常
|
|
||||||
Assertions.assertNotNull(resultHolder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -177,13 +182,10 @@ public class BaseTaskHubControllerTests extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
@Order(4)
|
@Order(4)
|
||||||
public void systemTaskItemStop() throws Exception {
|
public void systemTaskItemStop() throws Exception {
|
||||||
|
mockPost("/api/task/item/stop", "");
|
||||||
this.requestGet(SYSTEM_TASK_ITEM_STOP + "1");
|
this.requestGet(SYSTEM_TASK_ITEM_STOP + "1");
|
||||||
MvcResult mvcResult = this.requestGetWithOkAndReturn(SYSTEM_TASK_ITEM_STOP + "2");
|
mockPost("/api/task/stop", "");
|
||||||
// 获取返回值
|
this.requestGet(SYSTEM_TASK_ITEM_STOP + "2");
|
||||||
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
|
||||||
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
|
||||||
// 返回请求正常
|
|
||||||
Assertions.assertNotNull(resultHolder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -231,6 +233,7 @@ public class BaseTaskHubControllerTests extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
@Order(5)
|
@Order(5)
|
||||||
public void systemTaskBatchStop() throws Exception {
|
public void systemTaskBatchStop() throws Exception {
|
||||||
|
mockPost("/api/task/item/stop", "");
|
||||||
TableBatchProcessDTO request = new TableBatchProcessDTO();
|
TableBatchProcessDTO request = new TableBatchProcessDTO();
|
||||||
request.setSelectAll(true);
|
request.setSelectAll(true);
|
||||||
this.requestPost(SYSTEM_TASK_BATCH_STOP, request);
|
this.requestPost(SYSTEM_TASK_BATCH_STOP, request);
|
||||||
|
@ -245,6 +248,7 @@ public class BaseTaskHubControllerTests extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
@Order(5)
|
@Order(5)
|
||||||
public void systemTaskItemBatchStop() throws Exception {
|
public void systemTaskItemBatchStop() throws Exception {
|
||||||
|
mockPost("/api/task/item/stop", "");
|
||||||
TableBatchProcessDTO request = new TableBatchProcessDTO();
|
TableBatchProcessDTO request = new TableBatchProcessDTO();
|
||||||
request.setSelectAll(true);
|
request.setSelectAll(true);
|
||||||
this.requestPost(SYSTEM_TASK_ITEM_BATCH_STOP, request);
|
this.requestPost(SYSTEM_TASK_ITEM_BATCH_STOP, request);
|
||||||
|
@ -291,6 +295,15 @@ public class BaseTaskHubControllerTests extends BaseTest {
|
||||||
this.requestPost(SYSTEM_SCHEDULE_TASK_BATCH_DISABLE, request);
|
this.requestPost(SYSTEM_SCHEDULE_TASK_BATCH_DISABLE, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(9)
|
||||||
|
public void systemScheduleUpdateCron() throws Exception {
|
||||||
|
ScheduleRequest request = new ScheduleRequest();
|
||||||
|
request.setCron("0 0 0 1 * ?");
|
||||||
|
request.setId("wx_1");
|
||||||
|
this.requestPost(SYSTEM_SCHEDULE_TASK_UPDATE_CRON, request);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组织任务中心测试用例
|
* 组织任务中心测试用例
|
||||||
*/
|
*/
|
||||||
|
@ -310,6 +323,7 @@ public class BaseTaskHubControllerTests extends BaseTest {
|
||||||
public static final String ORG_SCHEDULE_TASK_SWITCH = "/organization/task-center/schedule/switch/";
|
public static final String ORG_SCHEDULE_TASK_SWITCH = "/organization/task-center/schedule/switch/";
|
||||||
public static final String ORG_SCHEDULE_TASK_BATCH_ENABLE = "/organization/task-center/schedule/batch-enable";
|
public static final String ORG_SCHEDULE_TASK_BATCH_ENABLE = "/organization/task-center/schedule/batch-enable";
|
||||||
public static final String ORG_SCHEDULE_TASK_BATCH_DISABLE = "/organization/task-center/schedule/batch-disable";
|
public static final String ORG_SCHEDULE_TASK_BATCH_DISABLE = "/organization/task-center/schedule/batch-disable";
|
||||||
|
public static final String ORG_SCHEDULE_TASK_UPDATE_CRON = "/organization/task-center/schedule/update-cron";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(20)
|
@Order(20)
|
||||||
|
@ -523,6 +537,15 @@ public class BaseTaskHubControllerTests extends BaseTest {
|
||||||
this.requestPost(ORG_SCHEDULE_TASK_BATCH_DISABLE, request);
|
this.requestPost(ORG_SCHEDULE_TASK_BATCH_DISABLE, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(9)
|
||||||
|
public void orgScheduleUpdateCron() throws Exception {
|
||||||
|
ScheduleRequest request = new ScheduleRequest();
|
||||||
|
request.setCron("0 0 0 1 * ?");
|
||||||
|
request.setId("wx_1");
|
||||||
|
this.requestPost(ORG_SCHEDULE_TASK_UPDATE_CRON, request);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(21)
|
@Order(21)
|
||||||
|
|
Loading…
Reference in New Issue