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