status
stringclasses 1
value | repo_name
stringclasses 31
values | repo_url
stringclasses 31
values | issue_id
int64 1
104k
| title
stringlengths 4
233
| body
stringlengths 0
186k
⌀ | issue_url
stringlengths 38
56
| pull_url
stringlengths 37
54
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
unknown | language
stringclasses 5
values | commit_datetime
unknown | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
/**
* verify process definition name unique
*
* @param loginUser login user
* @param projectName project name
* @param name name
* @return true if process definition name not exists, otherwise false
*/
public Map<String, Object> verifyProcessDefinitionName(User loginUser, String projectName, String name) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByName(projectName);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName);
Status resultEnum = (Status) checkResult.get(Constants.STATUS);
if (resultEnum != Status.SUCCESS) {
return checkResult;
}
ProcessDefinition processDefinition = processDefineMapper.verifyByDefineName(project.getId(), name);
if (processDefinition == null) {
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.PROCESS_INSTANCE_EXIST, name);
}
return result;
}
/**
* delete process definition by id
*
* @param loginUser login user
* @param projectName project name |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param processDefinitionId process definition id
* @return delete result code
*/
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> deleteProcessDefinitionById(User loginUser, String projectName, Integer processDefinitionId) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByName(projectName);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName);
Status resultEnum = (Status) checkResult.get(Constants.STATUS);
if (resultEnum != Status.SUCCESS) {
return checkResult;
}
ProcessDefinition processDefinition = processDefineMapper.selectById(processDefinitionId);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionId);
return result;
}
if (loginUser.getId() != processDefinition.getUserId() && loginUser.getUserType() != UserType.ADMIN_USER) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE, processDefinitionId);
return result;
}
List<ProcessInstance> processInstances = processInstanceService.queryByProcessDefineIdAndStatus(processDefinitionId, Constants.NOT_TERMINATED_STATES);
if (CollectionUtils.isNotEmpty(processInstances)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | putMsg(result, Status.DELETE_PROCESS_DEFINITION_BY_ID_FAIL,processInstances.size());
return result;
}
List<Schedule> schedules = scheduleMapper.queryByProcessDefinitionId(processDefinitionId);
if (!schedules.isEmpty() && schedules.size() > 1) {
logger.warn("scheduler num is {},Greater than 1", schedules.size());
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_ID_ERROR);
return result;
} else if (schedules.size() == 1) {
Schedule schedule = schedules.get(0);
if (schedule.getReleaseState() == ReleaseState.OFFLINE) {
scheduleMapper.deleteById(schedule.getId());
} else if (schedule.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.SCHEDULE_CRON_STATE_ONLINE, schedule.getId());
return result;
}
}
int delete = processDefineMapper.deleteById(processDefinitionId);
if (delete > 0) {
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_ID_ERROR);
}
return result;
}
/**
* release process definition: online / offline
*
* @param loginUser login user |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param projectName project name
* @param id process definition id
* @param releaseState release state
* @return release result code
*/
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> releaseProcessDefinition(User loginUser, String projectName, int id, int releaseState) {
HashMap<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByName(projectName);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName);
Status resultEnum = (Status) checkResult.get(Constants.STATUS);
if (resultEnum != Status.SUCCESS) {
return checkResult;
}
ReleaseState state = ReleaseState.getEnum(releaseState);
if (null == state) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
ProcessDefinition processDefinition = processDefineMapper.selectById(id);
switch (state) {
case ONLINE:
String resourceIds = processDefinition.getResourceIds();
if (StringUtils.isNotBlank(resourceIds)) {
Integer[] resourceIdArray = Arrays.stream(resourceIds.split(",")).map(Integer::parseInt).toArray(Integer[]::new);
PermissionCheck<Integer> permissionCheck = new PermissionCheck<>(AuthorizationType.RESOURCE_FILE_ID, processService, resourceIdArray, loginUser.getId(), logger);
try {
permissionCheck.checkPermission(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | } catch (Exception e) {
logger.error(e.getMessage(), e);
putMsg(result, Status.RESOURCE_NOT_EXIST_OR_NO_PERMISSION, RELEASESTATE);
return result;
}
}
processDefinition.setReleaseState(state);
processDefineMapper.updateById(processDefinition);
break;
case OFFLINE:
processDefinition.setReleaseState(state);
processDefineMapper.updateById(processDefinition);
List<Schedule> scheduleList = scheduleMapper.selectAllByProcessDefineArray(
new int[]{processDefinition.getId()}
);
for (Schedule schedule : scheduleList) {
logger.info("set schedule offline, project id: {}, schedule id: {}, process definition id: {}", project.getId(), schedule.getId(), id);
schedule.setReleaseState(ReleaseState.OFFLINE);
scheduleMapper.updateById(schedule);
SchedulerService.deleteSchedule(project.getId(), schedule.getId());
}
break;
default:
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
putMsg(result, Status.SUCCESS);
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | /**
* batch export process definition by ids
*/
public void batchExportProcessDefinitionByIds(User loginUser, String projectName, String processDefinitionIds, HttpServletResponse response) {
if (StringUtils.isEmpty(processDefinitionIds)) {
return;
}
Project project = projectMapper.queryByName(projectName);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
return;
}
List<ProcessMeta> processDefinitionList =
getProcessDefinitionList(processDefinitionIds);
if (CollectionUtils.isNotEmpty(processDefinitionList)) {
downloadProcessDefinitionFile(response, processDefinitionList);
}
}
/**
* get process definition list by ids
*/
private List<ProcessMeta> getProcessDefinitionList(String processDefinitionIds) {
List<ProcessMeta> processDefinitionList = new ArrayList<>();
String[] processDefinitionIdArray = processDefinitionIds.split(",");
for (String strProcessDefinitionId : processDefinitionIdArray) {
int processDefinitionId = Integer.parseInt(strProcessDefinitionId); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | ProcessDefinition processDefinition = processDefineMapper.queryByDefineId(processDefinitionId);
if (null != processDefinition) {
processDefinitionList.add(exportProcessMetaData(processDefinitionId, processDefinition));
}
}
return processDefinitionList;
}
/**
* download the process definition file
*/
private void downloadProcessDefinitionFile(HttpServletResponse response, List<ProcessMeta> processDefinitionList) {
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
BufferedOutputStream buff = null;
ServletOutputStream out = null;
try {
out = response.getOutputStream();
buff = new BufferedOutputStream(out);
buff.write(JSONUtils.toJsonString(processDefinitionList).getBytes(StandardCharsets.UTF_8));
buff.flush();
buff.close();
} catch (IOException e) {
logger.warn("export process fail", e);
} finally {
if (null != buff) {
try {
buff.close();
} catch (Exception e) {
logger.warn("export process buffer not close", e);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (null != out) {
try {
out.close();
} catch (Exception e) {
logger.warn("export process output stream not close", e);
}
}
}
}
/**
* get export process metadata string
*
* @param processDefinitionId process definition id
* @param processDefinition process definition
* @return export process metadata string
*/
public ProcessMeta exportProcessMetaData(Integer processDefinitionId, ProcessDefinition processDefinition) {
String correctProcessDefinitionJson = addExportTaskNodeSpecialParam(processDefinition.getProcessDefinitionJson());
processDefinition.setProcessDefinitionJson(correctProcessDefinitionJson);
ProcessMeta exportProcessMeta = new ProcessMeta();
exportProcessMeta.setProjectName(processDefinition.getProjectName());
exportProcessMeta.setProcessDefinitionName(processDefinition.getName());
exportProcessMeta.setProcessDefinitionJson(processDefinition.getProcessDefinitionJson());
exportProcessMeta.setProcessDefinitionDescription(processDefinition.getDescription());
exportProcessMeta.setProcessDefinitionLocations(processDefinition.getLocations());
exportProcessMeta.setProcessDefinitionConnects(processDefinition.getConnects());
List<Schedule> schedules = scheduleMapper.queryByProcessDefinitionId(processDefinitionId); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (!schedules.isEmpty()) {
Schedule schedule = schedules.get(0);
exportProcessMeta.setScheduleWarningType(schedule.getWarningType().toString());
exportProcessMeta.setScheduleWarningGroupId(schedule.getWarningGroupId());
exportProcessMeta.setScheduleStartTime(DateUtils.dateToString(schedule.getStartTime()));
exportProcessMeta.setScheduleEndTime(DateUtils.dateToString(schedule.getEndTime()));
exportProcessMeta.setScheduleCrontab(schedule.getCrontab());
exportProcessMeta.setScheduleFailureStrategy(String.valueOf(schedule.getFailureStrategy()));
exportProcessMeta.setScheduleReleaseState(String.valueOf(ReleaseState.OFFLINE));
exportProcessMeta.setScheduleProcessInstancePriority(String.valueOf(schedule.getProcessInstancePriority()));
exportProcessMeta.setScheduleWorkerGroupName(schedule.getWorkerGroup());
}
return exportProcessMeta;
}
/**
* correct task param which has datasource or dependent
*
* @param processDefinitionJson processDefinitionJson
* @return correct processDefinitionJson
*/
private String addExportTaskNodeSpecialParam(String processDefinitionJson) {
ObjectNode jsonObject = JSONUtils.parseObject(processDefinitionJson);
ArrayNode jsonArray = (ArrayNode) jsonObject.path(TASKS);
for (int i = 0; i < jsonArray.size(); i++) {
JsonNode taskNode = jsonArray.path(i);
if (StringUtils.isNotEmpty(taskNode.path("type").asText())) {
String taskType = taskNode.path("type").asText();
ProcessAddTaskParam addTaskParam = TaskNodeParamFactory.getByTaskType(taskType);
if (null != addTaskParam) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | addTaskParam.addExportSpecialParam(taskNode);
}
}
}
jsonObject.set(TASKS, jsonArray);
return jsonObject.toString();
}
/**
* check task if has sub process
*
* @param taskType task type
* @return if task has sub process return true else false
*/
private boolean checkTaskHasSubProcess(String taskType) {
return taskType.equals(TaskType.SUB_PROCESS.name());
}
/**
* import process definition
*
* @param loginUser login user
* @param file process metadata json file
* @param currentProjectName current project name
* @return import process
*/
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> importProcessDefinition(User loginUser, MultipartFile file, String currentProjectName) {
Map<String, Object> result = new HashMap<>();
String processMetaJson = FileUtils.file2String(file);
List<ProcessMeta> processMetaList = JSONUtils.toList(processMetaJson, ProcessMeta.class); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (CollectionUtils.isEmpty(processMetaList)) {
putMsg(result, Status.DATA_IS_NULL, "fileContent");
return result;
}
for (ProcessMeta processMeta : processMetaList) {
if (!checkAndImportProcessDefinition(loginUser, currentProjectName, result, processMeta)) {
return result;
}
}
return result;
}
/**
* check and import process definition
*/
private boolean checkAndImportProcessDefinition(User loginUser, String currentProjectName, Map<String, Object> result, ProcessMeta processMeta) {
if (!checkImportanceParams(processMeta, result)) {
return false;
}
String processDefinitionName = processMeta.getProcessDefinitionName();
Project targetProject = projectMapper.queryByName(currentProjectName);
if (null != targetProject) {
processDefinitionName = recursionProcessDefinitionName(targetProject.getId(),
processDefinitionName, 1);
}
Map<String, Object> checkResult = verifyProcessDefinitionName(loginUser, currentProjectName, processDefinitionName);
Status status = (Status) checkResult.get(Constants.STATUS);
if (Status.SUCCESS.equals(status)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | putMsg(result, Status.SUCCESS);
} else {
result.putAll(checkResult);
return false;
}
Map<String, Object> createProcessResult =
getCreateProcessResult(loginUser,
currentProjectName,
result,
processMeta,
processDefinitionName,
addImportTaskNodeParam(loginUser, processMeta.getProcessDefinitionJson(), targetProject));
if (createProcessResult == null) {
return false;
}
Integer processDefinitionId =
Objects.isNull(createProcessResult.get(PROCESSDEFINITIONID))
? null : Integer.parseInt(createProcessResult.get(PROCESSDEFINITIONID).toString());
return getImportProcessScheduleResult(loginUser,
currentProjectName,
result,
processMeta,
processDefinitionName,
processDefinitionId);
}
/**
* get create process result |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | */
private Map<String, Object> getCreateProcessResult(User loginUser,
String currentProjectName,
Map<String, Object> result,
ProcessMeta processMeta,
String processDefinitionName,
String importProcessParam) {
Map<String, Object> createProcessResult = null;
try {
createProcessResult = createProcessDefinition(loginUser
, currentProjectName,
processDefinitionName + "_import_" + DateUtils.getCurrentTimeStamp(),
importProcessParam,
processMeta.getProcessDefinitionDescription(),
processMeta.getProcessDefinitionLocations(),
processMeta.getProcessDefinitionConnects());
putMsg(result, Status.SUCCESS);
} catch (JsonProcessingException e) {
logger.error("import process meta json data: {}", e.getMessage(), e);
putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR);
}
return createProcessResult;
}
/**
* get import process schedule result
*/
private boolean getImportProcessScheduleResult(User loginUser,
String currentProjectName,
Map<String, Object> result,
ProcessMeta processMeta, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | String processDefinitionName,
Integer processDefinitionId) {
if (null != processMeta.getScheduleCrontab() && null != processDefinitionId) {
int scheduleInsert = importProcessSchedule(loginUser,
currentProjectName,
processMeta,
processDefinitionName,
processDefinitionId);
if (0 == scheduleInsert) {
putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR);
return false;
}
}
return true;
}
/**
* check importance params
*/
private boolean checkImportanceParams(ProcessMeta processMeta, Map<String, Object> result) {
if (StringUtils.isEmpty(processMeta.getProjectName())) {
putMsg(result, Status.DATA_IS_NULL, "projectName");
return false;
}
if (StringUtils.isEmpty(processMeta.getProcessDefinitionName())) {
putMsg(result, Status.DATA_IS_NULL, "processDefinitionName");
return false;
}
if (StringUtils.isEmpty(processMeta.getProcessDefinitionJson())) {
putMsg(result, Status.DATA_IS_NULL, "processDefinitionJson");
return false; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
return true;
}
/**
* import process add special task param
*
* @param loginUser login user
* @param processDefinitionJson process definition json
* @param targetProject target project
* @return import process param
*/
private String addImportTaskNodeParam(User loginUser, String processDefinitionJson, Project targetProject) {
ObjectNode jsonObject = JSONUtils.parseObject(processDefinitionJson);
ArrayNode jsonArray = (ArrayNode) jsonObject.get(TASKS);
for (int i = 0; i < jsonArray.size(); i++) {
JsonNode taskNode = jsonArray.path(i);
String taskType = taskNode.path("type").asText();
ProcessAddTaskParam addTaskParam = TaskNodeParamFactory.getByTaskType(taskType);
if (null != addTaskParam) {
addTaskParam.addImportSpecialParam(taskNode);
}
}
Map<Integer, Integer> subProcessIdMap = new HashMap<>();
List<Object> subProcessList = StreamUtils.asStream(jsonArray.elements())
.filter(elem -> checkTaskHasSubProcess(JSONUtils.parseObject(elem.toString()).path("type").asText()))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(subProcessList)) {
importSubProcess(loginUser, targetProject, jsonArray, subProcessIdMap); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
jsonObject.set(TASKS, jsonArray);
return jsonObject.toString();
}
/**
* import process schedule
*
* @param loginUser login user
* @param currentProjectName current project name
* @param processMeta process meta data
* @param processDefinitionName process definition name
* @param processDefinitionId process definition id
* @return insert schedule flag
*/
public int importProcessSchedule(User loginUser, String currentProjectName, ProcessMeta processMeta,
String processDefinitionName, Integer processDefinitionId) {
Date now = new Date();
Schedule scheduleObj = new Schedule();
scheduleObj.setProjectName(currentProjectName);
scheduleObj.setProcessDefinitionId(processDefinitionId);
scheduleObj.setProcessDefinitionName(processDefinitionName);
scheduleObj.setCreateTime(now);
scheduleObj.setUpdateTime(now);
scheduleObj.setUserId(loginUser.getId());
scheduleObj.setUserName(loginUser.getUserName());
scheduleObj.setCrontab(processMeta.getScheduleCrontab());
if (null != processMeta.getScheduleStartTime()) {
scheduleObj.setStartTime(DateUtils.stringToDate(processMeta.getScheduleStartTime()));
}
if (null != processMeta.getScheduleEndTime()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | scheduleObj.setEndTime(DateUtils.stringToDate(processMeta.getScheduleEndTime()));
}
if (null != processMeta.getScheduleWarningType()) {
scheduleObj.setWarningType(WarningType.valueOf(processMeta.getScheduleWarningType()));
}
if (null != processMeta.getScheduleWarningGroupId()) {
scheduleObj.setWarningGroupId(processMeta.getScheduleWarningGroupId());
}
if (null != processMeta.getScheduleFailureStrategy()) {
scheduleObj.setFailureStrategy(FailureStrategy.valueOf(processMeta.getScheduleFailureStrategy()));
}
if (null != processMeta.getScheduleReleaseState()) {
scheduleObj.setReleaseState(ReleaseState.valueOf(processMeta.getScheduleReleaseState()));
}
if (null != processMeta.getScheduleProcessInstancePriority()) {
scheduleObj.setProcessInstancePriority(Priority.valueOf(processMeta.getScheduleProcessInstancePriority()));
}
if (null != processMeta.getScheduleWorkerGroupName()) {
scheduleObj.setWorkerGroup(processMeta.getScheduleWorkerGroupName());
}
return scheduleMapper.insert(scheduleObj);
}
/**
* check import process has sub process
* recursion create sub process
*
* @param loginUser login user
* @param targetProject target project
* @param jsonArray process task array
* @param subProcessIdMap correct sub process id map |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | */
private void importSubProcess(User loginUser, Project targetProject, ArrayNode jsonArray, Map<Integer, Integer> subProcessIdMap) {
for (int i = 0; i < jsonArray.size(); i++) {
ObjectNode taskNode = (ObjectNode) jsonArray.path(i);
String taskType = taskNode.path("type").asText();
if (!checkTaskHasSubProcess(taskType)) {
continue;
}
ObjectNode subParams = (ObjectNode) taskNode.path("params");
Integer subProcessId = subParams.path(PROCESSDEFINITIONID).asInt();
ProcessDefinition subProcess = processDefineMapper.queryByDefineId(subProcessId);
if (null == subProcess) {
continue;
}
String subProcessJson = subProcess.getProcessDefinitionJson();
ProcessDefinition currentProjectSubProcess = processDefineMapper.queryByDefineName(targetProject.getId(), subProcess.getName());
if (null == currentProjectSubProcess) {
ArrayNode subJsonArray = (ArrayNode) JSONUtils.parseObject(subProcess.getProcessDefinitionJson()).get(TASKS);
List<Object> subProcessList = StreamUtils.asStream(subJsonArray.elements())
.filter(item -> checkTaskHasSubProcess(JSONUtils.parseObject(item.toString()).path("type").asText()))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(subProcessList)) {
importSubProcess(loginUser, targetProject, subJsonArray, subProcessIdMap);
if (!subProcessIdMap.isEmpty()) {
for (Map.Entry<Integer, Integer> entry : subProcessIdMap.entrySet()) {
String oldSubProcessId = "\"processDefinitionId\":" + entry.getKey(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | String newSubProcessId = "\"processDefinitionId\":" + entry.getValue();
subProcessJson = subProcessJson.replaceAll(oldSubProcessId, newSubProcessId);
}
subProcessIdMap.clear();
}
}
Date now = new Date();
ProcessDefinition processDefine = new ProcessDefinition();
processDefine.setName(subProcess.getName());
processDefine.setVersion(subProcess.getVersion());
processDefine.setReleaseState(subProcess.getReleaseState());
processDefine.setProjectId(targetProject.getId());
processDefine.setUserId(loginUser.getId());
processDefine.setProcessDefinitionJson(subProcessJson);
processDefine.setDescription(subProcess.getDescription());
processDefine.setLocations(subProcess.getLocations());
processDefine.setConnects(subProcess.getConnects());
processDefine.setTimeout(subProcess.getTimeout());
processDefine.setTenantId(subProcess.getTenantId());
processDefine.setGlobalParams(subProcess.getGlobalParams());
processDefine.setCreateTime(now);
processDefine.setUpdateTime(now);
processDefine.setFlag(subProcess.getFlag());
processDefine.setReceivers(subProcess.getReceivers());
processDefine.setReceiversCc(subProcess.getReceiversCc());
processDefineMapper.insert(processDefine);
logger.info("create sub process, project: {}, process name: {}", targetProject.getName(), processDefine.getName()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | ProcessDefinition newSubProcessDefine = processDefineMapper.queryByDefineName(processDefine.getProjectId(), processDefine.getName());
if (null != newSubProcessDefine) {
subProcessIdMap.put(subProcessId, newSubProcessDefine.getId());
subParams.put(PROCESSDEFINITIONID, newSubProcessDefine.getId());
taskNode.set("params", subParams);
}
}
}
}
/**
* check the process definition node meets the specifications
*
* @param processData process data
* @param processDefinitionJson process definition json
* @return check result code
*/
public Map<String, Object> checkProcessNodeList(ProcessData processData, String processDefinitionJson) {
Map<String, Object> result = new HashMap<>();
try {
if (processData == null) {
logger.error("process data is null");
putMsg(result, Status.DATA_IS_NOT_VALID, processDefinitionJson);
return result;
}
List<TaskNode> taskNodes = processData.getTasks();
if (taskNodes == null) {
logger.error("process node info is empty");
putMsg(result, Status.DATA_IS_NULL, processDefinitionJson);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
if (graphHasCycle(taskNodes)) {
logger.error("process DAG has cycle");
putMsg(result, Status.PROCESS_NODE_HAS_CYCLE);
return result;
}
for (TaskNode taskNode : taskNodes) {
if (!CheckUtils.checkTaskNodeParameters(taskNode.getParams(), taskNode.getType())) {
logger.error("task node {} parameter invalid", taskNode.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskNode.getName());
return result;
}
CheckUtils.checkOtherParams(taskNode.getExtras());
}
putMsg(result, Status.SUCCESS);
} catch (Exception e) {
result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR);
result.put(Constants.MSG, e.getMessage());
}
return result;
}
/**
* get task node details based on process definition
*
* @param defineId define id
* @return task node list
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | public Map<String, Object> getTaskNodeListByDefinitionId(Integer defineId) {
Map<String, Object> result = new HashMap<>();
ProcessDefinition processDefinition = processDefineMapper.selectById(defineId);
if (processDefinition == null) {
logger.info("process define not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, defineId);
return result;
}
String processDefinitionJson = processDefinition.getProcessDefinitionJson();
ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class);
if (null == processData) {
logger.error("process data is null");
putMsg(result, Status.DATA_IS_NOT_VALID, processDefinitionJson);
return result;
}
List<TaskNode> taskNodeList = (processData.getTasks() == null) ? new ArrayList<>() : processData.getTasks();
result.put(Constants.DATA_LIST, taskNodeList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* get task node details based on process definition
*
* @param defineIdList define id list
* @return task node list
*/
public Map<String, Object> getTaskNodeListByDefinitionIdList(String defineIdList) {
Map<String, Object> result = new HashMap<>();
Map<Integer, List<TaskNode>> taskNodeMap = new HashMap<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | String[] idList = defineIdList.split(",");
List<Integer> idIntList = new ArrayList<>();
for (String definitionId : idList) {
idIntList.add(Integer.parseInt(definitionId));
}
Integer[] idArray = idIntList.toArray(new Integer[0]);
List<ProcessDefinition> processDefinitionList = processDefineMapper.queryDefinitionListByIdList(idArray);
if (CollectionUtils.isEmpty(processDefinitionList)) {
logger.info("process definition not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, defineIdList);
return result;
}
for (ProcessDefinition processDefinition : processDefinitionList) {
String processDefinitionJson = processDefinition.getProcessDefinitionJson();
ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class);
List<TaskNode> taskNodeList = (processData.getTasks() == null) ? new ArrayList<>() : processData.getTasks();
taskNodeMap.put(processDefinition.getId(), taskNodeList);
}
result.put(Constants.DATA_LIST, taskNodeMap);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition all by project id
*
* @param projectId project id
* @return process definitions in the project
*/
public Map<String, Object> queryProcessDefinitionAllByProjectId(Integer projectId) {
HashMap<String, Object> result = new HashMap<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | List<ProcessDefinition> resourceList = processDefineMapper.queryAllDefinitionList(projectId);
result.put(Constants.DATA_LIST, resourceList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* Encapsulates the TreeView structure
*
* @param processId process definition id
* @param limit limit
* @return tree view json data
* @throws Exception exception
*/
public Map<String, Object> viewTree(Integer processId, Integer limit) throws Exception {
Map<String, Object> result = new HashMap<>();
ProcessDefinition processDefinition = processDefineMapper.selectById(processId);
if (null == processDefinition) {
logger.info("process define not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinition);
return result;
}
DAG<String, TaskNode, TaskNodeRelation> dag = genDagGraph(processDefinition);
/**
* nodes that is running
*/
Map<String, List<TreeViewDto>> runningNodeMap = new ConcurrentHashMap<>();
/**
* nodes that is waiting torun
*/
Map<String, List<TreeViewDto>> waitingRunningNodeMap = new ConcurrentHashMap<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | /**
* List of process instances
*/
List<ProcessInstance> processInstanceList = processInstanceService.queryByProcessDefineId(processId, limit);
for (ProcessInstance processInstance : processInstanceList) {
processInstance.setDuration(DateUtils.differSec(processInstance.getStartTime(), processInstance.getEndTime()));
}
if (limit > processInstanceList.size()) {
limit = processInstanceList.size();
}
TreeViewDto parentTreeViewDto = new TreeViewDto();
parentTreeViewDto.setName("DAG");
parentTreeViewDto.setType("");
for (int i = limit - 1; i >= 0; i--) {
ProcessInstance processInstance = processInstanceList.get(i);
Date endTime = processInstance.getEndTime() == null ? new Date() : processInstance.getEndTime();
parentTreeViewDto.getInstances().add(new Instance(processInstance.getId(), processInstance.getName(), "", processInstance.getState().toString()
, processInstance.getStartTime(), endTime, processInstance.getHost(), DateUtils.format2Readable(endTime.getTime() - processInstance.getStartTime().getTime())));
}
List<TreeViewDto> parentTreeViewDtoList = new ArrayList<>();
parentTreeViewDtoList.add(parentTreeViewDto);
for (String startNode : dag.getBeginNode()) {
runningNodeMap.put(startNode, parentTreeViewDtoList);
}
while (Stopper.isRunning()) {
Set<String> postNodeList = null;
Iterator<Map.Entry<String, List<TreeViewDto>>> iter = runningNodeMap.entrySet().iterator();
while (iter.hasNext()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | Map.Entry<String, List<TreeViewDto>> en = iter.next();
String nodeName = en.getKey();
parentTreeViewDtoList = en.getValue();
TreeViewDto treeViewDto = new TreeViewDto();
treeViewDto.setName(nodeName);
TaskNode taskNode = dag.getNode(nodeName);
treeViewDto.setType(taskNode.getType());
for (int i = limit - 1; i >= 0; i--) {
ProcessInstance processInstance = processInstanceList.get(i);
TaskInstance taskInstance = taskInstanceMapper.queryByInstanceIdAndName(processInstance.getId(), nodeName);
if (taskInstance == null) {
treeViewDto.getInstances().add(new Instance(-1, "not running", "null"));
} else {
Date startTime = taskInstance.getStartTime() == null ? new Date() : taskInstance.getStartTime();
Date endTime = taskInstance.getEndTime() == null ? new Date() : taskInstance.getEndTime();
int subProcessId = 0;
/**
* if process is sub process, the return sub id, or sub id=0
*/
if (taskInstance.getTaskType().equals(TaskType.SUB_PROCESS.name())) {
String taskJson = taskInstance.getTaskJson();
taskNode = JSONUtils.parseObject(taskJson, TaskNode.class);
subProcessId = Integer.parseInt(JSONUtils.parseObject(
taskNode.getParams()).path(CMDPARAM_SUB_PROCESS_DEFINE_ID).asText());
}
treeViewDto.getInstances().add(new Instance(taskInstance.getId(), taskInstance.getName(), taskInstance.getTaskType(), taskInstance.getState().toString()
, taskInstance.getStartTime(), taskInstance.getEndTime(), taskInstance.getHost(), DateUtils.format2Readable(endTime.getTime() - startTime.getTime()), subProcessId));
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | for (TreeViewDto pTreeViewDto : parentTreeViewDtoList) {
pTreeViewDto.getChildren().add(treeViewDto);
}
postNodeList = dag.getSubsequentNodes(nodeName);
if (CollectionUtils.isNotEmpty(postNodeList)) {
for (String nextNodeName : postNodeList) {
List<TreeViewDto> treeViewDtoList = waitingRunningNodeMap.get(nextNodeName);
if (CollectionUtils.isEmpty(treeViewDtoList)) {
treeViewDtoList = new ArrayList<>();
}
treeViewDtoList.add(treeViewDto);
waitingRunningNodeMap.put(nextNodeName, treeViewDtoList);
}
}
runningNodeMap.remove(nodeName);
}
if (waitingRunningNodeMap == null || waitingRunningNodeMap.size() == 0) {
break;
} else {
runningNodeMap.putAll(waitingRunningNodeMap);
waitingRunningNodeMap.clear();
}
}
result.put(Constants.DATA_LIST, parentTreeViewDto);
result.put(Constants.STATUS, Status.SUCCESS);
result.put(Constants.MSG, Status.SUCCESS.getMsg());
return result;
}
/**
* Generate the DAG Graph based on the process definition id |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | *
* @param processDefinition process definition
* @return dag graph
*/
private DAG<String, TaskNode, TaskNodeRelation> genDagGraph(ProcessDefinition processDefinition) {
String processDefinitionJson = processDefinition.getProcessDefinitionJson();
ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class);
if (null != processData) {
List<TaskNode> taskNodeList = processData.getTasks();
processDefinition.setGlobalParamList(processData.getGlobalParams());
ProcessDag processDag = DagHelper.getProcessDag(taskNodeList);
return DagHelper.buildDagGraph(processDag);
}
return new DAG<>();
}
/**
* whether the graph has a ring
*
* @param taskNodeResponseList task node response list
* @return if graph has cycle flag
*/
private boolean graphHasCycle(List<TaskNode> taskNodeResponseList) {
DAG<String, TaskNode, String> graph = new DAG<>();
for (TaskNode taskNodeResponse : taskNodeResponseList) {
graph.addNode(taskNodeResponse.getName(), taskNodeResponse);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | for (TaskNode taskNodeResponse : taskNodeResponseList) {
taskNodeResponse.getPreTasks();
List<String> preTasks = JSONUtils.toList(taskNodeResponse.getPreTasks(), String.class);
if (CollectionUtils.isNotEmpty(preTasks)) {
for (String preTask : preTasks) {
if (!graph.addEdge(preTask, taskNodeResponse.getName())) {
return true;
}
}
}
}
return graph.hasCycle();
}
private String recursionProcessDefinitionName(Integer projectId, String processDefinitionName, int num) {
ProcessDefinition processDefinition = processDefineMapper.queryByDefineName(projectId, processDefinitionName);
if (processDefinition != null) {
if (num > 1) {
String str = processDefinitionName.substring(0, processDefinitionName.length() - 3);
processDefinitionName = str + "(" + num + ")";
} else {
processDefinitionName = processDefinition.getName() + "(" + num + ")";
}
} else {
return processDefinitionName;
}
return recursionProcessDefinitionName(projectId, processDefinitionName, num + 1);
}
private Map<String, Object> copyProcessDefinition(User loginUser,
Integer processId,
Project targetProject) throws JsonProcessingException { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | Map<String, Object> result = new HashMap<>();
ProcessDefinition processDefinition = processDefineMapper.selectById(processId);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId);
return result;
} else {
return createProcessDefinition(
loginUser,
targetProject.getName(),
processDefinition.getName() + "_copy_" + DateUtils.getCurrentTimeStamp(),
processDefinition.getProcessDefinitionJson(),
processDefinition.getDescription(),
processDefinition.getLocations(),
processDefinition.getConnects());
}
}
/**
* batch copy process definition
*
* @param loginUser loginUser
* @param projectName projectName
* @param processDefinitionIds processDefinitionIds
* @param targetProjectId targetProjectId
*/
@Override
public Map<String, Object> batchCopyProcessDefinition(User loginUser,
String projectName,
String processDefinitionIds,
int targetProjectId) {
Map<String, Object> result = new HashMap<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | List<String> failedProcessList = new ArrayList<>();
if (StringUtils.isEmpty(processDefinitionIds)) {
putMsg(result, Status.PROCESS_DEFINITION_IDS_IS_EMPTY, processDefinitionIds);
return result;
}
Map<String, Object> checkResult = checkProjectAndAuth(loginUser, projectName);
if (checkResult != null) {
return checkResult;
}
Project targetProject = projectMapper.queryDetailById(targetProjectId);
if (targetProject == null) {
putMsg(result, Status.PROJECT_NOT_FOUNT, targetProjectId);
return result;
}
if (!(targetProject.getName()).equals(projectName)) {
Map<String, Object> checkTargetProjectResult = checkProjectAndAuth(loginUser, targetProject.getName());
if (checkTargetProjectResult != null) {
return checkTargetProjectResult;
}
}
String[] processDefinitionIdList = processDefinitionIds.split(Constants.COMMA);
doBatchCopyProcessDefinition(loginUser, targetProject, failedProcessList, processDefinitionIdList);
checkBatchOperateResult(projectName, targetProject.getName(), result, failedProcessList, true);
return result;
}
/**
* batch move process definition
*
* @param loginUser loginUser |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param projectName projectName
* @param processDefinitionIds processDefinitionIds
* @param targetProjectId targetProjectId
*/
@Override
public Map<String, Object> batchMoveProcessDefinition(User loginUser,
String projectName,
String processDefinitionIds,
int targetProjectId) {
Map<String, Object> result = new HashMap<>();
List<String> failedProcessList = new ArrayList<>();
Map<String, Object> checkResult = checkProjectAndAuth(loginUser, projectName);
if (checkResult != null) {
return checkResult;
}
if (StringUtils.isEmpty(processDefinitionIds)) {
putMsg(result, Status.PROCESS_DEFINITION_IDS_IS_EMPTY, processDefinitionIds);
return result;
}
Project targetProject = projectMapper.queryDetailById(targetProjectId);
if (targetProject == null) {
putMsg(result, Status.PROJECT_NOT_FOUNT, targetProjectId);
return result;
}
if (!(targetProject.getName()).equals(projectName)) {
Map<String, Object> checkTargetProjectResult = checkProjectAndAuth(loginUser, targetProject.getName());
if (checkTargetProjectResult != null) {
return checkTargetProjectResult;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
String[] processDefinitionIdList = processDefinitionIds.split(Constants.COMMA);
doBatchMoveProcessDefinition(targetProject, failedProcessList, processDefinitionIdList);
checkBatchOperateResult(projectName, targetProject.getName(), result, failedProcessList, false);
return result;
}
/**
* switch the defined process definition verison
*
* @param loginUser login user
* @param projectName project name
* @param processDefinitionId process definition id
* @param version the version user want to switch
* @return switch process definition version result code
*/
@Override
public Map<String, Object> switchProcessDefinitionVersion(User loginUser, String projectName
, int processDefinitionId, long version) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByName(projectName);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
return checkResult;
}
ProcessDefinition processDefinition = processDefineMapper.queryByDefineId(processDefinitionId);
if (Objects.isNull(processDefinition)) {
putMsg(result
, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_ERROR |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | , processDefinitionId);
return result;
}
ProcessDefinitionVersion processDefinitionVersion = processDefinitionVersionService
.queryByProcessDefinitionIdAndVersion(processDefinitionId, version);
if (Objects.isNull(processDefinitionVersion)) {
putMsg(result
, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_VERSION_ERROR
, processDefinitionId
, version);
return result;
}
processDefinition.setVersion(processDefinitionVersion.getVersion());
processDefinition.setProcessDefinitionJson(processDefinitionVersion.getProcessDefinitionJson());
processDefinition.setDescription(processDefinitionVersion.getDescription());
processDefinition.setLocations(processDefinitionVersion.getLocations());
processDefinition.setConnects(processDefinitionVersion.getConnects());
processDefinition.setTimeout(processDefinitionVersion.getTimeout());
processDefinition.setGlobalParams(processDefinitionVersion.getGlobalParams());
processDefinition.setUpdateTime(new Date());
processDefinition.setReceivers(processDefinitionVersion.getReceivers());
processDefinition.setReceiversCc(processDefinitionVersion.getReceiversCc());
processDefinition.setResourceIds(processDefinitionVersion.getResourceIds());
if (processDefineMapper.updateById(processDefinition) > 0) {
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR);
}
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | /**
* do batch move process definition
*
* @param targetProject targetProject
* @param failedProcessList failedProcessList
* @param processDefinitionIdList processDefinitionIdList
*/
private void doBatchMoveProcessDefinition(Project targetProject, List<String> failedProcessList, String[] processDefinitionIdList) {
for (String processDefinitionId : processDefinitionIdList) {
try {
Map<String, Object> moveProcessDefinitionResult =
moveProcessDefinition(Integer.valueOf(processDefinitionId), targetProject);
if (!Status.SUCCESS.equals(moveProcessDefinitionResult.get(Constants.STATUS))) {
setFailedProcessList(failedProcessList, processDefinitionId);
logger.error((String) moveProcessDefinitionResult.get(Constants.MSG));
}
} catch (Exception e) {
setFailedProcessList(failedProcessList, processDefinitionId);
}
}
}
/**
* batch copy process definition
*
* @param loginUser loginUser
* @param targetProject targetProject
* @param failedProcessList failedProcessList
* @param processDefinitionIdList processDefinitionIdList
*/
private void doBatchCopyProcessDefinition(User loginUser, Project targetProject, List<String> failedProcessList, String[] processDefinitionIdList) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | for (String processDefinitionId : processDefinitionIdList) {
try {
Map<String, Object> copyProcessDefinitionResult =
copyProcessDefinition(loginUser, Integer.valueOf(processDefinitionId), targetProject);
if (!Status.SUCCESS.equals(copyProcessDefinitionResult.get(Constants.STATUS))) {
setFailedProcessList(failedProcessList, processDefinitionId);
logger.error((String) copyProcessDefinitionResult.get(Constants.MSG));
}
} catch (Exception e) {
setFailedProcessList(failedProcessList, processDefinitionId);
}
}
}
/**
* set failed processList
*
* @param failedProcessList failedProcessList
* @param processDefinitionId processDefinitionId
*/
private void setFailedProcessList(List<String> failedProcessList, String processDefinitionId) {
ProcessDefinition processDefinition = processDefineMapper.queryByDefineId(Integer.valueOf(processDefinitionId));
if (processDefinition != null) {
failedProcessList.add(processDefinitionId + "[" + processDefinition.getName() + "]");
} else {
failedProcessList.add(processDefinitionId + "[null]");
}
}
/**
* check project and auth
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param loginUser loginUser
* @param projectName projectName
*/
private Map<String, Object> checkProjectAndAuth(User loginUser, String projectName) {
Project project = projectMapper.queryByName(projectName);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
return checkResult;
}
return null;
}
/**
* move process definition
*
* @param processId processId
* @param targetProject targetProject
* @return move result code
*/
private Map<String, Object> moveProcessDefinition(Integer processId,
Project targetProject) {
Map<String, Object> result = new HashMap<>();
ProcessDefinition processDefinition = processDefineMapper.selectById(processId);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId);
return result;
}
processDefinition.setProjectId(targetProject.getId());
processDefinition.setUpdateTime(new Date()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (processDefineMapper.updateById(processDefinition) > 0) {
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
return result;
}
/**
* check batch operate result
*
* @param srcProjectName srcProjectName
* @param targetProjectName targetProjectName
* @param result result
* @param failedProcessList failedProcessList
* @param isCopy isCopy
*/
private void checkBatchOperateResult(String srcProjectName, String targetProjectName,
Map<String, Object> result, List<String> failedProcessList, boolean isCopy) {
if (!failedProcessList.isEmpty()) {
if (isCopy) {
putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR, srcProjectName, targetProjectName, String.join(",", failedProcessList));
} else {
putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR, srcProjectName, targetProjectName, String.join(",", failedProcessList));
}
} else {
putMsg(result, Status.SUCCESS);
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.controller;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.service.ProcessDefinitionVersionService;
import org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java | import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionVersion;
import org.apache.dolphinscheduler.dao.entity.Resource;
import org.apache.dolphinscheduler.dao.entity.User;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.mock.web.MockHttpServletResponse;
/**
* process definition controller test
*/
@RunWith(MockitoJUnitRunner.Silent.class) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java | public class ProcessDefinitionControllerTest {
private static Logger logger = LoggerFactory.getLogger(ProcessDefinitionControllerTest.class);
@InjectMocks
private ProcessDefinitionController processDefinitionController;
@Mock
private ProcessDefinitionServiceImpl processDefinitionService;
@Mock
private ProcessDefinitionVersionService processDefinitionVersionService;
protected User user;
@Before
public void before() {
User loginUser = new User();
loginUser.setId(1);
loginUser.setUserType(UserType.GENERAL_USER);
loginUser.setUserName("admin"); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java | user = loginUser;
}
@Test
public void testCreateProcessDefinition() throws Exception {
String json = "{\"globalParams\":[],\"tasks\":[{\"type\":\"SHELL\",\"id\":\"tasks-36196\",\"name\""
+ ":\"ssh_test1\",\"params\":{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"aa=\\\"1234\\\"\\"
+ "necho ${aa}\"},\"desc\":\"\",\"runFlag\":\"NORMAL\",\"dependence\":{},\"maxRetryTimes\":\"0\""
+ ",\"retryInterval\":\"1\",\"timeout\":{\"strategy\":\"\",\"interval\":null,\"enable\":false},"
+ "\"taskInstancePriority\":\"MEDIUM\",\"workerGroupId\":-1,\"preTasks\":[]}],\"tenantId\":-1,\"timeout\":0}";
String locations = "{\"tasks-36196\":{\"name\":\"ssh_test1\",\"targetarr\":\"\",\"x\":141,\"y\":70}}";
String projectName = "test";
String name = "dag_test";
String description = "desc test";
String connects = "[]";
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS);
result.put("processDefinitionId", 1);
Mockito.when(processDefinitionService.createProcessDefinition(user, projectName, name, json,
description, locations, connects)).thenReturn(result);
Result response = processDefinitionController.createProcessDefinition(user, projectName, name, json,
locations, connects, description);
Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue());
}
private void putMsg(Map<String, Object> result, Status status, Object... statusParams) {
result.put(Constants.STATUS, status);
if (statusParams != null && statusParams.length > 0) {
result.put(Constants.MSG, MessageFormat.format(status.getMsg(), statusParams));
} else {
result.put(Constants.MSG, status.getMsg());
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java | }
@Test
public void testVerifyProcessDefinitionName() throws Exception {
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROCESS_INSTANCE_EXIST);
String projectName = "test";
String name = "dag_test";
Mockito.when(processDefinitionService.verifyProcessDefinitionName(user, projectName, name)).thenReturn(result);
Result response = processDefinitionController.verifyProcessDefinitionName(user, projectName, name);
Assert.assertEquals(Status.PROCESS_INSTANCE_EXIST.getCode(), response.getCode().intValue());
}
@Test
public void updateProcessDefinition() throws Exception {
String json = "{\"globalParams\":[],\"tasks\":[{\"type\":\"SHELL\",\"id\":\"tasks-36196\",\"name\":\"ssh_test1\""
+ ",\"params\":{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"aa=\\\"1234\\\"\\necho ${aa}\"}"
+ ",\"desc\":\"\",\"runFlag\":\"NORMAL\",\"dependence\":{},\"maxRetryTimes\":\"0\",\"retryInterval\""
+ ":\"1\",\"timeout\":{\"strategy\":\"\",\"interval\":null,\"enable\":false},\"taskInstancePriority\""
+ ":\"MEDIUM\",\"workerGroupId\":-1,\"preTasks\":[]}],\"tenantId\":-1,\"timeout\":0}";
String locations = "{\"tasks-36196\":{\"name\":\"ssh_test1\",\"targetarr\":\"\",\"x\":141,\"y\":70}}";
String projectName = "test";
String name = "dag_test";
String description = "desc test";
String connects = "[]";
int id = 1;
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS);
result.put("processDefinitionId", 1);
Mockito.when(processDefinitionService.updateProcessDefinition(user, projectName, id, name, json,
description, locations, connects)).thenReturn(result);
Result response = processDefinitionController.updateProcessDefinition(user, projectName, name, id, json, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java | locations, connects, description);
Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue());
}
@Test
public void testReleaseProcessDefinition() throws Exception {
String projectName = "test";
int id = 1;
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS);
Mockito.when(processDefinitionService.releaseProcessDefinition(user, projectName, id, ReleaseState.OFFLINE.ordinal())).thenReturn(result);
Result response = processDefinitionController.releaseProcessDefinition(user, projectName, id, ReleaseState.OFFLINE.ordinal());
Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue());
}
@Test
public void testQueryProcessDefinitionById() throws Exception {
String json = "{\"globalParams\":[],\"tasks\":[{\"type\":\"SHELL\",\"id\":\"tasks-36196\",\"name\":\"ssh_test1"
+ "\",\"params\":{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"aa=\\\"1234\\\"\\necho ${aa}"
+ "\"},\"desc\":\"\",\"runFlag\":\"NORMAL\",\"dependence\":{},\"maxRetryTimes\":\"0\",\"retryInterval\""
+ ":\"1\",\"timeout\":{\"strategy\":\"\",\"interval\":null,\"enable\":false},\"taskInstancePriority\":"
+ "\"MEDIUM\",\"workerGroupId\":-1,\"preTasks\":[]}],\"tenantId\":-1,\"timeout\":0}";
String locations = "{\"tasks-36196\":{\"name\":\"ssh_test1\",\"targetarr\":\"\",\"x\":141,\"y\":70}}";
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); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java | processDefinition.setId(id);
processDefinition.setLocations(locations);
processDefinition.setName(name);
processDefinition.setProcessDefinitionJson(json);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
Mockito.when(processDefinitionService.queryProcessDefinitionById(user, projectName, id)).thenReturn(result);
Result response = processDefinitionController.queryProcessDefinitionById(user, projectName, id);
Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue());
}
@Test
public void testBatchCopyProcessDefinition() throws Exception {
String projectName = "test";
int targetProjectId = 2;
String id = "1";
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS);
Mockito.when(processDefinitionService.batchCopyProcessDefinition(user, projectName, id, targetProjectId)).thenReturn(result);
Result response = processDefinitionController.copyProcessDefinition(user, projectName, id, targetProjectId);
Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue());
}
@Test
public void testBatchMoveProcessDefinition() throws Exception {
String projectName = "test";
int targetProjectId = 2;
String id = "1";
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS);
Mockito.when(processDefinitionService.batchMoveProcessDefinition(user, projectName, id, targetProjectId)).thenReturn(result); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java | Result response = processDefinitionController.moveProcessDefinition(user, projectName, id, targetProjectId);
Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue());
}
@Test
public void testQueryProcessDefinitionList() throws Exception {
String projectName = "test";
List<ProcessDefinition> resourceList = getDefinitionList();
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, resourceList);
Mockito.when(processDefinitionService.queryProcessDefinitionList(user, projectName)).thenReturn(result);
Result response = processDefinitionController.queryProcessDefinitionList(user, projectName);
Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue());
}
public List<ProcessDefinition> getDefinitionList() {
List<ProcessDefinition> resourceList = new ArrayList<>();
String json = "{\"globalParams\":[],\"tasks\":[{\"type\":\"SHELL\",\"id\":\"tasks-36196\",\"name\":\"ssh_test1"
+ "\",\"params\":{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"aa=\\\"1234\\\"\\necho ${aa}"
+ "\"},\"desc\":\"\",\"runFlag\":\"NORMAL\",\"dependence\":{},\"maxRetryTimes\":\"0\",\"retryInterval"
+ "\":\"1\",\"timeout\":{\"strategy\":\"\",\"interval\":null,\"enable\":false},\"taskInstancePriority\""
+ ":\"MEDIUM\",\"workerGroupId\":-1,\"preTasks\":[]}],\"tenantId\":-1,\"timeout\":0}";
String locations = "{\"tasks-36196\":{\"name\":\"ssh_test1\",\"targetarr\":\"\",\"x\":141,\"y\":70}}";
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); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java | processDefinition.setDescription(description);
processDefinition.setId(id);
processDefinition.setLocations(locations);
processDefinition.setName(name);
processDefinition.setProcessDefinitionJson(json);
String name2 = "dag_test";
int id2 = 2;
ProcessDefinition processDefinition2 = new ProcessDefinition();
processDefinition2.setProjectName(projectName);
processDefinition2.setConnects(connects);
processDefinition2.setDescription(description);
processDefinition2.setId(id2);
processDefinition2.setLocations(locations);
processDefinition2.setName(name2);
processDefinition2.setProcessDefinitionJson(json);
resourceList.add(processDefinition);
resourceList.add(processDefinition2);
return resourceList;
}
@Test
public void testDeleteProcessDefinitionById() throws Exception {
String projectName = "test";
int id = 1;
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS);
Mockito.when(processDefinitionService.deleteProcessDefinitionById(user, projectName, id)).thenReturn(result);
Result response = processDefinitionController.deleteProcessDefinitionById(user, projectName, id);
Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue());
}
@Test |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java | public void testGetNodeListByDefinitionId() throws Exception {
String projectName = "test";
int id = 1;
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS);
Mockito.when(processDefinitionService.getTaskNodeListByDefinitionId(id)).thenReturn(result);
Result response = processDefinitionController.getNodeListByDefinitionId(user, projectName, id);
Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue());
}
@Test
public void testGetNodeListByDefinitionIdList() throws Exception {
String projectName = "test";
String idList = "1,2,3";
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS);
Mockito.when(processDefinitionService.getTaskNodeListByDefinitionIdList(idList)).thenReturn(result);
Result response = processDefinitionController.getNodeListByDefinitionIdList(user, projectName, idList);
Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue());
}
@Test
public void testQueryProcessDefinitionAllByProjectId() throws Exception {
int projectId = 1;
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS);
Mockito.when(processDefinitionService.queryProcessDefinitionAllByProjectId(projectId)).thenReturn(result);
Result response = processDefinitionController.queryProcessDefinitionAllByProjectId(user, projectId);
Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue());
}
@Test
public void testViewTree() throws Exception { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java | String projectName = "test";
int processId = 1;
int limit = 2;
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS);
Mockito.when(processDefinitionService.viewTree(processId, limit)).thenReturn(result);
Result response = processDefinitionController.viewTree(user, projectName, processId, limit);
Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue());
}
@Test
public void testQueryProcessDefinitionListPaging() throws Exception {
String projectName = "test";
int pageNo = 1;
int pageSize = 10;
String searchVal = "";
int userId = 1;
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, new PageInfo<Resource>(1, 10));
Mockito.when(processDefinitionService.queryProcessDefinitionListPaging(user, projectName, searchVal, pageNo, pageSize, userId)).thenReturn(result);
Result response = processDefinitionController.queryProcessDefinitionListPaging(user, projectName, pageNo, searchVal, userId, pageSize);
Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue());
}
@Test
public void testBatchExportProcessDefinitionByIds() throws Exception {
String processDefinitionIds = "1,2";
String projectName = "test";
HttpServletResponse response = new MockHttpServletResponse();
Mockito.doNothing().when(this.processDefinitionService).batchExportProcessDefinitionByIds(user, projectName, processDefinitionIds, response);
processDefinitionController.batchExportProcessDefinitionByIds(user, projectName, processDefinitionIds, response); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java | }
@Test
public void testQueryProcessDefinitionVersions() {
String projectName = "test";
Map<String, Object> resultMap = new HashMap<>();
putMsg(resultMap, Status.SUCCESS);
resultMap.put(Constants.DATA_LIST, new PageInfo<ProcessDefinitionVersion>(1, 10));
Mockito.when(processDefinitionVersionService.queryProcessDefinitionVersions(
user
, projectName
, 1
, 10
, 1))
.thenReturn(resultMap);
Result result = processDefinitionController.queryProcessDefinitionVersions(
user
, projectName
, 1
, 10
, 1);
Assert.assertEquals(Status.SUCCESS.getCode(), (int) result.getCode());
}
@Test
public void testSwitchProcessDefinitionVersion() {
String projectName = "test";
Map<String, Object> resultMap = new HashMap<>();
putMsg(resultMap, Status.SUCCESS);
Mockito.when(processDefinitionService.switchProcessDefinitionVersion(
user
, projectName |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java | , 1
, 10))
.thenReturn(resultMap);
Result result = processDefinitionController.switchProcessDefinitionVersion(
user
, projectName
, 1
, 10);
Assert.assertEquals(Status.SUCCESS.getCode(), (int) result.getCode());
}
@Test
public void testDeleteProcessDefinitionVersion() {
String projectName = "test";
Map<String, Object> resultMap = new HashMap<>();
putMsg(resultMap, Status.SUCCESS);
Mockito.when(processDefinitionVersionService.deleteByProcessDefinitionIdAndVersion(
user
, projectName
, 1
, 10))
.thenReturn(resultMap);
Result result = processDefinitionController.deleteProcessDefinitionVersion(
user
, projectName
, 1
, 10);
Assert.assertEquals(Status.SUCCESS.getCode(), (int) result.getCode());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | package org.apache.dolphinscheduler.api.service;
import static org.assertj.core.api.Assertions.assertThat;
import org.apache.dolphinscheduler.api.dto.ProcessMeta;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl;
import org.apache.dolphinscheduler.api.service.impl.ProjectServiceImpl;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
import org.apache.dolphinscheduler.common.enums.FailureStrategy;
import org.apache.dolphinscheduler.common.enums.Priority;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.common.enums.WarningType;
import org.apache.dolphinscheduler.common.model.TaskNode;
import org.apache.dolphinscheduler.common.process.ResourceInfo;
import org.apache.dolphinscheduler.common.task.shell.ShellParameters;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.FileUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.common.utils.StringUtils;
import org.apache.dolphinscheduler.dao.entity.DataSource;
import org.apache.dolphinscheduler.dao.entity.ProcessData;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.Schedule;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.http.entity.ContentType;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.Method;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.multipart.MultipartFile;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@RunWith(MockitoJUnitRunner.class)
public class ProcessDefinitionServiceTest { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | @InjectMocks
private ProcessDefinitionServiceImpl processDefinitionService;
@Mock
private ProcessDefinitionMapper processDefineMapper;
@Mock
private ProjectMapper projectMapper;
@Mock
private ProjectServiceImpl projectService;
@Mock
private ScheduleMapper scheduleMapper;
@Mock
private ProcessService processService;
@Mock
private ProcessInstanceService processInstanceService;
@Mock
private TaskInstanceMapper taskInstanceMapper;
@Mock
private ProcessDefinitionVersionService processDefinitionVersionService;
private static final String SHELL_JSON = "{\n"
+ " \"globalParams\": [\n"
+ " \n"
+ " ],\n"
+ " \"tasks\": [\n"
+ " {\n"
+ " \"type\": \"SHELL\",\n"
+ " \"id\": \"tasks-9527\",\n"
+ " \"name\": \"shell-1\",\n"
+ " \"params\": {\n"
+ " \"resourceList\": [\n"
+ " \n" |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | + " ],\n"
+ " \"localParams\": [\n"
+ " \n"
+ " ],\n"
+ " \"rawScript\": \"#!/bin/bash\\necho \\\"shell-1\\\"\"\n"
+ " },\n"
+ " \"description\": \"\",\n"
+ " \"runFlag\": \"NORMAL\",\n"
+ " \"dependence\": {\n"
+ " \n"
+ " },\n"
+ " \"maxRetryTimes\": \"0\",\n"
+ " \"retryInterval\": \"1\",\n"
+ " \"timeout\": {\n"
+ " \"strategy\": \"\",\n"
+ " \"interval\": 1,\n"
+ " \"enable\": false\n"
+ " },\n"
+ " \"taskInstancePriority\": \"MEDIUM\",\n"
+ " \"workerGroupId\": -1,\n"
+ " \"preTasks\": [\n"
+ " \n"
+ " ]\n"
+ " }\n"
+ " ],\n"
+ " \"tenantId\": 1,\n"
+ " \"timeout\": 0\n"
+ "}";
private static final String CYCLE_SHELL_JSON = "{\n"
+ " \"globalParams\": [\n" |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | + " \n"
+ " ],\n"
+ " \"tasks\": [\n"
+ " {\n"
+ " \"type\": \"SHELL\",\n"
+ " \"id\": \"tasks-9527\",\n"
+ " \"name\": \"shell-1\",\n"
+ " \"params\": {\n"
+ " \"resourceList\": [\n"
+ " \n"
+ " ],\n"
+ " \"localParams\": [\n"
+ " \n"
+ " ],\n"
+ " \"rawScript\": \"#!/bin/bash\\necho \\\"shell-1\\\"\"\n"
+ " },\n"
+ " \"description\": \"\",\n"
+ " \"runFlag\": \"NORMAL\",\n"
+ " \"dependence\": {\n"
+ " \n"
+ " },\n"
+ " \"maxRetryTimes\": \"0\",\n"
+ " \"retryInterval\": \"1\",\n"
+ " \"timeout\": {\n"
+ " \"strategy\": \"\",\n"
+ " \"interval\": 1,\n"
+ " \"enable\": false\n"
+ " },\n"
+ " \"taskInstancePriority\": \"MEDIUM\",\n"
+ " \"workerGroupId\": -1,\n" |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | + " \"preTasks\": [\n"
+ " \"tasks-9529\"\n"
+ " ]\n"
+ " },\n"
+ " {\n"
+ " \"type\": \"SHELL\",\n"
+ " \"id\": \"tasks-9528\",\n"
+ " \"name\": \"shell-1\",\n"
+ " \"params\": {\n"
+ " \"resourceList\": [\n"
+ " \n"
+ " ],\n"
+ " \"localParams\": [\n"
+ " \n"
+ " ],\n"
+ " \"rawScript\": \"#!/bin/bash\\necho \\\"shell-1\\\"\"\n"
+ " },\n"
+ " \"description\": \"\",\n"
+ " \"runFlag\": \"NORMAL\",\n"
+ " \"dependence\": {\n"
+ " \n"
+ " },\n"
+ " \"maxRetryTimes\": \"0\",\n"
+ " \"retryInterval\": \"1\",\n"
+ " \"timeout\": {\n"
+ " \"strategy\": \"\",\n"
+ " \"interval\": 1,\n"
+ " \"enable\": false\n"
+ " },\n"
+ " \"taskInstancePriority\": \"MEDIUM\",\n" |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | + " \"workerGroupId\": -1,\n"
+ " \"preTasks\": [\n"
+ " \"tasks-9527\"\n"
+ " ]\n"
+ " },\n"
+ " {\n"
+ " \"type\": \"SHELL\",\n"
+ " \"id\": \"tasks-9529\",\n"
+ " \"name\": \"shell-1\",\n"
+ " \"params\": {\n"
+ " \"resourceList\": [\n"
+ " \n"
+ " ],\n"
+ " \"localParams\": [\n"
+ " \n"
+ " ],\n"
+ " \"rawScript\": \"#!/bin/bash\\necho \\\"shell-1\\\"\"\n"
+ " },\n"
+ " \"description\": \"\",\n"
+ " \"runFlag\": \"NORMAL\",\n"
+ " \"dependence\": {\n"
+ " \n"
+ " },\n"
+ " \"maxRetryTimes\": \"0\",\n"
+ " \"retryInterval\": \"1\",\n"
+ " \"timeout\": {\n"
+ " \"strategy\": \"\",\n"
+ " \"interval\": 1,\n"
+ " \"enable\": false\n"
+ " },\n" |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | + " \"taskInstancePriority\": \"MEDIUM\",\n"
+ " \"workerGroupId\": -1,\n"
+ " \"preTasks\": [\n"
+ " \"tasks-9528\"\n"
+ " ]\n"
+ " }\n"
+ " ],\n"
+ " \"tenantId\": 1,\n"
+ " \"timeout\": 0\n"
+ "}";
@Test
public void testQueryProcessDefinitionList() {
String projectName = "project_test1";
Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName));
Project project = getProject(projectName);
User loginUser = new User();
loginUser.setId(-1);
loginUser.setUserType(UserType.GENERAL_USER);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUNT, projectName);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result);
Map<String, Object> map = processDefinitionService.queryProcessDefinitionList(loginUser, "project_test1");
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectName);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result);
List<ProcessDefinition> resourceList = new ArrayList<>();
resourceList.add(getProcessDefinition());
Mockito.when(processDefineMapper.queryAllDefinitionList(project.getId())).thenReturn(resourceList); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | Map<String, Object> checkSuccessRes = processDefinitionService.queryProcessDefinitionList(loginUser, "project_test1");
Assert.assertEquals(Status.SUCCESS, checkSuccessRes.get(Constants.STATUS));
}
@Test
@SuppressWarnings("unchecked")
public void testQueryProcessDefinitionListPaging() {
String projectName = "project_test1";
Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName));
Project project = getProject(projectName);
User loginUser = new User();
loginUser.setId(-1);
loginUser.setUserType(UserType.GENERAL_USER);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUNT, projectName);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result);
Map<String, Object> map = processDefinitionService.queryProcessDefinitionListPaging(loginUser, "project_test1", "", 1, 5, 0);
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectName);
loginUser.setId(1);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result);
Page<ProcessDefinition> page = new Page<>(1, 10);
page.setTotal(30);
Mockito.when(processDefineMapper.queryDefineListPaging(
Mockito.any(IPage.class)
, Mockito.eq("")
, Mockito.eq(loginUser.getId())
, Mockito.eq(project.getId())
, Mockito.anyBoolean())).thenReturn(page);
Map<String, Object> map1 = processDefinitionService.queryProcessDefinitionListPaging( |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | loginUser, projectName, "", 1, 10, loginUser.getId());
Assert.assertEquals(Status.SUCCESS, map1.get(Constants.STATUS));
}
@Test
public void testQueryProcessDefinitionById() {
String projectName = "project_test1";
Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName));
Project project = getProject(projectName);
User loginUser = new User();
loginUser.setId(-1);
loginUser.setUserType(UserType.GENERAL_USER);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUNT, projectName);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result);
Map<String, Object> map = processDefinitionService.queryProcessDefinitionById(loginUser,
"project_test1", 1);
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectName);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result);
Mockito.when(processDefineMapper.selectById(1)).thenReturn(null);
Map<String, Object> instanceNotexitRes = processDefinitionService.queryProcessDefinitionById(loginUser,
"project_test1", 1);
Assert.assertEquals(Status.PROCESS_INSTANCE_NOT_EXIST, instanceNotexitRes.get(Constants.STATUS));
Mockito.when(processDefineMapper.selectById(46)).thenReturn(getProcessDefinition());
Map<String, Object> successRes = processDefinitionService.queryProcessDefinitionById(loginUser,
"project_test1", 46);
Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | }
@Test
public void testBatchCopyProcessDefinition() {
String projectName = "project_test1";
Project project = getProject(projectName);
User loginUser = new User();
loginUser.setId(-1);
loginUser.setUserType(UserType.GENERAL_USER);
Map<String, Object> map = processDefinitionService.batchCopyProcessDefinition(loginUser, projectName, StringUtils.EMPTY, 0);
Assert.assertEquals(Status.PROCESS_DEFINITION_IDS_IS_EMPTY, map.get(Constants.STATUS));
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUNT, projectName);
Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName));
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result);
Map<String, Object> map1 = processDefinitionService.batchCopyProcessDefinition(
loginUser, projectName, String.valueOf(project.getId()), 0);
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map1.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectName);
Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName));
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result);
Mockito.when(projectMapper.queryDetailById(0)).thenReturn(null);
Map<String, Object> map2 = processDefinitionService.batchCopyProcessDefinition(
loginUser, projectName, String.valueOf(project.getId()), 0);
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map2.get(Constants.STATUS));
Project project1 = getProject(projectName);
Mockito.when(projectMapper.queryByName(projectName)).thenReturn(project1); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result);
putMsg(result, Status.SUCCESS, projectName);
String projectName2 = "project_test2";
Project project2 = getProject(projectName2);
Mockito.when(projectMapper.queryByName(projectName2)).thenReturn(project2);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project2, projectName2)).thenReturn(result);
Mockito.when(projectMapper.queryDetailById(1)).thenReturn(project2);
ProcessDefinition definition = getProcessDefinition();
definition.setLocations("{\"tasks-36196\":{\"name\":\"ssh_test1\",\"targetarr\":\"\",\"x\":141,\"y\":70}}");
definition.setProcessDefinitionJson("{\"globalParams\":[],\"tasks\":[{\"type\":\"SHELL\",\"id\":\"tasks-36196\","
+ "\"name\":\"ssh_test1\",\"params\":{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"aa=\\\"1234"
+ "\\\"\\necho ${aa}\"},\"desc\":\"\",\"runFlag\":\"NORMAL\",\"dependence\":{},\"maxRetryTimes\":\"0\","
+ "\"retryInterval\":\"1\",\"timeout\":{\"strategy\":\"\",\"interval\":null,\"enable\":false},"
+ "\"taskInstancePriority\":\"MEDIUM\",\"workerGroupId\":-1,\"preTasks\":[]}],\"tenantId\":-1,\"timeout\":0}");
definition.setConnects("[]");
Mockito.when(processDefineMapper.selectById(46)).thenReturn(definition);
Map<String, Object> map3 = processDefinitionService.batchCopyProcessDefinition(
loginUser, projectName, "46", 1);
Assert.assertEquals(Status.SUCCESS, map3.get(Constants.STATUS));
}
@Test
public void testBatchMoveProcessDefinition() {
String projectName = "project_test1";
Project project1 = getProject(projectName);
Mockito.when(projectMapper.queryByName(projectName)).thenReturn(project1);
String projectName2 = "project_test2";
Project project2 = getProject(projectName2);
Mockito.when(projectMapper.queryByName(projectName2)).thenReturn(project2);
int targetProjectId = 2; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | Mockito.when(projectMapper.queryDetailById(targetProjectId)).thenReturn(getProjectById(targetProjectId));
Project project = getProject(projectName);
Project targetProject = getProjectById(targetProjectId);
User loginUser = new User();
loginUser.setId(-1);
loginUser.setUserType(UserType.GENERAL_USER);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS, projectName);
Map<String, Object> result2 = new HashMap<>();
putMsg(result2, Status.SUCCESS, targetProject.getName());
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project2, projectName2)).thenReturn(result);
ProcessDefinition definition = getProcessDefinition();
definition.setLocations("{\"tasks-36196\":{\"name\":\"ssh_test1\",\"targetarr\":\"\",\"x\":141,\"y\":70}}");
definition.setProcessDefinitionJson("{\"globalParams\":[],\"tasks\":[{\"type\":\"SHELL\",\"id\":\"tasks-36196\""
+ ",\"name\":\"ssh_test1\",\"params\":{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"aa=\\\"1234"
+ "\\\"\\necho ${aa}\"},\"desc\":\"\",\"runFlag\":\"NORMAL\",\"dependence\":{},\"maxRetryTimes\":\"0\","
+ "\"retryInterval\":\"1\",\"timeout\":{\"strategy\":\"\",\"interval\":null,\"enable\":false},"
+ "\"taskInstancePriority\":\"MEDIUM\",\"workerGroupId\":-1,\"preTasks\":[]}],\"tenantId\":-1,\"timeout\":0}");
definition.setConnects("[]");
Mockito.when(processDefineMapper.updateById(definition)).thenReturn(46);
Mockito.when(processDefineMapper.selectById(46)).thenReturn(definition);
putMsg(result, Status.SUCCESS);
Map<String, Object> successRes = processDefinitionService.batchMoveProcessDefinition(
loginUser, "project_test1", "46", 2);
Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
}
@Test
public void deleteProcessDefinitionByIdTest() { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | String projectName = "project_test1";
Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName));
Project project = getProject(projectName);
User loginUser = new User();
loginUser.setId(-1);
loginUser.setUserType(UserType.GENERAL_USER);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUNT, projectName);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result);
Map<String, Object> map = processDefinitionService.deleteProcessDefinitionById(loginUser, "project_test1", 6);
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectName);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result);
Mockito.when(processDefineMapper.selectById(1)).thenReturn(null);
Map<String, Object> instanceNotexitRes = processDefinitionService.deleteProcessDefinitionById(loginUser,
"project_test1", 1);
Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, instanceNotexitRes.get(Constants.STATUS));
ProcessDefinition processDefinition = getProcessDefinition();
loginUser.setUserType(UserType.GENERAL_USER);
Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition);
Map<String, Object> userNoAuthRes = processDefinitionService.deleteProcessDefinitionById(loginUser,
"project_test1", 46);
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, userNoAuthRes.get(Constants.STATUS));
loginUser.setUserType(UserType.ADMIN_USER);
processDefinition.setReleaseState(ReleaseState.ONLINE);
Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | Map<String, Object> dfOnlineRes = processDefinitionService.deleteProcessDefinitionById(loginUser,
"project_test1", 46);
Assert.assertEquals(Status.PROCESS_DEFINE_STATE_ONLINE, dfOnlineRes.get(Constants.STATUS));
processDefinition.setReleaseState(ReleaseState.OFFLINE);
Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition);
List<Schedule> schedules = new ArrayList<>();
schedules.add(getSchedule());
schedules.add(getSchedule());
Mockito.when(scheduleMapper.queryByProcessDefinitionId(46)).thenReturn(schedules);
Map<String, Object> schedulerGreaterThanOneRes = processDefinitionService.deleteProcessDefinitionById(loginUser,
"project_test1", 46);
Assert.assertEquals(Status.DELETE_PROCESS_DEFINE_BY_ID_ERROR, schedulerGreaterThanOneRes.get(Constants.STATUS));
schedules.clear();
Schedule schedule = getSchedule();
schedule.setReleaseState(ReleaseState.ONLINE);
schedules.add(schedule);
Mockito.when(scheduleMapper.queryByProcessDefinitionId(46)).thenReturn(schedules);
Map<String, Object> schedulerOnlineRes = processDefinitionService.deleteProcessDefinitionById(loginUser,
"project_test1", 46);
Assert.assertEquals(Status.SCHEDULE_CRON_STATE_ONLINE, schedulerOnlineRes.get(Constants.STATUS));
schedules.clear();
schedule.setReleaseState(ReleaseState.OFFLINE);
schedules.add(schedule);
Mockito.when(scheduleMapper.queryByProcessDefinitionId(46)).thenReturn(schedules);
Mockito.when(processDefineMapper.deleteById(46)).thenReturn(0);
Map<String, Object> deleteFail = processDefinitionService.deleteProcessDefinitionById(loginUser,
"project_test1", 46); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | Assert.assertEquals(Status.DELETE_PROCESS_DEFINE_BY_ID_ERROR, deleteFail.get(Constants.STATUS));
Mockito.when(processDefineMapper.deleteById(46)).thenReturn(1);
Map<String, Object> deleteSuccess = processDefinitionService.deleteProcessDefinitionById(loginUser,
"project_test1", 46);
Assert.assertEquals(Status.SUCCESS, deleteSuccess.get(Constants.STATUS));
}
@Test
public void testReleaseProcessDefinition() {
String projectName = "project_test1";
Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName));
Project project = getProject(projectName);
User loginUser = new User();
loginUser.setId(1);
loginUser.setUserType(UserType.GENERAL_USER);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUNT, projectName);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result);
Map<String, Object> map = processDefinitionService.releaseProcessDefinition(loginUser, "project_test1",
6, ReleaseState.OFFLINE.getCode());
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectName);
Mockito.when(processDefineMapper.selectById(46)).thenReturn(getProcessDefinition());
Map<String, Object> onlineRes = processDefinitionService.releaseProcessDefinition(
loginUser, "project_test1", 46, ReleaseState.ONLINE.getCode());
Assert.assertEquals(Status.SUCCESS, onlineRes.get(Constants.STATUS));
ProcessDefinition processDefinition1 = getProcessDefinition(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | processDefinition1.setResourceIds("1,2");
Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition1);
Mockito.when(processService.getUserById(1)).thenReturn(loginUser);
Map<String, Object> onlineWithResourceRes = processDefinitionService.releaseProcessDefinition(
loginUser, "project_test1", 46, ReleaseState.ONLINE.getCode());
Assert.assertEquals(Status.SUCCESS, onlineWithResourceRes.get(Constants.STATUS));
Map<String, Object> failRes = processDefinitionService.releaseProcessDefinition(
loginUser, "project_test1", 46, 2);
Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, failRes.get(Constants.STATUS));
}
@Test
public void testVerifyProcessDefinitionName() {
String projectName = "project_test1";
Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName));
Project project = getProject(projectName);
User loginUser = new User();
loginUser.setId(-1);
loginUser.setUserType(UserType.GENERAL_USER); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUNT, projectName);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result);
Map<String, Object> map = processDefinitionService.verifyProcessDefinitionName(loginUser,
"project_test1", "test_pdf");
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectName);
Mockito.when(processDefineMapper.verifyByDefineName(project.getId(), "test_pdf")).thenReturn(null);
Map<String, Object> processNotExistRes = processDefinitionService.verifyProcessDefinitionName(loginUser,
"project_test1", "test_pdf");
Assert.assertEquals(Status.SUCCESS, processNotExistRes.get(Constants.STATUS));
Mockito.when(processDefineMapper.verifyByDefineName(project.getId(), "test_pdf")).thenReturn(getProcessDefinition());
Map<String, Object> processExistRes = processDefinitionService.verifyProcessDefinitionName(loginUser,
"project_test1", "test_pdf");
Assert.assertEquals(Status.PROCESS_INSTANCE_EXIST, processExistRes.get(Constants.STATUS));
}
@Test
public void testCheckProcessNodeList() {
Map<String, Object> dataNotValidRes = processDefinitionService.checkProcessNodeList(null, "");
Assert.assertEquals(Status.DATA_IS_NOT_VALID, dataNotValidRes.get(Constants.STATUS));
String processDefinitionJson = SHELL_JSON;
ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class);
Assert.assertNotNull(processData);
Map<String, Object> taskEmptyRes = processDefinitionService.checkProcessNodeList(processData, processDefinitionJson);
Assert.assertEquals(Status.SUCCESS, taskEmptyRes.get(Constants.STATUS));
processData.setTasks(null); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | Map<String, Object> taskNotEmptyRes = processDefinitionService.checkProcessNodeList(processData, processDefinitionJson);
Assert.assertEquals(Status.DATA_IS_NULL, taskNotEmptyRes.get(Constants.STATUS));
String processDefinitionJsonCycle = CYCLE_SHELL_JSON;
ProcessData processDataCycle = JSONUtils.parseObject(processDefinitionJsonCycle, ProcessData.class);
Map<String, Object> taskCycleRes = processDefinitionService.checkProcessNodeList(processDataCycle, processDefinitionJsonCycle);
Assert.assertEquals(Status.PROCESS_NODE_HAS_CYCLE, taskCycleRes.get(Constants.STATUS));
String abnormalJson = processDefinitionJson.replaceAll("SHELL", "");
processData = JSONUtils.parseObject(abnormalJson, ProcessData.class);
Map<String, Object> abnormalTaskRes = processDefinitionService.checkProcessNodeList(processData, abnormalJson);
Assert.assertEquals(Status.PROCESS_NODE_S_PARAMETER_INVALID, abnormalTaskRes.get(Constants.STATUS));
}
@Test
public void testGetTaskNodeListByDefinitionId() {
Mockito.when(processDefineMapper.selectById(46)).thenReturn(null);
Map<String, Object> processDefinitionNullRes = processDefinitionService.getTaskNodeListByDefinitionId(46);
Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionNullRes.get(Constants.STATUS));
ProcessDefinition processDefinition = getProcessDefinition();
Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition);
Map<String, Object> successRes = processDefinitionService.getTaskNodeListByDefinitionId(46);
Assert.assertEquals(Status.DATA_IS_NOT_VALID, successRes.get(Constants.STATUS));
processDefinition.setProcessDefinitionJson(SHELL_JSON);
Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition);
Map<String, Object> dataNotValidRes = processDefinitionService.getTaskNodeListByDefinitionId(46);
Assert.assertEquals(Status.SUCCESS, dataNotValidRes.get(Constants.STATUS));
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | @Test
public void testGetTaskNodeListByDefinitionIdList() {
String defineIdList = "46";
Integer[] idArray = {46};
Mockito.when(processDefineMapper.queryDefinitionListByIdList(idArray)).thenReturn(null);
Map<String, Object> processNotExistRes = processDefinitionService.getTaskNodeListByDefinitionIdList(defineIdList);
Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, processNotExistRes.get(Constants.STATUS));
ProcessDefinition processDefinition = getProcessDefinition();
processDefinition.setProcessDefinitionJson(SHELL_JSON);
List<ProcessDefinition> processDefinitionList = new ArrayList<>();
processDefinitionList.add(processDefinition);
Mockito.when(processDefineMapper.queryDefinitionListByIdList(idArray)).thenReturn(processDefinitionList);
Map<String, Object> successRes = processDefinitionService.getTaskNodeListByDefinitionIdList(defineIdList);
Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
}
@Test
public void testQueryProcessDefinitionAllByProjectId() {
int projectId = 1;
ProcessDefinition processDefinition = getProcessDefinition();
processDefinition.setProcessDefinitionJson(SHELL_JSON);
List<ProcessDefinition> processDefinitionList = new ArrayList<>();
processDefinitionList.add(processDefinition);
Mockito.when(processDefineMapper.queryAllDefinitionList(projectId)).thenReturn(processDefinitionList);
Map<String, Object> successRes = processDefinitionService.queryProcessDefinitionAllByProjectId(projectId);
Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
}
@Test
public void testViewTree() throws Exception { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | ProcessDefinition processDefinition = getProcessDefinition();
processDefinition.setProcessDefinitionJson(SHELL_JSON);
Mockito.when(processDefineMapper.selectById(46)).thenReturn(null);
Map<String, Object> processDefinitionNullRes = processDefinitionService.viewTree(46, 10);
Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionNullRes.get(Constants.STATUS));
List<ProcessInstance> processInstanceList = new ArrayList<>();
ProcessInstance processInstance = new ProcessInstance();
processInstance.setId(1);
processInstance.setName("test_instance");
processInstance.setState(ExecutionStatus.RUNNING_EXECUTION);
processInstance.setHost("192.168.xx.xx");
processInstance.setStartTime(new Date());
processInstance.setEndTime(new Date());
processInstanceList.add(processInstance);
TaskInstance taskInstance = new TaskInstance();
taskInstance.setStartTime(new Date());
taskInstance.setEndTime(new Date());
taskInstance.setTaskType("SHELL");
taskInstance.setId(1);
taskInstance.setName("test_task_instance");
taskInstance.setState(ExecutionStatus.RUNNING_EXECUTION);
taskInstance.setHost("192.168.xx.xx");
Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition);
Mockito.when(processInstanceService.queryByProcessDefineId(46, 10)).thenReturn(processInstanceList);
Mockito.when(taskInstanceMapper.queryByInstanceIdAndName(processInstance.getId(), "shell-1")).thenReturn(null);
Map<String, Object> taskNullRes = processDefinitionService.viewTree(46, 10);
Assert.assertEquals(Status.SUCCESS, taskNullRes.get(Constants.STATUS)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | Mockito.when(taskInstanceMapper.queryByInstanceIdAndName(processInstance.getId(), "shell-1")).thenReturn(taskInstance);
Map<String, Object> taskNotNuLLRes = processDefinitionService.viewTree(46, 10);
Assert.assertEquals(Status.SUCCESS, taskNotNuLLRes.get(Constants.STATUS));
}
@Test
public void testImportProcessDefinitionById() throws IOException {
String processJson = "[\n"
+ " {\n"
+ " \"projectName\": \"testProject\",\n"
+ " \"processDefinitionName\": \"shell-4\",\n"
+ " \"processDefinitionJson\": \"{\\\"tenantId\\\":1"
+ ",\\\"globalParams\\\":[],\\\"tasks\\\":[{\\\"workerGroupId\\\":\\\"3\\\",\\\"description\\\""
+ ":\\\"\\\",\\\"runFlag\\\":\\\"NORMAL\\\",\\\"type\\\":\\\"SHELL\\\",\\\"params\\\":{\\\"rawScript\\\""
+ ":\\\"#!/bin/bash\\\\necho \\\\\\\"shell-4\\\\\\\"\\\",\\\"localParams\\\":[],\\\"resourceList\\\":[]}"
+ ",\\\"timeout\\\":{\\\"enable\\\":false,\\\"strategy\\\":\\\"\\\"},\\\"maxRetryTimes\\\":\\\"0\\\""
+ ",\\\"taskInstancePriority\\\":\\\"MEDIUM\\\",\\\"name\\\":\\\"shell-4\\\",\\\"dependence\\\":{}"
+ ",\\\"retryInterval\\\":\\\"1\\\",\\\"preTasks\\\":[],\\\"id\\\":\\\"tasks-84090\\\"}"
+ ",{\\\"taskInstancePriority\\\":\\\"MEDIUM\\\",\\\"name\\\":\\\"shell-5\\\",\\\"workerGroupId\\\""
+ ":\\\"3\\\",\\\"description\\\":\\\"\\\",\\\"dependence\\\":{},\\\"preTasks\\\":[\\\"shell-4\\\"]"
+ ",\\\"id\\\":\\\"tasks-87364\\\",\\\"runFlag\\\":\\\"NORMAL\\\",\\\"type\\\":\\\"SUB_PROCESS\\\""
+ ",\\\"params\\\":{\\\"processDefinitionId\\\":46},\\\"timeout\\\":{\\\"enable\\\":false"
+ ",\\\"strategy\\\":\\\"\\\"}}],\\\"timeout\\\":0}\",\n"
+ " \"processDefinitionDescription\": \"\",\n"
+ " \"processDefinitionLocations\": \"{\\\"tasks-84090\\\":{\\\"name\\\":\\\"shell-4\\\""
+ ",\\\"targetarr\\\":\\\"\\\",\\\"x\\\":128,\\\"y\\\":114},\\\"tasks-87364\\\":{\\\"name\\\""
+ ":\\\"shell-5\\\",\\\"targetarr\\\":\\\"tasks-84090\\\",\\\"x\\\":266,\\\"y\\\":115}}\",\n"
+ " \"processDefinitionConnects\": \"[{\\\"endPointSourceId\\\":\\\"tasks-84090\\\""
+ ",\\\"endPointTargetId\\\":\\\"tasks-87364\\\"}]\"\n"
+ " }\n"
+ "]"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | String subProcessJson = "{\n"
+ " \"globalParams\": [\n"
+ " \n"
+ " ],\n"
+ " \"tasks\": [\n"
+ " {\n"
+ " \"type\": \"SHELL\",\n"
+ " \"id\": \"tasks-52423\",\n"
+ " \"name\": \"shell-5\",\n"
+ " \"params\": {\n"
+ " \"resourceList\": [\n"
+ " \n"
+ " ],\n"
+ " \"localParams\": [\n"
+ " \n"
+ " ],\n"
+ " \"rawScript\": \"echo \\\"shell-5\\\"\"\n"
+ " },\n"
+ " \"description\": \"\",\n"
+ " \"runFlag\": \"NORMAL\",\n"
+ " \"dependence\": {\n"
+ " \n"
+ " },\n"
+ " \"maxRetryTimes\": \"0\",\n"
+ " \"retryInterval\": \"1\",\n"
+ " \"timeout\": {\n"
+ " \"strategy\": \"\",\n"
+ " \"interval\": null,\n"
+ " \"enable\": false\n"
+ " },\n" |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | + " \"taskInstancePriority\": \"MEDIUM\",\n"
+ " \"workerGroupId\": \"3\",\n"
+ " \"preTasks\": [\n"
+ " \n"
+ " ]\n"
+ " }\n"
+ " ],\n"
+ " \"tenantId\": 1,\n"
+ " \"timeout\": 0\n"
+ "}";
FileUtils.writeStringToFile(new File("/tmp/task.json"), processJson);
File file = new File("/tmp/task.json");
FileInputStream fileInputStream = new FileInputStream("/tmp/task.json");
MultipartFile multipartFile = new MockMultipartFile(file.getName(), file.getName(),
ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream);
User loginUser = new User();
loginUser.setId(1);
loginUser.setUserType(UserType.ADMIN_USER);
String currentProjectName = "testProject";
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS, currentProjectName);
ProcessDefinition shellDefinition2 = new ProcessDefinition();
shellDefinition2.setId(46);
shellDefinition2.setName("shell-5");
shellDefinition2.setProjectId(2);
shellDefinition2.setProcessDefinitionJson(subProcessJson);
Mockito.when(projectMapper.queryByName(currentProjectName)).thenReturn(getProject(currentProjectName));
Mockito.when(projectService.checkProjectAndAuth(loginUser, getProject(currentProjectName), currentProjectName)).thenReturn(result);
Mockito.when(processDefineMapper.queryByDefineId(46)).thenReturn(shellDefinition2);
Map<String, Object> importProcessResult = processDefinitionService.importProcessDefinition(loginUser, multipartFile, currentProjectName); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | Assert.assertEquals(Status.SUCCESS, importProcessResult.get(Constants.STATUS));
boolean delete = file.delete();
Assert.assertTrue(delete);
}
@Test
public void testUpdateProcessDefinition() {
User loginUser = new User();
loginUser.setId(1);
loginUser.setUserType(UserType.ADMIN_USER);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS);
String projectName = "project_test1";
Project project = getProject(projectName);
ProcessDefinition processDefinition = getProcessDefinition();
Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName));
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result);
Mockito.when(processService.findProcessDefineById(1)).thenReturn(processDefinition);
Mockito.when(processDefinitionVersionService.addProcessDefinitionVersion(processDefinition)).thenReturn(1L);
String sqlDependentJson = "{\n"
+ " \"globalParams\": [\n"
+ " \n"
+ " ],\n"
+ " \"tasks\": [\n"
+ " {\n"
+ " \"type\": \"SQL\",\n"
+ " \"id\": \"tasks-27297\",\n"
+ " \"name\": \"sql\",\n"
+ " \"params\": {\n"
+ " \"type\": \"MYSQL\",\n"
+ " \"datasource\": 1,\n" |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | + " \"sql\": \"select * from test\",\n"
+ " \"udfs\": \"\",\n"
+ " \"sqlType\": \"1\",\n"
+ " \"title\": \"\",\n"
+ " \"receivers\": \"\",\n"
+ " \"receiversCc\": \"\",\n"
+ " \"showType\": \"TABLE\",\n"
+ " \"localParams\": [\n"
+ " \n"
+ " ],\n"
+ " \"connParams\": \"\",\n"
+ " \"preStatements\": [\n"
+ " \n"
+ " ],\n"
+ " \"postStatements\": [\n"
+ " \n"
+ " ]\n"
+ " },\n"
+ " \"description\": \"\",\n"
+ " \"runFlag\": \"NORMAL\",\n"
+ " \"dependence\": {\n"
+ " \n"
+ " },\n"
+ " \"maxRetryTimes\": \"0\",\n"
+ " \"retryInterval\": \"1\",\n"
+ " \"timeout\": {\n"
+ " \"strategy\": \"\",\n"
+ " \"enable\": false\n"
+ " },\n"
+ " \"taskInstancePriority\": \"MEDIUM\",\n" |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | + " \"workerGroupId\": -1,\n"
+ " \"preTasks\": [\n"
+ " \"dependent\"\n"
+ " ]\n"
+ " },\n"
+ " {\n"
+ " \"type\": \"DEPENDENT\",\n"
+ " \"id\": \"tasks-33787\",\n"
+ " \"name\": \"dependent\",\n"
+ " \"params\": {\n"
+ " \n"
+ " },\n"
+ " \"description\": \"\",\n"
+ " \"runFlag\": \"NORMAL\",\n"
+ " \"dependence\": {\n"
+ " \"relation\": \"AND\",\n"
+ " \"dependTaskList\": [\n"
+ " {\n"
+ " \"relation\": \"AND\",\n"
+ " \"dependItemList\": [\n"
+ " {\n"
+ " \"projectId\": 2,\n"
+ " \"definitionId\": 46,\n"
+ " \"depTasks\": \"ALL\",\n"
+ " \"cycle\": \"day\",\n"
+ " \"dateValue\": \"today\"\n"
+ " }\n"
+ " ]\n"
+ " }\n"
+ " ]\n" |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | + " },\n"
+ " \"maxRetryTimes\": \"0\",\n"
+ " \"retryInterval\": \"1\",\n"
+ " \"timeout\": {\n"
+ " \"strategy\": \"\",\n"
+ " \"enable\": false\n"
+ " },\n"
+ " \"taskInstancePriority\": \"MEDIUM\",\n"
+ " \"workerGroupId\": -1,\n"
+ " \"preTasks\": [\n"
+ " \n"
+ " ]\n"
+ " }\n"
+ " ],\n"
+ " \"tenantId\": 1,\n"
+ " \"timeout\": 0\n"
+ "}";
Map<String, Object> updateResult = processDefinitionService.updateProcessDefinition(loginUser, projectName, 1, "test",
sqlDependentJson, "", "", "");
Assert.assertEquals(Status.UPDATE_PROCESS_DEFINITION_ERROR, updateResult.get(Constants.STATUS));
}
@Test
public void testBatchExportProcessDefinitionByIds() {
processDefinitionService.batchExportProcessDefinitionByIds(
null, null, null, null);
User loginUser = new User();
loginUser.setId(1);
loginUser.setUserType(UserType.ADMIN_USER);
String projectName = "project_test1";
Project project = getProject(projectName); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUNT);
Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName));
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result);
processDefinitionService.batchExportProcessDefinitionByIds(
loginUser, projectName, "1", null);
}
@Test
public void testGetResourceIds() throws Exception {
Method testMethod = ReflectionUtils.findMethod(ProcessDefinitionServiceImpl.class, "getResourceIds", ProcessData.class);
assertThat(testMethod).isNotNull();
testMethod.setAccessible(true);
ProcessData input1 = new ProcessData();
input1.setTasks(Collections.emptyList());
String output1 = (String) testMethod.invoke(processDefinitionService, input1);
assertThat(output1).isEmpty();
ProcessData input2 = new ProcessData();
input2.setTasks(null);
String output2 = (String) testMethod.invoke(processDefinitionService, input2);
assertThat(output2).isEmpty();
ProcessData input3 = new ProcessData();
TaskNode taskNode3 = new TaskNode();
taskNode3.setType("notExistType");
input3.setTasks(Collections.singletonList(taskNode3));
String output3 = (String) testMethod.invoke(processDefinitionService, input3);
assertThat(output3).isEmpty(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | ProcessData input4 = new ProcessData();
TaskNode taskNode4 = new TaskNode();
taskNode4.setType("SHELL");
taskNode4.setParams(null);
input4.setTasks(Collections.singletonList(taskNode4));
String output4 = (String) testMethod.invoke(processDefinitionService, input4);
assertThat(output4).isEmpty();
ProcessData input5 = new ProcessData();
TaskNode taskNode5 = new TaskNode();
taskNode5.setType("SHELL");
ShellParameters shellParameters5 = new ShellParameters();
ResourceInfo resourceInfo5A = new ResourceInfo();
resourceInfo5A.setId(0);
ResourceInfo resourceInfo5B = new ResourceInfo();
resourceInfo5B.setId(1);
shellParameters5.setResourceList(Arrays.asList(resourceInfo5A, resourceInfo5B));
taskNode5.setParams(JSONUtils.toJsonString(shellParameters5));
input5.setTasks(Collections.singletonList(taskNode5));
String output5 = (String) testMethod.invoke(processDefinitionService, input5);
assertThat(output5.split(",")).hasSize(2)
.containsExactlyInAnyOrder("0", "1");
ProcessData input6 = new ProcessData();
TaskNode taskNode6 = new TaskNode();
taskNode6.setType("SHELL");
ShellParameters shellParameters6 = new ShellParameters();
ResourceInfo resourceInfo6A = new ResourceInfo();
resourceInfo6A.setId(0); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | ResourceInfo resourceInfo6B = new ResourceInfo();
resourceInfo6B.setId(1);
ResourceInfo resourceInfo6C = new ResourceInfo();
resourceInfo6C.setId(1);
ResourceInfo resourceInfo6D = new ResourceInfo();
resourceInfo6D.setId(2);
shellParameters6.setResourceList(Arrays.asList(resourceInfo6A, resourceInfo6B, resourceInfo6C, resourceInfo6D));
taskNode6.setParams(JSONUtils.toJsonString(shellParameters6));
input6.setTasks(Collections.singletonList(taskNode6));
String output6 = (String) testMethod.invoke(processDefinitionService, input6);
assertThat(output6.split(",")).hasSize(3)
.containsExactlyInAnyOrder("0", "1", "2");
}
/**
* get mock datasource
*
* @return DataSource
*/
private DataSource getDataSource() {
DataSource dataSource = new DataSource();
dataSource.setId(2);
dataSource.setName("test");
return dataSource;
}
/**
* get mock processDefinition
*
* @return ProcessDefinition
*/
private ProcessDefinition getProcessDefinition() { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | ProcessDefinition processDefinition = new ProcessDefinition();
processDefinition.setId(46);
processDefinition.setName("test_pdf");
processDefinition.setProjectId(2);
processDefinition.setTenantId(1);
processDefinition.setDescription("");
return processDefinition;
}
/**
* get mock Project
*
* @param projectName projectName
* @return Project
*/
private Project getProject(String projectName) {
Project project = new Project();
project.setId(1);
project.setName(projectName);
project.setUserId(1);
return project;
}
/**
* get mock Project
*
* @param projectId projectId
* @return Project
*/
private Project getProjectById(int projectId) {
Project project = new Project();
project.setId(projectId); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | project.setName("project_test2");
project.setUserId(1);
return project;
}
/**
* get mock schedule
*
* @return schedule
*/
private Schedule getSchedule() {
Date date = new Date();
Schedule schedule = new Schedule();
schedule.setId(46);
schedule.setProcessDefinitionId(1);
schedule.setStartTime(date);
schedule.setEndTime(date);
schedule.setCrontab("0 0 5 * * ? *");
schedule.setFailureStrategy(FailureStrategy.END);
schedule.setUserId(1);
schedule.setReleaseState(ReleaseState.OFFLINE);
schedule.setProcessInstancePriority(Priority.MEDIUM);
schedule.setWarningType(WarningType.NONE);
schedule.setWarningGroupId(1);
schedule.setWorkerGroup(Constants.DEFAULT_WORKER_GROUP);
return schedule;
}
/**
* get mock processMeta
*
* @return processMeta |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,836 | [Bug][API] verifyProcessDefinitionName error message |

| https://github.com/apache/dolphinscheduler/issues/3836 | https://github.com/apache/dolphinscheduler/pull/3908 | d32300ba5b33ec17092ae3ba7dd6502f0f709554 | 13030502fd27863827ce9a2e3ec905c5a359170b | "2020-09-28T03:21:57Z" | java | "2020-10-15T06:09:28Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | */
private ProcessMeta getProcessMeta() {
ProcessMeta processMeta = new ProcessMeta();
Schedule schedule = getSchedule();
processMeta.setScheduleCrontab(schedule.getCrontab());
processMeta.setScheduleStartTime(DateUtils.dateToString(schedule.getStartTime()));
processMeta.setScheduleEndTime(DateUtils.dateToString(schedule.getEndTime()));
processMeta.setScheduleWarningType(String.valueOf(schedule.getWarningType()));
processMeta.setScheduleWarningGroupId(schedule.getWarningGroupId());
processMeta.setScheduleFailureStrategy(String.valueOf(schedule.getFailureStrategy()));
processMeta.setScheduleReleaseState(String.valueOf(schedule.getReleaseState()));
processMeta.setScheduleProcessInstancePriority(String.valueOf(schedule.getProcessInstancePriority()));
processMeta.setScheduleWorkerGroupName("workgroup1");
return processMeta;
}
private List<Schedule> getSchedulerList() {
List<Schedule> scheduleList = new ArrayList<>();
scheduleList.add(getSchedule());
return scheduleList;
}
private void putMsg(Map<String, Object> result, Status status, Object... statusParams) {
result.put(Constants.STATUS, status);
if (statusParams != null && statusParams.length > 0) {
result.put(Constants.MSG, MessageFormat.format(status.getMsg(), statusParams));
} else {
result.put(Constants.MSG, status.getMsg());
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,938 | [CodeClean][DAO]Remove redundant comments | Remove redundant comments
ProcessInstanceMapper# queryProcessInstanceListPaging

| https://github.com/apache/dolphinscheduler/issues/3938 | https://github.com/apache/dolphinscheduler/pull/3939 | 3fdc5576e19b8102ea4f10a714cd3c85b27b2c4e | fa355b23f39e14975d2d6ca1f0f6e2178a189b42 | "2020-10-17T16:58:17Z" | java | "2020-10-18T14:36:04Z" | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.dao.mapper;
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
import org.apache.dolphinscheduler.dao.entity.ExecuteStatusCount;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* process instance mapper interface
*/
public interface ProcessInstanceMapper extends BaseMapper<ProcessInstance> { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,938 | [CodeClean][DAO]Remove redundant comments | Remove redundant comments
ProcessInstanceMapper# queryProcessInstanceListPaging

| https://github.com/apache/dolphinscheduler/issues/3938 | https://github.com/apache/dolphinscheduler/pull/3939 | 3fdc5576e19b8102ea4f10a714cd3c85b27b2c4e | fa355b23f39e14975d2d6ca1f0f6e2178a189b42 | "2020-10-17T16:58:17Z" | java | "2020-10-18T14:36:04Z" | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.java | /**
* query process instance detail info by id
* @param processId processId
* @return process instance
*/
ProcessInstance queryDetailById(@Param("processId") int processId);
/**
* query process instance by host and stateArray
* @param host host
* @param stateArray stateArray
* @return process instance list
*/
List<ProcessInstance> queryByHostAndStatus(@Param("host") String host,
@Param("states") int[] stateArray);
/**
* query process instance by tenantId and stateArray
* @param tenantId tenantId
* @param states states array
* @return process instance list
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,938 | [CodeClean][DAO]Remove redundant comments | Remove redundant comments
ProcessInstanceMapper# queryProcessInstanceListPaging

| https://github.com/apache/dolphinscheduler/issues/3938 | https://github.com/apache/dolphinscheduler/pull/3939 | 3fdc5576e19b8102ea4f10a714cd3c85b27b2c4e | fa355b23f39e14975d2d6ca1f0f6e2178a189b42 | "2020-10-17T16:58:17Z" | java | "2020-10-18T14:36:04Z" | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.java | List<ProcessInstance> queryByTenantIdAndStatus(@Param("tenantId") int tenantId,
@Param("states") int[] states);
/**
* query process instance by worker group and stateArray
* @param workerGroupId workerGroupId
* @param states states array
* @return process instance list
*/
List<ProcessInstance> queryByWorkerGroupIdAndStatus(@Param("workerGroupId") int workerGroupId,
@Param("states") int[] states);
/**
* process instance page
* @param page page
* @param projectId projectId
* @param processDefinitionId processDefinitionId
* @param searchVal searchVal
* @param statusArray statusArray
* @param host host
* @param startTime startTime
* @param endTime endTime
* @return process instance IPage
*/
/**
* process instance page
* @param page page
* @param projectId projectId
* @param processDefinitionId processDefinitionId
* @param searchVal searchVal
* @param executorId executorId
* @param statusArray statusArray |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,938 | [CodeClean][DAO]Remove redundant comments | Remove redundant comments
ProcessInstanceMapper# queryProcessInstanceListPaging

| https://github.com/apache/dolphinscheduler/issues/3938 | https://github.com/apache/dolphinscheduler/pull/3939 | 3fdc5576e19b8102ea4f10a714cd3c85b27b2c4e | fa355b23f39e14975d2d6ca1f0f6e2178a189b42 | "2020-10-17T16:58:17Z" | java | "2020-10-18T14:36:04Z" | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.java | * @param host host
* @param startTime startTime
* @param endTime endTime
* @return process instance page
*/
IPage<ProcessInstance> queryProcessInstanceListPaging(Page<ProcessInstance> page,
@Param("projectId") int projectId,
@Param("processDefinitionId") Integer processDefinitionId,
@Param("searchVal") String searchVal,
@Param("executorId") Integer executorId,
@Param("states") int[] statusArray,
@Param("host") String host,
@Param("startTime") Date startTime,
@Param("endTime") Date endTime);
/**
* set failover by host and state array
* @param host host
* @param stateArray stateArray
* @return set result
*/
int setFailoverByHostAndStateArray(@Param("host") String host,
@Param("states") int[] stateArray);
/**
* update process instance by state
* @param originState originState
* @param destState destState
* @return update result
*/
int updateProcessInstanceByState(@Param("originState") ExecutionStatus originState,
@Param("destState") ExecutionStatus destState); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,938 | [CodeClean][DAO]Remove redundant comments | Remove redundant comments
ProcessInstanceMapper# queryProcessInstanceListPaging

| https://github.com/apache/dolphinscheduler/issues/3938 | https://github.com/apache/dolphinscheduler/pull/3939 | 3fdc5576e19b8102ea4f10a714cd3c85b27b2c4e | fa355b23f39e14975d2d6ca1f0f6e2178a189b42 | "2020-10-17T16:58:17Z" | java | "2020-10-18T14:36:04Z" | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.java | /**
* update process instance by tenantId
* @param originTenantId originTenantId
* @param destTenantId destTenantId
* @return update result
*/
int updateProcessInstanceByTenantId(@Param("originTenantId") int originTenantId,
@Param("destTenantId") int destTenantId);
/**
* update process instance by worker groupId
* @param originWorkerGroupId originWorkerGroupId
* @param destWorkerGroupId destWorkerGroupId
* @return update result
*/
int updateProcessInstanceByWorkerGroupId(@Param("originWorkerGroupId") int originWorkerGroupId, @Param("destWorkerGroupId") int destWorkerGroupId);
/**
* count process instance state by user
* @param startTime startTime
* @param endTime endTime
* @param projectIds projectIds
* @return ExecuteStatusCount list
*/
List<ExecuteStatusCount> countInstanceStateByUser(
@Param("startTime") Date startTime,
@Param("endTime") Date endTime,
@Param("projectIds") Integer[] projectIds);
/**
* query process instance by processDefinitionId
* @param processDefinitionId processDefinitionId
* @param size size |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,938 | [CodeClean][DAO]Remove redundant comments | Remove redundant comments
ProcessInstanceMapper# queryProcessInstanceListPaging

| https://github.com/apache/dolphinscheduler/issues/3938 | https://github.com/apache/dolphinscheduler/pull/3939 | 3fdc5576e19b8102ea4f10a714cd3c85b27b2c4e | fa355b23f39e14975d2d6ca1f0f6e2178a189b42 | "2020-10-17T16:58:17Z" | java | "2020-10-18T14:36:04Z" | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.java | * @return process instance list
*/
List<ProcessInstance> queryByProcessDefineId(
@Param("processDefinitionId") int processDefinitionId,
@Param("size") int size);
/**
* query last scheduler process instance
* @param definitionId processDefinitionId
* @param startTime startTime
* @param endTime endTime
* @return process instance
*/
ProcessInstance queryLastSchedulerProcess(@Param("processDefinitionId") int definitionId,
@Param("startTime") Date startTime,
@Param("endTime") Date endTime);
/**
* query last running process instance
* @param definitionId definitionId
* @param startTime startTime
* @param endTime endTime
* @param stateArray stateArray
* @return process instance
*/
ProcessInstance queryLastRunningProcess(@Param("processDefinitionId") int definitionId,
@Param("startTime") Date startTime,
@Param("endTime") Date endTime,
@Param("states") int[] stateArray);
/**
* query last manual process instance
* @param definitionId definitionId |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,938 | [CodeClean][DAO]Remove redundant comments | Remove redundant comments
ProcessInstanceMapper# queryProcessInstanceListPaging

| https://github.com/apache/dolphinscheduler/issues/3938 | https://github.com/apache/dolphinscheduler/pull/3939 | 3fdc5576e19b8102ea4f10a714cd3c85b27b2c4e | fa355b23f39e14975d2d6ca1f0f6e2178a189b42 | "2020-10-17T16:58:17Z" | java | "2020-10-18T14:36:04Z" | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.java | * @param startTime startTime
* @param endTime endTime
* @return process instance
*/
ProcessInstance queryLastManualProcess(@Param("processDefinitionId") int definitionId,
@Param("startTime") Date startTime,
@Param("endTime") Date endTime);
/**
* query top n process instance order by running duration
* @param size
* @param status process instance status
* @param startTime
* @param endTime
* @return ProcessInstance list
*/
List<ProcessInstance> queryTopNProcessInstance(@Param("size") int size,
@Param("startTime") Date startTime,
@Param("endTime") Date endTime,
@Param("status")ExecutionStatus status);
/**
* query process instance by processDefinitionId and stateArray
* @param processDefinitionId processDefinitionId
* @param states states array
* @return process instance list
*/
List<ProcessInstance> queryByProcessDefineIdAndStatus(
@Param("processDefinitionId") int processDefinitionId,
@Param("states") int[] states);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | /*
* Licnsd o h Apach Sofwar Foundaion (ASF) undr on or mor
* conribuor licns agrmns. S h NOTICE fil disribud wih
* his work for addiional informaion rgarding copyrigh ownrship.
* Th ASF licnss his fil o You undr h Apach Licns, Vrsion 2.0
* (h "Licns"); you may no us his fil xcp in complianc wih
* h Licns. You may obain a copy of h Licns a
*
* hp://www.apach.org/licnss/LICENSE-2.0
*
* Unlss rquird by applicabl law or agrd o in wriing, sofwar
* disribud undr h Licns is disribud on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ihr xprss or implid.
* S h Licns for h spcific languag govrning prmissions and
* limiaions undr h Licns.
*/
packag org.apach.dolphinschdulr.srvr.masr.runnr;
impor com.alibaba.fasjson.JSON;
impor com.googl.common.collc.Liss;
impor org.apach.commons.io.FilUils;
impor org.apach.dolphinschdulr.common.Consans;
impor org.apach.dolphinschdulr.common.nums.*;
impor org.apach.dolphinschdulr.common.graph.DAG; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | impor org.apach.dolphinschdulr.common.modl.TaskNod;
impor org.apach.dolphinschdulr.common.modl.TaskNodRlaion;
impor org.apach.dolphinschdulr.common.procss.ProcssDag;
impor org.apach.dolphinschdulr.common.ask.condiions.CondiionsParamrs;
impor org.apach.dolphinschdulr.common.hrad.Soppr;
impor org.apach.dolphinschdulr.common.hrad.ThradUils;
impor org.apach.dolphinschdulr.common.uils.*;
impor org.apach.dolphinschdulr.dao.niy.ProcssInsanc;
impor org.apach.dolphinschdulr.dao.niy.Schdul;
impor org.apach.dolphinschdulr.dao.niy.TaskInsanc;
impor org.apach.dolphinschdulr.dao.uils.DagHlpr;
impor org.apach.dolphinschdulr.rmo.NyRmoingClin;
impor org.apach.dolphinschdulr.srvr.masr.config.MasrConfig;
impor org.apach.dolphinschdulr.srvr.uils.AlrManagr;
impor org.apach.dolphinschdulr.srvic.ban.SpringApplicaionConx;
impor org.apach.dolphinschdulr.srvic.procss.ProcssSrvic;
impor org.apach.dolphinschdulr.srvic.quarz.cron.CronUils;
impor org.slf4j.Loggr;
impor org.slf4j.LoggrFacory;
impor java.io.Fil;
impor java.io.IOExcpion;
impor java.uil.*;
impor java.uil.concurrn.ConcurrnHashMap;
impor java.uil.concurrn.ExcuorSrvic;
impor java.uil.concurrn.Fuur;
impor saic org.apach.dolphinschdulr.common.Consans.*;
/**
* masr xc hrad,spli dag
*/
public class MasrExcThrad implmns Runnabl { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | /**
* loggr of MasrExcThrad
*/
priva saic final Loggr loggr = LoggrFacory.gLoggr(MasrExcThrad.class);
/**
* procss insanc
*/
priva ProcssInsanc procssInsanc;
/**
* runing TaskNod
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | priva final Map<MasrBasTaskExcThrad,Fuur<Boolan>> acivTaskNod = nw ConcurrnHashMap<>();
/**
* ask xc srvic
*/
priva final ExcuorSrvic askExcSrvic;
/**
* submi failur nods
*/
priva boolan askFaildSubmi = fals;
/**
* rcovr nod id lis
*/
priva Lis<TaskInsanc> rcovrNodIdLis = nw ArrayLis<>();
/**
* rror ask lis
*/
priva Map<Sring,TaskInsanc> rrorTaskLis = nw ConcurrnHashMap<>();
/**
* compl ask lis
*/
priva Map<Sring, TaskInsanc> complTaskLis = nw ConcurrnHashMap<>();
/**
* rady o submi ask lis
*/
priva Map<Sring, TaskInsanc> radyToSubmiTaskLis = nw ConcurrnHashMap<>();
/**
* dpnd faild ask map
*/
priva Map<Sring, TaskInsanc> dpndFaildTask = nw ConcurrnHashMap<>();
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | * forbiddn ask map
*/
priva Map<Sring, TaskNod> forbiddnTaskLis = nw ConcurrnHashMap<>();
/**
* skip ask map
*/
priva Map<Sring, TaskNod> skipTaskNodLis = nw ConcurrnHashMap<>();
/**
* rcovr olranc faul ask lis
*/
priva Lis<TaskInsanc> rcovrTolrancFaulTaskLis = nw ArrayLis<>();
/**
* alr managr
*/
priva AlrManagr alrManagr = nw AlrManagr();
/**
* h objc of DAG
*/
priva DAG<Sring,TaskNod,TaskNodRlaion> dag;
/**
* procss srvic
*/
priva ProcssSrvic procssSrvic;
/**
* masr config
*/
priva MasrConfig masrConfig;
/**
*
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | priva NyRmoingClin nyRmoingClin;
/**
* consrucor of MasrExcThrad
* @param procssInsanc procssInsanc
* @param procssSrvic procssSrvic
* @param nyRmoingClin nyRmoingClin
*/
public MasrExcThrad(ProcssInsanc procssInsanc, ProcssSrvic procssSrvic, NyRmoingClin nyRmoingClin){
his.procssSrvic = procssSrvic;
his.procssInsanc = procssInsanc;
his.masrConfig = SpringApplicaionConx.gBan(MasrConfig.class);
in masrTaskExcNum = masrConfig.gMasrExcTaskNum();
his.askExcSrvic = ThradUils.nwDamonFixdThradExcuor("Masr-Task-Exc-Thrad",
masrTaskExcNum);
his.nyRmoingClin = nyRmoingClin;
}
@Ovrrid
public void run() {
if (procssInsanc == null){
loggr.info("procss insanc is no xiss");
rurn;
}
if (procssInsanc.gSa().ypIsFinishd()){
loggr.info("procss insanc is don : {}",procssInsanc.gId());
rurn;
}
ry {
if (procssInsanc.isComplmnDaa() && Flag.NO == procssInsanc.gIsSubProcss()){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | xcuComplmnProcss();
}ls{
xcuProcss();
}
}cach (Excpion ){
loggr.rror("masr xc hrad xcpion", );
loggr.rror("procss xcu faild, procss id:{}", procssInsanc.gId());
procssInsanc.sSa(ExcuionSaus.FAILURE);
procssInsanc.sEndTim(nw Da());
procssSrvic.updaProcssInsanc(procssInsanc);
}finally {
askExcSrvic.shudown();
posHandl();
}
}
/**
* xcu procss
* @hrows Excpion xcpion
*/
priva void xcuProcss() hrows Excpion {
prparProcss();
runProcss();
ndProcss();
}
/**
* xcu complmn procss
* @hrows Excpion xcpion |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.