|
|
@ -110,13 +110,13 @@ public class ProcessDefinitionServiceTest { |
|
|
|
putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); |
|
|
|
putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); |
|
|
|
|
|
|
|
|
|
|
|
//project not found
|
|
|
|
//project not found
|
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
Map<String, Object> map = processDefinitionService.queryProcessDefinitionList(loginUser, projectCode); |
|
|
|
Map<String, Object> map = processDefinitionService.queryProcessDefinitionList(loginUser, projectCode); |
|
|
|
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); |
|
|
|
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); |
|
|
|
|
|
|
|
|
|
|
|
//project check auth success
|
|
|
|
//project check auth success
|
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
List<ProcessDefinition> resourceList = new ArrayList<>(); |
|
|
|
List<ProcessDefinition> resourceList = new ArrayList<>(); |
|
|
|
resourceList.add(getProcessDefinition()); |
|
|
|
resourceList.add(getProcessDefinition()); |
|
|
|
Mockito.when(processDefineMapper.queryAllDefinitionList(project.getCode())).thenReturn(resourceList); |
|
|
|
Mockito.when(processDefineMapper.queryAllDefinitionList(project.getCode())).thenReturn(resourceList); |
|
|
@ -140,13 +140,13 @@ public class ProcessDefinitionServiceTest { |
|
|
|
putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); |
|
|
|
putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); |
|
|
|
|
|
|
|
|
|
|
|
//project not found
|
|
|
|
//project not found
|
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
Map<String, Object> map = processDefinitionService.queryProcessDefinitionListPaging(loginUser, projectCode, "", 1, 5, 0); |
|
|
|
Map<String, Object> map = processDefinitionService.queryProcessDefinitionListPaging(loginUser, projectCode, "", 1, 5, 0); |
|
|
|
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); |
|
|
|
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); |
|
|
|
|
|
|
|
|
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
loginUser.setId(1); |
|
|
|
loginUser.setId(1); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
Page<ProcessDefinition> page = new Page<>(1, 10); |
|
|
|
Page<ProcessDefinition> page = new Page<>(1, 10); |
|
|
|
page.setTotal(30); |
|
|
|
page.setTotal(30); |
|
|
|
Mockito.when(processDefineMapper.queryDefineListPaging( |
|
|
|
Mockito.when(processDefineMapper.queryDefineListPaging( |
|
|
@ -177,13 +177,13 @@ public class ProcessDefinitionServiceTest { |
|
|
|
putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); |
|
|
|
putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); |
|
|
|
|
|
|
|
|
|
|
|
//project check auth fail
|
|
|
|
//project check auth fail
|
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
Map<String, Object> map = processDefinitionService.queryProcessDefinitionByCode(loginUser, 1L, 1L); |
|
|
|
Map<String, Object> map = processDefinitionService.queryProcessDefinitionByCode(loginUser, 1L, 1L); |
|
|
|
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); |
|
|
|
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); |
|
|
|
|
|
|
|
|
|
|
|
//project check auth success, instance not exist
|
|
|
|
//project check auth success, instance not exist
|
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
DagData dagData = new DagData(getProcessDefinition(), null, null); |
|
|
|
DagData dagData = new DagData(getProcessDefinition(), null, null); |
|
|
|
Mockito.when(processService.genDagData(Mockito.any())).thenReturn(dagData); |
|
|
|
Mockito.when(processService.genDagData(Mockito.any())).thenReturn(dagData); |
|
|
|
|
|
|
|
|
|
|
@ -193,7 +193,7 @@ public class ProcessDefinitionServiceTest { |
|
|
|
//instance exit
|
|
|
|
//instance exit
|
|
|
|
Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(getProcessDefinition()); |
|
|
|
Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(getProcessDefinition()); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
Map<String, Object> successRes = processDefinitionService.queryProcessDefinitionByCode(loginUser, projectCode, 46L); |
|
|
|
Map<String, Object> successRes = processDefinitionService.queryProcessDefinitionByCode(loginUser, projectCode, 46L); |
|
|
|
Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); |
|
|
|
Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); |
|
|
|
} |
|
|
|
} |
|
|
@ -213,13 +213,13 @@ public class ProcessDefinitionServiceTest { |
|
|
|
putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); |
|
|
|
putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); |
|
|
|
|
|
|
|
|
|
|
|
//project check auth fail
|
|
|
|
//project check auth fail
|
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
Map<String, Object> map = processDefinitionService.queryProcessDefinitionByName(loginUser, projectCode, "test_def"); |
|
|
|
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_FOUNT, map.get(Constants.STATUS)); |
|
|
|
|
|
|
|
|
|
|
|
//project check auth success, instance not exist
|
|
|
|
//project check auth success, instance not exist
|
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
Mockito.when(processDefineMapper.queryByDefineName(project.getCode(), "test_def")).thenReturn(null); |
|
|
|
Mockito.when(processDefineMapper.queryByDefineName(project.getCode(), "test_def")).thenReturn(null); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> instanceNotExitRes = processDefinitionService.queryProcessDefinitionByName(loginUser, projectCode, "test_def"); |
|
|
|
Map<String, Object> instanceNotExitRes = processDefinitionService.queryProcessDefinitionByName(loginUser, projectCode, "test_def"); |
|
|
@ -228,7 +228,7 @@ public class ProcessDefinitionServiceTest { |
|
|
|
//instance exit
|
|
|
|
//instance exit
|
|
|
|
Mockito.when(processDefineMapper.queryByDefineName(project.getCode(), "test")).thenReturn(getProcessDefinition()); |
|
|
|
Mockito.when(processDefineMapper.queryByDefineName(project.getCode(), "test")).thenReturn(getProcessDefinition()); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
Map<String, Object> successRes = processDefinitionService.queryProcessDefinitionByName(loginUser, projectCode, "test"); |
|
|
|
Map<String, Object> successRes = processDefinitionService.queryProcessDefinitionByName(loginUser, projectCode, "test"); |
|
|
|
Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); |
|
|
|
Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); |
|
|
|
} |
|
|
|
} |
|
|
@ -243,7 +243,7 @@ public class ProcessDefinitionServiceTest { |
|
|
|
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); |
|
|
|
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
|
|
|
|
|
|
|
|
// copy project definition ids empty test
|
|
|
|
// copy project definition ids empty test
|
|
|
|
Map<String, Object> map = processDefinitionService.batchCopyProcessDefinition(loginUser, projectCode, StringUtils.EMPTY, 2L); |
|
|
|
Map<String, Object> map = processDefinitionService.batchCopyProcessDefinition(loginUser, projectCode, StringUtils.EMPTY, 2L); |
|
|
@ -252,7 +252,7 @@ public class ProcessDefinitionServiceTest { |
|
|
|
|
|
|
|
|
|
|
|
// project check auth fail
|
|
|
|
// project check auth fail
|
|
|
|
putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); |
|
|
|
putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
Map<String, Object> map1 = processDefinitionService.batchCopyProcessDefinition( |
|
|
|
Map<String, Object> map1 = processDefinitionService.batchCopyProcessDefinition( |
|
|
|
loginUser, projectCode, String.valueOf(project.getId()), 2L); |
|
|
|
loginUser, projectCode, String.valueOf(project.getId()), 2L); |
|
|
|
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map1.get(Constants.STATUS)); |
|
|
|
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map1.get(Constants.STATUS)); |
|
|
@ -261,7 +261,7 @@ public class ProcessDefinitionServiceTest { |
|
|
|
projectCode = 2L; |
|
|
|
projectCode = 2L; |
|
|
|
Project project1 = getProject(projectCode); |
|
|
|
Project project1 = getProject(projectCode); |
|
|
|
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project1); |
|
|
|
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project1); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
|
|
|
|
|
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
ProcessDefinition definition = getProcessDefinition(); |
|
|
|
ProcessDefinition definition = getProcessDefinition(); |
|
|
@ -292,8 +292,8 @@ public class ProcessDefinitionServiceTest { |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
|
|
|
|
|
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project1, project1.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project1, projectCode)).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project2, project2.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project2, projectCode2)).thenReturn(result); |
|
|
|
|
|
|
|
|
|
|
|
ProcessDefinition definition = getProcessDefinition(); |
|
|
|
ProcessDefinition definition = getProcessDefinition(); |
|
|
|
List<ProcessDefinition> processDefinitionList = new ArrayList<>(); |
|
|
|
List<ProcessDefinition> processDefinitionList = new ArrayList<>(); |
|
|
@ -321,20 +321,20 @@ public class ProcessDefinitionServiceTest { |
|
|
|
//project check auth fail
|
|
|
|
//project check auth fail
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); |
|
|
|
putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
Map<String, Object> map = processDefinitionService.deleteProcessDefinitionById(loginUser, projectCode, 6); |
|
|
|
Map<String, Object> map = processDefinitionService.deleteProcessDefinitionById(loginUser, projectCode, 6); |
|
|
|
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); |
|
|
|
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); |
|
|
|
|
|
|
|
|
|
|
|
//project check auth success, instance not exist
|
|
|
|
//project check auth success, instance not exist
|
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
Mockito.when(processDefineMapper.selectById(1)).thenReturn(null); |
|
|
|
Mockito.when(processDefineMapper.selectById(1)).thenReturn(null); |
|
|
|
Map<String, Object> instanceNotExitRes = processDefinitionService.deleteProcessDefinitionById(loginUser, projectCode, 1); |
|
|
|
Map<String, Object> instanceNotExitRes = processDefinitionService.deleteProcessDefinitionById(loginUser, projectCode, 1); |
|
|
|
Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, instanceNotExitRes.get(Constants.STATUS)); |
|
|
|
Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, instanceNotExitRes.get(Constants.STATUS)); |
|
|
|
|
|
|
|
|
|
|
|
ProcessDefinition processDefinition = getProcessDefinition(); |
|
|
|
ProcessDefinition processDefinition = getProcessDefinition(); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
//user no auth
|
|
|
|
//user no auth
|
|
|
|
loginUser.setUserType(UserType.GENERAL_USER); |
|
|
|
loginUser.setUserType(UserType.GENERAL_USER); |
|
|
|
Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition); |
|
|
|
Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition); |
|
|
@ -344,7 +344,7 @@ public class ProcessDefinitionServiceTest { |
|
|
|
//process definition online
|
|
|
|
//process definition online
|
|
|
|
loginUser.setUserType(UserType.ADMIN_USER); |
|
|
|
loginUser.setUserType(UserType.ADMIN_USER); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
processDefinition.setReleaseState(ReleaseState.ONLINE); |
|
|
|
processDefinition.setReleaseState(ReleaseState.ONLINE); |
|
|
|
Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition); |
|
|
|
Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition); |
|
|
|
Map<String, Object> dfOnlineRes = processDefinitionService.deleteProcessDefinitionById(loginUser, projectCode, 46); |
|
|
|
Map<String, Object> dfOnlineRes = processDefinitionService.deleteProcessDefinitionById(loginUser, projectCode, 46); |
|
|
@ -354,7 +354,7 @@ public class ProcessDefinitionServiceTest { |
|
|
|
processDefinition.setReleaseState(ReleaseState.OFFLINE); |
|
|
|
processDefinition.setReleaseState(ReleaseState.OFFLINE); |
|
|
|
Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition); |
|
|
|
Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
List<Schedule> schedules = new ArrayList<>(); |
|
|
|
List<Schedule> schedules = new ArrayList<>(); |
|
|
|
schedules.add(getSchedule()); |
|
|
|
schedules.add(getSchedule()); |
|
|
|
schedules.add(getSchedule()); |
|
|
|
schedules.add(getSchedule()); |
|
|
@ -368,7 +368,7 @@ public class ProcessDefinitionServiceTest { |
|
|
|
schedule.setReleaseState(ReleaseState.ONLINE); |
|
|
|
schedule.setReleaseState(ReleaseState.ONLINE); |
|
|
|
schedules.add(schedule); |
|
|
|
schedules.add(schedule); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
Mockito.when(scheduleMapper.queryByProcessDefinitionCode(46)).thenReturn(schedules); |
|
|
|
Mockito.when(scheduleMapper.queryByProcessDefinitionCode(46)).thenReturn(schedules); |
|
|
|
Map<String, Object> schedulerOnlineRes = processDefinitionService.deleteProcessDefinitionById(loginUser, projectCode, 46); |
|
|
|
Map<String, Object> schedulerOnlineRes = processDefinitionService.deleteProcessDefinitionById(loginUser, projectCode, 46); |
|
|
|
Assert.assertEquals(Status.SCHEDULE_CRON_STATE_ONLINE, schedulerOnlineRes.get(Constants.STATUS)); |
|
|
|
Assert.assertEquals(Status.SCHEDULE_CRON_STATE_ONLINE, schedulerOnlineRes.get(Constants.STATUS)); |
|
|
@ -378,7 +378,7 @@ public class ProcessDefinitionServiceTest { |
|
|
|
schedule.setReleaseState(ReleaseState.OFFLINE); |
|
|
|
schedule.setReleaseState(ReleaseState.OFFLINE); |
|
|
|
schedules.add(schedule); |
|
|
|
schedules.add(schedule); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
Mockito.when(scheduleMapper.queryByProcessDefinitionCode(46)).thenReturn(schedules); |
|
|
|
Mockito.when(scheduleMapper.queryByProcessDefinitionCode(46)).thenReturn(schedules); |
|
|
|
Mockito.when(processDefineMapper.deleteById(46)).thenReturn(0); |
|
|
|
Mockito.when(processDefineMapper.deleteById(46)).thenReturn(0); |
|
|
|
Map<String, Object> deleteFail = processDefinitionService.deleteProcessDefinitionById(loginUser, projectCode, 46); |
|
|
|
Map<String, Object> deleteFail = processDefinitionService.deleteProcessDefinitionById(loginUser, projectCode, 46); |
|
|
@ -387,7 +387,7 @@ public class ProcessDefinitionServiceTest { |
|
|
|
//delete success
|
|
|
|
//delete success
|
|
|
|
Mockito.when(processDefineMapper.deleteById(46)).thenReturn(1); |
|
|
|
Mockito.when(processDefineMapper.deleteById(46)).thenReturn(1); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
Map<String, Object> deleteSuccess = processDefinitionService.deleteProcessDefinitionById(loginUser, projectCode, 46); |
|
|
|
Map<String, Object> deleteSuccess = processDefinitionService.deleteProcessDefinitionById(loginUser, projectCode, 46); |
|
|
|
Assert.assertEquals(Status.SUCCESS, deleteSuccess.get(Constants.STATUS)); |
|
|
|
Assert.assertEquals(Status.SUCCESS, deleteSuccess.get(Constants.STATUS)); |
|
|
|
} |
|
|
|
} |
|
|
@ -405,7 +405,7 @@ public class ProcessDefinitionServiceTest { |
|
|
|
//project check auth fail
|
|
|
|
//project check auth fail
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); |
|
|
|
putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
Map<String, Object> map = processDefinitionService.releaseProcessDefinition(loginUser, projectCode, |
|
|
|
Map<String, Object> map = processDefinitionService.releaseProcessDefinition(loginUser, projectCode, |
|
|
|
6, ReleaseState.OFFLINE); |
|
|
|
6, ReleaseState.OFFLINE); |
|
|
|
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); |
|
|
|
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); |
|
|
@ -444,7 +444,7 @@ public class ProcessDefinitionServiceTest { |
|
|
|
//project check auth fail
|
|
|
|
//project check auth fail
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); |
|
|
|
putMsg(result, Status.PROJECT_NOT_FOUNT, projectCode); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
Map<String, Object> map = processDefinitionService.verifyProcessDefinitionName(loginUser, |
|
|
|
Map<String, Object> map = processDefinitionService.verifyProcessDefinitionName(loginUser, |
|
|
|
projectCode, "test_pdf"); |
|
|
|
projectCode, "test_pdf"); |
|
|
|
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); |
|
|
|
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); |
|
|
@ -485,7 +485,7 @@ public class ProcessDefinitionServiceTest { |
|
|
|
//project check auth fail
|
|
|
|
//project check auth fail
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
//process definition not exist
|
|
|
|
//process definition not exist
|
|
|
|
Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(null); |
|
|
|
Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(null); |
|
|
|
Map<String, Object> processDefinitionNullRes = processDefinitionService.getTaskNodeListByDefinitionCode(loginUser, projectCode, 46L); |
|
|
|
Map<String, Object> processDefinitionNullRes = processDefinitionService.getTaskNodeListByDefinitionCode(loginUser, projectCode, 46L); |
|
|
@ -513,7 +513,7 @@ public class ProcessDefinitionServiceTest { |
|
|
|
//project check auth fail
|
|
|
|
//project check auth fail
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
//process definition not exist
|
|
|
|
//process definition not exist
|
|
|
|
String defineCodes = "46"; |
|
|
|
String defineCodes = "46"; |
|
|
|
Set<Long> defineCodeSet = Lists.newArrayList(defineCodes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toSet()); |
|
|
|
Set<Long> defineCodeSet = Lists.newArrayList(defineCodes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toSet()); |
|
|
@ -542,7 +542,7 @@ public class ProcessDefinitionServiceTest { |
|
|
|
Project project = getProject(projectCode); |
|
|
|
Project project = getProject(projectCode); |
|
|
|
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project); |
|
|
|
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
putMsg(result, Status.SUCCESS, projectCode); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
ProcessDefinition processDefinition = getProcessDefinition(); |
|
|
|
ProcessDefinition processDefinition = getProcessDefinition(); |
|
|
|
List<ProcessDefinition> processDefinitionList = new ArrayList<>(); |
|
|
|
List<ProcessDefinition> processDefinitionList = new ArrayList<>(); |
|
|
|
processDefinitionList.add(processDefinition); |
|
|
|
processDefinitionList.add(processDefinition); |
|
|
@ -590,7 +590,7 @@ public class ProcessDefinitionServiceTest { |
|
|
|
long projectCode = 1L; |
|
|
|
long projectCode = 1L; |
|
|
|
Project project = getProject(projectCode); |
|
|
|
Project project = getProject(projectCode); |
|
|
|
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); |
|
|
|
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> updateResult = processDefinitionService.updateProcessDefinition(loginUser, projectCode, "test", 1, |
|
|
|
Map<String, Object> updateResult = processDefinitionService.updateProcessDefinition(loginUser, projectCode, "test", 1, |
|
|
|
"", "", "", 0, "root", null); |
|
|
|
"", "", "", 0, "root", null); |
|
|
@ -611,7 +611,7 @@ public class ProcessDefinitionServiceTest { |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
putMsg(result, Status.PROJECT_NOT_FOUNT); |
|
|
|
putMsg(result, Status.PROJECT_NOT_FOUNT); |
|
|
|
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); |
|
|
|
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(result); |
|
|
|
|
|
|
|
|
|
|
|
processDefinitionService.batchExportProcessDefinitionByCodes( |
|
|
|
processDefinitionService.batchExportProcessDefinitionByCodes( |
|
|
|
loginUser, projectCode, "1", null); |
|
|
|
loginUser, projectCode, "1", null); |
|
|
@ -621,7 +621,7 @@ public class ProcessDefinitionServiceTest { |
|
|
|
Map<String, Object> checkResult = new HashMap<>(); |
|
|
|
Map<String, Object> checkResult = new HashMap<>(); |
|
|
|
checkResult.put(Constants.STATUS, Status.SUCCESS); |
|
|
|
checkResult.put(Constants.STATUS, Status.SUCCESS); |
|
|
|
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project); |
|
|
|
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(checkResult); |
|
|
|
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode)).thenReturn(checkResult); |
|
|
|
HttpServletResponse response = mock(HttpServletResponse.class); |
|
|
|
HttpServletResponse response = mock(HttpServletResponse.class); |
|
|
|
|
|
|
|
|
|
|
|
DagData dagData = new DagData(getProcessDefinition(), null, null); |
|
|
|
DagData dagData = new DagData(getProcessDefinition(), null, null); |
|
|
|