refactor(系统设置): 优化项目查询资源池
This commit is contained in:
parent
015065282f
commit
83e8f78e6c
|
@ -4,23 +4,20 @@ package io.metersphere.system.controller;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import io.metersphere.sdk.constants.PermissionConstants;
|
import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
import io.metersphere.system.dto.sdk.OptionDTO;
|
|
||||||
import io.metersphere.system.dto.user.UserExtendDTO;
|
|
||||||
import io.metersphere.system.security.CheckOwner;
|
|
||||||
import io.metersphere.system.utils.PageUtils;
|
|
||||||
import io.metersphere.system.utils.Pager;
|
|
||||||
import io.metersphere.system.dto.AddProjectRequest;
|
import io.metersphere.system.dto.AddProjectRequest;
|
||||||
import io.metersphere.system.dto.ProjectDTO;
|
import io.metersphere.system.dto.ProjectDTO;
|
||||||
import io.metersphere.system.dto.UpdateProjectNameRequest;
|
import io.metersphere.system.dto.UpdateProjectNameRequest;
|
||||||
import io.metersphere.system.dto.UpdateProjectRequest;
|
import io.metersphere.system.dto.UpdateProjectRequest;
|
||||||
|
import io.metersphere.system.dto.request.*;
|
||||||
|
import io.metersphere.system.dto.sdk.OptionDTO;
|
||||||
|
import io.metersphere.system.dto.user.UserExtendDTO;
|
||||||
import io.metersphere.system.log.annotation.Log;
|
import io.metersphere.system.log.annotation.Log;
|
||||||
import io.metersphere.system.log.constants.OperationLogType;
|
import io.metersphere.system.log.constants.OperationLogType;
|
||||||
import io.metersphere.system.dto.request.OrganizationProjectRequest;
|
import io.metersphere.system.security.CheckOwner;
|
||||||
import io.metersphere.system.dto.request.ProjectAddMemberBatchRequest;
|
|
||||||
import io.metersphere.system.dto.request.ProjectAddMemberRequest;
|
|
||||||
import io.metersphere.system.dto.request.ProjectMemberRequest;
|
|
||||||
import io.metersphere.system.service.OrganizationProjectLogService;
|
import io.metersphere.system.service.OrganizationProjectLogService;
|
||||||
import io.metersphere.system.service.OrganizationProjectService;
|
import io.metersphere.system.service.OrganizationProjectService;
|
||||||
|
import io.metersphere.system.utils.PageUtils;
|
||||||
|
import io.metersphere.system.utils.Pager;
|
||||||
import io.metersphere.system.utils.SessionUtils;
|
import io.metersphere.system.utils.SessionUtils;
|
||||||
import io.metersphere.validation.groups.Created;
|
import io.metersphere.validation.groups.Created;
|
||||||
import io.metersphere.validation.groups.Updated;
|
import io.metersphere.validation.groups.Updated;
|
||||||
|
@ -168,11 +165,11 @@ public class OrganizationProjectController {
|
||||||
return organizationProjectService.getUserMemberList(organizationId, projectId, keyword);
|
return organizationProjectService.getUserMemberList(organizationId, projectId, keyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/pool-options/{organizationId}")
|
@PostMapping("/pool-options")
|
||||||
@Operation(summary = "系统设置-组织-项目-获取资源池下拉选项")
|
@Operation(summary = "系统设置-组织-项目-获取资源池下拉选项")
|
||||||
@RequiresPermissions(PermissionConstants.ORGANIZATION_PROJECT_READ)
|
@RequiresPermissions(PermissionConstants.ORGANIZATION_PROJECT_READ)
|
||||||
public List<OptionDTO> getProjectOptions(@PathVariable String organizationId) {
|
public List<OptionDTO> getProjectOptions(@Validated @RequestBody ProjectPoolRequest request) {
|
||||||
return organizationProjectService.getTestResourcePoolOptions(organizationId);
|
return organizationProjectService.getTestResourcePoolOptions(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/rename")
|
@PostMapping("/rename")
|
||||||
|
|
|
@ -4,25 +4,22 @@ package io.metersphere.system.controller;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import io.metersphere.sdk.constants.PermissionConstants;
|
import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
import io.metersphere.system.dto.sdk.OptionDTO;
|
|
||||||
import io.metersphere.system.dto.user.UserExtendDTO;
|
|
||||||
import io.metersphere.system.security.CheckOwner;
|
|
||||||
import io.metersphere.system.utils.PageUtils;
|
|
||||||
import io.metersphere.system.utils.Pager;
|
|
||||||
import io.metersphere.system.domain.User;
|
import io.metersphere.system.domain.User;
|
||||||
import io.metersphere.system.dto.AddProjectRequest;
|
import io.metersphere.system.dto.AddProjectRequest;
|
||||||
import io.metersphere.system.dto.ProjectDTO;
|
import io.metersphere.system.dto.ProjectDTO;
|
||||||
import io.metersphere.system.dto.UpdateProjectNameRequest;
|
import io.metersphere.system.dto.UpdateProjectNameRequest;
|
||||||
import io.metersphere.system.dto.UpdateProjectRequest;
|
import io.metersphere.system.dto.UpdateProjectRequest;
|
||||||
|
import io.metersphere.system.dto.request.*;
|
||||||
|
import io.metersphere.system.dto.sdk.OptionDTO;
|
||||||
|
import io.metersphere.system.dto.user.UserExtendDTO;
|
||||||
import io.metersphere.system.log.annotation.Log;
|
import io.metersphere.system.log.annotation.Log;
|
||||||
import io.metersphere.system.log.constants.OperationLogType;
|
import io.metersphere.system.log.constants.OperationLogType;
|
||||||
import io.metersphere.system.dto.request.ProjectAddMemberBatchRequest;
|
import io.metersphere.system.security.CheckOwner;
|
||||||
import io.metersphere.system.dto.request.ProjectAddMemberRequest;
|
|
||||||
import io.metersphere.system.dto.request.ProjectMemberRequest;
|
|
||||||
import io.metersphere.system.dto.request.ProjectRequest;
|
|
||||||
import io.metersphere.system.service.SystemProjectLogService;
|
import io.metersphere.system.service.SystemProjectLogService;
|
||||||
import io.metersphere.system.service.SystemProjectService;
|
import io.metersphere.system.service.SystemProjectService;
|
||||||
import io.metersphere.system.service.UserService;
|
import io.metersphere.system.service.UserService;
|
||||||
|
import io.metersphere.system.utils.PageUtils;
|
||||||
|
import io.metersphere.system.utils.Pager;
|
||||||
import io.metersphere.system.utils.SessionUtils;
|
import io.metersphere.system.utils.SessionUtils;
|
||||||
import io.metersphere.validation.groups.Created;
|
import io.metersphere.validation.groups.Created;
|
||||||
import io.metersphere.validation.groups.Updated;
|
import io.metersphere.validation.groups.Updated;
|
||||||
|
@ -164,11 +161,11 @@ public class SystemProjectController {
|
||||||
return userService.getUserList(keyword);
|
return userService.getUserList(keyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/pool-options")
|
@PostMapping("/pool-options")
|
||||||
@Operation(summary = "系统设置-系统-组织与项目-项目-获取资源池下拉选项")
|
@Operation(summary = "系统设置-系统-组织与项目-项目-获取资源池下拉选项")
|
||||||
@RequiresPermissions(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ)
|
@RequiresPermissions(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ)
|
||||||
public List<OptionDTO> getProjectOptions(@RequestParam(value = "organizationId",required = false) String organizationId) {
|
public List<OptionDTO> getProjectOptions(@Validated @RequestBody ProjectPoolRequest request) {
|
||||||
return systemProjectService.getTestResourcePoolOptions(organizationId);
|
return systemProjectService.getTestResourcePoolOptions(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/rename")
|
@PostMapping("/rename")
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package io.metersphere.system.dto.request;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ProjectPoolRequest implements Serializable {
|
||||||
|
@Schema(description = "组织id")
|
||||||
|
@Size(min = 0, max = 50, message = "project.organization_id.length_range")
|
||||||
|
private String organizationId;
|
||||||
|
|
||||||
|
@Schema(description = "项目开启的模块id集合")
|
||||||
|
@NotEmpty
|
||||||
|
private List<String> modulesIds;
|
||||||
|
}
|
|
@ -18,6 +18,7 @@ import io.metersphere.sdk.util.Translator;
|
||||||
import io.metersphere.system.domain.*;
|
import io.metersphere.system.domain.*;
|
||||||
import io.metersphere.system.dto.*;
|
import io.metersphere.system.dto.*;
|
||||||
import io.metersphere.system.dto.request.ProjectAddMemberBatchRequest;
|
import io.metersphere.system.dto.request.ProjectAddMemberBatchRequest;
|
||||||
|
import io.metersphere.system.dto.request.ProjectPoolRequest;
|
||||||
import io.metersphere.system.dto.sdk.OptionDTO;
|
import io.metersphere.system.dto.sdk.OptionDTO;
|
||||||
import io.metersphere.system.dto.user.UserExtendDTO;
|
import io.metersphere.system.dto.user.UserExtendDTO;
|
||||||
import io.metersphere.system.invoker.ProjectServiceInvoker;
|
import io.metersphere.system.invoker.ProjectServiceInvoker;
|
||||||
|
@ -74,6 +75,9 @@ public class CommonProjectService {
|
||||||
@Resource
|
@Resource
|
||||||
private TestResourcePoolService testResourcePoolService;
|
private TestResourcePoolService testResourcePoolService;
|
||||||
public static final Integer DEFAULT_REMAIN_DAY_COUNT = 30;
|
public static final Integer DEFAULT_REMAIN_DAY_COUNT = 30;
|
||||||
|
public static final String API_TEST = "apiTest";
|
||||||
|
public static final String UI_TEST = "uiTest";
|
||||||
|
public static final String LOAD_TEST = "loadTest";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public CommonProjectService(ProjectServiceInvoker serviceInvoker) {
|
public CommonProjectService(ProjectServiceInvoker serviceInvoker) {
|
||||||
|
@ -612,12 +616,13 @@ public class CommonProjectService {
|
||||||
projectMapper.updateByPrimaryKeySelective(project);
|
projectMapper.updateByPrimaryKeySelective(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OptionDTO> getTestResourcePoolOptions(String organizationId) {
|
public List<OptionDTO> getTestResourcePoolOptions(ProjectPoolRequest request) {
|
||||||
|
List<OptionDTO> optionDTOS = new ArrayList<>();
|
||||||
//获取制定组织的资源池 和全部组织的资源池
|
//获取制定组织的资源池 和全部组织的资源池
|
||||||
List<TestResourcePool> testResourcePools = new ArrayList<>();
|
List<TestResourcePool> testResourcePools = new ArrayList<>();
|
||||||
if (StringUtils.isNotBlank(organizationId)) {
|
if (StringUtils.isNotBlank(request.getOrganizationId())) {
|
||||||
TestResourcePoolOrganizationExample example = new TestResourcePoolOrganizationExample();
|
TestResourcePoolOrganizationExample example = new TestResourcePoolOrganizationExample();
|
||||||
example.createCriteria().andOrgIdEqualTo(organizationId);
|
example.createCriteria().andOrgIdEqualTo(request.getOrganizationId());
|
||||||
List<TestResourcePoolOrganization> orgPools = testResourcePoolOrganizationMapper.selectByExample(example);
|
List<TestResourcePoolOrganization> orgPools = testResourcePoolOrganizationMapper.selectByExample(example);
|
||||||
if (CollectionUtils.isNotEmpty(orgPools)) {
|
if (CollectionUtils.isNotEmpty(orgPools)) {
|
||||||
List<String> poolIds = orgPools.stream().map(TestResourcePoolOrganization::getTestResourcePoolId).toList();
|
List<String> poolIds = orgPools.stream().map(TestResourcePoolOrganization::getTestResourcePoolId).toList();
|
||||||
|
@ -632,9 +637,19 @@ public class CommonProjectService {
|
||||||
testResourcePools.addAll(testResourcePoolMapper.selectByExample(poolExample));
|
testResourcePools.addAll(testResourcePoolMapper.selectByExample(poolExample));
|
||||||
|
|
||||||
testResourcePools = testResourcePools.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
testResourcePools = testResourcePools.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||||
return testResourcePools.stream().map(testResourcePool ->
|
//这里需要获取项目开启的模块 判断资源池开启的使用范围的模块是否在项目开启的模块中
|
||||||
new OptionDTO(testResourcePool.getId(), testResourcePool.getName())
|
List<String> moduleIds = request.getModulesIds();
|
||||||
).toList();
|
testResourcePools.forEach(pool -> {
|
||||||
|
if ((moduleIds.contains(API_TEST) && pool.getApiTest()) ||
|
||||||
|
(moduleIds.contains(LOAD_TEST) && pool.getLoadTest()) ||
|
||||||
|
(moduleIds.contains(UI_TEST) && pool.getUiTest())) {
|
||||||
|
OptionDTO optionDTO = new OptionDTO();
|
||||||
|
optionDTO.setId(pool.getId());
|
||||||
|
optionDTO.setName(pool.getName());
|
||||||
|
optionDTOS.add(optionDTO);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return optionDTOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rename(UpdateProjectNameRequest request, String userId) {
|
public void rename(UpdateProjectNameRequest request, String userId) {
|
||||||
|
@ -653,6 +668,7 @@ public class CommonProjectService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验该项目是否有权限使用该资源池
|
* 校验该项目是否有权限使用该资源池
|
||||||
|
*
|
||||||
* @param resourcePool
|
* @param resourcePool
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -683,6 +699,7 @@ public class CommonProjectService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 剩余天数
|
* 剩余天数
|
||||||
|
*
|
||||||
* @param deleteTime 删除时间
|
* @param deleteTime 删除时间
|
||||||
* @return 剩余天数
|
* @return 剩余天数
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package io.metersphere.system.service;
|
package io.metersphere.system.service;
|
||||||
|
|
||||||
import io.metersphere.system.dto.sdk.OptionDTO;
|
|
||||||
import io.metersphere.system.dto.user.UserExtendDTO;
|
|
||||||
import io.metersphere.sdk.exception.MSException;
|
import io.metersphere.sdk.exception.MSException;
|
||||||
import io.metersphere.sdk.util.BeanUtils;
|
import io.metersphere.sdk.util.BeanUtils;
|
||||||
import io.metersphere.sdk.util.Translator;
|
import io.metersphere.sdk.util.Translator;
|
||||||
|
@ -11,15 +9,14 @@ import io.metersphere.system.dto.AddProjectRequest;
|
||||||
import io.metersphere.system.dto.ProjectDTO;
|
import io.metersphere.system.dto.ProjectDTO;
|
||||||
import io.metersphere.system.dto.UpdateProjectNameRequest;
|
import io.metersphere.system.dto.UpdateProjectNameRequest;
|
||||||
import io.metersphere.system.dto.UpdateProjectRequest;
|
import io.metersphere.system.dto.UpdateProjectRequest;
|
||||||
|
import io.metersphere.system.dto.request.*;
|
||||||
|
import io.metersphere.system.dto.sdk.OptionDTO;
|
||||||
|
import io.metersphere.system.dto.user.UserExtendDTO;
|
||||||
import io.metersphere.system.log.constants.OperationLogModule;
|
import io.metersphere.system.log.constants.OperationLogModule;
|
||||||
import io.metersphere.system.log.constants.OperationLogType;
|
import io.metersphere.system.log.constants.OperationLogType;
|
||||||
import io.metersphere.system.mapper.ExtSystemProjectMapper;
|
import io.metersphere.system.mapper.ExtSystemProjectMapper;
|
||||||
import io.metersphere.system.mapper.OrganizationMapper;
|
import io.metersphere.system.mapper.OrganizationMapper;
|
||||||
import io.metersphere.system.mapper.UserRoleRelationMapper;
|
import io.metersphere.system.mapper.UserRoleRelationMapper;
|
||||||
import io.metersphere.system.dto.request.OrganizationProjectRequest;
|
|
||||||
import io.metersphere.system.dto.request.ProjectAddMemberBatchRequest;
|
|
||||||
import io.metersphere.system.dto.request.ProjectMemberRequest;
|
|
||||||
import io.metersphere.system.dto.request.ProjectRequest;
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -131,8 +128,8 @@ public class OrganizationProjectService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OptionDTO> getTestResourcePoolOptions(String organizationId) {
|
public List<OptionDTO> getTestResourcePoolOptions(ProjectPoolRequest request) {
|
||||||
return commonProjectService.getTestResourcePoolOptions(organizationId);
|
return commonProjectService.getTestResourcePoolOptions(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rename(UpdateProjectNameRequest project, String userId) {
|
public void rename(UpdateProjectNameRequest project, String userId) {
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
package io.metersphere.system.service;
|
package io.metersphere.system.service;
|
||||||
|
|
||||||
import io.metersphere.project.domain.Project;
|
import io.metersphere.project.domain.Project;
|
||||||
import io.metersphere.system.dto.sdk.OptionDTO;
|
|
||||||
import io.metersphere.system.dto.user.UserExtendDTO;
|
|
||||||
import io.metersphere.sdk.util.Translator;
|
import io.metersphere.sdk.util.Translator;
|
||||||
import io.metersphere.system.dto.*;
|
import io.metersphere.system.dto.*;
|
||||||
|
import io.metersphere.system.dto.request.ProjectAddMemberBatchRequest;
|
||||||
|
import io.metersphere.system.dto.request.ProjectMemberRequest;
|
||||||
|
import io.metersphere.system.dto.request.ProjectPoolRequest;
|
||||||
|
import io.metersphere.system.dto.request.ProjectRequest;
|
||||||
|
import io.metersphere.system.dto.sdk.OptionDTO;
|
||||||
|
import io.metersphere.system.dto.user.UserExtendDTO;
|
||||||
import io.metersphere.system.log.constants.OperationLogModule;
|
import io.metersphere.system.log.constants.OperationLogModule;
|
||||||
import io.metersphere.system.log.constants.OperationLogType;
|
import io.metersphere.system.log.constants.OperationLogType;
|
||||||
import io.metersphere.system.mapper.ExtSystemProjectMapper;
|
import io.metersphere.system.mapper.ExtSystemProjectMapper;
|
||||||
import io.metersphere.system.dto.request.ProjectAddMemberBatchRequest;
|
|
||||||
import io.metersphere.system.dto.request.ProjectMemberRequest;
|
|
||||||
import io.metersphere.system.dto.request.ProjectRequest;
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -96,8 +97,8 @@ public class SystemProjectService {
|
||||||
commonProjectService.disable(id, updateUser);
|
commonProjectService.disable(id, updateUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OptionDTO> getTestResourcePoolOptions(String organizationId) {
|
public List<OptionDTO> getTestResourcePoolOptions(ProjectPoolRequest request) {
|
||||||
return commonProjectService.getTestResourcePoolOptions(organizationId);
|
return commonProjectService.getTestResourcePoolOptions(request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ import io.metersphere.system.dto.*;
|
||||||
import io.metersphere.system.dto.request.OrganizationProjectRequest;
|
import io.metersphere.system.dto.request.OrganizationProjectRequest;
|
||||||
import io.metersphere.system.dto.request.ProjectAddMemberRequest;
|
import io.metersphere.system.dto.request.ProjectAddMemberRequest;
|
||||||
import io.metersphere.system.dto.request.ProjectMemberRequest;
|
import io.metersphere.system.dto.request.ProjectMemberRequest;
|
||||||
|
import io.metersphere.system.dto.request.ProjectPoolRequest;
|
||||||
import io.metersphere.system.dto.user.UserDTO;
|
import io.metersphere.system.dto.user.UserDTO;
|
||||||
import io.metersphere.system.dto.user.UserExtendDTO;
|
import io.metersphere.system.dto.user.UserExtendDTO;
|
||||||
import io.metersphere.system.invoker.ProjectServiceInvoker;
|
import io.metersphere.system.invoker.ProjectServiceInvoker;
|
||||||
|
@ -128,6 +129,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn();
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void responseGet(String url, ResultMatcher resultMatcher) throws Exception {
|
private void responseGet(String url, ResultMatcher resultMatcher) throws Exception {
|
||||||
mockMvc.perform(MockMvcRequestBuilders.get(url)
|
mockMvc.perform(MockMvcRequestBuilders.get(url)
|
||||||
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
||||||
|
@ -148,6 +150,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void compareProjectDTO(Project currentProject, Project result) {
|
public static void compareProjectDTO(Project currentProject, Project result) {
|
||||||
Assertions.assertNotNull(currentProject);
|
Assertions.assertNotNull(currentProject);
|
||||||
Assertions.assertNotNull(result);
|
Assertions.assertNotNull(result);
|
||||||
|
@ -173,6 +176,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
||||||
addProjectDTO.setUserIds(userIds);
|
addProjectDTO.setUserIds(userIds);
|
||||||
return addProjectDTO;
|
return addProjectDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UpdateProjectRequest generatorUpdate(String organizationId,
|
public UpdateProjectRequest generatorUpdate(String organizationId,
|
||||||
String projectId,
|
String projectId,
|
||||||
String name,
|
String name,
|
||||||
|
@ -285,6 +289,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
||||||
serviceInvoker.invokeCreateServices(initProject.getId());
|
serviceInvoker.invokeCreateServices(initProject.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(1)
|
@Order(1)
|
||||||
@Sql(scripts = {"/dml/init_org_project.sql"},
|
@Sql(scripts = {"/dml/init_org_project.sql"},
|
||||||
|
@ -391,7 +396,6 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
||||||
Assertions.assertTrue(projectTestResourcePools.stream().map(ProjectTestResourcePool::getTestResourcePoolId).toList().contains("resourcePoolId"));
|
Assertions.assertTrue(projectTestResourcePools.stream().map(ProjectTestResourcePool::getTestResourcePoolId).toList().contains("resourcePoolId"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
project.setName("organization-testAddProjectSuccess1");
|
project.setName("organization-testAddProjectSuccess1");
|
||||||
project.setOrganizationId(getDefault().getId());
|
project.setOrganizationId(getDefault().getId());
|
||||||
// @@校验权限
|
// @@校验权限
|
||||||
|
@ -424,6 +428,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
||||||
this.requestPost(addProject, project, ERROR_REQUEST_MATCHER);
|
this.requestPost(addProject, project, ERROR_REQUEST_MATCHER);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(3)
|
@Order(3)
|
||||||
public void testGetProject() throws Exception {
|
public void testGetProject() throws Exception {
|
||||||
|
@ -448,6 +453,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
||||||
// @@校验权限
|
// @@校验权限
|
||||||
requestGetPermissionTest(PermissionConstants.ORGANIZATION_PROJECT_READ, getProject + projectId);
|
requestGetPermissionTest(PermissionConstants.ORGANIZATION_PROJECT_READ, getProject + projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(4)
|
@Order(4)
|
||||||
public void testGetProjectError() throws Exception {
|
public void testGetProjectError() throws Exception {
|
||||||
|
@ -959,9 +965,12 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
@Order(23)
|
@Order(23)
|
||||||
public void testGetOptions() throws Exception {
|
public void testGetOptions() throws Exception {
|
||||||
this.requestGetWithOkAndReturn(getPoolOptions + "organizationId");
|
ProjectPoolRequest projectPoolRequest = new ProjectPoolRequest();
|
||||||
|
projectPoolRequest.setModulesIds(List.of("apiTest", "uiTest", "loadTest"));
|
||||||
|
projectPoolRequest.setOrganizationId(DEFAULT_ORGANIZATION_ID);
|
||||||
|
this.responsePost(getPoolOptions, projectPoolRequest);
|
||||||
// @@校验权限
|
// @@校验权限
|
||||||
requestGetPermissionTest(PermissionConstants.ORGANIZATION_PROJECT_READ, getPoolOptions + DEFAULT_ORGANIZATION_ID);
|
requestPostPermissionTest(PermissionConstants.ORGANIZATION_PROJECT_READ, getPoolOptions, projectPoolRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -149,6 +149,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn();
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void responseGet(String url, ResultMatcher resultMatcher) throws Exception {
|
private void responseGet(String url, ResultMatcher resultMatcher) throws Exception {
|
||||||
mockMvc.perform(MockMvcRequestBuilders.get(url)
|
mockMvc.perform(MockMvcRequestBuilders.get(url)
|
||||||
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
||||||
|
@ -169,6 +170,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void compareProjectDTO(Project currentProject, Project result) {
|
public static void compareProjectDTO(Project currentProject, Project result) {
|
||||||
Assertions.assertNotNull(currentProject);
|
Assertions.assertNotNull(currentProject);
|
||||||
Assertions.assertNotNull(result);
|
Assertions.assertNotNull(result);
|
||||||
|
@ -194,6 +196,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
||||||
addProjectDTO.setUserIds(userIds);
|
addProjectDTO.setUserIds(userIds);
|
||||||
return addProjectDTO;
|
return addProjectDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UpdateProjectRequest generatorUpdate(String organizationId,
|
public UpdateProjectRequest generatorUpdate(String organizationId,
|
||||||
String projectId,
|
String projectId,
|
||||||
String name,
|
String name,
|
||||||
|
@ -308,6 +311,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
||||||
serviceInvoker.invokeCreateServices(initProject.getId());
|
serviceInvoker.invokeCreateServices(initProject.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(1)
|
@Order(1)
|
||||||
/**
|
/**
|
||||||
|
@ -624,6 +628,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
||||||
this.requestPost(addProject, project, ERROR_REQUEST_MATCHER);
|
this.requestPost(addProject, project, ERROR_REQUEST_MATCHER);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(3)
|
@Order(3)
|
||||||
public void testGetProject() throws Exception {
|
public void testGetProject() throws Exception {
|
||||||
|
@ -643,6 +648,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
||||||
// @@校验权限
|
// @@校验权限
|
||||||
requestGetPermissionTest(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ, getProject + projectId);
|
requestGetPermissionTest(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ, getProject + projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(4)
|
@Order(4)
|
||||||
public void testGetProjectError() throws Exception {
|
public void testGetProjectError() throws Exception {
|
||||||
|
@ -894,7 +900,6 @@ public class SystemProjectControllerTests extends BaseTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(13)
|
@Order(13)
|
||||||
public void testAddProjectMember() throws Exception {
|
public void testAddProjectMember() throws Exception {
|
||||||
|
@ -1091,10 +1096,13 @@ public class SystemProjectControllerTests extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
@Order(22)
|
@Order(22)
|
||||||
public void testGetOptions() throws Exception {
|
public void testGetOptions() throws Exception {
|
||||||
this.requestGetWithOkAndReturn(getPoolOptions);
|
ProjectPoolRequest projectPoolRequest = new ProjectPoolRequest();
|
||||||
this.requestGetWithOkAndReturn(getPoolOptions + "?organizationId=" + DEFAULT_ORGANIZATION_ID);
|
projectPoolRequest.setModulesIds(List.of("apiTest", "uiTest", "loadTest"));
|
||||||
|
this.responsePost(getPoolOptions, projectPoolRequest);
|
||||||
|
projectPoolRequest.setOrganizationId(DEFAULT_ORGANIZATION_ID);
|
||||||
|
this.responsePost(getPoolOptions, projectPoolRequest);
|
||||||
// @@校验权限
|
// @@校验权限
|
||||||
requestGetPermissionTest(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ, getPoolOptions + "?organizationId=" + DEFAULT_ORGANIZATION_ID);
|
requestPostPermissionTest(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ, getPoolOptions, projectPoolRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue