[Fix-7340] Improve the prompt content for deleting a project that didn't exist. (#7449)

* improve the prompt
This commit is contained in:
calvin 2021-12-16 17:14:37 +08:00 committed by GitHub
parent 1cbc86b9e6
commit 6cad119806
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 59 additions and 59 deletions

View File

@ -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函数已存在"),

View File

@ -166,7 +166,7 @@ public class ProjectServiceImpl extends BaseServiceImpl implements ProjectServic
public Map<String, Object> checkProjectAndAuth(User loginUser, Project project, long projectCode) {
Map<String, Object> 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<String, Object> 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 {

View File

@ -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;
}

View File

@ -70,7 +70,7 @@ public class WorkFlowLineageServiceImpl extends BaseServiceImpl implements WorkF
Map<String, Object> 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<WorkFlowLineage> workFlowLineageList = workFlowLineageMapper.queryWorkFlowLineageByName(projectCode, workFlowName);
@ -84,7 +84,7 @@ public class WorkFlowLineageServiceImpl extends BaseServiceImpl implements WorkF
Map<String, Object> 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<Long, WorkFlowLineage> workFlowLineagesMap = new HashMap<>();
@ -133,7 +133,7 @@ public class WorkFlowLineageServiceImpl extends BaseServiceImpl implements WorkF
Map<String, Object> 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<ProcessLineage> processLineages = workFlowLineageMapper.queryProcessLineage(projectCode);

View File

@ -85,7 +85,7 @@ public class ProcessInstanceControllerTest extends AbstractControllerTest {
@Test
public void testQueryTaskListByProcessId() throws Exception {
Map<String, Object> 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

View File

@ -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());
}
}

View File

@ -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

View File

@ -146,10 +146,10 @@ public class DataAnalysisServiceTest {
// checkProject false
Map<String, Object> 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<String, Object> 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<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS, null);

View File

@ -127,12 +127,12 @@ public class ProcessDefinitionServiceTest {
loginUser.setUserType(UserType.GENERAL_USER);
Map<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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);

View File

@ -134,7 +134,7 @@ public class ProcessInstanceServiceTest {
User loginUser = getAdminUser();
Project project = getProject(projectCode);
Map<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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);

View File

@ -113,7 +113,7 @@ public class ProjectServiceTest {
Map<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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);

View File

@ -92,14 +92,14 @@ public class TaskInstanceServiceTest {
User loginUser = getAdminUser();
Project project = getProject(projectCode);
Map<String, Object> 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);

View File

@ -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);