diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java index cc6f4fce52..9b5ce28b4a 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java @@ -46,7 +46,7 @@ public enum Status { DATASOURCE_EXIST(10015, "data source name already exists", "数据源名称已存在"), DATASOURCE_CONNECT_FAILED(10016, "data source connection failed", "建立数据源连接失败"), TENANT_NOT_EXIST(10017, "tenant not exists", "租户不存在"), - PROJECT_NOT_FOUNT(10018, "project {0} not found ", "项目[{0}]不存在"), + PROJECT_NOT_FOUND(10018, "project {0} not found ", "项目[{0}]不存在"), PROJECT_ALREADY_EXISTS(10019, "project {0} already exists", "项目名称[{0}]已存在"), TASK_INSTANCE_NOT_EXISTS(10020, "task instance {0} does not exist", "任务实例[{0}]不存在"), TASK_INSTANCE_NOT_SUB_WORKFLOW_INSTANCE(10021, "task instance {0} is not sub process instance", "任务实例[{0}]不是子流程实例"), @@ -214,6 +214,7 @@ public enum Status { CURRENT_LOGIN_USER_TENANT_NOT_EXIST(10181, "the tenant of the currently login user is not specified", "未指定当前登录用户的租户"), REVOKE_PROJECT_ERROR(10182, "revoke project error", "撤销项目授权错误"), QUERY_AUTHORIZED_USER(10183, "query authorized user error", "查询拥有项目权限的用户错误"), + PROJECT_NOT_EXIST(10190, "This project was not found. Please refresh page.", "该项目不存在,请刷新页面"), UDF_FUNCTION_NOT_EXIST(20001, "UDF function not found", "UDF函数不存在"), UDF_FUNCTION_EXISTS(20002, "UDF function already exists", "UDF函数已存在"), diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java index 3579cd8ade..f608af31c0 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java @@ -166,7 +166,7 @@ public class ProjectServiceImpl extends BaseServiceImpl implements ProjectServic public Map checkProjectAndAuth(User loginUser, Project project, long projectCode) { Map result = new HashMap<>(); if (project == null) { - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_EXIST); } else if (!checkReadPermission(loginUser, project)) { // check read permission putMsg(result, Status.USER_NO_OPERATION_PROJECT_PERM, loginUser.getUserName(), projectCode); @@ -180,7 +180,7 @@ public class ProjectServiceImpl extends BaseServiceImpl implements ProjectServic public boolean hasProjectAndPerm(User loginUser, Project project, Map result) { boolean checkResult = false; if (project == null) { - putMsg(result, Status.PROJECT_NOT_FOUNT, ""); + putMsg(result, Status.PROJECT_NOT_FOUND, ""); } else if (!checkReadPermission(loginUser, project)) { putMsg(result, Status.USER_NO_OPERATION_PROJECT_PERM, loginUser.getUserName(), project.getCode()); } else { @@ -193,7 +193,7 @@ public class ProjectServiceImpl extends BaseServiceImpl implements ProjectServic public boolean hasProjectAndPerm(User loginUser, Project project, Result result) { boolean checkResult = false; if (project == null) { - putMsg(result, Status.PROJECT_NOT_FOUNT, ""); + putMsg(result, Status.PROJECT_NOT_FOUND, ""); } else if (!checkReadPermission(loginUser, project)) { putMsg(result, Status.USER_NO_OPERATION_PROJECT_PERM, loginUser.getUserName(), project.getName()); } else { diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java index 2c65c40d24..fd9561bdf6 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java @@ -59,7 +59,6 @@ import org.apache.commons.lang.StringUtils; import java.io.IOException; import java.text.MessageFormat; -import java.util.Arrays; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; @@ -602,7 +601,7 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService { // 2. check if project is existed Project project = this.projectMapper.queryByCode(projectCode); if (project == null) { - this.putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + this.putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); return result; } @@ -653,7 +652,7 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService { // 3. check if project is existed Project project = this.projectMapper.queryByCode(projectCode); if (project == null) { - this.putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + this.putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); return result; } diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkFlowLineageServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkFlowLineageServiceImpl.java index 1367de7d96..e3ee534c5e 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkFlowLineageServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkFlowLineageServiceImpl.java @@ -70,7 +70,7 @@ public class WorkFlowLineageServiceImpl extends BaseServiceImpl implements WorkF Map result = new HashMap<>(); Project project = projectMapper.queryByCode(projectCode); if (project == null) { - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); return result; } List workFlowLineageList = workFlowLineageMapper.queryWorkFlowLineageByName(projectCode, workFlowName); @@ -84,7 +84,7 @@ public class WorkFlowLineageServiceImpl extends BaseServiceImpl implements WorkF Map result = new HashMap<>(); Project project = projectMapper.queryByCode(projectCode); if (project == null) { - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); return result; } Map workFlowLineagesMap = new HashMap<>(); @@ -133,7 +133,7 @@ public class WorkFlowLineageServiceImpl extends BaseServiceImpl implements WorkF Map result = new HashMap<>(); Project project = projectMapper.queryByCode(projectCode); if (project == null) { - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); return result; } List processLineages = workFlowLineageMapper.queryProcessLineage(projectCode); diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceControllerTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceControllerTest.java index 7bafb59f3f..7862e0a960 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceControllerTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceControllerTest.java @@ -85,7 +85,7 @@ public class ProcessInstanceControllerTest extends AbstractControllerTest { @Test public void testQueryTaskListByProcessId() throws Exception { Map mockResult = new HashMap<>(); - mockResult.put(Constants.STATUS, Status.PROJECT_NOT_FOUNT); + mockResult.put(Constants.STATUS, Status.PROJECT_NOT_FOUND); PowerMockito.when(processInstanceService.queryTaskListByProcessId(Mockito.any(), Mockito.anyLong(), Mockito.any())) .thenReturn(mockResult); @@ -97,7 +97,7 @@ public class ProcessInstanceControllerTest extends AbstractControllerTest { Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertNotNull(result); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT.getCode(), result.getCode().intValue()); + Assert.assertEquals(Status.PROJECT_NOT_FOUND.getCode(), result.getCode().intValue()); } @Test diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/enums/StatusTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/enums/StatusTest.java index d0c1de1205..19b0926fbd 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/enums/StatusTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/enums/StatusTest.java @@ -51,6 +51,6 @@ public class StatusTest { // SUCCESS optional = Status.findStatusBy(10018); Assert.assertTrue(optional.isPresent()); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, optional.get()); + Assert.assertEquals(Status.PROJECT_NOT_FOUND, optional.get()); } } diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/BaseServiceTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/BaseServiceTest.java index 8815e4c21d..f51d3e3dc6 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/BaseServiceTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/BaseServiceTest.java @@ -82,7 +82,7 @@ public class BaseServiceTest { baseService.putMsg(result, Status.SUCCESS); Assert.assertEquals(Status.SUCCESS,result.get(Constants.STATUS)); //has params - baseService.putMsg(result, Status.PROJECT_NOT_FOUNT,"test"); + baseService.putMsg(result, Status.PROJECT_NOT_FOUND,"test"); } @@ -93,7 +93,7 @@ public class BaseServiceTest { baseService.putMsg(result, Status.SUCCESS); Assert.assertEquals(Status.SUCCESS.getMsg(),result.getMsg()); //has params - baseService.putMsg(result,Status.PROJECT_NOT_FOUNT,"test"); + baseService.putMsg(result,Status.PROJECT_NOT_FOUND,"test"); } @Test diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java index f93b30a580..aed7161e56 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java @@ -146,10 +146,10 @@ public class DataAnalysisServiceTest { // checkProject false Map failResult = new HashMap<>(); - putMsg(failResult, Status.PROJECT_NOT_FOUNT, 1); + putMsg(failResult, Status.PROJECT_NOT_FOUND, 1); Mockito.when(projectService.checkProjectAndAuth(any(), any(), anyLong())).thenReturn(failResult); failResult = dataAnalysisServiceImpl.countTaskStateByProject(user, 1, startDate, endDate); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, failResult.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_FOUND, failResult.get(Constants.STATUS)); } @Test @@ -220,10 +220,10 @@ public class DataAnalysisServiceTest { //checkProject false Map failResult = new HashMap<>(); - putMsg(failResult, Status.PROJECT_NOT_FOUNT, 1); + putMsg(failResult, Status.PROJECT_NOT_FOUND, 1); Mockito.when(projectService.checkProjectAndAuth(any(), any(), anyLong())).thenReturn(failResult); failResult = dataAnalysisServiceImpl.countProcessInstanceStateByProject(user, 1, startDate, endDate); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, failResult.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_FOUND, failResult.get(Constants.STATUS)); Map result = new HashMap<>(); putMsg(result, Status.SUCCESS, null); diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java index ca1a6d45a7..e3f77b0ea1 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java @@ -127,12 +127,12 @@ public class ProcessDefinitionServiceTest { loginUser.setUserType(UserType.GENERAL_USER); Map result = new HashMap<>(); - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); //project not found Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); Map map = processDefinitionService.queryProcessDefinitionList(loginUser, projectCode); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS)); //project check auth success putMsg(result, Status.SUCCESS, projectCode); @@ -157,12 +157,12 @@ public class ProcessDefinitionServiceTest { loginUser.setUserType(UserType.GENERAL_USER); Map result = new HashMap<>(); - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); //project not found Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); Result map = processDefinitionService.queryProcessDefinitionListPaging(loginUser, projectCode, "", 1, 5, 0); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT.getCode(), (int) map.getCode()); + Assert.assertEquals(Status.PROJECT_NOT_FOUND.getCode(), (int) map.getCode()); putMsg(result, Status.SUCCESS, projectCode); loginUser.setId(1); @@ -196,12 +196,12 @@ public class ProcessDefinitionServiceTest { tenant.setId(1); tenant.setTenantCode("root"); Map result = new HashMap<>(); - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); //project check auth fail Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); Map map = processDefinitionService.queryProcessDefinitionByCode(loginUser, 1L, 1L); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS)); //project check auth success, instance not exist putMsg(result, Status.SUCCESS, projectCode); @@ -233,12 +233,12 @@ public class ProcessDefinitionServiceTest { loginUser.setUserType(UserType.GENERAL_USER); Map result = new HashMap<>(); - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); //project check auth fail Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); Map map = processDefinitionService.queryProcessDefinitionByName(loginUser, projectCode, "test_def"); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS)); //project check auth success, instance not exist putMsg(result, Status.SUCCESS, projectCode); @@ -273,11 +273,11 @@ public class ProcessDefinitionServiceTest { Assert.assertEquals(Status.PROCESS_DEFINITION_CODES_IS_EMPTY, map.get(Constants.STATUS)); // project check auth fail - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); Map map1 = processDefinitionService.batchCopyProcessDefinition( loginUser, projectCode, String.valueOf(project.getId()), 2L); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map1.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_FOUND, map1.get(Constants.STATUS)); // project check auth success, target project name not equal project name, check auth target project fail projectCode = 2L; @@ -344,10 +344,10 @@ public class ProcessDefinitionServiceTest { //project check auth fail Map result = new HashMap<>(); - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); Map map = processDefinitionService.deleteProcessDefinitionByCode(loginUser, projectCode, 6L); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS)); //project check auth success, instance not exist putMsg(result, Status.SUCCESS, projectCode); @@ -420,11 +420,11 @@ public class ProcessDefinitionServiceTest { //project check auth fail Map result = new HashMap<>(); - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); Map map = processDefinitionService.releaseProcessDefinition(loginUser, projectCode, 6, ReleaseState.OFFLINE); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS)); // project check auth success, processs definition online putMsg(result, Status.SUCCESS, projectCode); @@ -464,11 +464,11 @@ public class ProcessDefinitionServiceTest { //project check auth fail Map result = new HashMap<>(); - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); Map map = processDefinitionService.verifyProcessDefinitionName(loginUser, projectCode, "test_pdf"); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS)); //project check auth success, process not exist putMsg(result, Status.SUCCESS, projectCode); @@ -630,7 +630,7 @@ public class ProcessDefinitionServiceTest { Project project = getProject(projectCode); Map result = new HashMap<>(); - putMsg(result, Status.PROJECT_NOT_FOUNT); + putMsg(result, Status.PROJECT_NOT_FOUND); Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java index eba085bf87..c7c0996869 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java @@ -134,7 +134,7 @@ public class ProcessInstanceServiceTest { User loginUser = getAdminUser(); Project project = getProject(projectCode); Map result = new HashMap<>(); - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); //project auth fail when(projectMapper.queryByCode(projectCode)).thenReturn(project); @@ -142,7 +142,7 @@ public class ProcessInstanceServiceTest { Result proejctAuthFailRes = processInstanceService.queryProcessInstanceList(loginUser, projectCode, 46, "2020-01-01 00:00:00", "2020-01-02 00:00:00", "", "test_user", ExecutionStatus.SUBMITTED_SUCCESS, "192.168.xx.xx", 1, 10); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT.getCode(), (int) proejctAuthFailRes.getCode()); + Assert.assertEquals(Status.PROJECT_NOT_FOUND.getCode(), (int) proejctAuthFailRes.getCode()); Date start = DateUtils.getScheduleDate("2020-01-01 00:00:00"); Date end = DateUtils.getScheduleDate("2020-01-02 00:00:00"); @@ -215,7 +215,7 @@ public class ProcessInstanceServiceTest { User loginUser = getAdminUser(); Project project = getProject(projectCode); Map result = new HashMap<>(5); - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); int size = 10; String startTime = "2020-01-01 00:00:00"; String endTime = "2020-08-02 00:00:00"; @@ -226,7 +226,7 @@ public class ProcessInstanceServiceTest { when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); Map proejctAuthFailRes = processInstanceService.queryTopNLongestRunningProcessInstance(loginUser, projectCode, size, startTime, endTime); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, proejctAuthFailRes.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_FOUND, proejctAuthFailRes.get(Constants.STATUS)); //project auth success putMsg(result, Status.SUCCESS, projectCode); @@ -247,13 +247,13 @@ public class ProcessInstanceServiceTest { User loginUser = getAdminUser(); Project project = getProject(projectCode); Map result = new HashMap<>(); - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); //project auth fail when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); Map proejctAuthFailRes = processInstanceService.queryProcessInstanceById(loginUser, projectCode, 1); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, proejctAuthFailRes.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_FOUND, proejctAuthFailRes.get(Constants.STATUS)); //project auth success ProcessInstance processInstance = getProcessInstance(); @@ -284,13 +284,13 @@ public class ProcessInstanceServiceTest { User loginUser = getAdminUser(); Project project = getProject(projectCode); Map result = new HashMap<>(); - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); //project auth fail when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); Map proejctAuthFailRes = processInstanceService.queryTaskListByProcessId(loginUser, projectCode, 1); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, proejctAuthFailRes.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_FOUND, proejctAuthFailRes.get(Constants.STATUS)); //project auth success putMsg(result, Status.SUCCESS, projectCode); @@ -330,13 +330,13 @@ public class ProcessInstanceServiceTest { User loginUser = getAdminUser(); Project project = getProject(projectCode); Map result = new HashMap<>(); - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); //project auth fail when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); Map proejctAuthFailRes = processInstanceService.querySubProcessInstanceByTaskId(loginUser, projectCode, 1); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, proejctAuthFailRes.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_FOUND, proejctAuthFailRes.get(Constants.STATUS)); //task null putMsg(result, Status.SUCCESS, projectCode); @@ -382,14 +382,14 @@ public class ProcessInstanceServiceTest { User loginUser = getAdminUser(); Project project = getProject(projectCode); Map result = new HashMap<>(); - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); //project auth fail when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); Map proejctAuthFailRes = processInstanceService.updateProcessInstance(loginUser, projectCode, 1, shellJson, taskJson, "2020-02-21 00:00:00", true, "", "", 0, ""); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, proejctAuthFailRes.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_FOUND, proejctAuthFailRes.get(Constants.STATUS)); //process instance null putMsg(result, Status.SUCCESS, projectCode); @@ -446,13 +446,13 @@ public class ProcessInstanceServiceTest { User loginUser = getAdminUser(); Project project = getProject(projectCode); Map result = new HashMap<>(); - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); //project auth fail when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); Map proejctAuthFailRes = processInstanceService.queryParentInstanceBySubId(loginUser, projectCode, 1); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, proejctAuthFailRes.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_FOUND, proejctAuthFailRes.get(Constants.STATUS)); //process instance null putMsg(result, Status.SUCCESS, projectCode); @@ -490,7 +490,7 @@ public class ProcessInstanceServiceTest { User loginUser = getAdminUser(); Project project = getProject(projectCode); Map result = new HashMap<>(); - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); //process instance null putMsg(result, Status.SUCCESS, projectCode); when(projectMapper.queryByCode(projectCode)).thenReturn(project); diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java index de782df087..9cfa94eddb 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java @@ -113,7 +113,7 @@ public class ProjectServiceTest { Map result = projectService.checkProjectAndAuth(loginUser, null, projectCode); logger.info(result.toString()); Status status = (Status) result.get(Constants.STATUS); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, result.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_EXIST, result.get(Constants.STATUS)); Project project = getProject(); //USER_NO_OPERATION_PROJECT_PERM @@ -131,7 +131,7 @@ public class ProjectServiceTest { Map result2 = new HashMap<>(); result2 = projectService.checkProjectAndAuth(loginUser, null, projectCode); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, result2.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_EXIST, result2.get(Constants.STATUS)); Project project1 = getProject(); // USER_NO_OPERATION_PROJECT_PERM @@ -198,7 +198,7 @@ public class ProjectServiceTest { //PROJECT_NOT_FOUNT Map result = projectService.deleteProject(loginUser, 11L); logger.info(result.toString()); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, result.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_EXIST, result.get(Constants.STATUS)); loginUser.setId(2); //USER_NO_OPERATION_PROJECT_PERM result = projectService.deleteProject(loginUser, 1L); @@ -231,7 +231,7 @@ public class ProjectServiceTest { // PROJECT_NOT_FOUNT Map result = projectService.update(loginUser, 1L, projectName, "desc", "testUser"); logger.info(result.toString()); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, result.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_FOUND, result.get(Constants.STATUS)); //PROJECT_ALREADY_EXISTS result = projectService.update(loginUser, 2L, projectName, "desc", userName); @@ -283,7 +283,7 @@ public class ProjectServiceTest { // Failure 1: PROJECT_NOT_FOUND Map result = this.projectService.queryAuthorizedUser(loginUser, 3682329499136L); logger.info("FAILURE 1: {}", result.toString()); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, result.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_FOUND, result.get(Constants.STATUS)); // Failure 2: USER_NO_OPERATION_PROJECT_PERM loginUser.setId(100); diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskInstanceServiceTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskInstanceServiceTest.java index 5544a18ee0..5977b5ca64 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskInstanceServiceTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskInstanceServiceTest.java @@ -92,14 +92,14 @@ public class TaskInstanceServiceTest { User loginUser = getAdminUser(); Project project = getProject(projectCode); Map result = new HashMap<>(); - putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); + putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); //project auth fail when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); Result projectAuthFailRes = taskInstanceService.queryTaskListPaging(loginUser, projectCode, 0, "", "", "test_user", "2019-02-26 19:48:00", "2019-02-26 19:48:22", "", null, "", 1, 20); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT.getCode(), (int)projectAuthFailRes.getCode()); + Assert.assertEquals(Status.PROJECT_NOT_FOUND.getCode(), (int)projectAuthFailRes.getCode()); // data parameter check putMsg(result, Status.SUCCESS, projectCode); diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java index 5e0eb6b9c1..2b17955a3a 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java @@ -357,7 +357,7 @@ public class UsersServiceTest { // ERROR: PROJECT_NOT_FOUNT result = this.usersService.grantProjectByCode(loginUser, authorizer, 999); logger.info(result.toString()); - Assert.assertEquals(Status.PROJECT_NOT_FOUNT, result.get(Constants.STATUS)); + Assert.assertEquals(Status.PROJECT_NOT_FOUND, result.get(Constants.STATUS)); // ERROR: USER_NO_OPERATION_PERM loginUser.setId(999);