feat(任务中心): 任务中心模块-定时任务-接口用例/场景实时任务列表
This commit is contained in:
parent
d4d4fd99b3
commit
785bfa10b0
|
@ -68,6 +68,8 @@ INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT
|
||||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'org_admin', 'ORGANIZATION_TEMPLATE:READ+UPDATE');
|
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'org_admin', 'ORGANIZATION_TEMPLATE:READ+UPDATE');
|
||||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'org_admin', 'ORGANIZATION_TEMPLATE:READ+DELETE');
|
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'org_admin', 'ORGANIZATION_TEMPLATE:READ+DELETE');
|
||||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'org_admin', 'ORGANIZATION_TEMPLATE:READ+ENABLE');
|
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'org_admin', 'ORGANIZATION_TEMPLATE:READ+ENABLE');
|
||||||
|
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'org_admin', 'ORGANIZATION_TASK_CENTER:READ');
|
||||||
|
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'org_admin', 'ORGANIZATION_TASK_CENTER:READ+SHOP');
|
||||||
|
|
||||||
-- 组织成员权限
|
-- 组织成员权限
|
||||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'org_member', 'ORGANIZATION_USER_ROLE:READ');
|
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'org_member', 'ORGANIZATION_USER_ROLE:READ');
|
||||||
|
|
|
@ -315,4 +315,13 @@ public class PermissionConstants {
|
||||||
public static final String TEST_PLAN_READ_EXECUTE = "PROJECT_TEST_PLAN:READ+EXECUTE";
|
public static final String TEST_PLAN_READ_EXECUTE = "PROJECT_TEST_PLAN:READ+EXECUTE";
|
||||||
public static final String TEST_PLAN_READ_ASSOCIATION = "PROJECT_TEST_PLAN:READ+ASSOCIATION";
|
public static final String TEST_PLAN_READ_ASSOCIATION = "PROJECT_TEST_PLAN:READ+ASSOCIATION";
|
||||||
/*------ end: TEST_PLAN ------*/
|
/*------ end: TEST_PLAN ------*/
|
||||||
|
|
||||||
|
/*------ start: SYSTEM_TASK_CENTER ------*/
|
||||||
|
public static final String SYSTEM_TASK_CENTER_READ = "SYSTEM_TASK_CENTER:READ";
|
||||||
|
/*------ end: SYSTEM_TASK_CENTER ------*/
|
||||||
|
|
||||||
|
/*------ start: ORGANIZATION_TASK_CENTER_READ ------*/
|
||||||
|
public static final String ORGANIZATION_TASK_CENTER_READ = "ORGANIZATION_TASK_CENTER:READ";
|
||||||
|
public static final String ORGANIZATION_TASK_CENTER_READ_STOP = "ORGANIZATION_TASK_CENTER::READ+STOP";
|
||||||
|
/*------ end: ORGANIZATION_TASK_CENTER_READ ------*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package io.metersphere.sdk.constants;
|
||||||
|
|
||||||
|
|
||||||
|
public enum TaskCenterResourceType {
|
||||||
|
API_CASE, API_SCENARIO, UI_TEST, LOAD_TEST, TEST_PLAN
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package io.metersphere.api.controller;
|
||||||
|
|
||||||
|
import io.metersphere.api.service.ApiTaskCenterService;
|
||||||
|
import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
|
import io.metersphere.system.dto.taskcenter.TaskCenterDTO;
|
||||||
|
import io.metersphere.system.dto.taskcenter.request.TaskCenterPageRequest;
|
||||||
|
import io.metersphere.system.security.CheckOwner;
|
||||||
|
import io.metersphere.system.utils.Pager;
|
||||||
|
import io.metersphere.system.utils.SessionUtils;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: LAN
|
||||||
|
* @date: 2024/1/17 19:19
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(value = "/task/center")
|
||||||
|
@Tag(name = "任务中心-实时任务-接口用例/场景")
|
||||||
|
public class ApiTaskCenterController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ApiTaskCenterService apiTaskCenterService;
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/api/project/real-time/page")
|
||||||
|
@Operation(summary = "项目-任务中心-接口用例/场景-实时任务列表")
|
||||||
|
@RequiresPermissions(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ)
|
||||||
|
@CheckOwner(resourceId = "", resourceType = "project")
|
||||||
|
public Pager<List<TaskCenterDTO>> projectList(@Validated @RequestBody TaskCenterPageRequest request) {
|
||||||
|
return apiTaskCenterService.getProjectPage(request, SessionUtils.getCurrentProjectId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/api/org/real-time/page")
|
||||||
|
@Operation(summary = "组织-任务中心-接口用例/场景-实时任务列表")
|
||||||
|
@RequiresPermissions(PermissionConstants.ORGANIZATION_TASK_CENTER_READ)
|
||||||
|
@CheckOwner(resourceId = "#request.getOrganizationId()", resourceType = "organization")
|
||||||
|
public Pager<List<TaskCenterDTO>> orgList(@Validated @RequestBody TaskCenterPageRequest request) {
|
||||||
|
return apiTaskCenterService.getOrganizationPage(request, SessionUtils.getCurrentOrganizationId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/api/system/real-time/page")
|
||||||
|
@Operation(summary = "系统-任务中心-接口用例/场景-实时任务列表")
|
||||||
|
@RequiresPermissions(PermissionConstants.SYSTEM_TASK_CENTER_READ)
|
||||||
|
public Pager<List<TaskCenterDTO>> systemList(@Validated @RequestBody TaskCenterPageRequest request) {
|
||||||
|
return apiTaskCenterService.getSystemPage(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -4,6 +4,8 @@ import io.metersphere.api.domain.ApiReport;
|
||||||
import io.metersphere.api.dto.definition.ApiReportBatchRequest;
|
import io.metersphere.api.dto.definition.ApiReportBatchRequest;
|
||||||
import io.metersphere.api.dto.definition.ApiReportPageRequest;
|
import io.metersphere.api.dto.definition.ApiReportPageRequest;
|
||||||
import io.metersphere.api.dto.definition.ApiReportStepDTO;
|
import io.metersphere.api.dto.definition.ApiReportStepDTO;
|
||||||
|
import io.metersphere.system.dto.taskcenter.TaskCenterDTO;
|
||||||
|
import io.metersphere.system.dto.taskcenter.request.TaskCenterPageRequest;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -23,4 +25,6 @@ public interface ExtApiReportMapper {
|
||||||
|
|
||||||
int selectApiReportByTime(@Param("time") long time, @Param("projectId") String projectId);
|
int selectApiReportByTime(@Param("time") long time, @Param("projectId") String projectId);
|
||||||
|
|
||||||
|
List<TaskCenterDTO> taskCenterlist(@Param("request") TaskCenterPageRequest request,@Param("projectIds") List<String> projectIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,4 +122,59 @@
|
||||||
</if>
|
</if>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
<select id="taskCenterlist" resultType="io.metersphere.system.dto.taskcenter.TaskCenterDTO">
|
||||||
|
SELECT
|
||||||
|
api_report.id,
|
||||||
|
api_report.project_id,
|
||||||
|
api_report.integrated,
|
||||||
|
api_report.STATUS,
|
||||||
|
api_report.start_time AS operationTime,
|
||||||
|
api_report.create_user AS operationName,
|
||||||
|
api_report.trigger_mode,
|
||||||
|
|
||||||
|
CASE
|
||||||
|
WHEN api_report.integrated = 0 THEN
|
||||||
|
c.num ELSE api_report.id
|
||||||
|
END AS resourceId,
|
||||||
|
|
||||||
|
CASE
|
||||||
|
WHEN api_report.integrated = 0 THEN
|
||||||
|
c.NAME ELSE api_report.NAME
|
||||||
|
END AS resourceName,
|
||||||
|
|
||||||
|
t.NAME AS poolName
|
||||||
|
FROM
|
||||||
|
api_report
|
||||||
|
LEFT JOIN api_test_case c ON api_report.resource_id = c.id
|
||||||
|
LEFT JOIN test_resource_pool t ON api_report.pool_id = t.id
|
||||||
|
where api_report.project_id IN
|
||||||
|
<foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
|
||||||
|
#{projectId}
|
||||||
|
</foreach>
|
||||||
|
<if test="request.keyword != null and request.keyword != ''">
|
||||||
|
and (
|
||||||
|
api_report.name like concat('%', #{request.keyword},'%')
|
||||||
|
or c.name like concat('%', #{request.keyword},'%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<include refid="taskCenterFilters">
|
||||||
|
<property name="filter" value="request.filter"/>
|
||||||
|
</include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<sql id="taskCenterFilters">
|
||||||
|
<if test="${filter} != null and ${filter}.size() > 0">
|
||||||
|
<foreach collection="${filter}.entrySet()" index="key" item="values">
|
||||||
|
<if test="values != null and values.size() > 0">
|
||||||
|
<choose>
|
||||||
|
<when test="key=='triggerMode'">
|
||||||
|
and api_report.trigger_mode in
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</sql>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -4,6 +4,8 @@ import io.metersphere.api.domain.ApiScenario;
|
||||||
import io.metersphere.api.dto.scenario.ApiScenarioBatchEditRequest;
|
import io.metersphere.api.dto.scenario.ApiScenarioBatchEditRequest;
|
||||||
import io.metersphere.api.dto.scenario.ApiScenarioDTO;
|
import io.metersphere.api.dto.scenario.ApiScenarioDTO;
|
||||||
import io.metersphere.api.dto.scenario.ApiScenarioPageRequest;
|
import io.metersphere.api.dto.scenario.ApiScenarioPageRequest;
|
||||||
|
import io.metersphere.system.dto.taskcenter.TaskCenterDTO;
|
||||||
|
import io.metersphere.system.dto.taskcenter.request.TaskCenterPageRequest;
|
||||||
import io.metersphere.dto.TestCaseProviderDTO;
|
import io.metersphere.dto.TestCaseProviderDTO;
|
||||||
import io.metersphere.project.dto.ModuleCountDTO;
|
import io.metersphere.project.dto.ModuleCountDTO;
|
||||||
import io.metersphere.request.AssociateOtherCaseRequest;
|
import io.metersphere.request.AssociateOtherCaseRequest;
|
||||||
|
@ -31,4 +33,6 @@ public interface ExtApiScenarioMapper {
|
||||||
List<ApiScenario> getTestCaseByProvider(@Param("request") AssociateOtherCaseRequest request, @Param("deleted") boolean deleted);
|
List<ApiScenario> getTestCaseByProvider(@Param("request") AssociateOtherCaseRequest request, @Param("deleted") boolean deleted);
|
||||||
|
|
||||||
Long getLastPos(@Param("projectId") String projectId);
|
Long getLastPos(@Param("projectId") String projectId);
|
||||||
|
|
||||||
|
List<TaskCenterDTO> taskCenterlist(@Param("request") TaskCenterPageRequest request, @Param("projectIds") List<String> projectIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -370,4 +370,57 @@
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="taskCenterlist" resultType="io.metersphere.system.dto.taskcenter.TaskCenterDTO">
|
||||||
|
select
|
||||||
|
api_scenario_report.id,
|
||||||
|
api_scenario_report.project_id,
|
||||||
|
api_scenario_report.integrated,
|
||||||
|
api_scenario_report.status,
|
||||||
|
api_scenario_report.start_time as operationTime,
|
||||||
|
api_scenario_report.create_user as operationName,
|
||||||
|
api_scenario_report.trigger_mode,
|
||||||
|
|
||||||
|
CASE
|
||||||
|
WHEN api_scenario_report.integrated = 0 THEN
|
||||||
|
s.num ELSE api_scenario_report.id
|
||||||
|
END AS resourceId,
|
||||||
|
|
||||||
|
CASE
|
||||||
|
WHEN api_scenario_report.integrated = 0 THEN
|
||||||
|
s.NAME ELSE api_scenario_report.NAME
|
||||||
|
END AS resourceName,
|
||||||
|
|
||||||
|
t.name as poolName
|
||||||
|
from api_scenario_report
|
||||||
|
left JOIN api_scenario s on api_scenario_report.scenario_id = s.id
|
||||||
|
left JOIN test_resource_pool t on api_scenario_report.pool_id = t.id
|
||||||
|
where api_scenario_report.project_id IN
|
||||||
|
<foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
|
||||||
|
#{projectId}
|
||||||
|
</foreach>
|
||||||
|
<if test="request.keyword != null and request.keyword != ''">
|
||||||
|
and (
|
||||||
|
api_scenario_report.name like concat('%', #{request.keyword},'%')
|
||||||
|
or s.name like concat('%', #{request.keyword},'%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<include refid="taskCenterFilters">
|
||||||
|
<property name="filter" value="request.filter"/>
|
||||||
|
</include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<sql id="taskCenterFilters">
|
||||||
|
<if test="${filter} != null and ${filter}.size() > 0">
|
||||||
|
<foreach collection="${filter}.entrySet()" index="key" item="values">
|
||||||
|
<if test="values != null and values.size() > 0">
|
||||||
|
<choose>
|
||||||
|
<when test="key=='triggerMode'">
|
||||||
|
and api_scenario_report.trigger_mode in
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</sql>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -0,0 +1,180 @@
|
||||||
|
package io.metersphere.api.service;
|
||||||
|
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
|
import com.github.pagehelper.page.PageMethod;
|
||||||
|
import io.metersphere.api.mapper.ExtApiReportMapper;
|
||||||
|
import io.metersphere.api.mapper.ExtApiScenarioMapper;
|
||||||
|
import io.metersphere.project.domain.Project;
|
||||||
|
import io.metersphere.project.mapper.ProjectMapper;
|
||||||
|
import io.metersphere.sdk.constants.TaskCenterResourceType;
|
||||||
|
import io.metersphere.sdk.exception.MSException;
|
||||||
|
import io.metersphere.sdk.util.Translator;
|
||||||
|
import io.metersphere.system.domain.Organization;
|
||||||
|
import io.metersphere.system.dto.sdk.OptionDTO;
|
||||||
|
import io.metersphere.system.dto.taskcenter.TaskCenterDTO;
|
||||||
|
import io.metersphere.system.dto.taskcenter.request.TaskCenterPageRequest;
|
||||||
|
import io.metersphere.system.mapper.BaseProjectMapper;
|
||||||
|
import io.metersphere.system.mapper.ExtOrganizationMapper;
|
||||||
|
import io.metersphere.system.mapper.OrganizationMapper;
|
||||||
|
import io.metersphere.system.service.UserLoginService;
|
||||||
|
import io.metersphere.system.utils.PageUtils;
|
||||||
|
import io.metersphere.system.utils.Pager;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: LAN
|
||||||
|
* @date: 2024/1/17 11:24
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public class ApiTaskCenterService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
ExtApiReportMapper extApiReportMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
ExtApiScenarioMapper extApiScenarioMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
ExtOrganizationMapper extOrganizationMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
BaseProjectMapper baseProjectMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
UserLoginService userLoginService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
ProjectMapper projectMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
OrganizationMapper organizationMapper;
|
||||||
|
|
||||||
|
private static final String DEFAULT_SORT = "start_time desc";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务中心实时任务列表-项目级
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Pager<List<TaskCenterDTO>> getProjectPage(TaskCenterPageRequest request, String projectId) {
|
||||||
|
checkProjectExist(projectId);
|
||||||
|
List<OptionDTO> projectList = getProjectOption(projectId);
|
||||||
|
return createTaskCenterPager(request, projectList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务中心实时任务列表-组织级
|
||||||
|
* @param request
|
||||||
|
* @returnxx
|
||||||
|
*/
|
||||||
|
public Pager<List<TaskCenterDTO>> getOrganizationPage(TaskCenterPageRequest request, String organizationId) {
|
||||||
|
checkOrganizationExist(organizationId);
|
||||||
|
List<OptionDTO> projectList = getOrgProjectList(organizationId);
|
||||||
|
return createTaskCenterPager(request, projectList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务中心实时任务列表-系统级
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Pager<List<TaskCenterDTO>> getSystemPage(TaskCenterPageRequest request) {
|
||||||
|
List<OptionDTO> projectList = getSystemProjectList();
|
||||||
|
return createTaskCenterPager(request, projectList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Pager<List<TaskCenterDTO>> createTaskCenterPager(TaskCenterPageRequest request, List<OptionDTO> projectList) {
|
||||||
|
Page<Object> page = PageMethod.startPage(request.getCurrent(), request.getPageSize(),
|
||||||
|
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : DEFAULT_SORT);
|
||||||
|
return PageUtils.setPageInfo(page, getPage(request, projectList));
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TaskCenterDTO> getPage(TaskCenterPageRequest request, List<OptionDTO> projectList) {
|
||||||
|
List<TaskCenterDTO> list = new ArrayList<>();
|
||||||
|
List<String> projectIds = projectList.stream().map(OptionDTO::getId).toList();
|
||||||
|
if (request != null && !projectIds.isEmpty()) {
|
||||||
|
if (request.getModuleType().equals(TaskCenterResourceType.API_CASE.toString())) {
|
||||||
|
list = extApiReportMapper.taskCenterlist(request, projectIds);
|
||||||
|
} else if (request.getModuleType().equals(TaskCenterResourceType.API_SCENARIO.toString())){
|
||||||
|
list = extApiScenarioMapper.taskCenterlist(request, projectIds);
|
||||||
|
}
|
||||||
|
processTaskCenter(list, projectList, projectIds);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processTaskCenter(List<TaskCenterDTO> list, List<OptionDTO> projectList, List<String> projectIds) {
|
||||||
|
if (!list.isEmpty()) {
|
||||||
|
// 取所有的userid
|
||||||
|
Set<String> userSet = list.stream()
|
||||||
|
.flatMap(item -> Stream.of(item.getOperationName()))
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
Map<String, String> userMap = userLoginService.getUserNameMap(new ArrayList<>(userSet));
|
||||||
|
// 项目
|
||||||
|
Map<String, String> projectMap = projectList.stream().collect(Collectors.toMap(OptionDTO::getId, OptionDTO::getName));
|
||||||
|
// 组织
|
||||||
|
List<OptionDTO> orgListByProjectList = getOrgListByProjectIds(projectIds);
|
||||||
|
Map<String, String> orgMap = orgListByProjectList.stream().collect(Collectors.toMap(OptionDTO::getId, OptionDTO::getName));
|
||||||
|
|
||||||
|
list.forEach(item -> {
|
||||||
|
item.setOperationName(userMap.getOrDefault(item.getOperationName(), StringUtils.EMPTY));
|
||||||
|
item.setProjectName(projectMap.getOrDefault(item.getProjectId(), StringUtils.EMPTY));
|
||||||
|
item.setOrganizationName(orgMap.getOrDefault(item.getProjectId(), StringUtils.EMPTY));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<OptionDTO> getProjectOption(String id){
|
||||||
|
return baseProjectMapper.getProjectOptionsById(id);
|
||||||
|
}
|
||||||
|
private List<OptionDTO> getOrgProjectList(String orgId){
|
||||||
|
return baseProjectMapper.getProjectOptionsByOrgId(orgId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<OptionDTO> getSystemProjectList(){
|
||||||
|
return baseProjectMapper.getProjectOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<OptionDTO> getOrgListByProjectIds(List<String> projectIds){
|
||||||
|
return extOrganizationMapper.getOrgListByProjectIds(projectIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看项目是否存在
|
||||||
|
*
|
||||||
|
* @param projectId 项目ID
|
||||||
|
*/
|
||||||
|
private Project checkProjectExist(String projectId) {
|
||||||
|
Project project = projectMapper.selectByPrimaryKey(projectId);
|
||||||
|
if (project == null) {
|
||||||
|
throw new MSException(Translator.get("project_not_exist"));
|
||||||
|
}
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看组织是否存在
|
||||||
|
*
|
||||||
|
* @param orgId 组织ID
|
||||||
|
*/
|
||||||
|
private Organization checkOrganizationExist(String orgId) {
|
||||||
|
Organization organization = organizationMapper.selectByPrimaryKey(orgId);
|
||||||
|
if (organization == null) {
|
||||||
|
throw new MSException(Translator.get("organization_not_exist"));
|
||||||
|
}
|
||||||
|
return organization;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,139 @@
|
||||||
|
package io.metersphere.api.controller;
|
||||||
|
|
||||||
|
import io.metersphere.sdk.constants.SessionConstants;
|
||||||
|
import io.metersphere.sdk.constants.TaskCenterResourceType;
|
||||||
|
import io.metersphere.sdk.util.JSON;
|
||||||
|
import io.metersphere.sdk.util.LogUtils;
|
||||||
|
import io.metersphere.system.base.BaseTest;
|
||||||
|
import io.metersphere.system.controller.handler.ResultHolder;
|
||||||
|
import io.metersphere.system.dto.taskcenter.request.TaskCenterPageRequest;
|
||||||
|
import io.metersphere.system.utils.Pager;
|
||||||
|
import org.junit.jupiter.api.*;
|
||||||
|
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||||
|
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.SqlConfig;
|
||||||
|
import org.springframework.test.web.servlet.MvcResult;
|
||||||
|
import org.springframework.test.web.servlet.ResultMatcher;
|
||||||
|
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
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)
|
||||||
|
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||||
|
@AutoConfigureMockMvc
|
||||||
|
public class ApiTaskCenterControllerTests extends BaseTest {
|
||||||
|
|
||||||
|
private static final String BASE_PATH = "/task/center/api/";
|
||||||
|
private final static String REAL_TIME_PROJECT_PAGE = BASE_PATH + "project/real-time/page";
|
||||||
|
private final static String REAL_TIME_ORG_PAGE = BASE_PATH + "org/real-time/page";
|
||||||
|
private final static String REAL_TIME_SYSTEM_PAGE = BASE_PATH + "system/real-time/page";
|
||||||
|
|
||||||
|
private static final ResultMatcher ERROR_REQUEST_MATCHER = status().is5xxServerError();
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(9)
|
||||||
|
@Sql(scripts = {"/dml/init_api_definition.sql"}, config = @SqlConfig(encoding = "utf-8", transactionMode = SqlConfig.TransactionMode.ISOLATED))
|
||||||
|
public void getPage() throws Exception {
|
||||||
|
|
||||||
|
doTaskCenterPage("KEYWORD", REAL_TIME_PROJECT_PAGE, TaskCenterResourceType.API_CASE.toString());
|
||||||
|
doTaskCenterPage("FILTER", REAL_TIME_PROJECT_PAGE, TaskCenterResourceType.API_CASE.toString());
|
||||||
|
doTaskCenterPage("KEYWORD", REAL_TIME_ORG_PAGE, TaskCenterResourceType.API_CASE.toString());
|
||||||
|
doTaskCenterPage("FILTER", REAL_TIME_ORG_PAGE, TaskCenterResourceType.API_CASE.toString());
|
||||||
|
doTaskCenterPage("KEYWORD", REAL_TIME_SYSTEM_PAGE, TaskCenterResourceType.API_CASE.toString());
|
||||||
|
doTaskCenterPage("FILTER", REAL_TIME_SYSTEM_PAGE, TaskCenterResourceType.API_CASE.toString());
|
||||||
|
|
||||||
|
doTaskCenterPage("KEYWORD", REAL_TIME_PROJECT_PAGE, TaskCenterResourceType.API_SCENARIO.toString());
|
||||||
|
doTaskCenterPage("FILTER", REAL_TIME_PROJECT_PAGE, TaskCenterResourceType.API_SCENARIO.toString());
|
||||||
|
doTaskCenterPage("KEYWORD", REAL_TIME_ORG_PAGE, TaskCenterResourceType.API_SCENARIO.toString());
|
||||||
|
doTaskCenterPage("FILTER", REAL_TIME_ORG_PAGE, TaskCenterResourceType.API_SCENARIO.toString());
|
||||||
|
doTaskCenterPage("KEYWORD", REAL_TIME_SYSTEM_PAGE, TaskCenterResourceType.API_SCENARIO.toString());
|
||||||
|
doTaskCenterPage("FILTER", REAL_TIME_SYSTEM_PAGE, TaskCenterResourceType.API_SCENARIO.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doTaskCenterPage(String search, String url, String moduleType) throws Exception {
|
||||||
|
TaskCenterPageRequest request = new TaskCenterPageRequest();
|
||||||
|
request.setModuleType(moduleType);
|
||||||
|
request.setCurrent(1);
|
||||||
|
request.setPageSize(10);
|
||||||
|
request.setSort(Map.of("startTime", "asc"));
|
||||||
|
// "KEYWORD", "FILTER"
|
||||||
|
switch (search) {
|
||||||
|
case "KEYWORD" -> configureKeywordSearch(request);
|
||||||
|
case "FILTER" -> configureFilterSearch(request);
|
||||||
|
default -> {}
|
||||||
|
}
|
||||||
|
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post(url)
|
||||||
|
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
||||||
|
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
||||||
|
.header(SessionConstants.CURRENT_PROJECT, DEFAULT_PROJECT_ID)
|
||||||
|
.header(SessionConstants.CURRENT_ORGANIZATION, DEFAULT_ORGANIZATION_ID)
|
||||||
|
.content(JSON.toJSONString(request))
|
||||||
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
|
.andExpect(status().isOk())
|
||||||
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn();
|
||||||
|
|
||||||
|
// 获取返回值
|
||||||
|
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
||||||
|
LogUtils.info(resultHolder);
|
||||||
|
// 返回请求正常
|
||||||
|
Assertions.assertNotNull(resultHolder);
|
||||||
|
Pager<?> pageData = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), Pager.class);
|
||||||
|
// 返回值不为空
|
||||||
|
Assertions.assertNotNull(pageData);
|
||||||
|
// 返回值的页码和当前页码相同
|
||||||
|
Assertions.assertEquals(pageData.getCurrent(), request.getCurrent());
|
||||||
|
// 返回的数据量不超过规定要返回的数据量相同
|
||||||
|
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= request.getPageSize());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doTaskCenterPageError(String url, String moduleType) throws Exception {
|
||||||
|
TaskCenterPageRequest request = new TaskCenterPageRequest();
|
||||||
|
request.setModuleType(moduleType);
|
||||||
|
request.setCurrent(1);
|
||||||
|
request.setPageSize(10);
|
||||||
|
request.setSort(Map.of("startTime", "asc"));
|
||||||
|
configureKeywordSearch(request);
|
||||||
|
|
||||||
|
mockMvc.perform(MockMvcRequestBuilders.post(url)
|
||||||
|
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
||||||
|
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
||||||
|
.header(SessionConstants.CURRENT_PROJECT, "DEFAULT_PROJECT_ID")
|
||||||
|
.header(SessionConstants.CURRENT_ORGANIZATION, "DEFAULT_ORGANIZATION_ID")
|
||||||
|
.content(JSON.toJSONString(request))
|
||||||
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
|
.andExpect(ERROR_REQUEST_MATCHER);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void configureKeywordSearch(TaskCenterPageRequest request) {
|
||||||
|
request.setKeyword("18");
|
||||||
|
request.setSort(Map.of("triggerMode", "asc"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void configureFilterSearch(TaskCenterPageRequest request) {
|
||||||
|
Map<String, List<String>> filters = new HashMap<>();
|
||||||
|
request.setSort(Map.of());
|
||||||
|
filters.put("triggerMode", List.of("MANUAL"));
|
||||||
|
request.setFilter(filters);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(10)
|
||||||
|
public void getPageError() throws Exception {
|
||||||
|
doTaskCenterPageError(REAL_TIME_PROJECT_PAGE, TaskCenterResourceType.API_CASE.toString());
|
||||||
|
doTaskCenterPageError(REAL_TIME_ORG_PAGE, TaskCenterResourceType.API_CASE.toString());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -65,3 +65,64 @@ INSERT INTO `api_definition_mock_config` VALUES
|
||||||
('mock_4', '{"type": "exact", "value": "another_exact_value"}', '{"status": 200, "body": {"data": "Another Mock Response"}}'),
|
('mock_4', '{"type": "exact", "value": "another_exact_value"}', '{"status": 200, "body": {"data": "Another Mock Response"}}'),
|
||||||
('mock_5', '{"type": "jsonpath", "value": "$.items[0].name"}', '{"status": 200, "body": {"items": [{"name": "Item 1"}]}}');
|
('mock_5', '{"type": "jsonpath", "value": "$.items[0].name"}', '{"status": 200, "body": {"items": [{"name": "Item 1"}]}}');
|
||||||
|
|
||||||
|
|
||||||
|
DELETE FROM `api_report` WHERE `id` in ('1', '2', '3', '4','5','6', '7', '8', '9','10','11', '12', '13', '14','15','16', '17', '18', '19','20');
|
||||||
|
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('1', 'Test Report 1', '12df5721-c5e6-a38b-e999-3eafcb992094', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1642000001, 1642001000, 1642002000, 1000, 'SUCCESS', 'MANUAL', 'SEQUENTIAL', '100660357777795313', 'version_1', b'0', '100001100001', 'env_1', 0, 0, 0, 100, 150, 150, '50%', '10%', '5%', '80%', '90%', 'script_1');
|
||||||
|
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('10', 'Test Report 10', '12df5721-c5e6-a38b-e999-3eafcb992100', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1642400101, 1642401100, 1642402100, 1000, 'ERROR', 'AUTOMATED', 'PARALLEL', '100660357777795313', 'version_5', b'0', '100001100001', 'env_5', 10, 5, 10, 85, 150, 145, '50%', '10%', '5%', '80%', '90%', 'script_10');
|
||||||
|
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('11', 'Test Report 11', '12df5721-c5e6-a38b-e999-3eafcb992233', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1642500001, 1642501000, 1642502000, 1000, 'SUCCESS', 'MANUAL', 'SEQUENTIAL', '100660357777795313', 'version_6', b'0', '100001100001', 'env_6', 0, 0, 0, 100, 150, 150, '50%', '10%', '5%', '80%', '90%', 'script_11');
|
||||||
|
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('12', 'Test Report 12', '3ee2ae9c-a680-4ed6-b115-1f6ab8980100', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1642500101, 1642501100, 1642502100, 1000, 'ERROR', 'AUTOMATED', 'PARALLEL', '100660357777795313', 'version_6', b'0', '100001100001', 'env_6', 10, 5, 10, 85, 150, 145, '50%', '10%', '5%', '80%', '90%', 'script_12');
|
||||||
|
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('13', 'Test Report 13', '3ee2ae9c-a680-4ed6-b115-1f6ab8980104', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1642600001, 1642601000, 1642602000, 1000, 'SUCCESS', 'MANUAL', 'SEQUENTIAL', '100660357777795313', 'version_7', b'0', '100001100001', 'env_7', 0, 0, 0, 100, 150, 150, '50%', '10%', '5%', '80%', '90%', 'script_13');
|
||||||
|
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('14', 'Test Report 14', '3ee2ae9c-a680-4ed6-b115-1f6ab8980545', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1642600101, 1642601100, 1642602100, 1000, 'ERROR', 'AUTOMATED', 'PARALLEL', '100660357777795313', 'version_7', b'0', '100001100001', 'env_7', 10, 5, 10, 85, 150, 145, '50%', '10%', '5%', '80%', '90%', 'script_14');
|
||||||
|
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('15', 'Test Report 15', '3ee2ae9c-a680-4ed6-b115-1f6ab8980553', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1642700001, 1642701000, 1642702000, 1000, 'SUCCESS', 'MANUAL', 'SEQUENTIAL', '100660357777795313', 'version_8', b'0', '100001100001', 'env_8', 0, 0, 0, 100, 150, 150, '50%', '10%', '5%', '80%', '90%', 'script_15');
|
||||||
|
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('16', 'Test Report 16', '3ee2ae9c-a680-4ed6-b115-1f6ab8980589', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1642700101, 1642701100, 1642702100, 1000, 'ERROR', 'AUTOMATED', 'PARALLEL', '100660357777795313', 'version_8', b'0', '100001100001', 'env_8', 10, 5, 10, 85, 150, 145, '50%', '10%', '5%', '80%', '90%', 'script_16');
|
||||||
|
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('17', 'Test Report 17', '3ee2ae9c-a680-4ed6-b115-1f6ab8980973', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1642800001, 1642801000, 1642802000, 1000, 'SUCCESS', 'MANUAL', 'SEQUENTIAL', '100660357777795313', 'version_9', b'0', '100001100001', 'env_9', 0, 0, 0, 100, 150, 150, '50%', '10%', '5%', '80%', '90%', 'script_17');
|
||||||
|
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('18', 'Test Report 18', '12df5721-c5e6-a38b-e999-3eafcb992094', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1642800101, 1642801100, 1642802100, 1000, 'ERROR', 'AUTOMATED', 'PARALLEL', '100660357777795313', 'version_9', b'0', '100001100001', 'env_9', 10, 5, 10, 85, 150, 145, '50%', '10%', '5%', '80%', '90%', 'script_18');
|
||||||
|
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('19', 'Test Report 19', '12df5721-c5e6-a38b-e999-3eafcb992100', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1642900001, 1642901000, 1642902000, 1000, 'SUCCESS', 'MANUAL', 'SEQUENTIAL', '100660357777795313', 'version_10', b'0', '100001100001', 'env_10', 0, 0, 0, 100, 150, 150, '50%', '10%', '5%', '80%', '90%', 'script_19');
|
||||||
|
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('2', 'Test Report 2', '12df5721-c5e6-a38b-e999-3eafcb992233', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1642000101, 1642001100, 1642002100, 1000, 'ERROR', 'AUTOMATED', 'PARALLEL', '100660357777795313', 'version_1', b'0', '100001100001', 'env_1', 10, 5, 10, 85, 150, 145, '50%', '10%', '5%', '80%', '90%', 'script_2');
|
||||||
|
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('20', 'Test Report 20', '3ee2ae9c-a680-4ed6-b115-1f6ab8980100', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1642900101, 1642901100, 1642902100, 1000, 'ERROR', 'AUTOMATED', 'PARALLEL', '100660357777795313', 'version_10', b'0', '100001100001', 'env_10', 10, 5, 10, 85, 150, 145, '50%', '10%', '5%', '80%', '90%', 'script_20');
|
||||||
|
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('3', 'Test Report 3', '3ee2ae9c-a680-4ed6-b115-1f6ab8980104', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1642100001, 1642101000, 1642102000, 1000, 'SUCCESS', 'MANUAL', 'SEQUENTIAL', '100660357777795313', 'version_2', b'0', '100001100001', 'env_2', 0, 0, 0, 100, 150, 150, '50%', '10%', '5%', '80%', '90%', 'script_3');
|
||||||
|
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('4', 'Test Report 4', 'resource_4', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1642100101, 1642101100, 1642102100, 1000, 'ERROR', 'AUTOMATED', 'PARALLEL', '100660357777795313', 'version_2', b'1', '100001100001', 'env_2', 10, 5, 10, 85, 150, 145, '50%', '10%', '5%', '80%', '90%', 'script_4');
|
||||||
|
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('5', 'Test Report 5', 'resource_5', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1642200001, 1642201000, 1642202000, 1000, 'SUCCESS', 'MANUAL', 'SEQUENTIAL', '100660357777795313', 'version_3', b'1', '100001100001', 'env_3', 0, 0, 0, 100, 150, 150, '50%', '10%', '5%', '80%', '90%', 'script_5');
|
||||||
|
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('6', 'Test Report 6', 'resource_6', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1642200101, 1642201100, 1642202100, 1000, 'ERROR', 'AUTOMATED', 'PARALLEL', '100660357777795313', 'version_3', b'1', '100001100001', 'env_3', 10, 5, 10, 85, 150, 145, '50%', '10%', '5%', '80%', '90%', 'script_6');
|
||||||
|
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('7', 'Test Report 7', 'resource_7', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1642300001, 1642301000, 1642302000, 1000, 'SUCCESS', 'MANUAL', 'SEQUENTIAL', '100660357777795313', 'version_4', b'1', '100001100001', 'env_4', 0, 0, 0, 100, 150, 150, '50%', '10%', '5%', '80%', '90%', 'script_7');
|
||||||
|
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('8', 'Test Report 8', 'resource_8', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1642300101, 1642301100, 1642302100, 1000, 'ERROR', 'AUTOMATED', 'PARALLEL', '100660357777795313', 'version_4', b'1', '100001100001', 'env_4', 10, 5, 10, 85, 150, 145, '50%', '10%', '5%', '80%', '90%', 'script_8');
|
||||||
|
INSERT INTO `api_report` (`id`, `name`, `resource_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('9', 'Test Report 9', 'resource_9', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1642400001, 1642401000, 1642402000, 1000, 'SUCCESS', 'MANUAL', 'SEQUENTIAL', '100660357777795313', 'version_5', b'1', '100001100001', 'env_5', 0, 0, 0, 100, 150, 150, '50%', '10%', '5%', '80%', '90%', 'script_9');
|
||||||
|
|
||||||
|
DELETE FROM `test_resource_pool` WHERE `id` in ('100660357777795313');
|
||||||
|
INSERT INTO `test_resource_pool` (`id`, `name`, `type`, `description`, `enable`, `create_time`, `update_time`, `create_user`, `api_test`, `load_test`, `ui_test`, `server_url`, `all_org`, `deleted`) VALUES ('100660357777795313', 'LOCAL', 'Node', '测试资源池', b'1', 1705894549000, 1705894549000, 'admin', b'1', b'1', b'1', NULL, b'1', b'0');
|
||||||
|
|
||||||
|
DELETE FROM `api_scenario` WHERE `id` in ('1', '2', '3', '4','5','6', '7', '8', '9');
|
||||||
|
INSERT INTO `api_scenario` (`id`, `name`, `priority`, `status`, `step_total`, `request_pass_rate`, `last_report_status`, `last_report_id`, `num`, `deleted`, `pos`, `version_id`, `ref_id`, `latest`, `project_id`, `module_id`, `description`, `tags`, `grouped`, `environment_id`, `create_user`, `create_time`, `delete_time`, `delete_user`, `update_user`, `update_time`) VALUES ('1', 'Scenario 1', 'P0', 'Completed', 10, '95%', 'Passed', 'report_1', 1001, b'0', 1, 'version_1', 'ref_1', b'1', '100001100001', 'module_1', 'Description 1', '[\"tag1\",\"tag2\"]', b'0', 'env_1', 'admin', 1640772861000, NULL, NULL, 'admin', 1640772861000);
|
||||||
|
INSERT INTO `api_scenario` (`id`, `name`, `priority`, `status`, `step_total`, `request_pass_rate`, `last_report_status`, `last_report_id`, `num`, `deleted`, `pos`, `version_id`, `ref_id`, `latest`, `project_id`, `module_id`, `description`, `tags`, `grouped`, `environment_id`, `create_user`, `create_time`, `delete_time`, `delete_user`, `update_user`, `update_time`) VALUES ('2', 'Scenario 2', 'P1', 'In Progress', 15, '80%', 'Running', 'report_2', 1002, b'0', 2, 'version_2', 'ref_2', b'0', '100001100001', 'module_2', 'Description 2', '[\"tag2\",\"tag3\"]', b'0', NULL, 'admin', 1640772862000, NULL, NULL, 'admin', 1640772862000);
|
||||||
|
INSERT INTO `api_scenario` (`id`, `name`, `priority`, `status`, `step_total`, `request_pass_rate`, `last_report_status`, `last_report_id`, `num`, `deleted`, `pos`, `version_id`, `ref_id`, `latest`, `project_id`, `module_id`, `description`, `tags`, `grouped`, `environment_id`, `create_user`, `create_time`, `delete_time`, `delete_user`, `update_user`, `update_time`) VALUES ('3', 'Scenario 3', 'P2', 'Not Planned', 8, 'Calculating', NULL, NULL, 1003, b'0', 3, 'version_3', 'ref_3', b'1', '100001100001', 'module_3', 'Description 3', '[\"tag1\",\"tag3\"]', b'1', 'env_2', 'admin', 1640772863000, NULL, NULL, 'admin', 1640772863000);
|
||||||
|
INSERT INTO `api_scenario` (`id`, `name`, `priority`, `status`, `step_total`, `request_pass_rate`, `last_report_status`, `last_report_id`, `num`, `deleted`, `pos`, `version_id`, `ref_id`, `latest`, `project_id`, `module_id`, `description`, `tags`, `grouped`, `environment_id`, `create_user`, `create_time`, `delete_time`, `delete_user`, `update_user`, `update_time`) VALUES ('4', 'Scenario 4', 'P1', 'Completed', 12, '90%', 'Passed', 'report_4', 1004, b'0', 4, 'version_4', 'ref_4', b'0', '100001100001', 'module_4', 'Description 4', '[\"tag1\",\"tag2\"]', b'0', NULL, 'admin', 1640772864000, NULL, NULL, 'admin', 1640772864000);
|
||||||
|
INSERT INTO `api_scenario` (`id`, `name`, `priority`, `status`, `step_total`, `request_pass_rate`, `last_report_status`, `last_report_id`, `num`, `deleted`, `pos`, `version_id`, `ref_id`, `latest`, `project_id`, `module_id`, `description`, `tags`, `grouped`, `environment_id`, `create_user`, `create_time`, `delete_time`, `delete_user`, `update_user`, `update_time`) VALUES ('5', 'Scenario 5', 'P0', 'In Progress', 18, '75%', 'Running', 'report_5', 1005, b'0', 5, 'version_5', 'ref_5', b'1', '100001100001', 'module_5', 'Description 5', '[\"tag2\",\"tag3\"]', b'1', 'env_3', 'admin', 1640772865000, NULL, NULL, 'admin', 1640772865000);
|
||||||
|
INSERT INTO `api_scenario` (`id`, `name`, `priority`, `status`, `step_total`, `request_pass_rate`, `last_report_status`, `last_report_id`, `num`, `deleted`, `pos`, `version_id`, `ref_id`, `latest`, `project_id`, `module_id`, `description`, `tags`, `grouped`, `environment_id`, `create_user`, `create_time`, `delete_time`, `delete_user`, `update_user`, `update_time`) VALUES ('6', 'Scenario 6', 'P2', 'Not Planned', 10, 'Calculating', NULL, NULL, 1006, b'0', 6, 'version_6', 'ref_6', b'0', '100001100001', 'module_6', 'Description 6', '[\"tag1\",\"tag3\"]', b'0', NULL, 'admin', 1640772866000, NULL, NULL, 'admin', 1640772866000);
|
||||||
|
INSERT INTO `api_scenario` (`id`, `name`, `priority`, `status`, `step_total`, `request_pass_rate`, `last_report_status`, `last_report_id`, `num`, `deleted`, `pos`, `version_id`, `ref_id`, `latest`, `project_id`, `module_id`, `description`, `tags`, `grouped`, `environment_id`, `create_user`, `create_time`, `delete_time`, `delete_user`, `update_user`, `update_time`) VALUES ('7', 'Scenario 7', 'P1', 'Completed', 14, '85%', 'Passed', 'report_7', 1007, b'0', 7, 'version_7', 'ref_7', b'1', '100001100001', 'module_7', 'Description 7', '[\"tag1\",\"tag2\"]', b'1', 'env_4', 'admin', 1640772867000, NULL, NULL, 'admin', 1640772867000);
|
||||||
|
INSERT INTO `api_scenario` (`id`, `name`, `priority`, `status`, `step_total`, `request_pass_rate`, `last_report_status`, `last_report_id`, `num`, `deleted`, `pos`, `version_id`, `ref_id`, `latest`, `project_id`, `module_id`, `description`, `tags`, `grouped`, `environment_id`, `create_user`, `create_time`, `delete_time`, `delete_user`, `update_user`, `update_time`) VALUES ('8', 'Scenario 8', 'P0', 'In Progress', 20, '70%', 'Running', 'report_8', 1008, b'0', 8, 'version_8', 'ref_8', b'0', '100001100001', 'module_8', 'Description 8', '[\"tag2\",\"tag3\"]', b'0', NULL, 'admin', 1640772868000, NULL, NULL, 'admin', 1640772868000);
|
||||||
|
INSERT INTO `api_scenario` (`id`, `name`, `priority`, `status`, `step_total`, `request_pass_rate`, `last_report_status`, `last_report_id`, `num`, `deleted`, `pos`, `version_id`, `ref_id`, `latest`, `project_id`, `module_id`, `description`, `tags`, `grouped`, `environment_id`, `create_user`, `create_time`, `delete_time`, `delete_user`, `update_user`, `update_time`) VALUES ('9', 'Scenario 9', 'P2', 'Not Planned', 16, 'Calculating', NULL, NULL, 1009, b'0', 9, 'version_9', 'ref_9', b'1', '100001100001', 'module_9', 'Description 9', '[\"tag1\",\"tag3\"]', b'1', 'env_5', 'admin', 1640772869000, NULL, NULL, 'admin', 1640772869000);
|
||||||
|
|
||||||
|
DELETE FROM `api_scenario_report` WHERE `id` in ('report_1', 'report_2', 'report_3', 'report_4','report_5','report_6', 'report_7', 'report_8', 'report_9','report_10','report_11', 'report_12', 'report_13', 'report_14','report_15','report_16', 'report_17', 'report_18', 'report_19','report_20');
|
||||||
|
INSERT INTO `api_scenario_report` (`id`, `name`, `scenario_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('report_1', 'Report 1', '1', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1640773000000, 1640773000000, 1640774000000, 5000, 'SUCCESS', 'Manual', 'Standalone', '100660357777795313', 'version_1', b'0', '100001100001', 'env_1', 2, 0, 0, 2, 20, 18, '95%', 'Calculating', 'Calculating', '90%', '90%', 'script_1');
|
||||||
|
INSERT INTO `api_scenario_report` (`id`, `name`, `scenario_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('report_10', 'Report 10', '3', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1640773900000, 1640773900000, 1640774900000, 5000, 'SUCCESS', 'Manual', 'Standalone', '100660357777795313', 'version_10', b'0', '100001100001', 'env_10', 2, 0, 0, 2, 22, 20, '90%', 'Calculating', 'Calculating', '85%', '80%', 'script_10');
|
||||||
|
INSERT INTO `api_scenario_report` (`id`, `name`, `scenario_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('report_11', 'Report 11', '4', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1640774000000, 1640774000000, 1640775000000, 5000, 'ERROR', 'Automated', 'Distributed', '100660357777795313', 'version_11', b'0', '100001100001', 'env_11', 3, 1, 0, 2, 28, 26, '75%', 'Calculating', 'Calculating', '80%', '85%', 'script_11');
|
||||||
|
INSERT INTO `api_scenario_report` (`id`, `name`, `scenario_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('report_12', 'Report 12', '5', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1640774100000, 1640774100000, 1640775100000, 5000, 'PENDING', 'Automated', 'Standalone', '100660357777795313', 'version_12', b'1', '100001100001', 'env_12', 0, 0, 16, 16, 26, 24, 'Calculating', 'Calculating', 'Calculating', 'Calculating', 'Calculating', 'script_12');
|
||||||
|
INSERT INTO `api_scenario_report` (`id`, `name`, `scenario_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('report_13', 'Report 13', '6', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1640774200000, 1640774200000, 1640775200000, 5000, 'SUCCESS', 'Manual', 'Standalone', '100660357777795313', 'version_13', b'0', '100001100001', 'env_13', 2, 0, 0, 2, 24, 22, '80%', 'Calculating', 'Calculating', '85%', '90%', 'script_13');
|
||||||
|
INSERT INTO `api_scenario_report` (`id`, `name`, `scenario_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('report_14', 'Report 14', '7', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1640774300000, 1640774300000, 1640775300000, 5000, 'ERROR', 'Automated', 'Distributed', '100660357777795313', 'version_14', b'0', '100001100001', 'env_14', 3, 1, 0, 2, 20, 18, '70%', 'Calculating', 'Calculating', '75%', '80%', 'script_14');
|
||||||
|
INSERT INTO `api_scenario_report` (`id`, `name`, `scenario_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('report_15', 'Report 15', '8', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1640774400000, 1640774400000, 1640775400000, 5000, 'PENDING', 'Automated', 'Standalone', '100660357777795313', 'version_15', b'1', '100001100001', 'env_15', 0, 0, 18, 18, 22, 20, 'Calculating','Calculating', 'Calculating', 'Calculating', 'Calculating', 'script_15');
|
||||||
|
INSERT INTO `api_scenario_report` (`id`, `name`, `scenario_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('report_16', 'Report 16', '3', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1640774500000, 1640774500000, 1640775500000, 5000, 'SUCCESS', 'Manual', 'Standalone', '100660357777795313', 'version_16', b'0', '100001100001', 'env_16', 2, 0, 0, 2, 20, 18, '85%', 'Calculating', 'Calculating', '90%', '90%', 'script_16');
|
||||||
|
INSERT INTO `api_scenario_report` (`id`, `name`, `scenario_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('report_17', 'Report 17', '4', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1640774600000, 1640774600000, 1640775600000, 5000, 'ERROR', 'Automated', 'Distributed', '100660357777795313', 'version_17', b'0', '100001100001', 'env_17', 3, 1, 0, 2, 26, 24, '75%', 'Calculating', 'Calculating', '80%', '85%', 'script_17');
|
||||||
|
INSERT INTO `api_scenario_report` (`id`, `name`, `scenario_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('report_18', 'Report 18', '5', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1640774700000, 1640774700000, 1640775700000, 5000, 'PENDING', 'Automated', 'Standalone', '100660357777795313', 'version_18', b'1', '100001100001', 'env_18', 0, 0, 20, 20, 30, 28, 'Calculating', 'Calculating', 'Calculating', 'Calculating', 'Calculating', 'script_18');
|
||||||
|
INSERT INTO `api_scenario_report` (`id`, `name`, `scenario_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('report_19', 'Report 19', '6', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1640774800000, 1640774800000, 1640775800000, 5000, 'SUCCESS', 'Manual', 'Standalone', '100660357777795313', 'version_19', b'0', '100001100001', 'env_19', 2, 0, 0, 2, 18, 16, '90%', 'Calculating', 'Calculating', '85%', '80%', 'script_19');
|
||||||
|
INSERT INTO `api_scenario_report` (`id`, `name`, `scenario_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('report_2', 'Report 2', '2', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1640773100000, 1640773100000, 1640774100000, 5000, 'ERROR', 'Automated', 'Distributed', '100660357777795313', 'version_2', b'0', '100001100001', 'env_2', 3, 1, 0, 2, 22, 20, '80%', 'Calculating', 'Calculating', '85%', '90%', 'script_2');
|
||||||
|
INSERT INTO `api_scenario_report` (`id`, `name`, `scenario_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('report_20', 'Report 20', '2', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1640774900000, 1640774900000, 1640775900000, 5000, 'ERROR', 'Automated', 'Distributed', '100660357777795313', 'version_20', b'0', '100001100001', 'env_20', 3, 1, 0, 2, 22, 20, '70%', 'Calculating', 'Calculating', '75%', '80%', 'script_20');
|
||||||
|
INSERT INTO `api_scenario_report` (`id`, `name`, `scenario_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('report_3', 'Report 3', '3', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1640773200000, 1640773200000, 1640774200000, 5000, 'PENDING', 'Automated', 'Standalone', '100660357777795313', 'version_3', b'1', '100001100001', 'env_3', 0, 0, 10, 10, 30, 28, 'Calculating','Calculating', 'Calculating', 'Calculating', 'Calculating', 'script_3');
|
||||||
|
INSERT INTO `api_scenario_report` (`id`, `name`, `scenario_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('report_4', 'Report 4', '4', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1640773300000, 1640773300000, 1640774300000, 5000, 'SUCCESS', 'Manual', 'Standalone', '100660357777795313', 'version_4', b'0', '100001100001', 'env_4', 2, 0, 0, 2, 18, 16, '90%','Calculating', 'Calculating', '85%', '80%', 'script_4');
|
||||||
|
INSERT INTO `api_scenario_report` (`id`, `name`, `scenario_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('report_5', 'Report 5', '5', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1640773400000, 1640773400000, 1640774400000, 5000, 'ERROR', 'Automated', 'Distributed', '100660357777795313', 'version_5', b'0', '100001100001', 'env_5', 3, 1, 0, 2, 24, 22, '70%', 'Calculating', 'Calculating', '75%', '80%', 'script_5');
|
||||||
|
INSERT INTO `api_scenario_report` (`id`, `name`, `scenario_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('report_6', 'Report 6', '6', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1640773500000, 1640773500000, 1640774500000, 5000, 'PENDING', 'Automated', 'Standalone', '100660357777795313', 'version_6', b'1', '100001100001', 'env_6', 0, 0, 12, 12, 20, 18, 'Calculating','Calculating', 'Calculating', 'Calculating', 'Calculating', 'script_6');
|
||||||
|
INSERT INTO `api_scenario_report` (`id`, `name`, `scenario_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('report_7', 'Report 7', '7', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1640773600000, 1640773600000, 1640774600000, 5000, 'SUCCESS', 'Manual', 'Standalone', '100660357777795313', 'version_7', b'0', '100001100001', 'env_7', 2, 0, 0, 2, 16, 14, '85%', 'Calculating', 'Calculating', '90%', '90%', 'script_7');
|
||||||
|
INSERT INTO `api_scenario_report` (`id`, `name`, `scenario_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('report_8', 'Report 8', '8', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1640773700000, 1640773700000, 1640774700000, 5000, 'ERROR', 'Automated', 'Distributed', '100660357777795313', 'version_8', b'0', '100001100001', 'env_8', 3, 1, 0, 2, 20, 18, 'Calculating', 'Calculating', '70%', '75%', '80%', 'script_8');
|
||||||
|
INSERT INTO `api_scenario_report` (`id`, `name`, `scenario_id`, `test_plan_id`, `create_user`, `delete_time`, `delete_user`, `deleted`, `update_user`, `update_time`, `start_time`, `end_time`, `request_duration`, `status`, `trigger_mode`, `run_mode`, `pool_id`, `version_id`, `integrated`, `project_id`, `environment_id`, `error_count`, `fake_error_count`, `pending_count`, `success_count`, `assertion_count`, `assertion_success_count`, `request_error_rate`, `request_pending_rate`, `request_fake_error_rate`, `request_pass_rate`, `assertion_pass_rate`, `script_identifier`) VALUES ('report_9', 'Report 9', '9', 'NONE', 'admin', NULL, NULL, b'0', 'admin', 1640773800000, 1640773800000, 1640774800000, 5000, 'PENDING', 'Automated', 'Standalone', '100660357777795313', 'version_9', b'1', '100001100001', 'env_9', 0, 0, 14, 14, 18, 16, 'Calculating', 'Calculating', 'Calculating', 'Calculating', 'Calculating', 'script_9');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
package io.metersphere.system.controller;
|
||||||
|
|
||||||
|
import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
|
import io.metersphere.system.dto.taskcenter.TaskCenterScheduleDTO;
|
||||||
|
import io.metersphere.system.dto.taskcenter.request.TaskCenterSchedulePageRequest;
|
||||||
|
import io.metersphere.system.security.CheckOwner;
|
||||||
|
import io.metersphere.system.service.TaskCenterService;
|
||||||
|
import io.metersphere.system.utils.Pager;
|
||||||
|
import io.metersphere.system.utils.SessionUtils;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: LAN
|
||||||
|
* @date: 2024/1/17 19:19
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(value = "/task/center")
|
||||||
|
@Tag(name = "任务中心-定时任务")
|
||||||
|
public class TaskCenterController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TaskCenterService taskCenterService;
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/project/schedule/page")
|
||||||
|
@Operation(summary = "项目-任务中心-定时任务列表")
|
||||||
|
@RequiresPermissions(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ)
|
||||||
|
@CheckOwner(resourceId = "", resourceType = "project")
|
||||||
|
public Pager<List<TaskCenterScheduleDTO>> projectScheduleList(@Validated @RequestBody TaskCenterSchedulePageRequest request) {
|
||||||
|
return taskCenterService.getProjectSchedulePage(request, SessionUtils.getCurrentProjectId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/org/schedule/page")
|
||||||
|
@Operation(summary = "组织-任务中心-定时任务列表")
|
||||||
|
@RequiresPermissions(PermissionConstants.ORGANIZATION_TASK_CENTER_READ)
|
||||||
|
@CheckOwner(resourceId = "", resourceType = "organization")
|
||||||
|
public Pager<List<TaskCenterScheduleDTO>> orgScheduleList(@Validated @RequestBody TaskCenterSchedulePageRequest request) {
|
||||||
|
return taskCenterService.getOrgSchedulePage(request, SessionUtils.getCurrentOrganizationId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/system/schedule/page")
|
||||||
|
@Operation(summary = "系统-任务中心-定时任务列表")
|
||||||
|
@RequiresPermissions(PermissionConstants.SYSTEM_TASK_CENTER_READ)
|
||||||
|
public Pager<List<TaskCenterScheduleDTO>> systemScheduleList(@Validated @RequestBody TaskCenterSchedulePageRequest request) {
|
||||||
|
return taskCenterService.getSystemSchedulePage(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package io.metersphere.system.dto.taskcenter;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: LAN
|
||||||
|
* @date: 2024/1/17 11:20
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TaskCenterDTO implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(description = "所属组织")
|
||||||
|
private String organizationName;
|
||||||
|
|
||||||
|
@Schema(description = "所属项目")
|
||||||
|
private String projectName;
|
||||||
|
|
||||||
|
@Schema(description = "项目id")
|
||||||
|
private String projectId;
|
||||||
|
|
||||||
|
@Schema(description = "报告id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "资源Id 单独报告显示模块业务id 集合报告显示报告id")
|
||||||
|
private String resourceId;
|
||||||
|
|
||||||
|
@Schema(description = "资源名称 单独报告显示模块名称 集合报告显示报告名称")
|
||||||
|
private String resourceName;
|
||||||
|
|
||||||
|
@Schema(description = "触发模式(手动,定时,批量,测试计划)")
|
||||||
|
private String triggerMode;
|
||||||
|
|
||||||
|
@Schema(description = "资源池名称")
|
||||||
|
private String poolName;
|
||||||
|
|
||||||
|
@Schema(description = "执行状态/SUCCESS/ERROR")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Schema(description = "操作人")
|
||||||
|
private String operationName;
|
||||||
|
|
||||||
|
@Schema(description = "操作时间")
|
||||||
|
private Long operationTime;
|
||||||
|
|
||||||
|
@Schema(description = "是否为集合报告")
|
||||||
|
private boolean integrated;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package io.metersphere.system.dto.taskcenter;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: LAN
|
||||||
|
* @date: 2024/1/17 11:20
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TaskCenterScheduleDTO implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(description = "所属组织")
|
||||||
|
private String organizationName;
|
||||||
|
|
||||||
|
@Schema(description = "所属项目")
|
||||||
|
private String projectName;
|
||||||
|
|
||||||
|
@Schema(description = "项目id")
|
||||||
|
private String projectId;
|
||||||
|
|
||||||
|
@Schema(description = "任务id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "任务名称")
|
||||||
|
private String taskName;
|
||||||
|
|
||||||
|
@Schema(description = "资源Id")
|
||||||
|
private String resourceId;
|
||||||
|
|
||||||
|
@Schema(description = "资源业务id")
|
||||||
|
private Long resourceNum;
|
||||||
|
|
||||||
|
@Schema(description = "资源名称")
|
||||||
|
private String resourceName;
|
||||||
|
|
||||||
|
@Schema(description = "资源分类")
|
||||||
|
private String resourceType;
|
||||||
|
|
||||||
|
@Schema(description = "运行规则(cron表达式)")
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
@Schema(description = "下次执行时间")
|
||||||
|
private Date nextTime;
|
||||||
|
|
||||||
|
@Schema(description = "任务状态")
|
||||||
|
private boolean enable;
|
||||||
|
|
||||||
|
@Schema(description = "操作人")
|
||||||
|
private String createUserName;
|
||||||
|
|
||||||
|
@Schema(description = "操作时间")
|
||||||
|
private Long createTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package io.metersphere.system.dto.taskcenter.enums;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: LAN
|
||||||
|
* @date: 2024/1/22 16:41
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
public enum ScheduleTagType {
|
||||||
|
API_IMPORT("API_IMPORT"),
|
||||||
|
TEST_RESOURCE("API_SCENARIO", "UI_SCENARIO", "LOAD_TEST", "TEST_PLAN"),
|
||||||
|
|
||||||
|
ORDER("CLEAN_REPORT", "BUG_SYNC");
|
||||||
|
|
||||||
|
private List<String> names;
|
||||||
|
|
||||||
|
ScheduleTagType(String... names) {
|
||||||
|
this.names = List.of(names);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getNames() {
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package io.metersphere.system.dto.taskcenter.request;
|
||||||
|
|
||||||
|
import io.metersphere.sdk.constants.TaskCenterResourceType;
|
||||||
|
import io.metersphere.system.dto.sdk.BasePageRequest;
|
||||||
|
import io.metersphere.system.valid.EnumValue;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: LAN
|
||||||
|
* @date: 2024/1/17 11:21
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TaskCenterPageRequest extends BasePageRequest implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(description = "所属模块", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@EnumValue(enumClass = TaskCenterResourceType.class)
|
||||||
|
private String moduleType = TaskCenterResourceType.API_CASE.toString();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package io.metersphere.system.dto.taskcenter.request;
|
||||||
|
|
||||||
|
import io.metersphere.system.dto.sdk.BasePageRequest;
|
||||||
|
import io.metersphere.system.dto.taskcenter.enums.ScheduleTagType;
|
||||||
|
import io.metersphere.system.valid.EnumValue;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: LAN
|
||||||
|
* @date: 2024/1/22 16:38
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TaskCenterSchedulePageRequest extends BasePageRequest implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(description = "定时任务所属类别", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@EnumValue(enumClass = ScheduleTagType.class)
|
||||||
|
private String scheduleTagType = ScheduleTagType.API_IMPORT.toString();
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package io.metersphere.system.mapper;
|
package io.metersphere.system.mapper;
|
||||||
|
|
||||||
import io.metersphere.project.domain.Project;
|
import io.metersphere.project.domain.Project;
|
||||||
|
import io.metersphere.system.dto.sdk.OptionDTO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -11,4 +12,21 @@ public interface BaseProjectMapper {
|
||||||
List<Project> selectProjectByIdList(List<String> projectIds);
|
List<Project> selectProjectByIdList(List<String> projectIds);
|
||||||
|
|
||||||
List<String> getProjectIdByOrgId(@Param("orgId") String orgId);
|
List<String> getProjectIdByOrgId(@Param("orgId") String orgId);
|
||||||
|
|
||||||
|
List<OptionDTO> getProjectOptionsById(@Param("id") String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有项目
|
||||||
|
*
|
||||||
|
* @return 所有项目
|
||||||
|
*/
|
||||||
|
List<OptionDTO> getProjectOptions();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取组织下的所有项目
|
||||||
|
*
|
||||||
|
* @param orgId 组织ID
|
||||||
|
* @return 组织下的所有项目
|
||||||
|
*/
|
||||||
|
List<OptionDTO> getProjectOptionsByOrgId(@Param("orgId") String orgId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,4 +21,25 @@
|
||||||
FROM project
|
FROM project
|
||||||
WHERE organization_id = #{orgId}
|
WHERE organization_id = #{orgId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getProjectOptionsByOrgId" resultType="io.metersphere.system.dto.sdk.OptionDTO">
|
||||||
|
select id, name
|
||||||
|
from project
|
||||||
|
where organization_id = #{orgId}
|
||||||
|
order by create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getProjectOptionsById" resultType="io.metersphere.system.dto.sdk.OptionDTO">
|
||||||
|
select id, name
|
||||||
|
from project
|
||||||
|
where id = #{id}
|
||||||
|
order by create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getProjectOptions" resultType="io.metersphere.system.dto.sdk.OptionDTO">
|
||||||
|
select id, name
|
||||||
|
from project
|
||||||
|
order by create_time desc
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -114,4 +114,11 @@ public interface ExtOrganizationMapper {
|
||||||
* @return 用户ID集合
|
* @return 用户ID集合
|
||||||
*/
|
*/
|
||||||
List<String> getRelatedOrganizationIds(@Param("userId") String userId);
|
List<String> getRelatedOrganizationIds(@Param("userId") String userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据项目获取组织名称
|
||||||
|
*
|
||||||
|
* @return 项目id对应组织名称列表
|
||||||
|
*/
|
||||||
|
List<OptionDTO> getOrgListByProjectIds(@Param("projectIds") List<String> projectIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,4 +177,14 @@
|
||||||
</if>
|
</if>
|
||||||
</if>
|
</if>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
<select id="getOrgListByProjectIds" resultType="io.metersphere.system.dto.sdk.OptionDTO">
|
||||||
|
select p.id, o.name
|
||||||
|
from project p
|
||||||
|
inner join organization o on p.organization_id = o.id
|
||||||
|
where p.id in
|
||||||
|
<foreach collection="projectIds" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -0,0 +1,25 @@
|
||||||
|
package io.metersphere.system.mapper;
|
||||||
|
|
||||||
|
import io.metersphere.api.domain.ApiScenario;
|
||||||
|
import io.metersphere.api.domain.ApiTestCase;
|
||||||
|
import io.metersphere.system.dto.taskcenter.TaskCenterScheduleDTO;
|
||||||
|
import io.metersphere.system.dto.taskcenter.request.TaskCenterSchedulePageRequest;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ExtScheduleMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询任务中心定时任务列表
|
||||||
|
*
|
||||||
|
* @param request 列表请求参数
|
||||||
|
* @return 定时任务列表数据
|
||||||
|
*/
|
||||||
|
List<TaskCenterScheduleDTO> taskCenterSchedulelist(@Param("request") TaskCenterSchedulePageRequest request, @Param("projectIds") List<String> projectIds, @Param("resourceTypes") List<String> resourceTypes);
|
||||||
|
|
||||||
|
List<ApiTestCase> getApiTestCaseListByIds(@Param("ids") List<String> ids);
|
||||||
|
|
||||||
|
List<ApiScenario> getApiScenarioListByIds(@Param("ids") List<String> ids);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="io.metersphere.system.mapper.ExtScheduleMapper">
|
||||||
|
<select id="taskCenterSchedulelist" resultType="io.metersphere.system.dto.taskcenter.TaskCenterScheduleDTO">
|
||||||
|
SELECT
|
||||||
|
schedule.id,
|
||||||
|
schedule.name as taskname,
|
||||||
|
schedule.project_id,
|
||||||
|
schedule.value,
|
||||||
|
schedule.enable,
|
||||||
|
schedule.resource_id,
|
||||||
|
schedule.resource_type,
|
||||||
|
schedule.create_user AS createUserName,
|
||||||
|
schedule.create_time
|
||||||
|
FROM
|
||||||
|
schedule
|
||||||
|
where
|
||||||
|
schedule.resource_type in
|
||||||
|
<foreach collection="resourceTypes" item="resourceType" separator="," open="(" close=")">
|
||||||
|
#{resourceType}
|
||||||
|
</foreach>
|
||||||
|
and schedule.project_id IN
|
||||||
|
<foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
|
||||||
|
#{projectId}
|
||||||
|
</foreach>
|
||||||
|
<if test="request.keyword != null and request.keyword != ''">
|
||||||
|
and (
|
||||||
|
schedule.name like concat('%', #{request.keyword},'%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<include refid="taskCenterScheduleFilters">
|
||||||
|
<property name="filter" value="request.filter"/>
|
||||||
|
</include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<sql id="taskCenterScheduleFilters">
|
||||||
|
<if test="${filter} != null and ${filter}.size() > 0">
|
||||||
|
<foreach collection="${filter}.entrySet()" index="key" item="values">
|
||||||
|
<if test="values != null and values.size() > 0">
|
||||||
|
<choose>
|
||||||
|
<when test="key=='resourceType'">
|
||||||
|
and schedule.resource_type in
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="getApiTestCaseListByIds" resultType="io.metersphere.api.domain.ApiTestCase">
|
||||||
|
select
|
||||||
|
api_test_case.id,
|
||||||
|
api_test_case.num,
|
||||||
|
api_test_case.name
|
||||||
|
from api_test_case where api_report.id in
|
||||||
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getApiScenarioListByIds" resultType="io.metersphere.api.domain.ApiScenario">
|
||||||
|
select
|
||||||
|
api_scenario.id,
|
||||||
|
api_scenario.num,
|
||||||
|
api_scenario.name
|
||||||
|
from api_scenario where api_scenario.id in
|
||||||
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,215 @@
|
||||||
|
package io.metersphere.system.service;
|
||||||
|
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
|
import com.github.pagehelper.page.PageMethod;
|
||||||
|
import io.metersphere.api.domain.ApiScenario;
|
||||||
|
import io.metersphere.project.domain.Project;
|
||||||
|
import io.metersphere.project.mapper.ProjectMapper;
|
||||||
|
import io.metersphere.sdk.constants.ScheduleResourceType;
|
||||||
|
import io.metersphere.sdk.exception.MSException;
|
||||||
|
import io.metersphere.sdk.util.Translator;
|
||||||
|
import io.metersphere.system.domain.Organization;
|
||||||
|
import io.metersphere.system.dto.sdk.OptionDTO;
|
||||||
|
import io.metersphere.system.dto.taskcenter.TaskCenterScheduleDTO;
|
||||||
|
import io.metersphere.system.dto.taskcenter.enums.ScheduleTagType;
|
||||||
|
import io.metersphere.system.dto.taskcenter.request.TaskCenterSchedulePageRequest;
|
||||||
|
import io.metersphere.system.mapper.BaseProjectMapper;
|
||||||
|
import io.metersphere.system.mapper.ExtOrganizationMapper;
|
||||||
|
import io.metersphere.system.mapper.ExtScheduleMapper;
|
||||||
|
import io.metersphere.system.mapper.OrganizationMapper;
|
||||||
|
import io.metersphere.system.utils.PageUtils;
|
||||||
|
import io.metersphere.system.utils.Pager;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.quartz.CronExpression;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: LAN
|
||||||
|
* @date: 2024/1/17 11:24
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public class TaskCenterService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
ExtOrganizationMapper extOrganizationMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
BaseProjectMapper baseProjectMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
UserLoginService userLoginService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
ExtScheduleMapper extScheduleMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
ProjectMapper projectMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
OrganizationMapper organizationMapper;
|
||||||
|
|
||||||
|
|
||||||
|
private static final String CREATE_TIME_SORT = "create_time desc";
|
||||||
|
|
||||||
|
|
||||||
|
public Pager<List<TaskCenterScheduleDTO>> getProjectSchedulePage(TaskCenterSchedulePageRequest request, String projectId) {
|
||||||
|
checkProjectExist(projectId);
|
||||||
|
List<OptionDTO> projectList = getProjectOption(projectId);
|
||||||
|
return createTaskCenterSchedulePager(request, projectList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pager<List<TaskCenterScheduleDTO>> getOrgSchedulePage(TaskCenterSchedulePageRequest request, String organizationId) {
|
||||||
|
checkOrganizationExist(organizationId);
|
||||||
|
List<OptionDTO> projectList = getOrgProjectList(organizationId);
|
||||||
|
return createTaskCenterSchedulePager(request, projectList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pager<List<TaskCenterScheduleDTO>> getSystemSchedulePage(TaskCenterSchedulePageRequest request) {
|
||||||
|
List<OptionDTO> projectList = getSystemProjectList();
|
||||||
|
return createTaskCenterSchedulePager(request, projectList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Pager<List<TaskCenterScheduleDTO>> createTaskCenterSchedulePager(TaskCenterSchedulePageRequest request, List<OptionDTO> projectList) {
|
||||||
|
Page<Object> page = PageMethod.startPage(request.getCurrent(), request.getPageSize(),
|
||||||
|
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : CREATE_TIME_SORT);
|
||||||
|
return PageUtils.setPageInfo(page, getSchedulePage(request, projectList));
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TaskCenterScheduleDTO> getSchedulePage(TaskCenterSchedulePageRequest request, List<OptionDTO> projectList) {
|
||||||
|
List<TaskCenterScheduleDTO> list = new ArrayList<>();
|
||||||
|
if (request != null && !projectList.isEmpty()) {
|
||||||
|
List<String> projectIds = projectList.stream().map(OptionDTO::getId).toList();
|
||||||
|
ScheduleTagType scheduleTagType = ScheduleTagType.valueOf(request.getScheduleTagType());
|
||||||
|
List<String> resourceTypes = scheduleTagType.getNames();
|
||||||
|
if (!resourceTypes.isEmpty()) {
|
||||||
|
list = extScheduleMapper.taskCenterSchedulelist(request, projectIds, resourceTypes);
|
||||||
|
processTaskCenterSchedule(list, projectList, projectIds, request.getScheduleTagType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processTaskCenterSchedule(List<TaskCenterScheduleDTO> list, List<OptionDTO> projectList, List<String> projectIds, String scheduleTagType) {
|
||||||
|
if (!list.isEmpty()) {
|
||||||
|
// 组织
|
||||||
|
List<OptionDTO> orgListByProjectList = getOrgListByProjectIds(projectIds);
|
||||||
|
Map<String, String> orgMap = orgListByProjectList.stream().collect(Collectors.toMap(OptionDTO::getId, OptionDTO::getName));
|
||||||
|
// 取所有的userid
|
||||||
|
Set<String> userSet = list.stream()
|
||||||
|
.flatMap(item -> Stream.of(item.getCreateUserName()))
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
Map<String, String> userMap = userLoginService.getUserNameMap(new ArrayList<>(userSet));
|
||||||
|
// 项目
|
||||||
|
Map<String, String> projectMap = projectList.stream().collect(Collectors.toMap(OptionDTO::getId, OptionDTO::getName));
|
||||||
|
|
||||||
|
|
||||||
|
list.forEach(item -> {
|
||||||
|
String resourceId = item.getResourceId();
|
||||||
|
if (ScheduleTagType.TEST_RESOURCE.toString().equals(scheduleTagType)) {
|
||||||
|
processTaskCenterScheduleData(list, resourceId, item);
|
||||||
|
}
|
||||||
|
item.setCreateUserName(userMap.getOrDefault(item.getCreateUserName(), StringUtils.EMPTY));
|
||||||
|
item.setProjectName(projectMap.getOrDefault(item.getProjectId(), StringUtils.EMPTY));
|
||||||
|
item.setOrganizationName(orgMap.getOrDefault(item.getProjectId(), StringUtils.EMPTY));
|
||||||
|
item.setNextTime(getNextExecution(item.getValue()));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processTaskCenterScheduleData (List<TaskCenterScheduleDTO> list, String resourceId, TaskCenterScheduleDTO taskCenterScheduleDTO) {
|
||||||
|
// 业务数据
|
||||||
|
// 根据 resourceType 分组,并获取每个类型对应的 resourceId 数组
|
||||||
|
Map<String, List<String>> resultMap = list.stream()
|
||||||
|
.collect(Collectors.groupingBy(TaskCenterScheduleDTO::getResourceType,
|
||||||
|
Collectors.mapping(TaskCenterScheduleDTO::getResourceId, Collectors.toList())));
|
||||||
|
Map<String, ApiScenario> apiScenarioMap = new HashMap<>();
|
||||||
|
resultMap.forEach((type, resourceIds) ->{
|
||||||
|
if (type.equals(ScheduleResourceType.API_SCENARIO.toString())) {
|
||||||
|
List<ApiScenario> apiScenarios = extScheduleMapper.getApiScenarioListByIds(resourceIds);
|
||||||
|
apiScenarioMap.putAll(apiScenarios.stream().collect(Collectors.toMap(ApiScenario::getId, Function.identity())));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO ui test load test ...
|
||||||
|
if (apiScenarioMap.containsKey(resourceId)) {
|
||||||
|
ApiScenario apiScenario = apiScenarioMap.get(resourceId);
|
||||||
|
taskCenterScheduleDTO.setResourceName(apiScenario.getName());
|
||||||
|
taskCenterScheduleDTO.setResourceNum(apiScenario.getNum());
|
||||||
|
} else {
|
||||||
|
taskCenterScheduleDTO.setResourceName(StringUtils.EMPTY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<OptionDTO> getProjectOption(String id){
|
||||||
|
return baseProjectMapper.getProjectOptionsById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<OptionDTO> getOrgProjectList(String orgId){
|
||||||
|
return baseProjectMapper.getProjectOptionsByOrgId(orgId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<OptionDTO> getSystemProjectList(){
|
||||||
|
return baseProjectMapper.getProjectOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<OptionDTO> getOrgListByProjectIds(List<String> projectIds){
|
||||||
|
return extOrganizationMapper.getOrgListByProjectIds(projectIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回下一个执行时间根据给定的Cron表达式
|
||||||
|
*
|
||||||
|
* @param cronExpression Cron表达式
|
||||||
|
* @return Date 下次Cron表达式执行时间
|
||||||
|
*/
|
||||||
|
public static Date getNextExecution(String cronExpression)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CronExpression cron = new CronExpression(cronExpression);
|
||||||
|
return cron.getNextValidTimeAfter(new Date(System.currentTimeMillis()));
|
||||||
|
}
|
||||||
|
catch (ParseException e)
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看项目是否存在
|
||||||
|
*
|
||||||
|
* @param projectId 项目ID
|
||||||
|
*/
|
||||||
|
private Project checkProjectExist(String projectId) {
|
||||||
|
Project project = projectMapper.selectByPrimaryKey(projectId);
|
||||||
|
if (project == null) {
|
||||||
|
throw new MSException(Translator.get("project_not_exist"));
|
||||||
|
}
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看组织是否存在
|
||||||
|
*
|
||||||
|
* @param orgId 组织ID
|
||||||
|
*/
|
||||||
|
private Organization checkOrganizationExist(String orgId) {
|
||||||
|
Organization organization = organizationMapper.selectByPrimaryKey(orgId);
|
||||||
|
if (organization == null) {
|
||||||
|
throw new MSException(Translator.get("organization_not_exist"));
|
||||||
|
}
|
||||||
|
return organization;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,141 @@
|
||||||
|
package io.metersphere.system.controller;
|
||||||
|
|
||||||
|
import io.metersphere.sdk.constants.SessionConstants;
|
||||||
|
import io.metersphere.sdk.util.JSON;
|
||||||
|
import io.metersphere.system.base.BaseTest;
|
||||||
|
import io.metersphere.system.controller.handler.ResultHolder;
|
||||||
|
import io.metersphere.system.dto.taskcenter.enums.ScheduleTagType;
|
||||||
|
import io.metersphere.system.dto.taskcenter.request.TaskCenterSchedulePageRequest;
|
||||||
|
import io.metersphere.system.utils.Pager;
|
||||||
|
import org.junit.jupiter.api.*;
|
||||||
|
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||||
|
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.SqlConfig;
|
||||||
|
import org.springframework.test.web.servlet.MvcResult;
|
||||||
|
import org.springframework.test.web.servlet.ResultMatcher;
|
||||||
|
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
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)
|
||||||
|
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||||
|
@AutoConfigureMockMvc
|
||||||
|
class TaskCenterScheduleControllerTests extends BaseTest {
|
||||||
|
|
||||||
|
private static final String BASE_PATH = "/task/center/";
|
||||||
|
private final static String SCHEDULED_PROJECT_PAGE = BASE_PATH + "project/schedule/page";
|
||||||
|
private final static String SCHEDULED_ORG_PAGE = BASE_PATH + "org/schedule/page";
|
||||||
|
private final static String SCHEDULED_SYSTEM_PAGE = BASE_PATH + "system/schedule/page";
|
||||||
|
|
||||||
|
private static final ResultMatcher ERROR_REQUEST_MATCHER = status().is5xxServerError();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(9)
|
||||||
|
@Sql(scripts = {"/dml/init_task_center.sql"}, config = @SqlConfig(encoding = "utf-8", transactionMode = SqlConfig.TransactionMode.ISOLATED))
|
||||||
|
void getPage() throws Exception {
|
||||||
|
doTaskCenterSchedulePage("KEYWORD", SCHEDULED_PROJECT_PAGE, ScheduleTagType.API_IMPORT.toString());
|
||||||
|
doTaskCenterSchedulePage("FILTER", SCHEDULED_PROJECT_PAGE, ScheduleTagType.API_IMPORT.toString());
|
||||||
|
doTaskCenterSchedulePage("KEYWORD", SCHEDULED_ORG_PAGE, ScheduleTagType.API_IMPORT.toString());
|
||||||
|
doTaskCenterSchedulePage("FILTER", SCHEDULED_ORG_PAGE, ScheduleTagType.API_IMPORT.toString());
|
||||||
|
doTaskCenterSchedulePage("KEYWORD", SCHEDULED_SYSTEM_PAGE, ScheduleTagType.API_IMPORT.toString());
|
||||||
|
doTaskCenterSchedulePage("FILTER", SCHEDULED_SYSTEM_PAGE, ScheduleTagType.API_IMPORT.toString());
|
||||||
|
|
||||||
|
doTaskCenterSchedulePage("KEYWORD", SCHEDULED_PROJECT_PAGE, ScheduleTagType.TEST_RESOURCE.toString());
|
||||||
|
doTaskCenterSchedulePage("FILTER", SCHEDULED_PROJECT_PAGE, ScheduleTagType.TEST_RESOURCE.toString());
|
||||||
|
doTaskCenterSchedulePage("KEYWORD", SCHEDULED_ORG_PAGE, ScheduleTagType.TEST_RESOURCE.toString());
|
||||||
|
doTaskCenterSchedulePage("FILTER", SCHEDULED_ORG_PAGE, ScheduleTagType.TEST_RESOURCE.toString());
|
||||||
|
doTaskCenterSchedulePage("KEYWORD", SCHEDULED_SYSTEM_PAGE, ScheduleTagType.TEST_RESOURCE.toString());
|
||||||
|
doTaskCenterSchedulePage("FILTER", SCHEDULED_SYSTEM_PAGE, ScheduleTagType.TEST_RESOURCE.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doTaskCenterSchedulePage(String search, String url, String scheduleTagType) throws Exception {
|
||||||
|
TaskCenterSchedulePageRequest request = new TaskCenterSchedulePageRequest();
|
||||||
|
request.setScheduleTagType(scheduleTagType);
|
||||||
|
request.setCurrent(1);
|
||||||
|
request.setPageSize(10);
|
||||||
|
request.setSort(Map.of("createTime", "asc"));
|
||||||
|
// "KEYWORD", "FILTER"
|
||||||
|
switch (search) {
|
||||||
|
case "KEYWORD" -> configureKeywordSearch(request);
|
||||||
|
case "FILTER" -> configureFilterSearch(request);
|
||||||
|
default -> {}
|
||||||
|
}
|
||||||
|
|
||||||
|
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post(url)
|
||||||
|
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
||||||
|
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
||||||
|
.header(SessionConstants.CURRENT_PROJECT, DEFAULT_PROJECT_ID)
|
||||||
|
.header(SessionConstants.CURRENT_ORGANIZATION, DEFAULT_ORGANIZATION_ID)
|
||||||
|
.content(JSON.toJSONString(request))
|
||||||
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
|
.andExpect(status().isOk())
|
||||||
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn();
|
||||||
|
|
||||||
|
// 获取返回值
|
||||||
|
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
||||||
|
// 返回请求正常
|
||||||
|
Assertions.assertNotNull(resultHolder);
|
||||||
|
Pager<?> pageData = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), Pager.class);
|
||||||
|
// 返回值不为空
|
||||||
|
Assertions.assertNotNull(pageData);
|
||||||
|
// 返回值的页码和当前页码相同
|
||||||
|
Assertions.assertEquals(pageData.getCurrent(), request.getCurrent());
|
||||||
|
// 返回的数据量不超过规定要返回的数据量相同
|
||||||
|
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= request.getPageSize());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doTaskCenterSchedulePageError( String url, String scheduleTagType) throws Exception {
|
||||||
|
TaskCenterSchedulePageRequest request = new TaskCenterSchedulePageRequest();
|
||||||
|
request.setScheduleTagType(scheduleTagType);
|
||||||
|
request.setCurrent(1);
|
||||||
|
request.setPageSize(10);
|
||||||
|
request.setSort(Map.of("createTime", "asc"));
|
||||||
|
configureKeywordSearch(request);
|
||||||
|
|
||||||
|
mockMvc.perform(MockMvcRequestBuilders.post(url)
|
||||||
|
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
||||||
|
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
||||||
|
.header(SessionConstants.CURRENT_PROJECT, "DEFAULT_PROJECT_ID")
|
||||||
|
.header(SessionConstants.CURRENT_ORGANIZATION, "DEFAULT_ORGANIZATION_ID")
|
||||||
|
.content(JSON.toJSONString(request))
|
||||||
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
|
.andExpect(ERROR_REQUEST_MATCHER);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void configureKeywordSearch(TaskCenterSchedulePageRequest request) {
|
||||||
|
request.setKeyword("Schedule");
|
||||||
|
request.setSort(Map.of("resourceType", "API_SCENARIO"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void configureFilterSearch(TaskCenterSchedulePageRequest request) {
|
||||||
|
Map<String, List<String>> filters = new HashMap<>();
|
||||||
|
request.setSort(Map.of());
|
||||||
|
filters.put("resourceType", List.of("API_SCENARIO", "API_IMPORT"));
|
||||||
|
request.setFilter(filters);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(10)
|
||||||
|
void getPageError() throws Exception {
|
||||||
|
doTaskCenterSchedulePageError(SCHEDULED_PROJECT_PAGE, ScheduleTagType.API_IMPORT.toString());
|
||||||
|
doTaskCenterSchedulePageError(SCHEDULED_ORG_PAGE, ScheduleTagType.API_IMPORT.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
|
||||||
|
DELETE FROM `api_scenario` WHERE `id` in ('1', '2', '3', '4','5','6', '7', '8', '9');
|
||||||
|
INSERT INTO `api_scenario` (`id`, `name`, `priority`, `status`, `step_total`, `request_pass_rate`, `last_report_status`, `last_report_id`, `num`, `deleted`, `pos`, `version_id`, `ref_id`, `latest`, `project_id`, `module_id`, `description`, `tags`, `grouped`, `environment_id`, `create_user`, `create_time`, `delete_time`, `delete_user`, `update_user`, `update_time`) VALUES ('1', 'Scenario 1', 'P0', 'Completed', 10, '95%', 'Passed', 'report_1', 1001, b'0', 1, 'version_1', 'ref_1', b'1', '100001100001', 'module_1', 'Description 1', 'Tag1,Tag2', b'0', 'env_1', 'admin', 1640772861000, NULL, NULL, 'admin', 1640772861000);
|
||||||
|
INSERT INTO `api_scenario` (`id`, `name`, `priority`, `status`, `step_total`, `request_pass_rate`, `last_report_status`, `last_report_id`, `num`, `deleted`, `pos`, `version_id`, `ref_id`, `latest`, `project_id`, `module_id`, `description`, `tags`, `grouped`, `environment_id`, `create_user`, `create_time`, `delete_time`, `delete_user`, `update_user`, `update_time`) VALUES ('2', 'Scenario 2', 'P1', 'In Progress', 15, '80%', 'Running', 'report_2', 1002, b'0', 2, 'version_2', 'ref_2', b'0', '100001100001', 'module_2', 'Description 2', 'Tag2,Tag3', b'0', NULL, 'admin', 1640772862000, NULL, NULL, 'admin', 1640772862000);
|
||||||
|
INSERT INTO `api_scenario` (`id`, `name`, `priority`, `status`, `step_total`, `request_pass_rate`, `last_report_status`, `last_report_id`, `num`, `deleted`, `pos`, `version_id`, `ref_id`, `latest`, `project_id`, `module_id`, `description`, `tags`, `grouped`, `environment_id`, `create_user`, `create_time`, `delete_time`, `delete_user`, `update_user`, `update_time`) VALUES ('3', 'Scenario 3', 'P2', 'Not Planned', 8, 'Calculating', NULL, NULL, 1003, b'0', 3, 'version_3', 'ref_3', b'1', '100001100001', 'module_3', 'Description 3', 'Tag1,Tag3', b'1', 'env_2', 'admin', 1640772863000, NULL, NULL, 'admin', 1640772863000);
|
||||||
|
INSERT INTO `api_scenario` (`id`, `name`, `priority`, `status`, `step_total`, `request_pass_rate`, `last_report_status`, `last_report_id`, `num`, `deleted`, `pos`, `version_id`, `ref_id`, `latest`, `project_id`, `module_id`, `description`, `tags`, `grouped`, `environment_id`, `create_user`, `create_time`, `delete_time`, `delete_user`, `update_user`, `update_time`) VALUES ('4', 'Scenario 4', 'P1', 'Completed', 12, '90%', 'Passed', 'report_4', 1004, b'0', 4, 'version_4', 'ref_4', b'0', '100001100001', 'module_4', 'Description 4', 'Tag1,Tag2', b'0', NULL, 'admin', 1640772864000, NULL, NULL, 'admin', 1640772864000);
|
||||||
|
INSERT INTO `api_scenario` (`id`, `name`, `priority`, `status`, `step_total`, `request_pass_rate`, `last_report_status`, `last_report_id`, `num`, `deleted`, `pos`, `version_id`, `ref_id`, `latest`, `project_id`, `module_id`, `description`, `tags`, `grouped`, `environment_id`, `create_user`, `create_time`, `delete_time`, `delete_user`, `update_user`, `update_time`) VALUES ('5', 'Scenario 5', 'P0', 'In Progress', 18, '75%', 'Running', 'report_5', 1005, b'0', 5, 'version_5', 'ref_5', b'1', '100001100001', 'module_5', 'Description 5', 'Tag2,Tag3', b'1', 'env_3', 'admin', 1640772865000, NULL, NULL, 'admin', 1640772865000);
|
||||||
|
INSERT INTO `api_scenario` (`id`, `name`, `priority`, `status`, `step_total`, `request_pass_rate`, `last_report_status`, `last_report_id`, `num`, `deleted`, `pos`, `version_id`, `ref_id`, `latest`, `project_id`, `module_id`, `description`, `tags`, `grouped`, `environment_id`, `create_user`, `create_time`, `delete_time`, `delete_user`, `update_user`, `update_time`) VALUES ('6', 'Scenario 6', 'P2', 'Not Planned', 10, 'Calculating', NULL, NULL, 1006, b'0', 6, 'version_6', 'ref_6', b'0', '100001100001', 'module_6', 'Description 6', 'Tag1,Tag3', b'0', NULL, 'admin', 1640772866000, NULL, NULL, 'admin', 1640772866000);
|
||||||
|
INSERT INTO `api_scenario` (`id`, `name`, `priority`, `status`, `step_total`, `request_pass_rate`, `last_report_status`, `last_report_id`, `num`, `deleted`, `pos`, `version_id`, `ref_id`, `latest`, `project_id`, `module_id`, `description`, `tags`, `grouped`, `environment_id`, `create_user`, `create_time`, `delete_time`, `delete_user`, `update_user`, `update_time`) VALUES ('7', 'Scenario 7', 'P1', 'Completed', 14, '85%', 'Passed', 'report_7', 1007, b'0', 7, 'version_7', 'ref_7', b'1', '100001100001', 'module_7', 'Description 7', 'Tag1,Tag2', b'1', 'env_4', 'admin', 1640772867000, NULL, NULL, 'admin', 1640772867000);
|
||||||
|
INSERT INTO `api_scenario` (`id`, `name`, `priority`, `status`, `step_total`, `request_pass_rate`, `last_report_status`, `last_report_id`, `num`, `deleted`, `pos`, `version_id`, `ref_id`, `latest`, `project_id`, `module_id`, `description`, `tags`, `grouped`, `environment_id`, `create_user`, `create_time`, `delete_time`, `delete_user`, `update_user`, `update_time`) VALUES ('8', 'Scenario 8', 'P0', 'In Progress', 20, '70%', 'Running', 'report_8', 1008, b'0', 8, 'version_8', 'ref_8', b'0', '100001100001', 'module_8', 'Description 8', 'Tag2,Tag3', b'0', NULL, 'admin', 1640772868000, NULL, NULL, 'admin', 1640772868000);
|
||||||
|
INSERT INTO `api_scenario` (`id`, `name`, `priority`, `status`, `step_total`, `request_pass_rate`, `last_report_status`, `last_report_id`, `num`, `deleted`, `pos`, `version_id`, `ref_id`, `latest`, `project_id`, `module_id`, `description`, `tags`, `grouped`, `environment_id`, `create_user`, `create_time`, `delete_time`, `delete_user`, `update_user`, `update_time`) VALUES ('9', 'Scenario 9', 'P2', 'Not Planned', 16, 'Calculating', NULL, NULL, 1009, b'0', 9, 'version_9', 'ref_9', b'1', '100001100001', 'module_9', 'Description 9', 'Tag1,Tag3', b'1', 'env_5', 'admin', 1640772869000, NULL, NULL, 'admin', 1640772869000);
|
||||||
|
|
||||||
|
|
||||||
|
DELETE FROM `schedule` WHERE `id` in ('1', '2', '3', '4','5','6', '7', '8', '9','10','11', '12', '13', '14','15','16', '17', '18', '19','20');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('1', 'key_1', 'cron', '42 12 10 20 05 ?', 'JobClass1', 'API_IMPORT', b'1', 'NONE', 'admin', 1640776000000, 1640777000000, '100001100001', 'Schedule 1', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('15', 'key_15', 'cron', '01 28 17 20 05 ?', 'JobClass15', 'API_IMPORT', b'0', 'NONE', 'admin', 1640777400000, 1640778400000, '100001100001', 'Schedule 15', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('22', 'key_22', 'cron', '50 15 10 20 05 ?', 'JobClass22', 'API_IMPORT', b'1', 'NONE', 'admin', 1640778100000, 1640779100000, '100001100001', 'Schedule 22', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('29', 'key_29', 'cron', '59 46 16 01 06 ?', 'JobClass29', 'API_IMPORT', b'1', 'NONE', 'admin', 1640778800000, 1640779800000, '100001100001', 'Schedule 29', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('8', 'key_8', 'cron', '00 00 12 16 06 ?', 'JobClass8', 'API_IMPORT', b'1', 'NONE', 'admin', 1640776700000, 1640777700000, '100001100001', 'Schedule 8', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('16', 'key_16', 'cron', '43 55 21 20 05 ?', 'JobClass16', 'API_SCENARIO', b'1', '1', 'admin', 1640777500000, 1640778500000, '100001100001', 'Schedule 16', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('2', 'key_2', 'cron', '49 33 11 02 06 ?', 'JobClass2', 'API_SCENARIO', b'1', '2', 'admin', 1640776100000, 1640777100000, '100001100001', 'Schedule 2', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('23', 'key_23', 'cron', '06 09 11 20 05 ?', 'JobClass23', 'API_SCENARIO', b'1', '3', 'admin', 1640778200000, 1640779200000, '100001100001', 'Schedule 23', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('30', 'key_30', 'cron', '40 29 11 02 06 ?', 'JobClass30', 'API_SCENARIO', b'0', '4', 'admin', 1640778900000, 1640779900000, '100001100001', 'Schedule 30', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('9', 'key_9', 'cron', '10 30 0/2 * * ?', 'JobClass9', 'API_SCENARIO', b'0', '5', 'admin', 1640776800000, 1640777800000, '100001100001', 'Schedule 9', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('14', 'key_14', 'cron', '55 27 11 20 05 ?', 'JobClass14', 'BUG_SYNC', b'1', '100001100001', 'admin', 1640777300000, 1640778300000, '100001100001', 'Schedule 14', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('21', 'key_21', 'cron', '42 12 10 20 05 ?', 'JobClass21', 'BUG_SYNC', b'0', '100001100001', 'admin', 1640778000000, 1640779000000, '100001100001', 'Schedule 21', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('28', 'key_28', 'cron', '43 55 21 20 05 ?', 'JobClass28', 'BUG_SYNC', b'1', '100001100001', 'admin', 1640778700000, 1640779700000, '100001100001', 'Schedule 28', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('7', 'key_7', 'cron', '00 36 11 02 06 ?', 'JobClass7', 'BUG_SYNC', b'1', '100001100001', 'admin', 1640776600000, 1640777600000, '100001100001', 'Schedule 7', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('13', 'key_13', 'cron', '52 27 11 20 05 ?', 'JobClass13', 'CLEAN_REPORT', b'1', '100001100001', 'admin', 1640777200000, 1640778200000, '100001100001', 'Schedule 13', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('20', 'key_20', 'cron', '56 35 11 02 06 ?', 'JobClass20', 'CLEAN_REPORT', b'1', '100001100001', 'admin', 1640777900000, 1640778900000, '100001100001', 'Schedule 20', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('27', 'key_27', 'cron', '01 28 17 20 05 ?', 'JobClass27', 'CLEAN_REPORT', b'0', '100001100001', 'admin', 1640778600000, 1640779600000, '100001100001', 'Schedule 27', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('6', 'key_6', 'cron', '56 35 11 02 06 ?', 'JobClass6', 'CLEAN_REPORT', b'0', '100001100001', 'admin', 1640776500000, 1640777500000, '100001100001', 'Schedule 6', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('11', 'key_11', 'cron', '06 09 11 20 05 ?', 'JobClass11', 'LOAD_TEST', b'1', 'load_test_11', 'admin', 1640777000000, 1640778000000, '100001100001', 'Schedule 11', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('18', 'key_18', 'cron', '50 50 16 01 06 ?', 'JobClass18', 'LOAD_TEST', b'0', 'load_test_18', 'admin', 1640777700000, 1640778700000, '100001100001', 'Schedule 18', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('25', 'key_25', 'cron', '52 27 11 20 05 ?', 'JobClass25', 'LOAD_TEST', b'1', 'load_test_25', 'admin', 1640778400000, 1640779400000, '100001100001', 'Schedule 25', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('4', 'key_4', 'cron', '49 33 11 02 06 ?', 'JobClass4', 'LOAD_TEST', b'1', 'load_test_4', 'admin', 1640776300000, 1640777300000, '100001100001', 'Schedule 4', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('12', 'key_12', 'cron', '19 22 11 20 05 ?', 'JobClass12', 'TEST_PLAN', b'0', 'test_plan_12', 'admin', 1640777100000, 1640778100000, '100001100001', 'Schedule 12', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('19', 'key_19', 'cron', '40 29 11 02 06 ?', 'JobClass19', 'TEST_PLAN', b'1', 'test_plan_19', 'admin', 1640777800000, 1640778800000, '100001100001', 'Schedule 19', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('26', 'key_26', 'cron', '55 27 11 20 05 ?', 'JobClass26', 'TEST_PLAN', b'1', 'test_plan_26', 'admin', 1640778500000, 1640779500000, '100001100001', 'Schedule 26', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('5', 'key_5', 'cron', '56 35 11 02 06 ?', 'JobClass5', 'TEST_PLAN', b'1', 'test_plan_5', 'admin', 1640776400000, 1640777400000, '100001100001', 'Schedule 5', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('10', 'key_10', 'cron', '50 15 10 20 05 ?', 'JobClass10', 'UI_SCENARIO', b'1', 'ui_scenario_10', 'admin', 1640776900000, 1640777900000, '100001100001', 'Schedule 10', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('17', 'key_17', 'cron', '59 46 16 01 06 ?', 'JobClass17', 'UI_SCENARIO', b'1', 'ui_scenario_17', 'admin', 1640777600000, 1640778600000, '100001100001', 'Schedule 17', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('24', 'key_24', 'cron', '19 22 11 20 05 ?', 'JobClass24', 'UI_SCENARIO', b'0', 'ui_scenario_24', 'admin', 1640778300000, 1640779300000, '100001100001', 'Schedule 24', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||||
|
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('3', 'key_3', 'cron', '50 50 16 01 06 ?', 'JobClass3', 'UI_SCENARIO', b'0', 'ui_scenario_3', 'admin', 1640776200000, 1640777200000, '100001100001', 'Schedule 3', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
Loading…
Reference in New Issue