From d6735e8eccb8c149510a7c24b10375457614e1ae Mon Sep 17 00:00:00 2001 From: Eric Gao Date: Fri, 7 Jul 2023 18:19:01 +0800 Subject: [PATCH] [Improvement][API] Fix some nits in apis (#14481) * Fix some nits in apis --- .../api/test/cases/ProcessDefinitionAPITest.java | 8 ++++---- .../dolphinscheduler/api/test/cases/SchedulerAPITest.java | 2 +- .../api/test/pages/workflow/ProcessDefinitionPage.java | 2 +- .../api/test/pages/workflow/SchedulerPage.java | 1 - .../api/controller/ProcessDefinitionController.java | 4 ++-- .../api/controller/SchedulerController.java | 4 ++-- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api/test/cases/ProcessDefinitionAPITest.java b/dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api/test/cases/ProcessDefinitionAPITest.java index 2443d71d3b..4c4507e785 100644 --- a/dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api/test/cases/ProcessDefinitionAPITest.java +++ b/dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api/test/cases/ProcessDefinitionAPITest.java @@ -126,10 +126,10 @@ public class ProcessDefinitionAPITest { @Test @Order(4) - public void testGetProcessListByProjectCodes() { - HttpResponse getProcessListByProjectCodesResponse = processDefinitionPage.getProcessListByProjectCodes(loginUser, projectCode); - Assertions.assertTrue(getProcessListByProjectCodesResponse.getBody().getSuccess()); - Assertions.assertTrue(getProcessListByProjectCodesResponse.getBody().getData().toString().contains("test_import")); + public void testgetProcessListByProjectCode() { + HttpResponse getProcessListByProjectCodeResponse = processDefinitionPage.getProcessListByProjectCode(loginUser, projectCode); + Assertions.assertTrue(getProcessListByProjectCodeResponse.getBody().getSuccess()); + Assertions.assertTrue(getProcessListByProjectCodeResponse.getBody().getData().toString().contains("test_import")); } @Test diff --git a/dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api/test/cases/SchedulerAPITest.java b/dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api/test/cases/SchedulerAPITest.java index b36a799695..ac06afefc6 100644 --- a/dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api/test/cases/SchedulerAPITest.java +++ b/dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api/test/cases/SchedulerAPITest.java @@ -143,7 +143,7 @@ public class SchedulerAPITest { @Test @Order(5) public void testUpdateSchedule() { - final String schedule = "{\"startTime\":\"1996-08-08 00:00:00\",\"endTime\":\"2200-08-08 00:00:00\",\"timezoneId\":\"America/Phoenix\",\"crontab\":\"0 0 3/6 * * ? *\"}" ; + final String schedule = "{\"startTime\":\"1996-08-08 00:00:00\",\"endTime\":\"2200-08-08 00:00:00\",\"timezoneId\":\"America/Phoenix\",\"crontab\":\"0 0 3/6 * * ? *\"}"; HttpResponse updateScheduleResponse = schedulerPage.updateSchedule(loginUser, projectCode, scheduleId, schedule); Assertions.assertTrue(updateScheduleResponse.getBody().getSuccess()); diff --git a/dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api/test/pages/workflow/ProcessDefinitionPage.java b/dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api/test/pages/workflow/ProcessDefinitionPage.java index 9a66722e4a..ef72e997ae 100644 --- a/dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api/test/pages/workflow/ProcessDefinitionPage.java +++ b/dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api/test/pages/workflow/ProcessDefinitionPage.java @@ -73,7 +73,7 @@ public class ProcessDefinitionPage { return requestClient.get(url, headers, params); } - public HttpResponse getProcessListByProjectCodes(User loginUser, long projectCode) { + public HttpResponse getProcessListByProjectCode(User loginUser, long projectCode) { Map params = new HashMap<>(); params.put("loginUser", loginUser); Map headers = new HashMap<>(); diff --git a/dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api/test/pages/workflow/SchedulerPage.java b/dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api/test/pages/workflow/SchedulerPage.java index 7ebcaf2d9f..cfe23fd1bb 100644 --- a/dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api/test/pages/workflow/SchedulerPage.java +++ b/dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api/test/pages/workflow/SchedulerPage.java @@ -90,7 +90,6 @@ public class SchedulerPage { Map params = new HashMap<>(); params.put("loginUser", loginUser); params.put("schedule", schedule); - params.put("warningGroupId", 1); Map headers = new HashMap<>(); headers.put(Constants.SESSION_ID_KEY, sessionId); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java index b8dacde82b..ecafc7a7f7 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java @@ -600,8 +600,8 @@ public class ProcessDefinitionController extends BaseController { @GetMapping(value = "/query-process-definition-list") @ResponseStatus(HttpStatus.OK) @ApiException(GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR) - public Result getProcessListByProjectCodes(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser, - @Parameter(name = "projectCode", description = "PROJECT_CODE", required = true) @PathVariable long projectCode) { + public Result getProcessListByProjectCode(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser, + @Parameter(name = "projectCode", description = "PROJECT_CODE", required = true) @PathVariable long projectCode) { Map result = processDefinitionService.queryProcessDefinitionListByProjectCode(projectCode); return returnDataList(result); } diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java index 5935e2b30b..cd714ae236 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java @@ -152,7 +152,7 @@ public class SchedulerController extends BaseController { @Operation(summary = "updateSchedule", description = "UPDATE_SCHEDULE_NOTES") @Parameters({ @Parameter(name = "id", description = "SCHEDULE_ID", required = true, schema = @Schema(implementation = int.class, example = "100")), - @Parameter(name = "schedule", description = "SCHEDULE", schema = @Schema(implementation = String.class, example = "{'startTime':'2019-06-10 00:00:00','endTime':'2019-06-13 00:00:00','crontab':'0 0 3/6 * * ? *'}")), + @Parameter(name = "schedule", description = "SCHEDULE", schema = @Schema(implementation = String.class, example = "{\"startTime\":\"1996-08-08 00:00:00\",\"endTime\":\"2200-08-08 00:00:00\",\"timezoneId\":\"America/Phoenix\",\"crontab\":\"0 0 3/6 * * ? *\"}")), @Parameter(name = "warningType", description = "WARNING_TYPE", schema = @Schema(implementation = WarningType.class)), @Parameter(name = "warningGroupId", description = "WARNING_GROUP_ID", schema = @Schema(implementation = int.class, example = "100")), @Parameter(name = "failureStrategy", description = "FAILURE_STRATEGY", schema = @Schema(implementation = FailureStrategy.class)), @@ -170,7 +170,7 @@ public class SchedulerController extends BaseController { @PathVariable(value = "id") Integer id, @RequestParam(value = "schedule") String schedule, @RequestParam(value = "warningType", required = false, defaultValue = DEFAULT_WARNING_TYPE) WarningType warningType, - @RequestParam(value = "warningGroupId", required = false) int warningGroupId, + @RequestParam(value = "warningGroupId", required = false, defaultValue = DEFAULT_NOTIFY_GROUP_ID) int warningGroupId, @RequestParam(value = "failureStrategy", required = false, defaultValue = "END") FailureStrategy failureStrategy, @RequestParam(value = "workerGroup", required = false, defaultValue = "default") String workerGroup, @RequestParam(value = "tenantCode", required = false, defaultValue = "default") String tenantCode,