This is an automated email from the ASF dual-hosted git repository.
kirs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new c3f6f96 [Improvement-4568][API] When the workflow definition name
validation API fails, the system prompts that the workflow definition name
already exists (#4569)
c3f6f96 is described below
commit c3f6f962ca0aacef410a74760b6e40f23fecca7d
Author: zhuangchong <[email protected]>
AuthorDate: Wed Feb 3 17:07:51 2021 +0800
[Improvement-4568][API] When the workflow definition name validation API
fails, the system prompts that the workflow definition name already exists
(#4569)
* fix dev definition api error prompt.
* imp api definition name verify message prompt.
---
.../src/main/java/org/apache/dolphinscheduler/api/enums/Status.java | 3 ++-
.../api/service/impl/ProcessDefinitionServiceImpl.java | 4 ++--
.../api/controller/ProcessDefinitionControllerTest.java | 4 ++--
.../dolphinscheduler/api/service/ProcessDefinitionServiceTest.java | 2 +-
4 files changed, 7 insertions(+), 6 deletions(-)
diff --git
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
index 6605154..895a3de 100644
---
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
+++
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
@@ -133,7 +133,7 @@ public enum Status {
QUERY_TASK_INSTANCE_LOG_ERROR(10103, "view task instance log error",
"查询任务实例日志错误"),
DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR(10104, "download task instance log
file error", "下载任务日志文件错误"),
CREATE_PROCESS_DEFINITION(10105, "create process definition", "创建工作流错误"),
- VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR(10106, "verify process
definition name unique error", "工作流定义名称已存在"),
+ VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR(10106, "verify process
definition name unique error", "工作流定义名称验证错误"),
UPDATE_PROCESS_DEFINITION_ERROR(10107, "update process definition error",
"更新工作流定义错误"),
RELEASE_PROCESS_DEFINITION_ERROR(10108, "release process definition
error", "上线工作流错误"),
QUERY_DATAIL_OF_PROCESS_DEFINITION_ERROR(10109, "query datail of process
definition error", "查询工作流详细信息错误"),
@@ -199,6 +199,7 @@ public enum Status {
FORCE_TASK_SUCCESS_ERROR(10165, "force task success error", "强制成功任务实例错误"),
TASK_INSTANCE_STATE_OPERATION_ERROR(10166, "the status of task instance
{0} is {1},Cannot perform force success operation",
"任务实例[{0}]的状态是[{1}],无法执行强制成功操作"),
DATASOURCE_TYPE_NOT_EXIST(10167, "data source type not exist", "数据源类型不存在"),
+ PROCESS_DEFINITION_NAME_EXIST(10168, "process definition name {0} already
exists", "工作流定义名称[{0}]已存在"),
UDF_FUNCTION_NOT_EXIST(20001, "UDF function not found", "UDF函数不存在"),
UDF_FUNCTION_EXISTS(20002, "UDF function already exists", "UDF函数已存在"),
diff --git
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
index 123e2a3..af91ed2 100644
---
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
+++
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
@@ -429,7 +429,7 @@ public class ProcessDefinitionServiceImpl extends
BaseService implements
// check whether the new process define name exist
ProcessDefinition definition =
processDefineMapper.verifyByDefineName(project.getId(), name);
if (definition != null) {
- putMsg(result,
Status.VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR, name);
+ putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
return result;
}
}
@@ -497,7 +497,7 @@ public class ProcessDefinitionServiceImpl extends
BaseService implements
if (processDefinition == null) {
putMsg(result, Status.SUCCESS);
} else {
- putMsg(result, Status.VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR,
name);
+ putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
}
return result;
}
diff --git
a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
index 9719448..e44fad8 100644
---
a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
+++
b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
@@ -117,14 +117,14 @@ public class ProcessDefinitionControllerTest {
public void testVerifyProcessDefinitionName() throws Exception {
Map<String, Object> result = new HashMap<>();
- putMsg(result, Status.VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR);
+ putMsg(result, Status.PROCESS_DEFINITION_NAME_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.VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR.getCode(),
response.getCode().intValue());
+ Assert.assertEquals(Status.PROCESS_DEFINITION_NAME_EXIST.getCode(),
response.getCode().intValue());
}
diff --git
a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
index 4db5338..7ebb40e 100644
---
a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
+++
b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
@@ -657,7 +657,7 @@ public class ProcessDefinitionServiceTest {
Mockito.when(processDefineMapper.verifyByDefineName(project.getId(),
"test_pdf")).thenReturn(getProcessDefinition());
Map<String, Object> processExistRes =
processDefinitionService.verifyProcessDefinitionName(loginUser,
"project_test1", "test_pdf");
-
Assert.assertEquals(Status.VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR,
processExistRes.get(Constants.STATUS));
+ Assert.assertEquals(Status.PROCESS_DEFINITION_NAME_EXIST,
processExistRes.get(Constants.STATUS));
}
@Test