From ce73868e2caec0f2c120d55d3b4ded5fe29e14e6 Mon Sep 17 00:00:00 2001 From: JinyLeeChina <42576980+JinyLeeChina@users.noreply.github.com> Date: Fri, 30 Jul 2021 13:48:18 +0800 Subject: [PATCH] [Feature][JsonSplit-api] remove connects of ProcessDefinition (#5920) * modify viewTree of ProcessDefiniton * modify ut * modify ut * modify viewTree of ProcessDefiniton * export/import of ProcessDefinition api * fix ut * fix ut * fix codeStyle * remove connects of ProcessDefinition Co-authored-by: JinyLeeChina <297062848@qq.com> --- .../ProcessDefinitionController.java | 12 +- .../controller/ProcessInstanceController.java | 5 +- .../api/service/ProcessDefinitionService.java | 4 - .../api/service/ProcessInstanceService.java | 3 +- .../impl/ProcessDefinitionServiceImpl.java | 8 +- .../impl/ProcessInstanceServiceImpl.java | 16 +- .../ProcessDefinitionControllerTest.java | 15 +- .../ProcessInstanceControllerTest.java | 1 - .../service/ProcessDefinitionServiceTest.java | 2 +- .../service/ProcessInstanceServiceTest.java | 12 +- .../dao/entity/ProcessDefinition.java | 20 +- .../dao/entity/ProcessDefinitionLog.java | 1 - .../dao/entity/ProcessInstance.java | 173 ++++++++---------- .../dao/mapper/ProcessDefinitionLogMapper.xml | 4 +- .../dao/mapper/ProcessDefinitionMapper.xml | 11 +- .../service/process/ProcessService.java | 10 +- .../service/process/ProcessServiceTest.java | 3 +- 17 files changed, 112 insertions(+), 188 deletions(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java index 6dae09f523..84e0e3a6ea 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java @@ -99,7 +99,6 @@ public class ProcessDefinitionController extends BaseController { * @param name process definition name * @param description description * @param globalParams globalParams - * @param connects connects for nodes * @param locations locations for nodes * @param timeout timeout * @param tenantCode tenantCode @@ -110,7 +109,6 @@ public class ProcessDefinitionController extends BaseController { @ApiImplicitParams({ @ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String"), @ApiImplicitParam(name = "locations", value = "PROCESS_DEFINITION_LOCATIONS", required = true, type = "String"), - @ApiImplicitParam(name = "connects", value = "PROCESS_DEFINITION_CONNECTS", required = true, type = "String"), @ApiImplicitParam(name = "description", value = "PROCESS_DEFINITION_DESC", required = false, type = "String") }) @PostMapping(value = "/save") @@ -122,14 +120,13 @@ public class ProcessDefinitionController extends BaseController { @RequestParam(value = "name", required = true) String name, @RequestParam(value = "description", required = false) String description, @RequestParam(value = "globalParams", required = false, defaultValue = "[]") String globalParams, - @RequestParam(value = "connects", required = false) String connects, @RequestParam(value = "locations", required = false) String locations, @RequestParam(value = "timeout", required = false, defaultValue = "0") int timeout, @RequestParam(value = "tenantCode", required = true) String tenantCode, @RequestParam(value = "taskRelationJson", required = true) String taskRelationJson) throws JsonProcessingException { Map result = processDefinitionService.createProcessDefinition(loginUser, projectCode, name, description, globalParams, - connects, locations, timeout, tenantCode, taskRelationJson); + locations, timeout, tenantCode, taskRelationJson); return returnDataList(result); } @@ -215,7 +212,6 @@ public class ProcessDefinitionController extends BaseController { * @param code process definition code * @param description description * @param globalParams globalParams - * @param connects connects for nodes * @param locations locations for nodes * @param timeout timeout * @param tenantCode tenantCode @@ -228,7 +224,6 @@ public class ProcessDefinitionController extends BaseController { @ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String"), @ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "123456789"), @ApiImplicitParam(name = "locations", value = "PROCESS_DEFINITION_LOCATIONS", required = true, type = "String"), - @ApiImplicitParam(name = "connects", value = "PROCESS_DEFINITION_CONNECTS", required = true, type = "String"), @ApiImplicitParam(name = "description", value = "PROCESS_DEFINITION_DESC", required = false, type = "String"), @ApiImplicitParam(name = "releaseState", value = "RELEASE_PROCESS_DEFINITION_NOTES", required = false, dataType = "ReleaseState") }) @@ -242,7 +237,6 @@ public class ProcessDefinitionController extends BaseController { @RequestParam(value = "code", required = true) long code, @RequestParam(value = "description", required = false) String description, @RequestParam(value = "globalParams", required = false, defaultValue = "[]") String globalParams, - @RequestParam(value = "connects", required = false) String connects, @RequestParam(value = "locations", required = false) String locations, @RequestParam(value = "timeout", required = false, defaultValue = "0") int timeout, @RequestParam(value = "tenantCode", required = true) String tenantCode, @@ -250,7 +244,7 @@ public class ProcessDefinitionController extends BaseController { @RequestParam(value = "releaseState", required = false, defaultValue = "OFFLINE") ReleaseState releaseState) { Map result = processDefinitionService.updateProcessDefinition(loginUser, projectCode, name, code, description, globalParams, - connects, locations, timeout, tenantCode, taskRelationJson); + locations, timeout, tenantCode, taskRelationJson); // If the update fails, the result will be returned directly if (result.get(Constants.STATUS) != Status.SUCCESS) { return returnDataList(result); @@ -357,7 +351,7 @@ public class ProcessDefinitionController extends BaseController { @ApiImplicitParams({ @ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String"), @ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "123456789"), - @ApiImplicitParam(name = "releaseState", value = "PROCESS_DEFINITION_CONNECTS", required = true, dataType = "ReleaseState"), + @ApiImplicitParam(name = "releaseState", value = "PROCESS_DEFINITION_RELEASE", required = true, dataType = "ReleaseState"), }) @PostMapping(value = "/release") @ResponseStatus(HttpStatus.OK) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceController.java index 9a6a3de07a..20106a25ea 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceController.java @@ -170,7 +170,6 @@ public class ProcessInstanceController extends BaseController { * @param syncDefine sync define * @param flag flag * @param locations locations - * @param connects connects * @return update result code */ @ApiOperation(value = "updateProcessInstance", notes = "UPDATE_PROCESS_INSTANCE_NOTES") @@ -180,7 +179,6 @@ public class ProcessInstanceController extends BaseController { @ApiImplicitParam(name = "scheduleTime", value = "SCHEDULE_TIME", type = "String"), @ApiImplicitParam(name = "syncDefine", value = "SYNC_DEFINE", required = true, type = "Boolean"), @ApiImplicitParam(name = "locations", value = "PROCESS_INSTANCE_LOCATIONS", type = "String"), - @ApiImplicitParam(name = "connects", value = "PROCESS_INSTANCE_CONNECTS", type = "String"), @ApiImplicitParam(name = "flag", value = "RECOVERY_PROCESS_INSTANCE_FLAG", type = "Flag"), }) @PostMapping(value = "/update") @@ -194,11 +192,10 @@ public class ProcessInstanceController extends BaseController { @RequestParam(value = "scheduleTime", required = false) String scheduleTime, @RequestParam(value = "syncDefine", required = true) Boolean syncDefine, @RequestParam(value = "locations", required = false) String locations, - @RequestParam(value = "connects", required = false) String connects, @RequestParam(value = "flag", required = false) Flag flag ) throws ParseException { Map result = processInstanceService.updateProcessInstance(loginUser, projectName, - processInstanceId, processInstanceJson, scheduleTime, syncDefine, flag, locations, connects); + processInstanceId, processInstanceJson, scheduleTime, syncDefine, flag, locations); return returnDataList(result); } diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java index 999ccae788..5fcf581b6a 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java @@ -42,7 +42,6 @@ public interface ProcessDefinitionService { * @param name process definition name * @param description description * @param globalParams global params - * @param connects connects for nodes * @param locations locations for nodes * @param timeout timeout * @param tenantCode tenantCode @@ -55,7 +54,6 @@ public interface ProcessDefinitionService { String name, String description, String globalParams, - String connects, String locations, int timeout, String tenantCode, @@ -150,7 +148,6 @@ public interface ProcessDefinitionService { * @param code process definition code * @param description description * @param globalParams global params - * @param connects connects for nodes * @param locations locations for nodes * @param timeout timeout * @param tenantCode tenantCode @@ -163,7 +160,6 @@ public interface ProcessDefinitionService { long code, String description, String globalParams, - String connects, String locations, int timeout, String tenantCode, diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java index 0fafcf7dcb..18c8b7f8a5 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java @@ -104,13 +104,12 @@ public interface ProcessInstanceService { * @param syncDefine sync define * @param flag flag * @param locations locations - * @param connects connects * @return update result code * @throws ParseException parse exception for json parse */ Map updateProcessInstance(User loginUser, String projectName, Integer processInstanceId, String processInstanceJson, String scheduleTime, Boolean syncDefine, - Flag flag, String locations, String connects) throws ParseException; + Flag flag, String locations) throws ParseException; /** * query parent process instance detail info by sub process instance id diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java index 3a0b1be700..b28e89936d 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java @@ -170,7 +170,6 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro * @param name process definition name * @param description description * @param globalParams global params - * @param connects connects for nodes * @param locations locations for nodes * @param timeout timeout * @param tenantCode tenantCode @@ -184,7 +183,6 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro String name, String description, String globalParams, - String connects, String locations, int timeout, String tenantCode, @@ -223,7 +221,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro return result; } ProcessDefinition processDefinition = new ProcessDefinition(projectCode, name, processDefinitionCode, description, - globalParams, locations, connects, timeout, loginUser.getId(), tenant.getId()); + globalParams, locations, timeout, loginUser.getId(), tenant.getId()); return createProcessDefine(loginUser, result, taskRelationList, processDefinition); } @@ -404,7 +402,6 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro * @param code process definition code * @param description description * @param globalParams global params - * @param connects connects for nodes * @param locations locations for nodes * @param timeout timeout * @param tenantCode tenantCode @@ -418,7 +415,6 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro long code, String description, String globalParams, - String connects, String locations, int timeout, String tenantCode, @@ -462,7 +458,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro } } - processDefinition.set(projectCode, name, description, globalParams, locations, connects, timeout, tenant.getId()); + processDefinition.set(projectCode, name, description, globalParams, locations, timeout, tenant.getId()); return updateProcessDefine(loginUser, result, taskRelationList, processDefinition); } diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java index a86a00b008..de0808ead9 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java @@ -207,7 +207,6 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId); } else { processInstance.setWarningGroupId(processDefinition.getWarningGroupId()); - processInstance.setConnects(processDefinition.getConnects()); processInstance.setLocations(processDefinition.getLocations()); ProcessData processData = processService.genProcessData(processDefinition); @@ -421,14 +420,13 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce * @param syncDefine sync define * @param flag flag * @param locations locations - * @param connects connects * @return update result code */ @Transactional @Override public Map updateProcessInstance(User loginUser, String projectName, Integer processInstanceId, String processInstanceJson, String scheduleTime, Boolean syncDefine, - Flag flag, String locations, String connects) { + Flag flag, String locations) { Map result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); //check project permission @@ -463,8 +461,7 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce int updateDefine = 1; if (Boolean.TRUE.equals(syncDefine)) { processDefinition.setId(processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode()).getId()); - updateDefine = syncDefinition(loginUser, project, locations, connects, - processInstance, processDefinition, processData); + updateDefine = syncDefinition(loginUser, project, locations, processInstance, processDefinition, processData); processInstance.setProcessDefinitionVersion(processDefinitionLogMapper. queryMaxVersionForDefinition(processInstance.getProcessDefinitionCode())); @@ -482,20 +479,17 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce /** * sync definition according process instance */ - private int syncDefinition(User loginUser, Project project, String locations, String connects, - ProcessInstance processInstance, ProcessDefinition processDefinition, - ProcessData processData) { + private int syncDefinition(User loginUser, Project project, String locations, ProcessInstance processInstance, + ProcessDefinition processDefinition, ProcessData processData) { String originDefParams = JSONUtils.toJsonString(processData.getGlobalParams()); processDefinition.setGlobalParams(originDefParams); processDefinition.setLocations(locations); - processDefinition.setConnects(connects); processDefinition.setTimeout(processInstance.getTimeout()); processDefinition.setUpdateTime(new Date()); return processService.saveProcessDefinition(loginUser, project, processDefinition.getName(), - processDefinition.getDescription(), locations, connects, - processData, processDefinition, false); + processDefinition.getDescription(), locations, processData, processDefinition, false); } /** diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java index 77bd2065f0..099f62ca96 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java @@ -80,7 +80,6 @@ public class ProcessDefinitionControllerTest { String name = "dag_test"; String description = "desc test"; String globalParams = "[]"; - String connects = "[]"; String locations = "[]"; int timeout = 0; String tenantCode = "root"; @@ -89,10 +88,10 @@ public class ProcessDefinitionControllerTest { result.put(Constants.DATA_LIST, 1); Mockito.when(processDefinitionService.createProcessDefinition(user, projectCode, name, description, globalParams, - connects, locations, timeout, tenantCode, json)).thenReturn(result); + locations, timeout, tenantCode, json)).thenReturn(result); Result response = processDefinitionController.createProcessDefinition(user, projectCode, name, description, globalParams, - connects, locations, timeout, tenantCode, json); + locations, timeout, tenantCode, json); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } @@ -127,7 +126,6 @@ public class ProcessDefinitionControllerTest { long projectCode = 1L; String name = "dag_test"; String description = "desc test"; - String connects = "[]"; String globalParams = "[]"; int timeout = 0; String tenantCode = "root"; @@ -137,10 +135,10 @@ public class ProcessDefinitionControllerTest { result.put("processDefinitionId", 1); Mockito.when(processDefinitionService.updateProcessDefinition(user, projectCode, name, code, description, globalParams, - connects, locations, timeout, tenantCode, json)).thenReturn(result); + locations, timeout, tenantCode, json)).thenReturn(result); Result response = processDefinitionController.updateProcessDefinition(user, projectCode, name, code, description, globalParams, - connects, locations, timeout, tenantCode, json, ReleaseState.OFFLINE); + locations, timeout, tenantCode, json, ReleaseState.OFFLINE); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } @@ -162,12 +160,10 @@ public class ProcessDefinitionControllerTest { long projectCode = 1L; String name = "dag_test"; String description = "desc test"; - String connects = "[]"; long code = 1L; ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setProjectCode(projectCode); - processDefinition.setConnects(connects); processDefinition.setDescription(description); processDefinition.setCode(code); processDefinition.setLocations(locations); @@ -234,12 +230,10 @@ public class ProcessDefinitionControllerTest { String projectName = "test"; String name = "dag_test"; String description = "desc test"; - String connects = "[]"; int id = 1; ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setProjectName(projectName); - processDefinition.setConnects(connects); processDefinition.setDescription(description); processDefinition.setId(id); processDefinition.setLocations(locations); @@ -250,7 +244,6 @@ public class ProcessDefinitionControllerTest { ProcessDefinition processDefinition2 = new ProcessDefinition(); processDefinition2.setProjectName(projectName); - processDefinition2.setConnects(connects); processDefinition2.setDescription(description); processDefinition2.setId(id2); processDefinition2.setLocations(locations); 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 99fd896494..f5ab017f08 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 @@ -87,7 +87,6 @@ public class ProcessInstanceControllerTest extends AbstractControllerTest { paramsMap.add("scheduleTime", "2019-12-15 00:00:00"); paramsMap.add("syncDefine", "false"); paramsMap.add("locations", locations); - paramsMap.add("connects", "[]"); MvcResult mvcResult = mockMvc.perform(post("/projects/{projectName}/instance/update", "cxc_1113") .header("sessionId", sessionId) 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 6fea42a4b6..c25fa59746 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 @@ -832,7 +832,7 @@ public class ProcessDefinitionServiceTest { + "\"postTaskVersion\":1,\"conditionType\":0,\"conditionParams\":{}},{\"name\":\"\",\"preTaskCode\":123456789," + "\"preTaskVersion\":1,\"postTaskCode\":123451234,\"postTaskVersion\":1,\"conditionType\":0,\"conditionParams\":{}}]"; Map updateResult = processDefinitionService.updateProcessDefinition(loginUser, projectCode, "test", 1, - "", "", "", "", 0, "root", taskRelationJson); + "", "", "", 0, "root", taskRelationJson); Assert.assertEquals(Status.DATA_IS_NOT_VALID, updateResult.get(Constants.STATUS)); } 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 6549890a6e..132be73855 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 @@ -364,7 +364,7 @@ public class ProcessInstanceServiceTest { when(projectMapper.queryByName(projectName)).thenReturn(null); when(projectService.checkProjectAndAuth(loginUser, null, projectName)).thenReturn(result); Map proejctAuthFailRes = processInstanceService.updateProcessInstance(loginUser, projectName, 1, - shellJson, "2020-02-21 00:00:00", true, Flag.YES, "", ""); + shellJson, "2020-02-21 00:00:00", true, Flag.YES, ""); Assert.assertEquals(Status.PROJECT_NOT_FOUNT, proejctAuthFailRes.get(Constants.STATUS)); //process instance null @@ -375,14 +375,14 @@ public class ProcessInstanceServiceTest { when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result); when(processService.findProcessInstanceDetailById(1)).thenReturn(null); Map processInstanceNullRes = processInstanceService.updateProcessInstance(loginUser, projectName, 1, - shellJson, "2020-02-21 00:00:00", true, Flag.YES, "", ""); + shellJson, "2020-02-21 00:00:00", true, Flag.YES, ""); Assert.assertEquals(Status.PROCESS_INSTANCE_NOT_EXIST, processInstanceNullRes.get(Constants.STATUS)); //process instance not finish when(processService.findProcessInstanceDetailById(1)).thenReturn(processInstance); processInstance.setState(ExecutionStatus.RUNNING_EXECUTION); Map processInstanceNotFinishRes = processInstanceService.updateProcessInstance(loginUser, projectName, 1, - shellJson, "2020-02-21 00:00:00", true, Flag.YES, "", ""); + shellJson, "2020-02-21 00:00:00", true, Flag.YES, ""); Assert.assertEquals(Status.PROCESS_INSTANCE_STATE_OPERATION_ERROR, processInstanceNotFinishRes.get(Constants.STATUS)); //process instance finish @@ -405,18 +405,18 @@ public class ProcessInstanceServiceTest { processInstance.getProcessDefinitionVersion())).thenReturn(processDefinition); Map processInstanceFinishRes = processInstanceService.updateProcessInstance(loginUser, projectName, 1, - shellJson, "2020-02-21 00:00:00", true, Flag.YES, "", ""); + shellJson, "2020-02-21 00:00:00", true, Flag.YES, ""); Assert.assertEquals(Status.UPDATE_PROCESS_INSTANCE_ERROR, processInstanceFinishRes.get(Constants.STATUS)); //success when(processService.saveProcessDefinition(Mockito.any(), Mockito.any(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), - Mockito.anyString(), Mockito.any(), Mockito.any(), Mockito.anyBoolean())).thenReturn(1); + Mockito.any(), Mockito.any(), Mockito.anyBoolean())).thenReturn(1); when(processService.findProcessDefinition(46L, 0)).thenReturn(processDefinition); putMsg(result, Status.SUCCESS, projectName); Map successRes = processInstanceService.updateProcessInstance(loginUser, projectName, 1, - shellJson, "2020-02-21 00:00:00", true, Flag.YES, "", ""); + shellJson, "2020-02-21 00:00:00", true, Flag.YES, ""); Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinition.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinition.java index be1a9a8728..6f170df182 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinition.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinition.java @@ -148,12 +148,6 @@ public class ProcessDefinition { */ private String locations; - /** - * connects array for web - * TODO: delete - */ - private String connects; - /** * schedule release state : online/offline */ @@ -196,11 +190,10 @@ public class ProcessDefinition { String description, String globalParams, String locations, - String connects, int timeout, int userId, int tenantId) { - set(projectCode, name, description, globalParams, connects, locations, timeout, tenantId); + set(projectCode, name, description, globalParams, locations, timeout, tenantId); this.code = code; this.userId = userId; Date date = new Date(); @@ -212,7 +205,6 @@ public class ProcessDefinition { String name, String description, String globalParams, - String connects, String locations, int timeout, int tenantId) { @@ -221,7 +213,6 @@ public class ProcessDefinition { this.description = description; this.globalParams = globalParams; this.locations = locations; - this.connects = connects; this.timeout = timeout; this.tenantId = tenantId; this.flag = Flag.YES; @@ -366,14 +357,6 @@ public class ProcessDefinition { this.locations = locations; } - public String getConnects() { - return connects; - } - - public void setConnects(String connects) { - this.connects = connects; - } - public ReleaseState getScheduleReleaseState() { return scheduleReleaseState; } @@ -468,7 +451,6 @@ public class ProcessDefinition { + ", userName='" + userName + '\'' + ", projectName='" + projectName + '\'' + ", locations='" + locations + '\'' - + ", connects='" + connects + '\'' + ", scheduleReleaseState=" + scheduleReleaseState + ", timeout=" + timeout + ", warningGroupId=" + warningGroupId diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinitionLog.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinitionLog.java index fcd773d3a3..aa01c45ee6 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinitionLog.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinitionLog.java @@ -61,7 +61,6 @@ public class ProcessDefinitionLog extends ProcessDefinition { this.setUserName(processDefinition.getUserName()); this.setProjectName(processDefinition.getProjectName()); this.setLocations(processDefinition.getLocations()); - this.setConnects(processDefinition.getConnects()); this.setScheduleReleaseState(processDefinition.getScheduleReleaseState()); this.setTimeout(processDefinition.getTimeout()); this.setTenantId(processDefinition.getTenantId()); diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessInstance.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessInstance.java index b24af661fb..48a3d79c19 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessInstance.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessInstance.java @@ -191,12 +191,6 @@ public class ProcessInstance { @TableField(exist = false) private String locations; - /** - * task connects for web - */ - @TableField(exist = false) - private String connects; - /** * history command */ @@ -253,12 +247,12 @@ public class ProcessInstance { public ProcessInstance(ProcessDefinition processDefinition) { this.processDefinition = processDefinition; this.name = processDefinition.getName() - + "-" - + - processDefinition.getVersion() - + "-" - + - DateUtils.getCurrentTimeStamp(); + + "-" + + + processDefinition.getVersion() + + "-" + + + DateUtils.getCurrentTimeStamp(); } public String getVarPool() { @@ -481,14 +475,6 @@ public class ProcessInstance { this.locations = locations; } - public String getConnects() { - return connects; - } - - public void setConnects(String connects) { - this.connects = connects; - } - public String getHistoryCmd() { return historyCmd; } @@ -602,81 +588,78 @@ public class ProcessInstance { @Override public String toString() { return "ProcessInstance{" - + "id=" + id - + ", state=" + state - + ", recovery=" + recovery - + ", startTime=" + startTime - + ", endTime=" + endTime - + ", runTimes=" + runTimes - + ", name='" + name + '\'' - + ", host='" + host + '\'' - + ", processDefinition=" - + processDefinition - + ", commandType=" - + commandType - + ", commandParam='" - + commandParam - + '\'' - + ", taskDependType=" - + taskDependType - + ", maxTryTimes=" - + maxTryTimes - + ", failureStrategy=" - + failureStrategy - + ", warningType=" - + warningType - + ", warningGroupId=" - + warningGroupId - + ", scheduleTime=" - + scheduleTime - + ", commandStartTime=" - + commandStartTime - + ", globalParams='" - + globalParams - + '\'' - + ", processInstanceJson='" - + processInstanceJson - + '\'' - + ", executorId=" - + executorId - + ", tenantCode='" - + tenantCode - + '\'' - + ", queue='" - + queue - + '\'' - + ", isSubProcess=" - + isSubProcess - + ", locations='" - + locations - + '\'' - + ", connects='" - + connects - + '\'' - + ", historyCmd='" - + historyCmd - + '\'' - + ", dependenceScheduleTimes='" - + dependenceScheduleTimes - + '\'' - + ", duration=" - + duration - + ", processInstancePriority=" - + processInstancePriority - + ", workerGroup='" - + workerGroup - + '\'' - + ", timeout=" - + timeout - + ", tenantId=" - + tenantId - + ", processDefinitionCode='" - + processDefinitionCode - + '\'' - + ", processDefinitionVersion='" - + processDefinitionVersion - + '\'' - + '}'; + + "id=" + id + + ", state=" + state + + ", recovery=" + recovery + + ", startTime=" + startTime + + ", endTime=" + endTime + + ", runTimes=" + runTimes + + ", name='" + name + '\'' + + ", host='" + host + '\'' + + ", processDefinition=" + + processDefinition + + ", commandType=" + + commandType + + ", commandParam='" + + commandParam + + '\'' + + ", taskDependType=" + + taskDependType + + ", maxTryTimes=" + + maxTryTimes + + ", failureStrategy=" + + failureStrategy + + ", warningType=" + + warningType + + ", warningGroupId=" + + warningGroupId + + ", scheduleTime=" + + scheduleTime + + ", commandStartTime=" + + commandStartTime + + ", globalParams='" + + globalParams + + '\'' + + ", processInstanceJson='" + + processInstanceJson + + '\'' + + ", executorId=" + + executorId + + ", tenantCode='" + + tenantCode + + '\'' + + ", queue='" + + queue + + '\'' + + ", isSubProcess=" + + isSubProcess + + ", locations='" + + locations + + '\'' + + ", historyCmd='" + + historyCmd + + '\'' + + ", dependenceScheduleTimes='" + + dependenceScheduleTimes + + '\'' + + ", duration=" + + duration + + ", processInstancePriority=" + + processInstancePriority + + ", workerGroup='" + + workerGroup + + '\'' + + ", timeout=" + + timeout + + ", tenantId=" + + tenantId + + ", processDefinitionCode='" + + processDefinitionCode + + '\'' + + ", processDefinitionVersion='" + + processDefinitionVersion + + '\'' + + '}'; } @Override diff --git a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionLogMapper.xml b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionLogMapper.xml index 92642e2592..ddb251ae3a 100644 --- a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionLogMapper.xml +++ b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionLogMapper.xml @@ -21,13 +21,13 @@ id, code, name, version, description, project_code, - release_state, user_id,global_params, flag, locations, connects, + release_state, user_id,global_params, flag, locations, warning_group_id, timeout, tenant_id,operator, operate_time, create_time, update_time select pd.id, pd.code, pd.name, pd.version, pd.release_state, pd.project_code, pd.user_id, pd.description, - pd.global_params, pd.flag, pd.locations, pd.connects, pd.warning_group_id, pd.create_time, pd.timeout, - pd.tenant_id, pd.update_time + pd.global_params, pd.flag, pd.locations, pd.warning_group_id, pd.create_time, pd.timeout, pd.tenant_id, pd.update_time from t_ds_process_definition pd WHERE pd.project_code = #{projectCode} and pd.name = #{processDefinitionName} @@ -59,8 +57,7 @@ SELECT pd.id, pd.code, pd.name, pd.version, pd.release_state, pd.project_code, pd.user_id, pd.description, - pd.global_params, pd.flag, pd.locations, pd.connects, pd.warning_group_id, pd.create_time, pd.timeout, + pd.global_params, pd.flag, pd.locations, pd.warning_group_id, pd.create_time, pd.timeout, pd.tenant_id, pd.update_time, u.user_name,p.name AS project_name FROM t_ds_process_definition pd, diff --git a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java index b65441e635..83b5e8c0e4 100644 --- a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java +++ b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java @@ -607,7 +607,6 @@ public class ProcessService { } processInstance.setCommandStartTime(command.getStartTime()); processInstance.setLocations(processDefinition.getLocations()); - processInstance.setConnects(processDefinition.getConnects()); // reset global params while there are start parameters setGlobalParamIfCommanded(processDefinition, cmdParam); @@ -2238,10 +2237,9 @@ public class ProcessService { */ @Deprecated public int saveProcessDefinition(User operator, Project project, String name, String desc, String locations, - String connects, ProcessData processData, ProcessDefinition processDefinition, - Boolean isFromProcessDefine) { + ProcessData processData, ProcessDefinition processDefinition, Boolean isFromProcessDefine) { ProcessDefinitionLog processDefinitionLog = insertProcessDefinitionLog(operator, processDefinition.getCode(), - name, processData, project, desc, locations, connects); + name, processData, project, desc, locations); Map taskDefinitionMap = handleTaskDefinition(operator, project.getCode(), processData.getTasks(), isFromProcessDefine); if (Constants.DEFINITION_FAILURE == handleTaskRelation(operator, project.getCode(), processDefinitionLog, processData.getTasks(), taskDefinitionMap)) { return Constants.DEFINITION_FAILURE; @@ -2254,8 +2252,7 @@ public class ProcessService { */ @Deprecated public ProcessDefinitionLog insertProcessDefinitionLog(User operator, Long processDefinitionCode, String processDefinitionName, - ProcessData processData, Project project, - String desc, String locations, String connects) { + ProcessData processData, Project project, String desc, String locations) { ProcessDefinitionLog processDefinitionLog = new ProcessDefinitionLog(); Integer version = processDefineLogMapper.queryMaxVersionForDefinition(processDefinitionCode); processDefinitionLog.setUserId(operator.getId()); @@ -2266,7 +2263,6 @@ public class ProcessService { processDefinitionLog.setProjectCode(project.getCode()); processDefinitionLog.setDescription(desc); processDefinitionLog.setLocations(locations); - processDefinitionLog.setConnects(connects); processDefinitionLog.setTimeout(processData.getTimeout()); processDefinitionLog.setTenantId(processData.getTenantId()); processDefinitionLog.setOperator(operator.getId()); diff --git a/dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java b/dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java index 00c1435794..9eeec7896e 100644 --- a/dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java +++ b/dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java @@ -351,8 +351,7 @@ public class ProcessServiceTest { processDefinition.setVersion(1); processDefinition.setCode(11L); Assert.assertEquals(-1, processService.saveProcessDefinition(user, project, "name", - "desc", "locations", "connects", processData, - processDefinition, true)); + "desc", "locations", processData, processDefinition, true)); } @Test