refactor(项目管理): 重命名枚举名称

This commit is contained in:
wxg0103 2023-10-24 19:27:59 +08:00 committed by f2c-ci-robot[bot]
parent 7454357e58
commit 097ca36387
4 changed files with 16 additions and 16 deletions

View File

@ -1,6 +1,6 @@
package io.metersphere.sdk.constants;
public class ModuleType {
public class ApplicationScope {
public static final String API_TEST = "api_test";
public static final String UI_TEST = "ui_test";
public static final String LOAD_TEST = "load_test";

View File

@ -5,7 +5,7 @@ import io.metersphere.project.dto.ModuleDTO;
import io.metersphere.project.request.ProjectApplicationRequest;
import io.metersphere.project.service.ProjectApplicationService;
import io.metersphere.project.service.ProjectService;
import io.metersphere.sdk.constants.ModuleType;
import io.metersphere.sdk.constants.ApplicationScope;
import io.metersphere.sdk.constants.PermissionConstants;
import io.metersphere.sdk.constants.ProjectApplicationType;
import io.metersphere.sdk.dto.OptionDTO;
@ -85,7 +85,7 @@ public class ProjectApplicationController {
@Operation(summary = "UI测试-获取资源池列表")
@RequiresPermissions(PermissionConstants.PROJECT_APPLICATION_UI_READ)
public List<OptionDTO> getUiPoolOptions(@PathVariable String projectId) {
return projectService.getPoolOptions(projectId, ModuleType.UI_TEST);
return projectService.getPoolOptions(projectId, ApplicationScope.UI_TEST);
}
@ -152,7 +152,7 @@ public class ProjectApplicationController {
@Operation(summary = "接口测试-获取资源池列表")
@RequiresPermissions(PermissionConstants.PROJECT_APPLICATION_API_READ)
public List<OptionDTO> getApiPoolOptions(@PathVariable String projectId) {
return projectService.getPoolOptions(projectId, ModuleType.API_TEST);
return projectService.getPoolOptions(projectId, ApplicationScope.API_TEST);
}

View File

@ -9,7 +9,7 @@ import io.metersphere.project.mapper.ProjectMapper;
import io.metersphere.project.mapper.ProjectTestResourcePoolMapper;
import io.metersphere.project.request.ProjectSwitchRequest;
import io.metersphere.sdk.constants.InternalUserRole;
import io.metersphere.sdk.constants.ModuleType;
import io.metersphere.sdk.constants.ApplicationScope;
import io.metersphere.sdk.dto.OptionDTO;
import io.metersphere.sdk.dto.SessionUser;
import io.metersphere.sdk.dto.UserDTO;
@ -166,15 +166,15 @@ public class ProjectService {
criteria.andIdIn(poolIds).andEnableEqualTo(true).andDeletedEqualTo(false);
List<TestResourcePool> testResourcePools = new ArrayList<>();
testResourcePools = switch (type) {
case ModuleType.API_TEST-> {
case ApplicationScope.API_TEST-> {
criteria.andApiTestEqualTo(true);
yield testResourcePoolMapper.selectByExample(example);
}
case ModuleType.UI_TEST -> {
case ApplicationScope.UI_TEST -> {
criteria.andUiTestEqualTo(true);
yield testResourcePoolMapper.selectByExample(example);
}
case ModuleType.LOAD_TEST -> {
case ApplicationScope.LOAD_TEST -> {
criteria.andLoadTestEqualTo(true);
yield testResourcePoolMapper.selectByExample(example);
}

View File

@ -5,7 +5,7 @@ import io.metersphere.project.domain.Project;
import io.metersphere.project.domain.ProjectExample;
import io.metersphere.project.mapper.ProjectMapper;
import io.metersphere.project.request.ProjectSwitchRequest;
import io.metersphere.sdk.constants.ModuleType;
import io.metersphere.sdk.constants.ApplicationScope;
import io.metersphere.sdk.constants.PermissionConstants;
import io.metersphere.sdk.constants.SessionConstants;
import io.metersphere.sdk.dto.UserDTO;
@ -327,15 +327,15 @@ public class ProjectControllerTests extends BaseTest {
@Test
@Order(9)
public void testGetPoolOptions() throws Exception {
MvcResult mvcResult = this.responseGet(getPoolOptions + ModuleType.API_TEST + "/" + DEFAULT_PROJECT_ID);
mvcResult = this.responseGet(getPoolOptions + ModuleType.UI_TEST + "/" + DEFAULT_PROJECT_ID);
mvcResult = this.responseGet(getPoolOptions + ModuleType.LOAD_TEST + "/" + DEFAULT_PROJECT_ID);
MvcResult mvcResult = this.responseGet(getPoolOptions + ApplicationScope.API_TEST + "/" + DEFAULT_PROJECT_ID);
mvcResult = this.responseGet(getPoolOptions + ApplicationScope.UI_TEST + "/" + DEFAULT_PROJECT_ID);
mvcResult = this.responseGet(getPoolOptions + ApplicationScope.LOAD_TEST + "/" + DEFAULT_PROJECT_ID);
mvcResult = this.responseGet(getPoolOptions + "test" + "/" + DEFAULT_PROJECT_ID);
mvcResult = this.responseGet(getPoolOptions + ModuleType.API_TEST + "/" + "projectId");
mvcResult = this.responseGet(getPoolOptions + ModuleType.UI_TEST + "/" + "projectId");
mvcResult = this.responseGet(getPoolOptions + ModuleType.LOAD_TEST + "/" + "projectId");
mvcResult = this.responseGet(getPoolOptions + ApplicationScope.API_TEST + "/" + "projectId");
mvcResult = this.responseGet(getPoolOptions + ApplicationScope.UI_TEST + "/" + "projectId");
mvcResult = this.responseGet(getPoolOptions + ApplicationScope.LOAD_TEST + "/" + "projectId");
//项目不存在
this.responseGet(getPoolOptions + ModuleType.LOAD_TEST + "/" + "projectId20", status().is5xxServerError());
this.responseGet(getPoolOptions + ApplicationScope.LOAD_TEST + "/" + "projectId20", status().is5xxServerError());
//权限校验
requestGetPermissionTest(PermissionConstants.PROJECT_BASE_INFO_READ, getPoolOptions + "api_test" + "/" + DEFAULT_PROJECT_ID);