You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/07/07 13:53:56 UTC
[GitHub] [dolphinscheduler] welsh-wen opened a new pull request, #10670: Project management basic test cases
welsh-wen opened a new pull request, #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670
<!--Thanks very much for contributing to Apache DolphinScheduler. Please review https://dolphinscheduler.apache.org/en-us/community/development/pull-request.html before opening a pull request.-->
## Purpose of the pull request
<!--(For example: This pull request adds checkstyle plugin).-->
## Brief change log
<!--*(for example:)*
- *Add maven-checkstyle-plugin to root pom.xml*
-->
## Verify this pull request
<!--*(Please pick either of the following options)*-->
This pull request is code cleanup without any test coverage.
*(or)*
This pull request is already covered by existing tests, such as *(please describe tests)*.
(or)
This change added tests and can be verified as follows:
<!--*(example:)*
- *Added dolphinscheduler-dao tests for end-to-end.*
- *Added CronUtilsTest to verify the change.*
- *Manually verified the change by testing locally.* -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1191421211
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=coverage&view=list) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=duplicated_lines_density&view=list) No Duplication information
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1192262102
SonarCloud Quality Gate failed. [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_coverage&view=list) [3.3% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list) [3.9% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r927389193
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/ProjectPage.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import com.sun.xml.internal.ws.api.model.ExceptionType;
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.ProjectListResponseData;
+import org.apache.dolphinscheduler.api.test.entity.ProjectListResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class ProjectPage {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectPage.class);
+
+ public HttpResponse createProject(String sessionId, String projectName, String description, String userName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("projectName", projectName);
+ params.put("description", description);
+ params.put("userName", userName);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+
+ RequestClient requestClient = new RequestClient();
+
+ try {
+ HttpResponse res = requestClient.post("/projects", headers, params);
+ return res;
+ } catch (Exception e) {
+ logger.error("create project fail, message:{}", e);
Review Comment:
Thanks for the reminder, it has been fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r913886151
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/TaskParamsMap.java:
##########
@@ -0,0 +1,61 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.ArrayList;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
Review Comment:
Thanks for the reminder, it has been fixed
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/TaskDefinitionRequestData.java:
##########
@@ -0,0 +1,181 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Map;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
Review Comment:
Thanks for the reminder, it has been fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature] [API-TEST] Project management basic test cases [dolphinscheduler]
Posted by "zhongjiajie (via GitHub)" <gi...@apache.org>.
zhongjiajie closed pull request #10670: [Feature] [API-TEST] Project management basic test cases
URL: https://github.com/apache/dolphinscheduler/pull/10670
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] zhongjiajie commented on pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
zhongjiajie commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1180012820
have restart the failed CI
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
SbloodyS commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r927318640
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/TenantAPITest.java:
##########
@@ -76,38 +76,9 @@ public void testCreateTenant() {
public void testDuplicateCreateTenant() {
TenantPage tenantPage = new TenantPage();
- HttpResponse createTenantHttpResponse = tenantPage.createTenant(sessionId, tenant, 1, "");
+ HttpResponse createTenantHttpResponse = tenantPage.createTenant(sessionId, tenantName, 1, "");
Assertions.assertFalse(createTenantHttpResponse.body().success());
}
- @Test
- @Order(5)
- public void testGetTenantListPaging() {
- TenantPage tenantPage = new TenantPage();
-
- HttpResponse createTenantHttpResponse = tenantPage.getTenantListPaging(sessionId, 1, 10, "");
- boolean result = false;
-
- for (TenantListPagingResponseTotalList tenantListPagingResponseTotalList : JSONUtils.convertValue(createTenantHttpResponse.body().data(), TenantListPagingResponseData.class).totalList()) {
- if (tenantListPagingResponseTotalList.tenantCode().equals(tenant)) {
- result = true;
- existTenantId = tenantListPagingResponseTotalList.id();
- break;
- }
- }
-
- Assertions.assertTrue(createTenantHttpResponse.body().success());
- Assertions.assertTrue(result);
- }
-
- @Test
- @Order(10)
- public void testDeleteTenant() {
- TenantPage tenantPage = new TenantPage();
-
- HttpResponse deleteTenantHttpResponse = tenantPage.deleteTenant(sessionId, existTenantId);
-
- Assertions.assertTrue(deleteTenantHttpResponse.body().success());
- }
Review Comment:
Why did you delete these?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r927365600
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowInstancesPage.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.TaskDefinitionRequestData;
+import org.apache.dolphinscheduler.api.test.entity.TaskParamsMap;
+import org.apache.dolphinscheduler.api.test.entity.TaskRelationRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowInstancesResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowInstancesResponseTotalListData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public final class WorkFlowInstancesPage {
+ private static String workFlowInstanceState = null;
+ private static final Logger logger = LoggerFactory.getLogger(WorkFlowInstancesPage.class);
+
+
Review Comment:
Thanks for the reminder, it has been fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r912499582
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,165 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+
+ String taskDefinitionJson = "[{\"code\":" + genNumId + ",\"delayTime\":\"0\",\"description\":\"\",\"environmentCode\":-1,\"failRetryInterval\":\"1\",\"failRetryTimes\":\"0\",\"flag\":\"YES\",\"name\":\"echo_123\",\"taskParams\":{\"localParams\":[],\"rawScript\":\"echo 123\",\"resourceList\":[]},\"taskPriority\":\"MEDIUM\",\"taskType\":\"SHELL\",\"timeout\":0,\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"workerGroup\":\"default\"}]";
+ String taskRelationJson = "[{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":"+ genNumId + ",\"postTaskVersion\":0,\"conditionType\":\"NONE\",\"conditionParams\":{}}]";
+ String locations = "[{\"taskCode\":" + genNumId +",\"x\":33.5,\"y\":38.5}]";
Review Comment:
Thanks for the reminder, it has been fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1173027501
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=coverage&view=list) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=duplicated_lines_density&view=list) No Duplication information
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r913665657
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/ProjectPage.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.ProjectListResponseData;
+import org.apache.dolphinscheduler.api.test.entity.ProjectListResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class ProjectPage {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
Review Comment:
Thanks for the reminder, it has been fixed
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/TaskInstancePage.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.TaskInstanceResponseData;
+import org.apache.dolphinscheduler.api.test.entity.TaskInstanceResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class TaskInstancePage {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
Review Comment:
Thanks for the reminder, it has been fixed
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,199 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.*;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
Review Comment:
Thanks for the reminder, it has been fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1175724625
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=coverage&view=list) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1179493852
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [7 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_coverage&view=list) [59.0% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1189914276
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=coverage&view=list) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=duplicated_lines_density&view=list) No Duplication information
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r927362844
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/TaskInstancePage.java:
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.TaskInstanceResponseData;
+import org.apache.dolphinscheduler.api.test.entity.TaskInstanceResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class TaskInstancePage {
+ private static final Logger logger = LoggerFactory.getLogger(TaskInstancePage.class);
+ private static String taskState = null;
+ private static Integer taskInstanceId = null;
+
+ public String queryTaskInstance(String sessionId, String projectName, String workFlowName){
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize", 10);
+ params.put("pageNo", 1);
+ params.put("searchVal", "");
+ params.put("processInstanceId", "");
+ params.put("host", "");
+ params.put("stateType", "");
+ params.put("startDate", "");
+ params.put("endDate", "");
+ params.put("executorName", "");
+ params.put("processInstanceName", workFlowName);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.runWorkflow(sessionId, projectName, workFlowName);
+
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-instances", headers, params);
+
+
+ for (TaskInstanceResponseTotalList taskInstanceRes : JSONUtils.convertValue(res.body().data(), TaskInstanceResponseData.class).totalList()) {
+
Review Comment:
Thanks for the reminder, it has been fixed
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/ProjectPage.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import com.sun.xml.internal.ws.api.model.ExceptionType;
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.ProjectListResponseData;
+import org.apache.dolphinscheduler.api.test.entity.ProjectListResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class ProjectPage {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectPage.class);
+
+ public HttpResponse createProject(String sessionId, String projectName, String description, String userName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("projectName", projectName);
+ params.put("description", description);
+ params.put("userName", userName);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+
+ RequestClient requestClient = new RequestClient();
+
+ try {
+ HttpResponse res = requestClient.post("/projects", headers, params);
+ return res;
+ } catch (Exception e) {
+ logger.error("create project fail, message:{}", e);
+ }
+ return null;
+ }
+
+ public HttpResponse searchProject(String sessionId, String searchVal) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize", 10);
+ params.put("pageNo", 1);
+ params.put("searchVal", searchVal);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+
+ RequestClient requestClient = new RequestClient();
+
+ return requestClient.get("/projects", headers, params);
+ }
+
+ public String getProjectCode(String sessionId, String searchVal) {
+ String projectCode = null;
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize", 10);
+ params.put("pageNo", 1);
+ params.put("searchVal", searchVal);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+
+ RequestClient requestClient = new RequestClient();
+
+ HttpResponse res = requestClient.get("/projects", headers, params);
+
+ logger.info("project %s", res);
Review Comment:
Thanks for the reminder, it has been fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r909668975
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,156 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ String taskDefinitionJson = "[{\"code\":" + genNumId + ",\"delayTime\":\"0\",\"description\":\"\",\"environmentCode\":-1,\"failRetryInterval\":\"1\",\"failRetryTimes\":\"0\",\"flag\":\"YES\",\"name\":\"echo_123\",\"taskParams\":{\"localParams\":[],\"rawScript\":\"echo 123\",\"resourceList\":[]},\"taskPriority\":\"MEDIUM\",\"taskType\":\"SHELL\",\"timeout\":0,\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"workerGroup\":\"default\"}]";
+ String taskRelationJson = "[{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":"+ genNumId + ",\"postTaskVersion\":0,\"conditionType\":\"NONE\",\"conditionParams\":{}}]";
+ String locations = "[{\"taskCode\":" + genNumId +",\"x\":33.5,\"y\":38.5}]";
+ params.put("taskDefinitionJson", taskDefinitionJson);
+ params.put("taskRelationJson", taskRelationJson);
+ params.put("locations", locations);
+ params.put("name", workFlowName);
+ params.put("tenantCode", "admin");
+ params.put("executionType", "PARALLEL");
+ params.put("description", "");
+ params.put("globalParams", "[]");
+ params.put("timeout", 0);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ System.out.printf("创建工作流 param是:%s",params);
+ System.out.printf("创建工作流header头是:%s", "/projects/"+projectCode+"/process-definition");
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/process-definition", headers, params);
+
+ System.out.printf("创建工作流结果:%s", res);
+ return res;
+ }
+
+ public HttpResponse queryWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize",10);
+ params.put("pageNo",1);
+ params.put("searchVal",workFlowName);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ HttpResponse res = requestClient.get("/projects/"+ projectCode + "/process-definition", headers, params);
+ System.out.printf("查询工作流结果:%s\n", res);
+ for (WorkFlowResponseTotalList workFlowList : JSONUtils.convertValue(res.body().data(), WorkFlowResponseData.class).totalList()) {
+ workFlowCode = workFlowList.code();
+ }
+
+ return res;
+ }
+
+ public HttpResponse onLineWorkflow(String sessionId, String projectName, String workFlowName){
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.queryWorkflow(sessionId, projectName, workFlowName);
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("name", workFlowName);
+ params.put("releaseState", "ONLINE");
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/process-definition/"+workFlowCode+"/release", headers, params);
+
+ System.out.printf("上线工作流:%s", res);
+ return res;
+
+ }
+
+ public HttpResponse runWorkflow(String sessionId, String projectName, String workFlowName){
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.queryWorkflow(sessionId, projectName, workFlowName);
+ workflow.onLineWorkflow(sessionId, projectName, workFlowName);
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("processDefinitionCode", workFlowCode);
+ params.put("startEndTime", "2022-06-25T16:00:00.000Z");
+ params.put("startEndTime", "2022-06-25T16:00:00.000Z");
+ params.put("scheduleTime", "2022-06-26 00:00:00,2022-06-26 00:00:00");
+ params.put("failureStrategy", "CONTINUE");
+ params.put("warningType", "NONE");
+ params.put("warningGroupId", "");
+ params.put("execType", "START_PROCESS");
+ params.put("startNodeList", "");
+ params.put("taskDependType", "TASK_POST");
+ params.put("dependentMode", "OFF_MODE");
+ params.put("runMode", "RUN_MODE_SERIAL");
+ params.put("processInstancePriority", "MEDIUM");
+ params.put("workerGroup", "default");
+ params.put("environmentCode", "");
+ params.put("startParams", "");
+ params.put("expectedParallelismNumber", "");
+ params.put("dryRun", 0);
Review Comment:
Thanks for your advice, I will fix it as soon as possible
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,156 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ String taskDefinitionJson = "[{\"code\":" + genNumId + ",\"delayTime\":\"0\",\"description\":\"\",\"environmentCode\":-1,\"failRetryInterval\":\"1\",\"failRetryTimes\":\"0\",\"flag\":\"YES\",\"name\":\"echo_123\",\"taskParams\":{\"localParams\":[],\"rawScript\":\"echo 123\",\"resourceList\":[]},\"taskPriority\":\"MEDIUM\",\"taskType\":\"SHELL\",\"timeout\":0,\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"workerGroup\":\"default\"}]";
+ String taskRelationJson = "[{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":"+ genNumId + ",\"postTaskVersion\":0,\"conditionType\":\"NONE\",\"conditionParams\":{}}]";
+ String locations = "[{\"taskCode\":" + genNumId +",\"x\":33.5,\"y\":38.5}]";
+ params.put("taskDefinitionJson", taskDefinitionJson);
+ params.put("taskRelationJson", taskRelationJson);
+ params.put("locations", locations);
+ params.put("name", workFlowName);
+ params.put("tenantCode", "admin");
+ params.put("executionType", "PARALLEL");
+ params.put("description", "");
+ params.put("globalParams", "[]");
+ params.put("timeout", 0);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ System.out.printf("创建工作流 param是:%s",params);
+ System.out.printf("创建工作流header头是:%s", "/projects/"+projectCode+"/process-definition");
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/process-definition", headers, params);
+
+ System.out.printf("创建工作流结果:%s", res);
Review Comment:
Thanks for your advice, I will fix it as soon as possible
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,156 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ String taskDefinitionJson = "[{\"code\":" + genNumId + ",\"delayTime\":\"0\",\"description\":\"\",\"environmentCode\":-1,\"failRetryInterval\":\"1\",\"failRetryTimes\":\"0\",\"flag\":\"YES\",\"name\":\"echo_123\",\"taskParams\":{\"localParams\":[],\"rawScript\":\"echo 123\",\"resourceList\":[]},\"taskPriority\":\"MEDIUM\",\"taskType\":\"SHELL\",\"timeout\":0,\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"workerGroup\":\"default\"}]";
+ String taskRelationJson = "[{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":"+ genNumId + ",\"postTaskVersion\":0,\"conditionType\":\"NONE\",\"conditionParams\":{}}]";
+ String locations = "[{\"taskCode\":" + genNumId +",\"x\":33.5,\"y\":38.5}]";
+ params.put("taskDefinitionJson", taskDefinitionJson);
+ params.put("taskRelationJson", taskRelationJson);
+ params.put("locations", locations);
+ params.put("name", workFlowName);
+ params.put("tenantCode", "admin");
+ params.put("executionType", "PARALLEL");
+ params.put("description", "");
+ params.put("globalParams", "[]");
+ params.put("timeout", 0);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
Review Comment:
Thanks for your advice, I will fix it as soon as possible
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] zhongjiajie commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
zhongjiajie commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r910545797
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/ProjectAPITest.java:
##########
@@ -0,0 +1,79 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.*;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class ProjectAPITest {
+ private static final String tenant = System.getProperty("user.name");
+ private static final String projectName = "wen";
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ }
+
+ @AfterAll
+ public static void cleanup() {
+ LOGGER.info("success cleanup");
+ }
Review Comment:
Should remove it if we do nothing in after all
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/ProjectAPITest.java:
##########
@@ -0,0 +1,79 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.*;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class ProjectAPITest {
+ private static final String tenant = System.getProperty("user.name");
+ private static final String projectName = "wen";
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ }
+
+ @AfterAll
+ public static void cleanup() {
+ LOGGER.info("success cleanup");
+ }
+
+ @Test
+ @Order(1)
+ public void testCreateProject() {
+ ProjectPage projectPage = new ProjectPage();
+
+ HttpResponse createProjectHttpResponse = projectPage.createProject(sessionId, projectName, "123", "admin");
+ System.out.println(createProjectHttpResponse.body());
+ Assertions.assertTrue(createProjectHttpResponse.body().success());
+ }
+
+ @Test
+ @Order(1)
Review Comment:
Order numbers bigger than 1 should be used here, to keep the tests in a specific order. we can not query project if we not create them
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/ProjectAPITest.java:
##########
@@ -0,0 +1,79 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.*;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class ProjectAPITest {
+ private static final String tenant = System.getProperty("user.name");
+ private static final String projectName = "wen";
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ }
+
+ @AfterAll
+ public static void cleanup() {
+ LOGGER.info("success cleanup");
+ }
+
+ @Test
+ @Order(1)
+ public void testCreateProject() {
+ ProjectPage projectPage = new ProjectPage();
+
+ HttpResponse createProjectHttpResponse = projectPage.createProject(sessionId, projectName, "123", "admin");
Review Comment:
Constans value `user` you statement in the head of this file is encouraged to use. same as L72
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1170683617
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=coverage&view=list) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1173553973
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=coverage&view=list) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=duplicated_lines_density&view=list) No Duplication information
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] kezhenxu94 commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r914372663
##########
dolphinscheduler-api-test/pom.xml:
##########
@@ -37,7 +37,8 @@
<junit.version>5.7.2</junit.version>
<selenium.version>3.141.59</selenium.version>
- <lombok.version>1.18.24</lombok.version>
+ <lombok.version>1.18.10</lombok.version>
+<!-- <lombok.version>1.18.20</lombok.version>-->
Review Comment:
What's the reason to downgrade this version?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
SbloodyS commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r914380039
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/TenantAPITest.java:
##########
@@ -76,38 +76,9 @@ public void testCreateTenant() {
public void testDuplicateCreateTenant() {
TenantPage tenantPage = new TenantPage();
- HttpResponse createTenantHttpResponse = tenantPage.createTenant(sessionId, tenant, 1, "");
+ HttpResponse createTenantHttpResponse = tenantPage.createTenant(sessionId, tenantName, 1, "");
Assertions.assertFalse(createTenantHttpResponse.body().success());
}
- @Test
- @Order(5)
- public void testGetTenantListPaging() {
- TenantPage tenantPage = new TenantPage();
-
- HttpResponse createTenantHttpResponse = tenantPage.getTenantListPaging(sessionId, 1, 10, "");
- boolean result = false;
-
- for (TenantListPagingResponseTotalList tenantListPagingResponseTotalList : JSONUtils.convertValue(createTenantHttpResponse.body().data(), TenantListPagingResponseData.class).totalList()) {
- if (tenantListPagingResponseTotalList.tenantCode().equals(tenant)) {
- result = true;
- existTenantId = tenantListPagingResponseTotalList.id();
- break;
- }
- }
-
- Assertions.assertTrue(createTenantHttpResponse.body().success());
- Assertions.assertTrue(result);
- }
-
- @Test
- @Order(10)
- public void testDeleteTenant() {
- TenantPage tenantPage = new TenantPage();
-
- HttpResponse deleteTenantHttpResponse = tenantPage.deleteTenant(sessionId, existTenantId);
-
- Assertions.assertTrue(deleteTenantHttpResponse.body().success());
- }
Review Comment:
> Still not to change here
> and why we checksytle not work in this case?
Currently checkstyle not enabled in api-test...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
SbloodyS commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r925369512
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowAPITest.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.pages.security.TenantPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case02_wen";
+
+ private static final String projectDesc = "123";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String tenantName = "admin";
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ ProjectPage projectPage = new ProjectPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+ TenantPage tenantPage = new TenantPage();
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ projectPage.createProject(sessionId, projectName, projectDesc, user);
+ tenantPage.createTenant(sessionId, tenantName, 1, "");
+
+ }
+
+ @Test
+ @Order(1)
+ public void testCreateWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId, projectName);
+ HttpResponse res = flow.createWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Create workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+ }
+
+ @Test
+ @Order(2)
+ public void testOnlineWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ HttpResponse res = flow.onLineWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Online workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+
+ }
+
+ @Test
+ @Order(3)
+ public void testQueryWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId, projectName);
+ HttpResponse res = flow.queryWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Query workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+ }
+
+ @Test
+ @Order(4)
+ public void testRunWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ HttpResponse res = flow.runWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Run workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+
Review Comment:
Because our workflow runs asynchronously, we need to verify the workflow running state through workflow instance query.
##########
.github/workflows/api-test.yml:
##########
@@ -90,6 +90,12 @@ jobs:
case:
- name: Tenant
class: org.apache.dolphinscheduler.api.test.cases.TenantAPITest
+ - name: Project
+ class: org.apache.dolphinscheduler.api.test.cases.ProjectAPITest
+ - name: WorkFlow
+ class: org.apache.dolphinscheduler.api.test.cases.WorkFlowAPITest
+ - name: WorkFlowInstance
+ class: org.apache.dolphinscheduler.api.test.cases.WorkFlowInstanceAPITest
Review Comment:
I think we should combine workflow use cases of the same task type into the same file since workflow operation and query belong to the same type. And it's better rename to `WorkFlowShellAPITest`.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/TaskInstancePage.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.TaskInstanceResponseData;
+import org.apache.dolphinscheduler.api.test.entity.TaskInstanceResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class TaskInstancePage {
+ private static final Logger logger = LoggerFactory.getLogger(TaskInstancePage.class);
+ private static String taskState = null;
+ private static Integer taskInstanceId = null;
+
+ public String queryTaskInstance(String sessionId, String projectName, String workFlowName){
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize", 10);
+ params.put("pageNo", 1);
+ params.put("searchVal", "");
+ params.put("processInstanceId", "");
+ params.put("host", "");
+ params.put("stateType", "");
+ params.put("startDate", "");
+ params.put("endDate", "");
+ params.put("executorName", "");
+ params.put("processInstanceName", workFlowName);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.runWorkflow(sessionId, projectName, workFlowName);
+
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-instances", headers, params);
+
+
+ for (TaskInstanceResponseTotalList taskInstanceRes : JSONUtils.convertValue(res.body().data(), TaskInstanceResponseData.class).totalList()) {
+
+ taskState = taskInstanceRes.state();
+ taskInstanceId = taskInstanceRes.id();
+ }
+
+ logger.info("查询task状态:%s", taskState);
Review Comment:
English please. BTW, I think it's unnessnary.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,212 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.TaskParamsMap;
+import org.apache.dolphinscheduler.api.test.entity.TaskDefinitionRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.TaskRelationRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(WorkFlowDefinitionPage.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, String> headers = new HashMap<>();
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+ TaskDefinitionRequestData taskDefinitionRequestData = new TaskDefinitionRequestData();
+ TaskRelationRequestData taskRelationRequestData = new TaskRelationRequestData();
+
+ TaskParamsMap taskParams = new TaskParamsMap();
+ ArrayList<Object> localParams = new ArrayList<>();
+ ArrayList<Object> resourceList = new ArrayList<>();
+ taskParams.localParams(localParams);
+ taskParams.resourceList(resourceList);
+ taskParams.rawScript("echo 123");
+
+ taskDefinitionRequestData.code(genNumId);
+ taskDefinitionRequestData.delayTime("0");
+ taskDefinitionRequestData.description("");
+ taskDefinitionRequestData.environmentCode("-1");
+ taskDefinitionRequestData.failRetryInterval("1");
+ taskDefinitionRequestData.failRetryTimes("0");
+ taskDefinitionRequestData.flag("YES");
+ taskDefinitionRequestData.name("echo_123");
+ taskDefinitionRequestData.taskParams(taskParams);
+ taskDefinitionRequestData.taskPriority("MEDIUM");
+ taskDefinitionRequestData.taskType("SHELL");
+ taskDefinitionRequestData.timeout(0);
+ taskDefinitionRequestData.timeoutFlag("CLOSE");
+ taskDefinitionRequestData.timeoutNotifyStrategy("");
+ taskDefinitionRequestData.workerGroup("default");
+
+ ArrayList<Object> taskDefinitionRequestDataList = new ArrayList<>();
+ taskDefinitionRequestDataList.add(taskDefinitionRequestData);
+
+ logger.info("taskDefinitionRequestData:aaaa: %s");
+ logger.info(String.valueOf(taskDefinitionRequestData));
+ logger.info(String.valueOf(taskDefinitionRequestData.getClass()));
+ logger.info(String.valueOf(taskDefinitionRequestDataList));
+ logger.info(String.valueOf(taskDefinitionRequestDataList.getClass()));
+ logger.info("taskDefinitionRequestData:bbbb: %s");
Review Comment:
Please remove unnessnary log ouput.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,212 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.TaskParamsMap;
+import org.apache.dolphinscheduler.api.test.entity.TaskDefinitionRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.TaskRelationRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(WorkFlowDefinitionPage.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, String> headers = new HashMap<>();
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+ TaskDefinitionRequestData taskDefinitionRequestData = new TaskDefinitionRequestData();
+ TaskRelationRequestData taskRelationRequestData = new TaskRelationRequestData();
+
+ TaskParamsMap taskParams = new TaskParamsMap();
+ ArrayList<Object> localParams = new ArrayList<>();
+ ArrayList<Object> resourceList = new ArrayList<>();
+ taskParams.localParams(localParams);
+ taskParams.resourceList(resourceList);
+ taskParams.rawScript("echo 123");
+
+ taskDefinitionRequestData.code(genNumId);
+ taskDefinitionRequestData.delayTime("0");
+ taskDefinitionRequestData.description("");
+ taskDefinitionRequestData.environmentCode("-1");
+ taskDefinitionRequestData.failRetryInterval("1");
+ taskDefinitionRequestData.failRetryTimes("0");
+ taskDefinitionRequestData.flag("YES");
+ taskDefinitionRequestData.name("echo_123");
+ taskDefinitionRequestData.taskParams(taskParams);
+ taskDefinitionRequestData.taskPriority("MEDIUM");
+ taskDefinitionRequestData.taskType("SHELL");
+ taskDefinitionRequestData.timeout(0);
+ taskDefinitionRequestData.timeoutFlag("CLOSE");
+ taskDefinitionRequestData.timeoutNotifyStrategy("");
+ taskDefinitionRequestData.workerGroup("default");
+
+ ArrayList<Object> taskDefinitionRequestDataList = new ArrayList<>();
+ taskDefinitionRequestDataList.add(taskDefinitionRequestData);
+
+ logger.info("taskDefinitionRequestData:aaaa: %s");
+ logger.info(String.valueOf(taskDefinitionRequestData));
+ logger.info(String.valueOf(taskDefinitionRequestData.getClass()));
+ logger.info(String.valueOf(taskDefinitionRequestDataList));
+ logger.info(String.valueOf(taskDefinitionRequestDataList.getClass()));
+ logger.info("taskDefinitionRequestData:bbbb: %s");
+
+ HashMap<String, Object> conditionParams = new HashMap();
+
+ taskRelationRequestData.name("");
+ taskRelationRequestData.preTaskCode(0);
+ taskRelationRequestData.preTaskVersion(0);
+ taskRelationRequestData.preTaskCode(0);
+ taskRelationRequestData.postTaskCode(genNumId);
+ taskRelationRequestData.conditionType("NONE");
+ taskRelationRequestData.conditionParams(conditionParams);
+ ArrayList<Object> taskRelationRequestDataList = new ArrayList<>();
+ taskRelationRequestDataList.add(taskRelationRequestData);
+
+ HashMap<String, Object> locations = new HashMap();
+ locations.put("taskCode", genNumId);
+ locations.put("x", 33.5);
+ locations.put("y", 38.5);
+ ArrayList<Object> locationsList = new ArrayList<>();
+ locationsList.add(locations);
+
+ workFlowCreateRequestData.locations(JSONUtils.toJsonString(locationsList));
+ workFlowCreateRequestData.taskDefinitionJson(JSONUtils.toJsonString(taskDefinitionRequestDataList));
+ workFlowCreateRequestData.taskRelationJson(JSONUtils.toJsonString(taskRelationRequestDataList));
+ workFlowCreateRequestData.name(workFlowName);
+ workFlowCreateRequestData.tenantCode("admin");
+ workFlowCreateRequestData.executionType("PARALLEL");
+ workFlowCreateRequestData.description("");
+ workFlowCreateRequestData.globalParams("[]");
+ workFlowCreateRequestData.timeout(0);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+
+ logger.info(String.valueOf(workFlowCreateRequestData));
Review Comment:
Please remove unnessnary log ouput.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1193319168
SonarCloud Quality Gate failed. [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [1 Code Smell](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_coverage&view=list) [2.3% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list) [1.7% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1192261248
SonarCloud Quality Gate failed. [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_coverage&view=list) [3.3% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list) [3.9% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
SbloodyS commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r912767355
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/ProjectAPITest.java:
##########
@@ -0,0 +1,69 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.*;
Review Comment:
Please avoid impot *
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] zhongjiajie commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
zhongjiajie commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r914378786
##########
dolphinscheduler-api-test/pom.xml:
##########
@@ -37,7 +37,8 @@
<junit.version>5.7.2</junit.version>
<selenium.version>3.141.59</selenium.version>
- <lombok.version>1.18.24</lombok.version>
+ <lombok.version>1.18.10</lombok.version>
+<!-- <lombok.version>1.18.20</lombok.version>-->
Review Comment:
I think we should not change this version
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/ProjectPage.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.ProjectListResponseData;
+import org.apache.dolphinscheduler.api.test.entity.ProjectListResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class ProjectPage {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectPage.class);
+
+ public HttpResponse createProject(String sessionId, String projectName, String description, String userName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("projectName", projectName);
+ params.put("description", description);
+ params.put("userName", userName);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+
+ RequestClient requestClient = new RequestClient();
+
+ return requestClient.post("/projects", headers, params);
+ }
+
Review Comment:
Can we test add project which already exists and test whether it will raise error here?
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/WorkFlowResponseTotalList.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
+public class WorkFlowResponseTotalList {
+
+ private String code;
+
+ private Date createTime;
+
+ private String description;
+
+ private String executionType;
+
+ private String flag;
+
+ private Arrays globalParamList;
+
+ private HashMap globalParamMap;
Review Comment:
do you mean `Map` instead of `HashMap`, or just `String` and add method to convert string to map?
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/TenantAPITest.java:
##########
@@ -76,38 +76,9 @@ public void testCreateTenant() {
public void testDuplicateCreateTenant() {
TenantPage tenantPage = new TenantPage();
- HttpResponse createTenantHttpResponse = tenantPage.createTenant(sessionId, tenant, 1, "");
+ HttpResponse createTenantHttpResponse = tenantPage.createTenant(sessionId, tenantName, 1, "");
Assertions.assertFalse(createTenantHttpResponse.body().success());
}
- @Test
- @Order(5)
- public void testGetTenantListPaging() {
- TenantPage tenantPage = new TenantPage();
-
- HttpResponse createTenantHttpResponse = tenantPage.getTenantListPaging(sessionId, 1, 10, "");
- boolean result = false;
-
- for (TenantListPagingResponseTotalList tenantListPagingResponseTotalList : JSONUtils.convertValue(createTenantHttpResponse.body().data(), TenantListPagingResponseData.class).totalList()) {
- if (tenantListPagingResponseTotalList.tenantCode().equals(tenant)) {
- result = true;
- existTenantId = tenantListPagingResponseTotalList.id();
- break;
- }
- }
-
- Assertions.assertTrue(createTenantHttpResponse.body().success());
- Assertions.assertTrue(result);
- }
-
- @Test
- @Order(10)
- public void testDeleteTenant() {
- TenantPage tenantPage = new TenantPage();
-
- HttpResponse deleteTenantHttpResponse = tenantPage.deleteTenant(sessionId, existTenantId);
-
- Assertions.assertTrue(deleteTenantHttpResponse.body().success());
- }
Review Comment:
Is there any reason for why we need to delete these tests?
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/TaskDefinitionRequestData.java:
##########
@@ -0,0 +1,181 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Map;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
Review Comment:
resolve
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/ProjectAPITest.java:
##########
@@ -0,0 +1,69 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.*;
Review Comment:
Still not to change here
and why we checksytle not work in this case?
##########
.github/workflows/api-test.yml:
##########
@@ -88,6 +88,8 @@ jobs:
case:
- name: Tenant
class: org.apache.dolphinscheduler.api.test.cases.TenantAPITest
+ - name: Project
+ class: org.apache.dolphinscheduler.api.test.cases.ProjectAPITest
Review Comment:
I find out you adding three new cases for api-test, but you just add one of them, please add the others to here to make it work
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/WorkFlowResponseTotalList.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
+public class WorkFlowResponseTotalList {
+
+ private String code;
+
+ private Date createTime;
+
+ private String description;
+
+ private String executionType;
+
+ private String flag;
+
+ private Arrays globalParamList;
+
+ private HashMap globalParamMap;
+
+ private String globalParams;
+
+ private Integer id;
+
+ private String locations;
+
+ private String modifyBy;
+
+ private String name;
+
+ private String projectCode;
+
+ private String projectName;
+
+ private String releaseState;
+
+ private String scheduleReleaseState;
+
+ private String tenantCode;
+
+ private String tenantId;
+
+ private Integer timeout;
+
+ private Date updateTime;
+
+ private Integer userId;
+
+ private String userName;
+
+ private Integer version;
+
+ private Integer warningGroupId;
+
+
Review Comment:
still not change here
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowAPITest.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.pages.security.TenantPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case02_wen";
+
+ private static final String projectDesc = "123";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String tenantName = "admin";
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ ProjectPage projectPage = new ProjectPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+ TenantPage tenantPage = new TenantPage();
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ projectPage.createProject(sessionId, projectName, projectDesc, user);
+ tenantPage.createTenant(sessionId, tenantName, 1, "");
+
+ }
+
+ @Test
+ @Order(1)
+ public void testCreateWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId, projectName);
+ HttpResponse res = flow.createWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Create workflow res:%s", res);
Review Comment:
I think we should better remove all the logger in the test cases, IMO is useless, but maybe we need to hear others' opinion @caishunfeng @SbloodyS
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/TaskInstanceResponseData.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
+public class TaskInstanceResponseData {
+
+ private Integer currentPage;
+
+ private Integer pageSize;
+
+ private Integer start;
+
+ private Integer total;
+
+ private List<TaskInstanceResponseTotalList> totalList;
+
+ private Integer totalPage;
+
+
Review Comment:
still need change here
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/ProjectListResponseData.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
+public class ProjectListResponseData {
+
+
Review Comment:
still need to fix here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
SbloodyS commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r912449240
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/ProjectAPITest.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class ProjectAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "wen";
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+
Review Comment:
Please separate each method by one line.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowInstanceAPITest.java:
##########
@@ -0,0 +1,79 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowInstanceAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String tenant = System.getProperty("user.name");
+
+ private static final String projectName = "wen";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ private static String genNumId = null;
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ }
+
+ @Test
+ @Order(1)
+ public void testQueryWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+
+ flow.getGenNumId(sessionId,"wen");
+
+ HttpResponse res = flow.createWorkflow(sessionId, projectName, workFlowName);
+
+ }
+
+
+
+
Review Comment:
Remove extra blank lines.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/ProjectListResponseData.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
+public class ProjectListResponseData {
+
+
Review Comment:
Remove extra blank lines.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,165 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+
+ String taskDefinitionJson = "[{\"code\":" + genNumId + ",\"delayTime\":\"0\",\"description\":\"\",\"environmentCode\":-1,\"failRetryInterval\":\"1\",\"failRetryTimes\":\"0\",\"flag\":\"YES\",\"name\":\"echo_123\",\"taskParams\":{\"localParams\":[],\"rawScript\":\"echo 123\",\"resourceList\":[]},\"taskPriority\":\"MEDIUM\",\"taskType\":\"SHELL\",\"timeout\":0,\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"workerGroup\":\"default\"}]";
+ String taskRelationJson = "[{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":"+ genNumId + ",\"postTaskVersion\":0,\"conditionType\":\"NONE\",\"conditionParams\":{}}]";
+ String locations = "[{\"taskCode\":" + genNumId +",\"x\":33.5,\"y\":38.5}]";
+ workFlowCreateRequestData.setTaskDefinitionJson(taskDefinitionJson);
+ workFlowCreateRequestData.setTaskRelationJson(taskRelationJson);
+ workFlowCreateRequestData.setLocations(locations);
+ workFlowCreateRequestData.setName(workFlowName);
+ workFlowCreateRequestData.setTenantCode("admin");
+ workFlowCreateRequestData.setExecutionType("PARALLEL");
+ workFlowCreateRequestData.setDescription("");
+ workFlowCreateRequestData.setGlobalParams("[]");
+ workFlowCreateRequestData.setTimeout(0);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/process-definition", headers, JSONUtils.convertValue(workFlowCreateRequestData, Map.class));
+ logger.info("创建工作流结果:%s", res);
+ return res;
+ }
+
+ public HttpResponse queryWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize",10);
+ params.put("pageNo",1);
+ params.put("searchVal",workFlowName);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ HttpResponse res = requestClient.get("/projects/"+ projectCode + "/process-definition", headers, params);
+
+ logger.info("查询工作流结果:%s\n", res);
+ for (WorkFlowResponseTotalList workFlowList : JSONUtils.convertValue(res.body().data(), WorkFlowResponseData.class).totalList()) {
+ workFlowCode = workFlowList.code();
+ }
+
+ return res;
+ }
+
+ public HttpResponse onLineWorkflow(String sessionId, String projectName, String workFlowName){
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.queryWorkflow(sessionId, projectName, workFlowName);
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("name", workFlowName);
+ params.put("releaseState", "ONLINE");
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/process-definition/"+workFlowCode+"/release", headers, params);
+
+ logger.info("上线工作流:%s", res);
Review Comment:
Same as line 86.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,165 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+
+ String taskDefinitionJson = "[{\"code\":" + genNumId + ",\"delayTime\":\"0\",\"description\":\"\",\"environmentCode\":-1,\"failRetryInterval\":\"1\",\"failRetryTimes\":\"0\",\"flag\":\"YES\",\"name\":\"echo_123\",\"taskParams\":{\"localParams\":[],\"rawScript\":\"echo 123\",\"resourceList\":[]},\"taskPriority\":\"MEDIUM\",\"taskType\":\"SHELL\",\"timeout\":0,\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"workerGroup\":\"default\"}]";
+ String taskRelationJson = "[{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":"+ genNumId + ",\"postTaskVersion\":0,\"conditionType\":\"NONE\",\"conditionParams\":{}}]";
+ String locations = "[{\"taskCode\":" + genNumId +",\"x\":33.5,\"y\":38.5}]";
+ workFlowCreateRequestData.setTaskDefinitionJson(taskDefinitionJson);
+ workFlowCreateRequestData.setTaskRelationJson(taskRelationJson);
+ workFlowCreateRequestData.setLocations(locations);
+ workFlowCreateRequestData.setName(workFlowName);
+ workFlowCreateRequestData.setTenantCode("admin");
+ workFlowCreateRequestData.setExecutionType("PARALLEL");
+ workFlowCreateRequestData.setDescription("");
+ workFlowCreateRequestData.setGlobalParams("[]");
+ workFlowCreateRequestData.setTimeout(0);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/process-definition", headers, JSONUtils.convertValue(workFlowCreateRequestData, Map.class));
+ logger.info("创建工作流结果:%s", res);
+ return res;
+ }
+
+ public HttpResponse queryWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize",10);
+ params.put("pageNo",1);
+ params.put("searchVal",workFlowName);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ HttpResponse res = requestClient.get("/projects/"+ projectCode + "/process-definition", headers, params);
+
+ logger.info("查询工作流结果:%s\n", res);
+ for (WorkFlowResponseTotalList workFlowList : JSONUtils.convertValue(res.body().data(), WorkFlowResponseData.class).totalList()) {
+ workFlowCode = workFlowList.code();
+ }
+
+ return res;
+ }
+
+ public HttpResponse onLineWorkflow(String sessionId, String projectName, String workFlowName){
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.queryWorkflow(sessionId, projectName, workFlowName);
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("name", workFlowName);
+ params.put("releaseState", "ONLINE");
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/process-definition/"+workFlowCode+"/release", headers, params);
+
+ logger.info("上线工作流:%s", res);
+ return res;
+
+ }
+
+ public HttpResponse runWorkflow(String sessionId, String projectName, String workFlowName){
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.queryWorkflow(sessionId, projectName, workFlowName);
+ workflow.onLineWorkflow(sessionId, projectName, workFlowName);
+ Map<String, String> headers = new HashMap<>();
+
+ WorkFlowRunRequestData workFlowRunRequestData = new WorkFlowRunRequestData();
+ workFlowRunRequestData.setProcessDefinitionCode(workFlowCode);
+ workFlowRunRequestData.setStartEndTime("2022-06-25T16:00:00.000Z");
+ workFlowRunRequestData.setScheduleTime("2022-06-26 00:00:00,2022-06-26 00:00:00");
+ workFlowRunRequestData.setFailureStrategy("CONTINUE");
+ workFlowRunRequestData.setWarningType("NONE");
+ workFlowRunRequestData.setWarningGroupId("");
+ workFlowRunRequestData.setExecType("START_PROCESS");
+ workFlowRunRequestData.setStartNodeList("");
+ workFlowRunRequestData.setTaskDependType("TASK_POST");
+ workFlowRunRequestData.setDependentMode("OFF_MODE");
+ workFlowRunRequestData.setRunMode("RUN_MODE_SERIAL");
+ workFlowRunRequestData.setProcessInstancePriority("MEDIUM");
+ workFlowRunRequestData.setWorkerGroup("default");
+ workFlowRunRequestData.setEnvironmentCode("");
+ workFlowRunRequestData.setStartParams("");
+ workFlowRunRequestData.setExpectedParallelismNumber("");
+ workFlowRunRequestData.setDryRun(0);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/executors/start-process-instance", headers, JSONUtils.convertValue(workFlowRunRequestData, Map.class));
+
+ logger.info("运行工作流:%s", res);
+ return res;
+
+ }
+
+
+
Review Comment:
Remove extra blank lines.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,165 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+
+ String taskDefinitionJson = "[{\"code\":" + genNumId + ",\"delayTime\":\"0\",\"description\":\"\",\"environmentCode\":-1,\"failRetryInterval\":\"1\",\"failRetryTimes\":\"0\",\"flag\":\"YES\",\"name\":\"echo_123\",\"taskParams\":{\"localParams\":[],\"rawScript\":\"echo 123\",\"resourceList\":[]},\"taskPriority\":\"MEDIUM\",\"taskType\":\"SHELL\",\"timeout\":0,\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"workerGroup\":\"default\"}]";
+ String taskRelationJson = "[{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":"+ genNumId + ",\"postTaskVersion\":0,\"conditionType\":\"NONE\",\"conditionParams\":{}}]";
+ String locations = "[{\"taskCode\":" + genNumId +",\"x\":33.5,\"y\":38.5}]";
+ workFlowCreateRequestData.setTaskDefinitionJson(taskDefinitionJson);
+ workFlowCreateRequestData.setTaskRelationJson(taskRelationJson);
+ workFlowCreateRequestData.setLocations(locations);
+ workFlowCreateRequestData.setName(workFlowName);
+ workFlowCreateRequestData.setTenantCode("admin");
+ workFlowCreateRequestData.setExecutionType("PARALLEL");
+ workFlowCreateRequestData.setDescription("");
+ workFlowCreateRequestData.setGlobalParams("[]");
+ workFlowCreateRequestData.setTimeout(0);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/process-definition", headers, JSONUtils.convertValue(workFlowCreateRequestData, Map.class));
+ logger.info("创建工作流结果:%s", res);
+ return res;
+ }
+
+ public HttpResponse queryWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize",10);
+ params.put("pageNo",1);
+ params.put("searchVal",workFlowName);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ HttpResponse res = requestClient.get("/projects/"+ projectCode + "/process-definition", headers, params);
+
+ logger.info("查询工作流结果:%s\n", res);
Review Comment:
Same as line 86.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/TaskInstanceResponseTotalList.java:
##########
@@ -0,0 +1,135 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
+public class TaskInstanceResponseTotalList {
+
+ private String alertFlag;
+
+ private String appLink;
+
+ private boolean blockingTask;
+
+ private boolean conditionsTask;
+
+ private Integer delayTime;
+
+ private boolean dependTask;
+
+ private String dependency;
+
+ private String dependentResult;
+
+ private Integer dryRun;
+
+ private String duration;
+
+ private Date endTime;
+
+ private String environmentCode;
+
+ private String environmentConfig;
+
+ private String executePath;
+
+ private String executorId;
+
+ private String executorName;
+
+ private boolean firstRun;
+
+ private Date firstSubmitTime;
+
+ private String flag;
+
+ private String host;
+
+ private Integer id;
+
+ private String logPath;
+
+ private Integer maxRetryTimes;
+
+ private String name;
+
+ private Integer pid;
+
+ private String processDefine;
+
+ private String processInstance;
+
+ private Integer processInstanceId;
+
+ private String processInstanceName;
+
+ private String processInstancePriority;
+
+ private String resources;
+
+ private Integer retryInterval;
+
+ private Integer retryTimes;
+
+ private Date startTime;
+
+ private String state;
+
+ private boolean subProcess;
+
+ private Date submitTime;
+
+ private String switchDependency;
+
+ private boolean switchTask;
+
+ private String taskCode;
+
+ private boolean taskComplete;
+
+ private String taskDefine;
+
+ private Integer taskDefinitionVersion;
+
+ private Integer taskGroupId;
+
+ private Integer taskGroupPriority;
+
+ private String taskInstancePriority;
+
+ private String taskParams;
+
+ private String taskType;
+
+ private String varPool;
+
+ private String workerGroup;
+
+
+
Review Comment:
Remove extra blank lines.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/TaskInstanceResponseData.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
+public class TaskInstanceResponseData {
+
+ private Integer currentPage;
+
+ private Integer pageSize;
+
+ private Integer start;
+
+ private Integer total;
+
+ private List<TaskInstanceResponseTotalList> totalList;
+
+ private Integer totalPage;
+
+
Review Comment:
Remove extra blank lines.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,165 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+
+ String taskDefinitionJson = "[{\"code\":" + genNumId + ",\"delayTime\":\"0\",\"description\":\"\",\"environmentCode\":-1,\"failRetryInterval\":\"1\",\"failRetryTimes\":\"0\",\"flag\":\"YES\",\"name\":\"echo_123\",\"taskParams\":{\"localParams\":[],\"rawScript\":\"echo 123\",\"resourceList\":[]},\"taskPriority\":\"MEDIUM\",\"taskType\":\"SHELL\",\"timeout\":0,\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"workerGroup\":\"default\"}]";
+ String taskRelationJson = "[{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":"+ genNumId + ",\"postTaskVersion\":0,\"conditionType\":\"NONE\",\"conditionParams\":{}}]";
+ String locations = "[{\"taskCode\":" + genNumId +",\"x\":33.5,\"y\":38.5}]";
+ workFlowCreateRequestData.setTaskDefinitionJson(taskDefinitionJson);
+ workFlowCreateRequestData.setTaskRelationJson(taskRelationJson);
+ workFlowCreateRequestData.setLocations(locations);
+ workFlowCreateRequestData.setName(workFlowName);
+ workFlowCreateRequestData.setTenantCode("admin");
+ workFlowCreateRequestData.setExecutionType("PARALLEL");
+ workFlowCreateRequestData.setDescription("");
+ workFlowCreateRequestData.setGlobalParams("[]");
+ workFlowCreateRequestData.setTimeout(0);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/process-definition", headers, JSONUtils.convertValue(workFlowCreateRequestData, Map.class));
+ logger.info("创建工作流结果:%s", res);
+ return res;
+ }
+
+ public HttpResponse queryWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize",10);
+ params.put("pageNo",1);
+ params.put("searchVal",workFlowName);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ HttpResponse res = requestClient.get("/projects/"+ projectCode + "/process-definition", headers, params);
+
+ logger.info("查询工作流结果:%s\n", res);
+ for (WorkFlowResponseTotalList workFlowList : JSONUtils.convertValue(res.body().data(), WorkFlowResponseData.class).totalList()) {
+ workFlowCode = workFlowList.code();
+ }
+
+ return res;
+ }
+
+ public HttpResponse onLineWorkflow(String sessionId, String projectName, String workFlowName){
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.queryWorkflow(sessionId, projectName, workFlowName);
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("name", workFlowName);
+ params.put("releaseState", "ONLINE");
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/process-definition/"+workFlowCode+"/release", headers, params);
+
+ logger.info("上线工作流:%s", res);
+ return res;
+
+ }
+
+ public HttpResponse runWorkflow(String sessionId, String projectName, String workFlowName){
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.queryWorkflow(sessionId, projectName, workFlowName);
+ workflow.onLineWorkflow(sessionId, projectName, workFlowName);
+ Map<String, String> headers = new HashMap<>();
+
+ WorkFlowRunRequestData workFlowRunRequestData = new WorkFlowRunRequestData();
+ workFlowRunRequestData.setProcessDefinitionCode(workFlowCode);
+ workFlowRunRequestData.setStartEndTime("2022-06-25T16:00:00.000Z");
+ workFlowRunRequestData.setScheduleTime("2022-06-26 00:00:00,2022-06-26 00:00:00");
+ workFlowRunRequestData.setFailureStrategy("CONTINUE");
+ workFlowRunRequestData.setWarningType("NONE");
+ workFlowRunRequestData.setWarningGroupId("");
+ workFlowRunRequestData.setExecType("START_PROCESS");
+ workFlowRunRequestData.setStartNodeList("");
+ workFlowRunRequestData.setTaskDependType("TASK_POST");
+ workFlowRunRequestData.setDependentMode("OFF_MODE");
+ workFlowRunRequestData.setRunMode("RUN_MODE_SERIAL");
+ workFlowRunRequestData.setProcessInstancePriority("MEDIUM");
+ workFlowRunRequestData.setWorkerGroup("default");
+ workFlowRunRequestData.setEnvironmentCode("");
+ workFlowRunRequestData.setStartParams("");
+ workFlowRunRequestData.setExpectedParallelismNumber("");
+ workFlowRunRequestData.setDryRun(0);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/executors/start-process-instance", headers, JSONUtils.convertValue(workFlowRunRequestData, Map.class));
+
+ logger.info("运行工作流:%s", res);
Review Comment:
Same as line 86.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/WorkFlowResponseTotalList.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
+public class WorkFlowResponseTotalList {
+
+ private String code;
+
+ private Date createTime;
+
+ private String description;
+
+ private String executionType;
+
+ private String flag;
+
+ private Arrays globalParamList;
+
+ private HashMap globalParamMap;
+
+ private String globalParams;
+
+ private Integer id;
+
+ private String locations;
+
+ private String modifyBy;
+
+ private String name;
+
+ private String projectCode;
+
+ private String projectName;
+
+ private String releaseState;
+
+ private String scheduleReleaseState;
+
+ private String tenantCode;
+
+ private String tenantId;
+
+ private Integer timeout;
+
+ private Date updateTime;
+
+ private Integer userId;
+
+ private String userName;
+
+ private Integer version;
+
+ private Integer warningGroupId;
+
+
Review Comment:
Remove extra blank lines.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,165 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+
+ String taskDefinitionJson = "[{\"code\":" + genNumId + ",\"delayTime\":\"0\",\"description\":\"\",\"environmentCode\":-1,\"failRetryInterval\":\"1\",\"failRetryTimes\":\"0\",\"flag\":\"YES\",\"name\":\"echo_123\",\"taskParams\":{\"localParams\":[],\"rawScript\":\"echo 123\",\"resourceList\":[]},\"taskPriority\":\"MEDIUM\",\"taskType\":\"SHELL\",\"timeout\":0,\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"workerGroup\":\"default\"}]";
+ String taskRelationJson = "[{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":"+ genNumId + ",\"postTaskVersion\":0,\"conditionType\":\"NONE\",\"conditionParams\":{}}]";
+ String locations = "[{\"taskCode\":" + genNumId +",\"x\":33.5,\"y\":38.5}]";
Review Comment:
We should use entities instead of writing json directly.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/ProjectAPITest.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class ProjectAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "wen";
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ }
+
+
+ @Test
+ @Order(99)
+ public void testCreateProject() {
+ ProjectPage projectPage = new ProjectPage();
+
+ HttpResponse createProjectHttpResponse = projectPage.createProject(sessionId, projectName, "123", user);
+ logger.info(String.valueOf(createProjectHttpResponse.body()));
+ Assertions.assertTrue(createProjectHttpResponse.body().success());
+ }
+
+ @Test
+ @Order(1)
+ public void testQeuryProject() {
+ ProjectPage projectPage = new ProjectPage();
+
+ String aa = projectPage.getProjectCode(sessionId, projectName);
+ System.out.println(aa);
+ }
Review Comment:
Please arrange the test methods according to the execution order.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,165 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+
+ String taskDefinitionJson = "[{\"code\":" + genNumId + ",\"delayTime\":\"0\",\"description\":\"\",\"environmentCode\":-1,\"failRetryInterval\":\"1\",\"failRetryTimes\":\"0\",\"flag\":\"YES\",\"name\":\"echo_123\",\"taskParams\":{\"localParams\":[],\"rawScript\":\"echo 123\",\"resourceList\":[]},\"taskPriority\":\"MEDIUM\",\"taskType\":\"SHELL\",\"timeout\":0,\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"workerGroup\":\"default\"}]";
+ String taskRelationJson = "[{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":"+ genNumId + ",\"postTaskVersion\":0,\"conditionType\":\"NONE\",\"conditionParams\":{}}]";
+ String locations = "[{\"taskCode\":" + genNumId +",\"x\":33.5,\"y\":38.5}]";
+ workFlowCreateRequestData.setTaskDefinitionJson(taskDefinitionJson);
+ workFlowCreateRequestData.setTaskRelationJson(taskRelationJson);
+ workFlowCreateRequestData.setLocations(locations);
+ workFlowCreateRequestData.setName(workFlowName);
+ workFlowCreateRequestData.setTenantCode("admin");
+ workFlowCreateRequestData.setExecutionType("PARALLEL");
+ workFlowCreateRequestData.setDescription("");
+ workFlowCreateRequestData.setGlobalParams("[]");
+ workFlowCreateRequestData.setTimeout(0);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/process-definition", headers, JSONUtils.convertValue(workFlowCreateRequestData, Map.class));
+ logger.info("创建工作流结果:%s", res);
Review Comment:
Use English instead of Chinese.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/TaskInstancePage.java:
##########
@@ -0,0 +1,105 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.TaskInstanceResponseData;
+import org.apache.dolphinscheduler.api.test.entity.TaskInstanceResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class TaskInstancePage {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+ private static String taskState = null;
+ private static Integer taskInstanceId = null;
+
+ public String queryTaskInstance(String sessionId, String projectName, String workFlowName){
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize", 10);
+ params.put("pageNo", 1);
+ params.put("searchVal", "");
+ params.put("processInstanceId", "");
+ params.put("host", "");
+ params.put("stateType", "");
+ params.put("startDate", "");
+ params.put("endDate", "");
+ params.put("executorName", "");
+ params.put("processInstanceName", workFlowName);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.runWorkflow(sessionId, projectName, workFlowName);
+
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-instances", headers, params);
+
+
+ for (TaskInstanceResponseTotalList taskInstanceRes : JSONUtils.convertValue(res.body().data(), TaskInstanceResponseData.class).totalList()) {
+
+ taskState = taskInstanceRes.state();
+ taskInstanceId = taskInstanceRes.id();
+ }
+
+ logger.info("查询task状态:%s", taskState);
+ return taskState;
+
+ }
+
+
+ public HttpResponse queryTaskInstanceLog(String sessionId, String projectName, String workFlowName){
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ TaskInstancePage taskInstance = new TaskInstancePage();
+ taskInstance.queryTaskInstance(sessionId, projectName, workFlowName);
+
+ params.put("taskInstanceId", taskInstanceId);
+ params.put("limit", 1000);
+ params.put("skipLineNum", 0);
+
+ HttpResponse res = requestClient.get("/log/detail", headers, params);
+ String res_log = (String) res.body().data();
+
+ logger.info("查询实例log:%s", res_log);
+
+ return res;
+
+ }
+
+
+
+
+
Review Comment:
Remove extra blank lines.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/WorkFlowResponseTotalList.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
+public class WorkFlowResponseTotalList {
+
+ private String code;
+
+ private Date createTime;
+
+ private String description;
+
+ private String executionType;
+
+ private String flag;
+
+ private Arrays globalParamList;
+
+ private HashMap globalParamMap;
Review Comment:
It's better to define generic types.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/ProjectPage.java:
##########
@@ -0,0 +1,94 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.ProjectListResponseData;
+import org.apache.dolphinscheduler.api.test.entity.ProjectListResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class ProjectPage {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ public HttpResponse createProject(String sessionId, String projectName, String description, String userName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("projectName", projectName);
+ params.put("description", description);
+ params.put("userName", userName);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+
+ RequestClient requestClient = new RequestClient();
+
+ return requestClient.post("/projects", headers, params);
+ }
+
+ public HttpResponse searchProject(String sessionId, String searchVal) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize", 10);
+ params.put("pageNo", 1);
+ params.put("searchVal", searchVal);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+
+ RequestClient requestClient = new RequestClient();
+
+ return requestClient.get("/projects", headers, params);
+ }
+
+ public String getProjectCode(String sessionId, String searchVal) {
+ String projectCode = null;
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize", 10);
+ params.put("pageNo", 1);
+ params.put("searchVal", searchVal);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+
+ RequestClient requestClient = new RequestClient();
+
+ HttpResponse res = requestClient.get("/projects", headers, params);
+
+ logger.info("项目 %s", res);
+
+ for (ProjectListResponseTotalList ProjectListRes : JSONUtils.convertValue(res.body().data(), ProjectListResponseData.class).totalList()) {
+ logger.info(ProjectListRes.code());
+ projectCode = ProjectListRes.code();
+ }
+ return projectCode;
+ }
+
+
+
+
Review Comment:
Remove extra blank lines.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/WorkFlowRunRequestData.java:
##########
@@ -0,0 +1,204 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
+public class WorkFlowRunRequestData {
+
+ private String processDefinitionCode;
+
+ private String startEndTime;
+
+ private String failureStrategy;
+
+ private String warningType;
+
+ private String warningGroupId;
+
+ private String execType;
+
+ private String startNodeList;
+
+ private String taskDependType;
+
+ private String dependentMode;
+
+ private String runMode;
+
+ private String processInstancePriority;
+
+ private String workerGroup;
+
+ private String environmentCode;
+
+ private String startParams;
+
+ private String expectedParallelismNumber;
+
+ private Integer dryRun;
+
+ private String scheduleTime;
+
+ public String getProcessDefinitionCode() {
+ return processDefinitionCode;
+ }
+
+ public String getStartEndTime() {
+ return startEndTime;
+ }
+
+ public String getFailureStrategy() {
+ return failureStrategy;
+ }
+
+ public String getWarningType() {
+ return warningType;
+ }
+
+ public String getWarningGroupId() {
+ return warningGroupId;
+ }
+
+ public String getExecType() {
+ return execType;
+ }
+
+ public String getStartNodeList() {
+ return startNodeList;
+ }
+
+ public String getTaskDependType() {
+ return taskDependType;
+ }
+
+ public String getDependentMode() {
+ return dependentMode;
+ }
+
+ public String getRunMode() {
+ return runMode;
+ }
+
+ public String getProcessInstancePriority() {
+ return processInstancePriority;
+ }
+
+ public String getWorkerGroup() {
+ return workerGroup;
+ }
+
+ public String getEnvironmentCode() {
+ return environmentCode;
+ }
+
+ public String getStartParams() {
+ return startParams;
+ }
+
+ public String getExpectedParallelismNumber() {
+ return expectedParallelismNumber;
+ }
+
+ public Integer getDryRun() {
+ return dryRun;
+ }
+
+ public String getScheduleTime() {
+ return scheduleTime;
+ }
+
+ public void setProcessDefinitionCode(String processDefinitionCode) {
+ this.processDefinitionCode = processDefinitionCode;
+ }
+
+ public void setStartEndTime(String startEndTime) {
+ this.startEndTime = startEndTime;
+ }
+
+ public void setFailureStrategy(String failureStrategy) {
+ this.failureStrategy = failureStrategy;
+ }
+
+ public void setWarningType(String warningType) {
+ this.warningType = warningType;
+ }
+
+ public void setWarningGroupId(String warningGroupId) {
+ this.warningGroupId = warningGroupId;
+ }
+
+ public void setExecType(String execType) {
+ this.execType = execType;
+ }
+
+ public void setStartNodeList(String startNodeList) {
+ this.startNodeList = startNodeList;
+ }
+
+ public void setTaskDependType(String taskDependType) {
+ this.taskDependType = taskDependType;
+ }
+
+ public void setDependentMode(String dependentMode) {
+ this.dependentMode = dependentMode;
+ }
+
+ public void setRunMode(String runMode) {
+ this.runMode = runMode;
+ }
+
+ public void setProcessInstancePriority(String processInstancePriority) {
+ this.processInstancePriority = processInstancePriority;
+ }
+
+ public void setWorkerGroup(String workerGroup) {
+ this.workerGroup = workerGroup;
+ }
+
+ public void setEnvironmentCode(String environmentCode) {
+ this.environmentCode = environmentCode;
+ }
+
+ public void setStartParams(String startParams) {
+ this.startParams = startParams;
+ }
+
+ public void setExpectedParallelismNumber(String expectedParallelismNumber) {
+ this.expectedParallelismNumber = expectedParallelismNumber;
+ }
+
+ public void setDryRun(Integer dryRun) {
+ this.dryRun = dryRun;
+ }
+
+ public void setScheduleTime(String scheduleTime) {
+ this.scheduleTime = scheduleTime;
+ }
+
+
+
+
Review Comment:
Remove extra blank lines.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowAPITest.java:
##########
@@ -0,0 +1,109 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "wen";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ private static String genNumId = null;
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ }
+
+ @Test
+ @Order(99)
+ public void testCreateWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId,"wen");
+ HttpResponse res = flow.createWorkflow(sessionId, projectName, workFlowName);
+ System.out.println(res);
+ System.out.println(res.body());
+ Assertions.assertTrue(res.body().success());
+ }
+
+ @Test
+ @Order(1)
+ public void testQueryWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId,"wen");
+ HttpResponse res = flow.queryWorkflow(sessionId, projectName, workFlowName);
+ System.out.println(res);
+ System.out.println(res.body());
+ Assertions.assertTrue(res.body().success());
+ }
+
+ @Test
+ @Order(98)
+ public void testOnlineWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ HttpResponse res = flow.onLineWorkflow(sessionId, projectName, workFlowName);
+ System.out.println(res);
+ System.out.println(res.body());
+ Assertions.assertTrue(res.body().success());
+
+ }
+
+
+ @Test
+ @Order(97)
+ public void testRunWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ HttpResponse res = flow.runWorkflow(sessionId, projectName, workFlowName);
+ System.out.println(res);
+ System.out.println(res.body());
+ Assertions.assertTrue(res.body().success());
+
+ }
+
+
Review Comment:
Remove extra blank lines.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/ProjectAPITest.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class ProjectAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "wen";
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ }
+
+
+ @Test
+ @Order(99)
+ public void testCreateProject() {
+ ProjectPage projectPage = new ProjectPage();
+
+ HttpResponse createProjectHttpResponse = projectPage.createProject(sessionId, projectName, "123", user);
+ logger.info(String.valueOf(createProjectHttpResponse.body()));
+ Assertions.assertTrue(createProjectHttpResponse.body().success());
+ }
+
+ @Test
+ @Order(1)
+ public void testQeuryProject() {
+ ProjectPage projectPage = new ProjectPage();
+
+ String aa = projectPage.getProjectCode(sessionId, projectName);
Review Comment:
We should use names that represent specific meanings as variables rather than meaningless words.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/ProjectAPITest.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class ProjectAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "wen";
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ }
+
+
+ @Test
+ @Order(99)
+ public void testCreateProject() {
+ ProjectPage projectPage = new ProjectPage();
+
+ HttpResponse createProjectHttpResponse = projectPage.createProject(sessionId, projectName, "123", user);
+ logger.info(String.valueOf(createProjectHttpResponse.body()));
+ Assertions.assertTrue(createProjectHttpResponse.body().success());
+ }
+
+ @Test
+ @Order(1)
+ public void testQeuryProject() {
+ ProjectPage projectPage = new ProjectPage();
+
+ String aa = projectPage.getProjectCode(sessionId, projectName);
+ System.out.println(aa);
Review Comment:
Please avoid using any of `system.out` in this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] codecov-commenter commented on pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1170680171
# [Codecov](https://codecov.io/gh/apache/dolphinscheduler/pull/10670?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#10670](https://codecov.io/gh/apache/dolphinscheduler/pull/10670?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ffb8bfd) into [dev](https://codecov.io/gh/apache/dolphinscheduler/commit/3fbfa27f1343491ac7757cde59e4e5654a18e958?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (3fbfa27) will **decrease** coverage by `0.00%`.
> The diff coverage is `n/a`.
```diff
@@ Coverage Diff @@
## dev #10670 +/- ##
============================================
- Coverage 40.90% 40.90% -0.01%
+ Complexity 4830 4829 -1
============================================
Files 897 897
Lines 36157 36151 -6
Branches 4006 4000 -6
============================================
- Hits 14789 14786 -3
+ Misses 19897 19894 -3
Partials 1471 1471
```
| [Impacted Files](https://codecov.io/gh/apache/dolphinscheduler/pull/10670?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...er/master/dispatch/host/assign/RandomSelector.java](https://codecov.io/gh/apache/dolphinscheduler/pull/10670/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci1tYXN0ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvc2VydmVyL21hc3Rlci9kaXNwYXRjaC9ob3N0L2Fzc2lnbi9SYW5kb21TZWxlY3Rvci5qYXZh) | `77.77% <0.00%> (-5.56%)` | :arrow_down: |
| [...r/plugin/task/sqoop/parameter/SqoopParameters.java](https://codecov.io/gh/apache/dolphinscheduler/pull/10670/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci10YXNrLXBsdWdpbi9kb2xwaGluc2NoZWR1bGVyLXRhc2stc3Fvb3Avc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvcGx1Z2luL3Rhc2svc3Fvb3AvcGFyYW1ldGVyL1Nxb29wUGFyYW1ldGVycy5qYXZh) | `53.33% <0.00%> (-1.34%)` | :arrow_down: |
| [...rver/master/runner/task/BlockingTaskProcessor.java](https://codecov.io/gh/apache/dolphinscheduler/pull/10670/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci1tYXN0ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvc2VydmVyL21hc3Rlci9ydW5uZXIvdGFzay9CbG9ja2luZ1Rhc2tQcm9jZXNzb3IuamF2YQ==) | `75.60% <0.00%> (-0.30%)` | :arrow_down: |
| [...eduler/api/service/impl/DataSourceServiceImpl.java](https://codecov.io/gh/apache/dolphinscheduler/pull/10670/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL3NlcnZpY2UvaW1wbC9EYXRhU291cmNlU2VydmljZUltcGwuamF2YQ==) | `29.41% <0.00%> (ø)` | |
| [.../dolphinscheduler/plugin/task/datax/DataxTask.java](https://codecov.io/gh/apache/dolphinscheduler/pull/10670/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci10YXNrLXBsdWdpbi9kb2xwaGluc2NoZWR1bGVyLXRhc2stZGF0YXgvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvcGx1Z2luL3Rhc2svZGF0YXgvRGF0YXhUYXNrLmphdmE=) | `0.00% <0.00%> (ø)` | |
| [...cheduler/plugin/task/api/ShellCommandExecutor.java](https://codecov.io/gh/apache/dolphinscheduler/pull/10670/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci10YXNrLXBsdWdpbi9kb2xwaGluc2NoZWR1bGVyLXRhc2stYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kb2xwaGluc2NoZWR1bGVyL3BsdWdpbi90YXNrL2FwaS9TaGVsbENvbW1hbmRFeGVjdXRvci5qYXZh) | `0.00% <0.00%> (ø)` | |
| [...er/api/service/impl/TaskDefinitionServiceImpl.java](https://codecov.io/gh/apache/dolphinscheduler/pull/10670/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL3NlcnZpY2UvaW1wbC9UYXNrRGVmaW5pdGlvblNlcnZpY2VJbXBsLmphdmE=) | `24.01% <0.00%> (+0.05%)` | :arrow_up: |
| [...hinscheduler/plugin/alert/wechat/WeChatSender.java](https://codecov.io/gh/apache/dolphinscheduler/pull/10670/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci1hbGVydC9kb2xwaGluc2NoZWR1bGVyLWFsZXJ0LXBsdWdpbnMvZG9scGhpbnNjaGVkdWxlci1hbGVydC13ZWNoYXQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvcGx1Z2luL2FsZXJ0L3dlY2hhdC9XZUNoYXRTZW5kZXIuamF2YQ==) | `29.78% <0.00%> (+0.20%)` | :arrow_up: |
| [...olphinscheduler/plugin/alert/email/MailSender.java](https://codecov.io/gh/apache/dolphinscheduler/pull/10670/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci1hbGVydC9kb2xwaGluc2NoZWR1bGVyLWFsZXJ0LXBsdWdpbnMvZG9scGhpbnNjaGVkdWxlci1hbGVydC1lbWFpbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZG9scGhpbnNjaGVkdWxlci9wbHVnaW4vYWxlcnQvZW1haWwvTWFpbFNlbmRlci5qYXZh) | `51.38% <0.00%> (+0.35%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/dolphinscheduler/pull/10670?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/dolphinscheduler/pull/10670?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [3fbfa27...ffb8bfd](https://codecov.io/gh/apache/dolphinscheduler/pull/10670?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
SbloodyS commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r910551655
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/ProjectAPITest.java:
##########
@@ -0,0 +1,79 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.*;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class ProjectAPITest {
+ private static final String tenant = System.getProperty("user.name");
+ private static final String projectName = "wen";
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ }
+
+ @AfterAll
+ public static void cleanup() {
+ LOGGER.info("success cleanup");
+ }
+
+ @Test
+ @Order(1)
+ public void testCreateProject() {
+ ProjectPage projectPage = new ProjectPage();
+
+ HttpResponse createProjectHttpResponse = projectPage.createProject(sessionId, projectName, "123", "admin");
+ System.out.println(createProjectHttpResponse.body());
+ Assertions.assertTrue(createProjectHttpResponse.body().success());
+ }
+
+ @Test
+ @Order(1)
Review Comment:
> Order numbers bigger than 1 should be used here, to keep the tests in a specific order. we can not query project if we not create them
Good catch. hahaha
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
SbloodyS commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r914381922
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowAPITest.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.pages.security.TenantPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case02_wen";
+
+ private static final String projectDesc = "123";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String tenantName = "admin";
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ ProjectPage projectPage = new ProjectPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+ TenantPage tenantPage = new TenantPage();
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ projectPage.createProject(sessionId, projectName, projectDesc, user);
+ tenantPage.createTenant(sessionId, tenantName, 1, "");
+
+ }
+
+ @Test
+ @Order(1)
+ public void testCreateWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId, projectName);
+ HttpResponse res = flow.createWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Create workflow res:%s", res);
Review Comment:
I'm not quite sure about it. PTAL @kezhenxu94
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1173560247
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=coverage&view=list) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=duplicated_lines_density&view=list) No Duplication information
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r912455946
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowInstanceAPITest.java:
##########
@@ -0,0 +1,79 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowInstanceAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String tenant = System.getProperty("user.name");
+
+ private static final String projectName = "wen";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ private static String genNumId = null;
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ }
+
+ @Test
+ @Order(1)
+ public void testQueryWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+
+ flow.getGenNumId(sessionId,"wen");
+
+ HttpResponse res = flow.createWorkflow(sessionId, projectName, workFlowName);
+
+ }
+
+
+
+
Review Comment:
Thanks for the reminder, it has been fixed
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/ProjectAPITest.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class ProjectAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "wen";
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+
Review Comment:
Thanks for the reminder, it has been fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
SbloodyS commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r909612131
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/TaskInstanceAPITest.java:
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.TaskInstancePage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.*;
Review Comment:
Same here.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,156 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ String taskDefinitionJson = "[{\"code\":" + genNumId + ",\"delayTime\":\"0\",\"description\":\"\",\"environmentCode\":-1,\"failRetryInterval\":\"1\",\"failRetryTimes\":\"0\",\"flag\":\"YES\",\"name\":\"echo_123\",\"taskParams\":{\"localParams\":[],\"rawScript\":\"echo 123\",\"resourceList\":[]},\"taskPriority\":\"MEDIUM\",\"taskType\":\"SHELL\",\"timeout\":0,\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"workerGroup\":\"default\"}]";
+ String taskRelationJson = "[{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":"+ genNumId + ",\"postTaskVersion\":0,\"conditionType\":\"NONE\",\"conditionParams\":{}}]";
+ String locations = "[{\"taskCode\":" + genNumId +",\"x\":33.5,\"y\":38.5}]";
+ params.put("taskDefinitionJson", taskDefinitionJson);
+ params.put("taskRelationJson", taskRelationJson);
+ params.put("locations", locations);
+ params.put("name", workFlowName);
+ params.put("tenantCode", "admin");
+ params.put("executionType", "PARALLEL");
+ params.put("description", "");
+ params.put("globalParams", "[]");
+ params.put("timeout", 0);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ System.out.printf("创建工作流 param是:%s",params);
+ System.out.printf("创建工作流header头是:%s", "/projects/"+projectCode+"/process-definition");
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/process-definition", headers, params);
+
+ System.out.printf("创建工作流结果:%s", res);
Review Comment:
We should not use `System.out``` in any code. Please use `LOGGER`.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,156 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ String taskDefinitionJson = "[{\"code\":" + genNumId + ",\"delayTime\":\"0\",\"description\":\"\",\"environmentCode\":-1,\"failRetryInterval\":\"1\",\"failRetryTimes\":\"0\",\"flag\":\"YES\",\"name\":\"echo_123\",\"taskParams\":{\"localParams\":[],\"rawScript\":\"echo 123\",\"resourceList\":[]},\"taskPriority\":\"MEDIUM\",\"taskType\":\"SHELL\",\"timeout\":0,\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"workerGroup\":\"default\"}]";
+ String taskRelationJson = "[{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":"+ genNumId + ",\"postTaskVersion\":0,\"conditionType\":\"NONE\",\"conditionParams\":{}}]";
+ String locations = "[{\"taskCode\":" + genNumId +",\"x\":33.5,\"y\":38.5}]";
+ params.put("taskDefinitionJson", taskDefinitionJson);
+ params.put("taskRelationJson", taskRelationJson);
+ params.put("locations", locations);
+ params.put("name", workFlowName);
+ params.put("tenantCode", "admin");
+ params.put("executionType", "PARALLEL");
+ params.put("description", "");
+ params.put("globalParams", "[]");
+ params.put("timeout", 0);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ System.out.printf("创建工作流 param是:%s",params);
+ System.out.printf("创建工作流header头是:%s", "/projects/"+projectCode+"/process-definition");
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/process-definition", headers, params);
+
+ System.out.printf("创建工作流结果:%s", res);
+ return res;
+ }
+
+ public HttpResponse queryWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize",10);
+ params.put("pageNo",1);
+ params.put("searchVal",workFlowName);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ HttpResponse res = requestClient.get("/projects/"+ projectCode + "/process-definition", headers, params);
+ System.out.printf("查询工作流结果:%s\n", res);
+ for (WorkFlowResponseTotalList workFlowList : JSONUtils.convertValue(res.body().data(), WorkFlowResponseData.class).totalList()) {
+ workFlowCode = workFlowList.code();
+ }
+
+ return res;
+ }
+
+ public HttpResponse onLineWorkflow(String sessionId, String projectName, String workFlowName){
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.queryWorkflow(sessionId, projectName, workFlowName);
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("name", workFlowName);
+ params.put("releaseState", "ONLINE");
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/process-definition/"+workFlowCode+"/release", headers, params);
+
+ System.out.printf("上线工作流:%s", res);
+ return res;
+
+ }
+
+ public HttpResponse runWorkflow(String sessionId, String projectName, String workFlowName){
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.queryWorkflow(sessionId, projectName, workFlowName);
+ workflow.onLineWorkflow(sessionId, projectName, workFlowName);
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("processDefinitionCode", workFlowCode);
+ params.put("startEndTime", "2022-06-25T16:00:00.000Z");
+ params.put("startEndTime", "2022-06-25T16:00:00.000Z");
+ params.put("scheduleTime", "2022-06-26 00:00:00,2022-06-26 00:00:00");
+ params.put("failureStrategy", "CONTINUE");
+ params.put("warningType", "NONE");
+ params.put("warningGroupId", "");
+ params.put("execType", "START_PROCESS");
+ params.put("startNodeList", "");
+ params.put("taskDependType", "TASK_POST");
+ params.put("dependentMode", "OFF_MODE");
+ params.put("runMode", "RUN_MODE_SERIAL");
+ params.put("processInstancePriority", "MEDIUM");
+ params.put("workerGroup", "default");
+ params.put("environmentCode", "");
+ params.put("startParams", "");
+ params.put("expectedParallelismNumber", "");
+ params.put("dryRun", 0);
Review Comment:
It is recommended to create an entity class instead of a map to increase code readability and reusability.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,156 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ String taskDefinitionJson = "[{\"code\":" + genNumId + ",\"delayTime\":\"0\",\"description\":\"\",\"environmentCode\":-1,\"failRetryInterval\":\"1\",\"failRetryTimes\":\"0\",\"flag\":\"YES\",\"name\":\"echo_123\",\"taskParams\":{\"localParams\":[],\"rawScript\":\"echo 123\",\"resourceList\":[]},\"taskPriority\":\"MEDIUM\",\"taskType\":\"SHELL\",\"timeout\":0,\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"workerGroup\":\"default\"}]";
+ String taskRelationJson = "[{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":"+ genNumId + ",\"postTaskVersion\":0,\"conditionType\":\"NONE\",\"conditionParams\":{}}]";
+ String locations = "[{\"taskCode\":" + genNumId +",\"x\":33.5,\"y\":38.5}]";
+ params.put("taskDefinitionJson", taskDefinitionJson);
+ params.put("taskRelationJson", taskRelationJson);
+ params.put("locations", locations);
+ params.put("name", workFlowName);
+ params.put("tenantCode", "admin");
+ params.put("executionType", "PARALLEL");
+ params.put("description", "");
+ params.put("globalParams", "[]");
+ params.put("timeout", 0);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
Review Comment:
Same as line 142.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowInstanceAPITest.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.*;
Review Comment:
Same here.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/ProjectAPITest.java:
##########
@@ -0,0 +1,79 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.*;
Review Comment:
Please avoid import *
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowAPITest.java:
##########
@@ -0,0 +1,104 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.*;
Review Comment:
Same here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r912421405
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/ProjectAPITest.java:
##########
@@ -0,0 +1,79 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.*;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class ProjectAPITest {
+ private static final String tenant = System.getProperty("user.name");
+ private static final String projectName = "wen";
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ }
+
+ @AfterAll
+ public static void cleanup() {
+ LOGGER.info("success cleanup");
+ }
Review Comment:
Thanks for your advice, I will fix it as soon as possible
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
SbloodyS commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r927327072
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowShellAPITest.java:
##########
@@ -0,0 +1,131 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowInstancesPage;
+import org.apache.dolphinscheduler.api.test.pages.security.TenantPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowShellAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case02_wen";
+
+ private static final String projectDesc = "123";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String tenantName = "wendada";
Review Comment:
Please use `System.getProperty("user.name")` to get tenant instead of hardcode it since it may cause test error in different environments.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1193283292
SonarCloud Quality Gate failed. [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [1 Bug](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [135 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_coverage&view=list) [24.3% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list) [1.8% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r913885893
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/WorkFlowRunRequestData.java:
##########
@@ -0,0 +1,204 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
Review Comment:
Thanks for the reminder, it has been fixed
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/WorkFlowCreateRequestData.java:
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.ArrayList;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
Review Comment:
Thanks for the reminder, it has been fixed
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/TaskRelationRequestData.java:
##########
@@ -0,0 +1,101 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Map;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
Review Comment:
Thanks for the reminder, it has been fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] WangJPLeo commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
WangJPLeo commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r913461833
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/TaskDefinitionRequestData.java:
##########
@@ -0,0 +1,181 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Map;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
Review Comment:
Annotation @Data and get/set methods in classes are duplicated.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/TaskParamsMap.java:
##########
@@ -0,0 +1,61 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.ArrayList;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
Review Comment:
Same here.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/TaskRelationRequestData.java:
##########
@@ -0,0 +1,101 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Map;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
Review Comment:
Same here.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/WorkFlowRunRequestData.java:
##########
@@ -0,0 +1,204 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
Review Comment:
Same here.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/WorkFlowCreateRequestData.java:
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.ArrayList;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
Review Comment:
Same here.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/TaskInstancePage.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.TaskInstanceResponseData;
+import org.apache.dolphinscheduler.api.test.entity.TaskInstanceResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class TaskInstancePage {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
Review Comment:
Same here.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,199 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.*;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
Review Comment:
Same here.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/ProjectPage.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.ProjectListResponseData;
+import org.apache.dolphinscheduler.api.test.entity.ProjectListResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class ProjectPage {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
Review Comment:
The Logger in the class should correctly specify which class it belongs to, here it should be ProjectPage.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1191417042
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=coverage&view=list) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=duplicated_lines_density&view=list) No Duplication information
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1193505939
SonarCloud Quality Gate failed. [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [1 Code Smell](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_coverage&view=list) [2.2% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list) [1.7% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] SbloodyS closed pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
SbloodyS closed pull request #10670: Project management basic test cases
URL: https://github.com/apache/dolphinscheduler/pull/10670
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r909668664
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/ProjectAPITest.java:
##########
@@ -0,0 +1,79 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.*;
Review Comment:
Thanks for your advice, I will fix it as soon as possible
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/TaskInstanceAPITest.java:
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.TaskInstancePage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.*;
Review Comment:
Thanks for your advice, I will fix it as soon as possible
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowAPITest.java:
##########
@@ -0,0 +1,104 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.*;
Review Comment:
Thanks for your advice, I will fix it as soon as possible
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowInstanceAPITest.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.*;
Review Comment:
Thanks for your advice, I will fix it as soon as possible
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
SbloodyS commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r914380039
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/TenantAPITest.java:
##########
@@ -76,38 +76,9 @@ public void testCreateTenant() {
public void testDuplicateCreateTenant() {
TenantPage tenantPage = new TenantPage();
- HttpResponse createTenantHttpResponse = tenantPage.createTenant(sessionId, tenant, 1, "");
+ HttpResponse createTenantHttpResponse = tenantPage.createTenant(sessionId, tenantName, 1, "");
Assertions.assertFalse(createTenantHttpResponse.body().success());
}
- @Test
- @Order(5)
- public void testGetTenantListPaging() {
- TenantPage tenantPage = new TenantPage();
-
- HttpResponse createTenantHttpResponse = tenantPage.getTenantListPaging(sessionId, 1, 10, "");
- boolean result = false;
-
- for (TenantListPagingResponseTotalList tenantListPagingResponseTotalList : JSONUtils.convertValue(createTenantHttpResponse.body().data(), TenantListPagingResponseData.class).totalList()) {
- if (tenantListPagingResponseTotalList.tenantCode().equals(tenant)) {
- result = true;
- existTenantId = tenantListPagingResponseTotalList.id();
- break;
- }
- }
-
- Assertions.assertTrue(createTenantHttpResponse.body().success());
- Assertions.assertTrue(result);
- }
-
- @Test
- @Order(10)
- public void testDeleteTenant() {
- TenantPage tenantPage = new TenantPage();
-
- HttpResponse deleteTenantHttpResponse = tenantPage.deleteTenant(sessionId, existTenantId);
-
- Assertions.assertTrue(deleteTenantHttpResponse.body().success());
- }
Review Comment:
> Is there any reason for why we need to delete these tests?
Currently checkstyle not enabled in api-test...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r914493223
##########
.github/workflows/api-test.yml:
##########
@@ -88,6 +88,8 @@ jobs:
case:
- name: Tenant
class: org.apache.dolphinscheduler.api.test.cases.TenantAPITest
+ - name: Project
+ class: org.apache.dolphinscheduler.api.test.cases.ProjectAPITest
Review Comment:
Thanks for the reminder, it has been fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
SbloodyS commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r914451461
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/TenantAPITest.java:
##########
@@ -76,38 +76,9 @@ public void testCreateTenant() {
public void testDuplicateCreateTenant() {
TenantPage tenantPage = new TenantPage();
- HttpResponse createTenantHttpResponse = tenantPage.createTenant(sessionId, tenant, 1, "");
+ HttpResponse createTenantHttpResponse = tenantPage.createTenant(sessionId, tenantName, 1, "");
Assertions.assertFalse(createTenantHttpResponse.body().success());
}
- @Test
- @Order(5)
- public void testGetTenantListPaging() {
- TenantPage tenantPage = new TenantPage();
-
- HttpResponse createTenantHttpResponse = tenantPage.getTenantListPaging(sessionId, 1, 10, "");
- boolean result = false;
-
- for (TenantListPagingResponseTotalList tenantListPagingResponseTotalList : JSONUtils.convertValue(createTenantHttpResponse.body().data(), TenantListPagingResponseData.class).totalList()) {
- if (tenantListPagingResponseTotalList.tenantCode().equals(tenant)) {
- result = true;
- existTenantId = tenantListPagingResponseTotalList.id();
- break;
- }
- }
-
- Assertions.assertTrue(createTenantHttpResponse.body().success());
- Assertions.assertTrue(result);
- }
-
- @Test
- @Order(10)
- public void testDeleteTenant() {
- TenantPage tenantPage = new TenantPage();
-
- HttpResponse deleteTenantHttpResponse = tenantPage.deleteTenant(sessionId, existTenantId);
-
- Assertions.assertTrue(deleteTenantHttpResponse.body().success());
- }
Review Comment:
API-Test's checkstyle have been enabled in #10805.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r926697013
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,212 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.TaskParamsMap;
+import org.apache.dolphinscheduler.api.test.entity.TaskDefinitionRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.TaskRelationRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(WorkFlowDefinitionPage.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, String> headers = new HashMap<>();
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+ TaskDefinitionRequestData taskDefinitionRequestData = new TaskDefinitionRequestData();
+ TaskRelationRequestData taskRelationRequestData = new TaskRelationRequestData();
+
+ TaskParamsMap taskParams = new TaskParamsMap();
+ ArrayList<Object> localParams = new ArrayList<>();
+ ArrayList<Object> resourceList = new ArrayList<>();
+ taskParams.localParams(localParams);
+ taskParams.resourceList(resourceList);
+ taskParams.rawScript("echo 123");
+
+ taskDefinitionRequestData.code(genNumId);
+ taskDefinitionRequestData.delayTime("0");
+ taskDefinitionRequestData.description("");
+ taskDefinitionRequestData.environmentCode("-1");
+ taskDefinitionRequestData.failRetryInterval("1");
+ taskDefinitionRequestData.failRetryTimes("0");
+ taskDefinitionRequestData.flag("YES");
+ taskDefinitionRequestData.name("echo_123");
+ taskDefinitionRequestData.taskParams(taskParams);
+ taskDefinitionRequestData.taskPriority("MEDIUM");
+ taskDefinitionRequestData.taskType("SHELL");
+ taskDefinitionRequestData.timeout(0);
+ taskDefinitionRequestData.timeoutFlag("CLOSE");
+ taskDefinitionRequestData.timeoutNotifyStrategy("");
+ taskDefinitionRequestData.workerGroup("default");
+
+ ArrayList<Object> taskDefinitionRequestDataList = new ArrayList<>();
+ taskDefinitionRequestDataList.add(taskDefinitionRequestData);
+
+ logger.info("taskDefinitionRequestData:aaaa: %s");
+ logger.info(String.valueOf(taskDefinitionRequestData));
+ logger.info(String.valueOf(taskDefinitionRequestData.getClass()));
+ logger.info(String.valueOf(taskDefinitionRequestDataList));
+ logger.info(String.valueOf(taskDefinitionRequestDataList.getClass()));
+ logger.info("taskDefinitionRequestData:bbbb: %s");
Review Comment:
Thank you for your reminder. Corresponding modifications have been made here
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,212 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.TaskParamsMap;
+import org.apache.dolphinscheduler.api.test.entity.TaskDefinitionRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.TaskRelationRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(WorkFlowDefinitionPage.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, String> headers = new HashMap<>();
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+ TaskDefinitionRequestData taskDefinitionRequestData = new TaskDefinitionRequestData();
+ TaskRelationRequestData taskRelationRequestData = new TaskRelationRequestData();
+
+ TaskParamsMap taskParams = new TaskParamsMap();
+ ArrayList<Object> localParams = new ArrayList<>();
+ ArrayList<Object> resourceList = new ArrayList<>();
+ taskParams.localParams(localParams);
+ taskParams.resourceList(resourceList);
+ taskParams.rawScript("echo 123");
+
+ taskDefinitionRequestData.code(genNumId);
+ taskDefinitionRequestData.delayTime("0");
+ taskDefinitionRequestData.description("");
+ taskDefinitionRequestData.environmentCode("-1");
+ taskDefinitionRequestData.failRetryInterval("1");
+ taskDefinitionRequestData.failRetryTimes("0");
+ taskDefinitionRequestData.flag("YES");
+ taskDefinitionRequestData.name("echo_123");
+ taskDefinitionRequestData.taskParams(taskParams);
+ taskDefinitionRequestData.taskPriority("MEDIUM");
+ taskDefinitionRequestData.taskType("SHELL");
+ taskDefinitionRequestData.timeout(0);
+ taskDefinitionRequestData.timeoutFlag("CLOSE");
+ taskDefinitionRequestData.timeoutNotifyStrategy("");
+ taskDefinitionRequestData.workerGroup("default");
+
+ ArrayList<Object> taskDefinitionRequestDataList = new ArrayList<>();
+ taskDefinitionRequestDataList.add(taskDefinitionRequestData);
+
+ logger.info("taskDefinitionRequestData:aaaa: %s");
+ logger.info(String.valueOf(taskDefinitionRequestData));
+ logger.info(String.valueOf(taskDefinitionRequestData.getClass()));
+ logger.info(String.valueOf(taskDefinitionRequestDataList));
+ logger.info(String.valueOf(taskDefinitionRequestDataList.getClass()));
+ logger.info("taskDefinitionRequestData:bbbb: %s");
+
+ HashMap<String, Object> conditionParams = new HashMap();
+
+ taskRelationRequestData.name("");
+ taskRelationRequestData.preTaskCode(0);
+ taskRelationRequestData.preTaskVersion(0);
+ taskRelationRequestData.preTaskCode(0);
+ taskRelationRequestData.postTaskCode(genNumId);
+ taskRelationRequestData.conditionType("NONE");
+ taskRelationRequestData.conditionParams(conditionParams);
+ ArrayList<Object> taskRelationRequestDataList = new ArrayList<>();
+ taskRelationRequestDataList.add(taskRelationRequestData);
+
+ HashMap<String, Object> locations = new HashMap();
+ locations.put("taskCode", genNumId);
+ locations.put("x", 33.5);
+ locations.put("y", 38.5);
+ ArrayList<Object> locationsList = new ArrayList<>();
+ locationsList.add(locations);
+
+ workFlowCreateRequestData.locations(JSONUtils.toJsonString(locationsList));
+ workFlowCreateRequestData.taskDefinitionJson(JSONUtils.toJsonString(taskDefinitionRequestDataList));
+ workFlowCreateRequestData.taskRelationJson(JSONUtils.toJsonString(taskRelationRequestDataList));
+ workFlowCreateRequestData.name(workFlowName);
+ workFlowCreateRequestData.tenantCode("admin");
+ workFlowCreateRequestData.executionType("PARALLEL");
+ workFlowCreateRequestData.description("");
+ workFlowCreateRequestData.globalParams("[]");
+ workFlowCreateRequestData.timeout(0);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+
+ logger.info(String.valueOf(workFlowCreateRequestData));
Review Comment:
Thank you for your reminder. Corresponding modifications have been made here
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/TaskInstancePage.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.TaskInstanceResponseData;
+import org.apache.dolphinscheduler.api.test.entity.TaskInstanceResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class TaskInstancePage {
+ private static final Logger logger = LoggerFactory.getLogger(TaskInstancePage.class);
+ private static String taskState = null;
+ private static Integer taskInstanceId = null;
+
+ public String queryTaskInstance(String sessionId, String projectName, String workFlowName){
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize", 10);
+ params.put("pageNo", 1);
+ params.put("searchVal", "");
+ params.put("processInstanceId", "");
+ params.put("host", "");
+ params.put("stateType", "");
+ params.put("startDate", "");
+ params.put("endDate", "");
+ params.put("executorName", "");
+ params.put("processInstanceName", workFlowName);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.runWorkflow(sessionId, projectName, workFlowName);
+
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-instances", headers, params);
+
+
+ for (TaskInstanceResponseTotalList taskInstanceRes : JSONUtils.convertValue(res.body().data(), TaskInstanceResponseData.class).totalList()) {
+
+ taskState = taskInstanceRes.state();
+ taskInstanceId = taskInstanceRes.id();
+ }
+
+ logger.info("查询task状态:%s", taskState);
Review Comment:
Thank you for your reminder. Corresponding modifications have been made here
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowAPITest.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.pages.security.TenantPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case02_wen";
+
+ private static final String projectDesc = "123";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String tenantName = "admin";
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ ProjectPage projectPage = new ProjectPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+ TenantPage tenantPage = new TenantPage();
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ projectPage.createProject(sessionId, projectName, projectDesc, user);
+ tenantPage.createTenant(sessionId, tenantName, 1, "");
+
+ }
+
+ @Test
+ @Order(1)
+ public void testCreateWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId, projectName);
+ HttpResponse res = flow.createWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Create workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+ }
+
+ @Test
+ @Order(2)
+ public void testOnlineWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ HttpResponse res = flow.onLineWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Online workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+
+ }
+
+ @Test
+ @Order(3)
+ public void testQueryWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId, projectName);
+ HttpResponse res = flow.queryWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Query workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+ }
+
+ @Test
+ @Order(4)
+ public void testRunWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ HttpResponse res = flow.runWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Run workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+
Review Comment:
Thank you for your reminder. Corresponding modifications have been made here
##########
.github/workflows/api-test.yml:
##########
@@ -90,6 +90,12 @@ jobs:
case:
- name: Tenant
class: org.apache.dolphinscheduler.api.test.cases.TenantAPITest
+ - name: Project
+ class: org.apache.dolphinscheduler.api.test.cases.ProjectAPITest
+ - name: WorkFlow
+ class: org.apache.dolphinscheduler.api.test.cases.WorkFlowAPITest
+ - name: WorkFlowInstance
+ class: org.apache.dolphinscheduler.api.test.cases.WorkFlowInstanceAPITest
Review Comment:
Thank you for your reminder. Corresponding modifications have been made here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r927366594
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowShellAPITest.java:
##########
@@ -0,0 +1,131 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowInstancesPage;
+import org.apache.dolphinscheduler.api.test.pages.security.TenantPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowShellAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case02_wen";
+
+ private static final String projectDesc = "123";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String tenantName = "wendada";
Review Comment:
Thanks for the reminder, it has been fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] SbloodyS commented on pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
SbloodyS commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1169967406
BTW, please associate the issue. @welsh-wen
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1189912902
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=coverage&view=list) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=duplicated_lines_density&view=list) No Duplication information
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] zhongjiajie commented on pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
zhongjiajie commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1174803354
I rerun the CI to test whether is fakey test or not
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r912468593
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/ProjectAPITest.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class ProjectAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "wen";
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ }
+
+
+ @Test
+ @Order(99)
+ public void testCreateProject() {
+ ProjectPage projectPage = new ProjectPage();
+
+ HttpResponse createProjectHttpResponse = projectPage.createProject(sessionId, projectName, "123", user);
+ logger.info(String.valueOf(createProjectHttpResponse.body()));
+ Assertions.assertTrue(createProjectHttpResponse.body().success());
+ }
+
+ @Test
+ @Order(1)
+ public void testQeuryProject() {
+ ProjectPage projectPage = new ProjectPage();
+
+ String aa = projectPage.getProjectCode(sessionId, projectName);
Review Comment:
Thanks for the reminder, it has been fixed
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/ProjectAPITest.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class ProjectAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "wen";
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ }
+
+
+ @Test
+ @Order(99)
+ public void testCreateProject() {
+ ProjectPage projectPage = new ProjectPage();
+
+ HttpResponse createProjectHttpResponse = projectPage.createProject(sessionId, projectName, "123", user);
+ logger.info(String.valueOf(createProjectHttpResponse.body()));
+ Assertions.assertTrue(createProjectHttpResponse.body().success());
+ }
+
+ @Test
+ @Order(1)
+ public void testQeuryProject() {
+ ProjectPage projectPage = new ProjectPage();
+
+ String aa = projectPage.getProjectCode(sessionId, projectName);
+ System.out.println(aa);
Review Comment:
Thanks for the reminder, it has been fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r912421426
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/ProjectAPITest.java:
##########
@@ -0,0 +1,79 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.*;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class ProjectAPITest {
+ private static final String tenant = System.getProperty("user.name");
+ private static final String projectName = "wen";
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ }
+
+ @AfterAll
+ public static void cleanup() {
+ LOGGER.info("success cleanup");
+ }
+
+ @Test
+ @Order(1)
+ public void testCreateProject() {
+ ProjectPage projectPage = new ProjectPage();
+
+ HttpResponse createProjectHttpResponse = projectPage.createProject(sessionId, projectName, "123", "admin");
+ System.out.println(createProjectHttpResponse.body());
+ Assertions.assertTrue(createProjectHttpResponse.body().success());
+ }
+
+ @Test
+ @Order(1)
Review Comment:
Thanks for your advice, I will fix it as soon as possible
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r914518126
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/ProjectPage.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.ProjectListResponseData;
+import org.apache.dolphinscheduler.api.test.entity.ProjectListResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class ProjectPage {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectPage.class);
+
+ public HttpResponse createProject(String sessionId, String projectName, String description, String userName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("projectName", projectName);
+ params.put("description", description);
+ params.put("userName", userName);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+
+ RequestClient requestClient = new RequestClient();
+
+ return requestClient.post("/projects", headers, params);
+ }
+
Review Comment:
Thanks for the reminder, it has been fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature] [API-TEST] Project management basic test cases [dolphinscheduler]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1839787705
This pull request has been automatically marked as stale because it has not had recent activity for 120 days. It will be closed in 7 days if no further activity occurs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r912421844
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/ProjectAPITest.java:
##########
@@ -0,0 +1,79 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.*;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class ProjectAPITest {
+ private static final String tenant = System.getProperty("user.name");
+ private static final String projectName = "wen";
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ }
+
+ @AfterAll
+ public static void cleanup() {
+ LOGGER.info("success cleanup");
+ }
+
+ @Test
+ @Order(1)
+ public void testCreateProject() {
+ ProjectPage projectPage = new ProjectPage();
+
+ HttpResponse createProjectHttpResponse = projectPage.createProject(sessionId, projectName, "123", "admin");
Review Comment:
Thanks for your advice, I will fix it as soon as possible
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r912455889
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,165 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+
+ String taskDefinitionJson = "[{\"code\":" + genNumId + ",\"delayTime\":\"0\",\"description\":\"\",\"environmentCode\":-1,\"failRetryInterval\":\"1\",\"failRetryTimes\":\"0\",\"flag\":\"YES\",\"name\":\"echo_123\",\"taskParams\":{\"localParams\":[],\"rawScript\":\"echo 123\",\"resourceList\":[]},\"taskPriority\":\"MEDIUM\",\"taskType\":\"SHELL\",\"timeout\":0,\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"workerGroup\":\"default\"}]";
+ String taskRelationJson = "[{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":"+ genNumId + ",\"postTaskVersion\":0,\"conditionType\":\"NONE\",\"conditionParams\":{}}]";
+ String locations = "[{\"taskCode\":" + genNumId +",\"x\":33.5,\"y\":38.5}]";
+ workFlowCreateRequestData.setTaskDefinitionJson(taskDefinitionJson);
+ workFlowCreateRequestData.setTaskRelationJson(taskRelationJson);
+ workFlowCreateRequestData.setLocations(locations);
+ workFlowCreateRequestData.setName(workFlowName);
+ workFlowCreateRequestData.setTenantCode("admin");
+ workFlowCreateRequestData.setExecutionType("PARALLEL");
+ workFlowCreateRequestData.setDescription("");
+ workFlowCreateRequestData.setGlobalParams("[]");
+ workFlowCreateRequestData.setTimeout(0);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/process-definition", headers, JSONUtils.convertValue(workFlowCreateRequestData, Map.class));
+ logger.info("创建工作流结果:%s", res);
Review Comment:
Thanks for the reminder, it has been fixed
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/TaskInstanceResponseData.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
+public class TaskInstanceResponseData {
+
+ private Integer currentPage;
+
+ private Integer pageSize;
+
+ private Integer start;
+
+ private Integer total;
+
+ private List<TaskInstanceResponseTotalList> totalList;
+
+ private Integer totalPage;
+
+
Review Comment:
Thanks for the reminder, it has been fixed
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/entity/ProjectListResponseData.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
+public class ProjectListResponseData {
+
+
Review Comment:
Thanks for the reminder, it has been fixed
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowAPITest.java:
##########
@@ -0,0 +1,109 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "wen";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ private static String genNumId = null;
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ }
+
+ @Test
+ @Order(99)
+ public void testCreateWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId,"wen");
+ HttpResponse res = flow.createWorkflow(sessionId, projectName, workFlowName);
+ System.out.println(res);
+ System.out.println(res.body());
+ Assertions.assertTrue(res.body().success());
+ }
+
+ @Test
+ @Order(1)
+ public void testQueryWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId,"wen");
+ HttpResponse res = flow.queryWorkflow(sessionId, projectName, workFlowName);
+ System.out.println(res);
+ System.out.println(res.body());
+ Assertions.assertTrue(res.body().success());
+ }
+
+ @Test
+ @Order(98)
+ public void testOnlineWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ HttpResponse res = flow.onLineWorkflow(sessionId, projectName, workFlowName);
+ System.out.println(res);
+ System.out.println(res.body());
+ Assertions.assertTrue(res.body().success());
+
+ }
+
+
+ @Test
+ @Order(97)
+ public void testRunWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ HttpResponse res = flow.runWorkflow(sessionId, projectName, workFlowName);
+ System.out.println(res);
+ System.out.println(res.body());
+ Assertions.assertTrue(res.body().success());
+
+ }
+
+
Review Comment:
Thanks for the reminder, it has been fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1173027705
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=coverage&view=list) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=duplicated_lines_density&view=list) No Duplication information
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1170684976
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=coverage&view=list) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r914522688
##########
dolphinscheduler-api-test/pom.xml:
##########
@@ -37,7 +37,8 @@
<junit.version>5.7.2</junit.version>
<selenium.version>3.141.59</selenium.version>
- <lombok.version>1.18.24</lombok.version>
+ <lombok.version>1.18.10</lombok.version>
+<!-- <lombok.version>1.18.20</lombok.version>-->
Review Comment:
Thanks for the reminder, it has been restored
reson:
Initially I modified the version of lombok because it did not work, but later found that it was caused by incorrect use, and has now been restored to the original version
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r914565499
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/ProjectPage.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.ProjectListResponseData;
+import org.apache.dolphinscheduler.api.test.entity.ProjectListResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class ProjectPage {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectPage.class);
+
+ public HttpResponse createProject(String sessionId, String projectName, String description, String userName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("projectName", projectName);
+ params.put("description", description);
+ params.put("userName", userName);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+
+ RequestClient requestClient = new RequestClient();
+
+ return requestClient.post("/projects", headers, params);
+ }
+
Review Comment:
-- do you mean Map instead of HashMap, or just String and add method to convert string to map?
The reason for using this type is that I see the return value as it is 「globalParamMap: {}」 type
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] caishunfeng commented on pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
caishunfeng commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1189784190
@welsh-wen please update pr title and add some description for it, see https://dolphinscheduler.apache.org/zh-cn/community/development/pull-request.html
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r927500080
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,205 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.TenantAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.TaskParamsMap;
+import org.apache.dolphinscheduler.api.test.entity.TaskDefinitionRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.TaskRelationRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(WorkFlowDefinitionPage.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, String> headers = new HashMap<>();
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+ TaskDefinitionRequestData taskDefinitionRequestData = new TaskDefinitionRequestData();
+ TaskRelationRequestData taskRelationRequestData = new TaskRelationRequestData();
+
+ TaskParamsMap taskParams = new TaskParamsMap();
+ ArrayList<Object> localParams = new ArrayList<>();
+ ArrayList<Object> resourceList = new ArrayList<>();
+ taskParams.localParams(localParams);
+ taskParams.resourceList(resourceList);
+ taskParams.rawScript("echo 123");
+
+ taskDefinitionRequestData.code(genNumId);
+ taskDefinitionRequestData.delayTime("0");
+ taskDefinitionRequestData.description("");
+ taskDefinitionRequestData.environmentCode("-1");
+ taskDefinitionRequestData.failRetryInterval("1");
+ taskDefinitionRequestData.failRetryTimes("0");
+ taskDefinitionRequestData.flag("YES");
+ taskDefinitionRequestData.name("echo_123");
+ taskDefinitionRequestData.taskParams(taskParams);
+ taskDefinitionRequestData.taskPriority("MEDIUM");
+ taskDefinitionRequestData.taskType("SHELL");
+ taskDefinitionRequestData.timeout(0);
+ taskDefinitionRequestData.timeoutFlag("CLOSE");
+ taskDefinitionRequestData.timeoutNotifyStrategy("");
+ taskDefinitionRequestData.workerGroup("default");
+
+ ArrayList<Object> taskDefinitionRequestDataList = new ArrayList<>();
+ taskDefinitionRequestDataList.add(taskDefinitionRequestData);
+
+ HashMap<String, Object> conditionParams = new HashMap();
+
+ taskRelationRequestData.name("");
+ taskRelationRequestData.preTaskCode(0);
+ taskRelationRequestData.preTaskVersion(0);
+ taskRelationRequestData.preTaskCode(0);
+ taskRelationRequestData.postTaskCode(genNumId);
+ taskRelationRequestData.conditionType("NONE");
+ taskRelationRequestData.conditionParams(conditionParams);
+ ArrayList<Object> taskRelationRequestDataList = new ArrayList<>();
+ taskRelationRequestDataList.add(taskRelationRequestData);
+
+ HashMap<String, Object> locations = new HashMap();
+ locations.put("taskCode", genNumId);
+ locations.put("x", 33.5);
+ locations.put("y", 38.5);
+ ArrayList<Object> locationsList = new ArrayList<>();
+ locationsList.add(locations);
+
+ workFlowCreateRequestData.locations(JSONUtils.toJsonString(locationsList));
+ workFlowCreateRequestData.taskDefinitionJson(JSONUtils.toJsonString(taskDefinitionRequestDataList));
+ workFlowCreateRequestData.taskRelationJson(JSONUtils.toJsonString(taskRelationRequestDataList));
+ workFlowCreateRequestData.name(workFlowName);
+ workFlowCreateRequestData.tenantCode(TenantAPITest.tenantName);
+ workFlowCreateRequestData.executionType("PARALLEL");
+ workFlowCreateRequestData.description("");
+ workFlowCreateRequestData.globalParams("[]");
+ workFlowCreateRequestData.timeout(0);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/process-definition", headers, JSONUtils.convertValue(workFlowCreateRequestData, Map.class));
+ return res;
+ }
+
+ public HttpResponse queryWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize",10);
+ params.put("pageNo",1);
+ params.put("searchVal",workFlowName);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ HttpResponse res = requestClient.get("/projects/"+ projectCode + "/process-definition", headers, params);
+
+ for (WorkFlowResponseTotalList workFlowList : JSONUtils.convertValue(res.body().data(), WorkFlowResponseData.class).totalList()) {
+ workFlowCode = workFlowList.code();
+ }
+
+ return res;
+ }
+
+ public HttpResponse onLineWorkflow(String sessionId, String projectName, String workFlowName){
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.queryWorkflow(sessionId, projectName, workFlowName);
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("name", workFlowName);
+ params.put("releaseState", "ONLINE");
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/process-definition/"+workFlowCode+"/release", headers, params);
+
+ return res;
+
+ }
+
+ public HttpResponse runWorkflow(String sessionId, String projectName, String workFlowName){
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.queryWorkflow(sessionId, projectName, workFlowName);
+ workflow.onLineWorkflow(sessionId, projectName, workFlowName);
+ Map<String, String> headers = new HashMap<>();
+
+ WorkFlowRunRequestData workFlowRunRequestData = new WorkFlowRunRequestData();
+
+ workFlowRunRequestData.processDefinitionCode(workFlowCode);
+ workFlowRunRequestData.startEndTime("2022-06-25T16:00:00.000Z");
+ workFlowRunRequestData.scheduleTime("2022-06-26 00:00:00,2022-06-26 00:00:00");
+ workFlowRunRequestData.failureStrategy("CONTINUE");
+ workFlowRunRequestData.warningType("NONE");
+ workFlowRunRequestData.warningGroupId("");
+ workFlowRunRequestData.execType("START_PROCESS");
+ workFlowRunRequestData.startNodeList("");
+ workFlowRunRequestData.taskDependType("TASK_POST");
+ workFlowRunRequestData.dependentMode("OFF_MODE");
+ workFlowRunRequestData.runMode("RUN_MODE_SERIAL");
+ workFlowRunRequestData.processInstancePriority("MEDIUM");
+ workFlowRunRequestData.workerGroup("default");
+ workFlowRunRequestData.environmentCode("");
+ workFlowRunRequestData.startParams("");
+ workFlowRunRequestData.expectedParallelismNumber("");
+ workFlowRunRequestData.dryRun(0);
Review Comment:
Thanks for the reminder, it has been fixed
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,205 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.TenantAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.TaskParamsMap;
+import org.apache.dolphinscheduler.api.test.entity.TaskDefinitionRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.TaskRelationRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(WorkFlowDefinitionPage.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, String> headers = new HashMap<>();
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+ TaskDefinitionRequestData taskDefinitionRequestData = new TaskDefinitionRequestData();
+ TaskRelationRequestData taskRelationRequestData = new TaskRelationRequestData();
+
+ TaskParamsMap taskParams = new TaskParamsMap();
+ ArrayList<Object> localParams = new ArrayList<>();
+ ArrayList<Object> resourceList = new ArrayList<>();
+ taskParams.localParams(localParams);
+ taskParams.resourceList(resourceList);
+ taskParams.rawScript("echo 123");
+
+ taskDefinitionRequestData.code(genNumId);
+ taskDefinitionRequestData.delayTime("0");
+ taskDefinitionRequestData.description("");
+ taskDefinitionRequestData.environmentCode("-1");
+ taskDefinitionRequestData.failRetryInterval("1");
+ taskDefinitionRequestData.failRetryTimes("0");
+ taskDefinitionRequestData.flag("YES");
+ taskDefinitionRequestData.name("echo_123");
+ taskDefinitionRequestData.taskParams(taskParams);
+ taskDefinitionRequestData.taskPriority("MEDIUM");
+ taskDefinitionRequestData.taskType("SHELL");
+ taskDefinitionRequestData.timeout(0);
+ taskDefinitionRequestData.timeoutFlag("CLOSE");
+ taskDefinitionRequestData.timeoutNotifyStrategy("");
+ taskDefinitionRequestData.workerGroup("default");
+
+ ArrayList<Object> taskDefinitionRequestDataList = new ArrayList<>();
+ taskDefinitionRequestDataList.add(taskDefinitionRequestData);
+
+ HashMap<String, Object> conditionParams = new HashMap();
+
+ taskRelationRequestData.name("");
+ taskRelationRequestData.preTaskCode(0);
+ taskRelationRequestData.preTaskVersion(0);
+ taskRelationRequestData.preTaskCode(0);
+ taskRelationRequestData.postTaskCode(genNumId);
+ taskRelationRequestData.conditionType("NONE");
+ taskRelationRequestData.conditionParams(conditionParams);
+ ArrayList<Object> taskRelationRequestDataList = new ArrayList<>();
+ taskRelationRequestDataList.add(taskRelationRequestData);
+
+ HashMap<String, Object> locations = new HashMap();
+ locations.put("taskCode", genNumId);
+ locations.put("x", 33.5);
+ locations.put("y", 38.5);
+ ArrayList<Object> locationsList = new ArrayList<>();
+ locationsList.add(locations);
+
+ workFlowCreateRequestData.locations(JSONUtils.toJsonString(locationsList));
+ workFlowCreateRequestData.taskDefinitionJson(JSONUtils.toJsonString(taskDefinitionRequestDataList));
+ workFlowCreateRequestData.taskRelationJson(JSONUtils.toJsonString(taskRelationRequestDataList));
+ workFlowCreateRequestData.name(workFlowName);
+ workFlowCreateRequestData.tenantCode(TenantAPITest.tenantName);
+ workFlowCreateRequestData.executionType("PARALLEL");
+ workFlowCreateRequestData.description("");
+ workFlowCreateRequestData.globalParams("[]");
+ workFlowCreateRequestData.timeout(0);
Review Comment:
Thanks for the reminder, it has been fixed
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,205 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.TenantAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.TaskParamsMap;
+import org.apache.dolphinscheduler.api.test.entity.TaskDefinitionRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.TaskRelationRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(WorkFlowDefinitionPage.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, String> headers = new HashMap<>();
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+ TaskDefinitionRequestData taskDefinitionRequestData = new TaskDefinitionRequestData();
+ TaskRelationRequestData taskRelationRequestData = new TaskRelationRequestData();
+
+ TaskParamsMap taskParams = new TaskParamsMap();
+ ArrayList<Object> localParams = new ArrayList<>();
+ ArrayList<Object> resourceList = new ArrayList<>();
+ taskParams.localParams(localParams);
+ taskParams.resourceList(resourceList);
+ taskParams.rawScript("echo 123");
+
+ taskDefinitionRequestData.code(genNumId);
+ taskDefinitionRequestData.delayTime("0");
+ taskDefinitionRequestData.description("");
+ taskDefinitionRequestData.environmentCode("-1");
+ taskDefinitionRequestData.failRetryInterval("1");
+ taskDefinitionRequestData.failRetryTimes("0");
+ taskDefinitionRequestData.flag("YES");
+ taskDefinitionRequestData.name("echo_123");
+ taskDefinitionRequestData.taskParams(taskParams);
+ taskDefinitionRequestData.taskPriority("MEDIUM");
+ taskDefinitionRequestData.taskType("SHELL");
+ taskDefinitionRequestData.timeout(0);
+ taskDefinitionRequestData.timeoutFlag("CLOSE");
+ taskDefinitionRequestData.timeoutNotifyStrategy("");
+ taskDefinitionRequestData.workerGroup("default");
+
+ ArrayList<Object> taskDefinitionRequestDataList = new ArrayList<>();
+ taskDefinitionRequestDataList.add(taskDefinitionRequestData);
+
+ HashMap<String, Object> conditionParams = new HashMap();
+
+ taskRelationRequestData.name("");
+ taskRelationRequestData.preTaskCode(0);
+ taskRelationRequestData.preTaskVersion(0);
+ taskRelationRequestData.preTaskCode(0);
+ taskRelationRequestData.postTaskCode(genNumId);
+ taskRelationRequestData.conditionType("NONE");
Review Comment:
Thanks for the reminder, it has been fixed
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,205 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.TenantAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.TaskParamsMap;
+import org.apache.dolphinscheduler.api.test.entity.TaskDefinitionRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.TaskRelationRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(WorkFlowDefinitionPage.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, String> headers = new HashMap<>();
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+ TaskDefinitionRequestData taskDefinitionRequestData = new TaskDefinitionRequestData();
+ TaskRelationRequestData taskRelationRequestData = new TaskRelationRequestData();
+
+ TaskParamsMap taskParams = new TaskParamsMap();
+ ArrayList<Object> localParams = new ArrayList<>();
+ ArrayList<Object> resourceList = new ArrayList<>();
+ taskParams.localParams(localParams);
+ taskParams.resourceList(resourceList);
+ taskParams.rawScript("echo 123");
Review Comment:
Thanks for the reminder, it has been fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1192523559
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=coverage&view=list) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=duplicated_lines_density&view=list) No Duplication information
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1179493233
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [7 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_coverage&view=list) [59.0% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
SbloodyS commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r927320811
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/ProjectPage.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import com.sun.xml.internal.ws.api.model.ExceptionType;
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.ProjectListResponseData;
+import org.apache.dolphinscheduler.api.test.entity.ProjectListResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class ProjectPage {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectPage.class);
+
+ public HttpResponse createProject(String sessionId, String projectName, String description, String userName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("projectName", projectName);
+ params.put("description", description);
+ params.put("userName", userName);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+
+ RequestClient requestClient = new RequestClient();
+
+ try {
+ HttpResponse res = requestClient.post("/projects", headers, params);
+ return res;
+ } catch (Exception e) {
+ logger.error("create project fail, message:{}", e);
Review Comment:
Is it better to throw an exception directly so that the test can be stopped directly instead of continue. WDYT?
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/TaskInstancePage.java:
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.TaskInstanceResponseData;
+import org.apache.dolphinscheduler.api.test.entity.TaskInstanceResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class TaskInstancePage {
+ private static final Logger logger = LoggerFactory.getLogger(TaskInstancePage.class);
+ private static String taskState = null;
+ private static Integer taskInstanceId = null;
+
+ public String queryTaskInstance(String sessionId, String projectName, String workFlowName){
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize", 10);
+ params.put("pageNo", 1);
+ params.put("searchVal", "");
+ params.put("processInstanceId", "");
+ params.put("host", "");
+ params.put("stateType", "");
+ params.put("startDate", "");
+ params.put("endDate", "");
+ params.put("executorName", "");
+ params.put("processInstanceName", workFlowName);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.runWorkflow(sessionId, projectName, workFlowName);
+
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-instances", headers, params);
+
+
+ for (TaskInstanceResponseTotalList taskInstanceRes : JSONUtils.convertValue(res.body().data(), TaskInstanceResponseData.class).totalList()) {
+
Review Comment:
It's better to remove the blank line.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,205 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.TenantAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.TaskParamsMap;
+import org.apache.dolphinscheduler.api.test.entity.TaskDefinitionRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.TaskRelationRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(WorkFlowDefinitionPage.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, String> headers = new HashMap<>();
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+ TaskDefinitionRequestData taskDefinitionRequestData = new TaskDefinitionRequestData();
+ TaskRelationRequestData taskRelationRequestData = new TaskRelationRequestData();
+
+ TaskParamsMap taskParams = new TaskParamsMap();
+ ArrayList<Object> localParams = new ArrayList<>();
+ ArrayList<Object> resourceList = new ArrayList<>();
+ taskParams.localParams(localParams);
+ taskParams.resourceList(resourceList);
+ taskParams.rawScript("echo 123");
Review Comment:
We should turn this into an input to the method instead of hardcode it.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/TaskInstancePage.java:
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.TaskInstanceResponseData;
+import org.apache.dolphinscheduler.api.test.entity.TaskInstanceResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class TaskInstancePage {
+ private static final Logger logger = LoggerFactory.getLogger(TaskInstancePage.class);
+ private static String taskState = null;
+ private static Integer taskInstanceId = null;
+
+ public String queryTaskInstance(String sessionId, String projectName, String workFlowName){
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize", 10);
+ params.put("pageNo", 1);
+ params.put("searchVal", "");
+ params.put("processInstanceId", "");
+ params.put("host", "");
+ params.put("stateType", "");
+ params.put("startDate", "");
+ params.put("endDate", "");
+ params.put("executorName", "");
+ params.put("processInstanceName", workFlowName);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.runWorkflow(sessionId, projectName, workFlowName);
+
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-instances", headers, params);
+
+
+ for (TaskInstanceResponseTotalList taskInstanceRes : JSONUtils.convertValue(res.body().data(), TaskInstanceResponseData.class).totalList()) {
+
+ taskState = taskInstanceRes.state();
+ taskInstanceId = taskInstanceRes.id();
+ }
+
+ return taskState;
+
+ }
+
+ public HttpResponse queryTaskInstanceLog(String sessionId, String projectName, String workFlowName){
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ TaskInstancePage taskInstance = new TaskInstancePage();
+ taskInstance.queryTaskInstance(sessionId, projectName, workFlowName);
+
+ params.put("taskInstanceId", taskInstanceId);
+ params.put("limit", 1000);
+ params.put("skipLineNum", 0);
+
+ HttpResponse res = requestClient.get("/log/detail", headers, params);
+ String res_log = (String) res.body().data();
+
+ logger.info("查询实例log:%s", res_log);
Review Comment:
Please remove unnessnary log.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,205 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.TenantAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.TaskParamsMap;
+import org.apache.dolphinscheduler.api.test.entity.TaskDefinitionRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.TaskRelationRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(WorkFlowDefinitionPage.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, String> headers = new HashMap<>();
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+ TaskDefinitionRequestData taskDefinitionRequestData = new TaskDefinitionRequestData();
+ TaskRelationRequestData taskRelationRequestData = new TaskRelationRequestData();
+
+ TaskParamsMap taskParams = new TaskParamsMap();
+ ArrayList<Object> localParams = new ArrayList<>();
+ ArrayList<Object> resourceList = new ArrayList<>();
+ taskParams.localParams(localParams);
+ taskParams.resourceList(resourceList);
+ taskParams.rawScript("echo 123");
+
+ taskDefinitionRequestData.code(genNumId);
+ taskDefinitionRequestData.delayTime("0");
+ taskDefinitionRequestData.description("");
+ taskDefinitionRequestData.environmentCode("-1");
+ taskDefinitionRequestData.failRetryInterval("1");
+ taskDefinitionRequestData.failRetryTimes("0");
+ taskDefinitionRequestData.flag("YES");
+ taskDefinitionRequestData.name("echo_123");
+ taskDefinitionRequestData.taskParams(taskParams);
+ taskDefinitionRequestData.taskPriority("MEDIUM");
+ taskDefinitionRequestData.taskType("SHELL");
+ taskDefinitionRequestData.timeout(0);
+ taskDefinitionRequestData.timeoutFlag("CLOSE");
+ taskDefinitionRequestData.timeoutNotifyStrategy("");
+ taskDefinitionRequestData.workerGroup("default");
Review Comment:
Same as L75.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/ProjectPage.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import com.sun.xml.internal.ws.api.model.ExceptionType;
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.ProjectListResponseData;
+import org.apache.dolphinscheduler.api.test.entity.ProjectListResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class ProjectPage {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectPage.class);
+
+ public HttpResponse createProject(String sessionId, String projectName, String description, String userName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("projectName", projectName);
+ params.put("description", description);
+ params.put("userName", userName);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+
+ RequestClient requestClient = new RequestClient();
+
+ try {
+ HttpResponse res = requestClient.post("/projects", headers, params);
+ return res;
+ } catch (Exception e) {
+ logger.error("create project fail, message:{}", e);
+ }
+ return null;
+ }
+
+ public HttpResponse searchProject(String sessionId, String searchVal) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize", 10);
+ params.put("pageNo", 1);
+ params.put("searchVal", searchVal);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+
+ RequestClient requestClient = new RequestClient();
+
+ return requestClient.get("/projects", headers, params);
+ }
+
+ public String getProjectCode(String sessionId, String searchVal) {
+ String projectCode = null;
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize", 10);
+ params.put("pageNo", 1);
+ params.put("searchVal", searchVal);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+
+ RequestClient requestClient = new RequestClient();
+
+ HttpResponse res = requestClient.get("/projects", headers, params);
+
+ logger.info("project %s", res);
Review Comment:
Please remove unnessnary log.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,205 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.TenantAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.TaskParamsMap;
+import org.apache.dolphinscheduler.api.test.entity.TaskDefinitionRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.TaskRelationRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(WorkFlowDefinitionPage.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, String> headers = new HashMap<>();
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+ TaskDefinitionRequestData taskDefinitionRequestData = new TaskDefinitionRequestData();
+ TaskRelationRequestData taskRelationRequestData = new TaskRelationRequestData();
+
+ TaskParamsMap taskParams = new TaskParamsMap();
+ ArrayList<Object> localParams = new ArrayList<>();
+ ArrayList<Object> resourceList = new ArrayList<>();
+ taskParams.localParams(localParams);
+ taskParams.resourceList(resourceList);
+ taskParams.rawScript("echo 123");
+
+ taskDefinitionRequestData.code(genNumId);
+ taskDefinitionRequestData.delayTime("0");
+ taskDefinitionRequestData.description("");
+ taskDefinitionRequestData.environmentCode("-1");
+ taskDefinitionRequestData.failRetryInterval("1");
+ taskDefinitionRequestData.failRetryTimes("0");
+ taskDefinitionRequestData.flag("YES");
+ taskDefinitionRequestData.name("echo_123");
+ taskDefinitionRequestData.taskParams(taskParams);
+ taskDefinitionRequestData.taskPriority("MEDIUM");
+ taskDefinitionRequestData.taskType("SHELL");
+ taskDefinitionRequestData.timeout(0);
+ taskDefinitionRequestData.timeoutFlag("CLOSE");
+ taskDefinitionRequestData.timeoutNotifyStrategy("");
+ taskDefinitionRequestData.workerGroup("default");
+
+ ArrayList<Object> taskDefinitionRequestDataList = new ArrayList<>();
+ taskDefinitionRequestDataList.add(taskDefinitionRequestData);
+
+ HashMap<String, Object> conditionParams = new HashMap();
+
+ taskRelationRequestData.name("");
+ taskRelationRequestData.preTaskCode(0);
+ taskRelationRequestData.preTaskVersion(0);
+ taskRelationRequestData.preTaskCode(0);
+ taskRelationRequestData.postTaskCode(genNumId);
+ taskRelationRequestData.conditionType("NONE");
+ taskRelationRequestData.conditionParams(conditionParams);
+ ArrayList<Object> taskRelationRequestDataList = new ArrayList<>();
+ taskRelationRequestDataList.add(taskRelationRequestData);
+
+ HashMap<String, Object> locations = new HashMap();
+ locations.put("taskCode", genNumId);
+ locations.put("x", 33.5);
+ locations.put("y", 38.5);
+ ArrayList<Object> locationsList = new ArrayList<>();
+ locationsList.add(locations);
+
+ workFlowCreateRequestData.locations(JSONUtils.toJsonString(locationsList));
+ workFlowCreateRequestData.taskDefinitionJson(JSONUtils.toJsonString(taskDefinitionRequestDataList));
+ workFlowCreateRequestData.taskRelationJson(JSONUtils.toJsonString(taskRelationRequestDataList));
+ workFlowCreateRequestData.name(workFlowName);
+ workFlowCreateRequestData.tenantCode(TenantAPITest.tenantName);
+ workFlowCreateRequestData.executionType("PARALLEL");
+ workFlowCreateRequestData.description("");
+ workFlowCreateRequestData.globalParams("[]");
+ workFlowCreateRequestData.timeout(0);
Review Comment:
Same as L75.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,205 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.TenantAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.TaskParamsMap;
+import org.apache.dolphinscheduler.api.test.entity.TaskDefinitionRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.TaskRelationRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(WorkFlowDefinitionPage.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, String> headers = new HashMap<>();
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+ TaskDefinitionRequestData taskDefinitionRequestData = new TaskDefinitionRequestData();
+ TaskRelationRequestData taskRelationRequestData = new TaskRelationRequestData();
+
+ TaskParamsMap taskParams = new TaskParamsMap();
+ ArrayList<Object> localParams = new ArrayList<>();
+ ArrayList<Object> resourceList = new ArrayList<>();
+ taskParams.localParams(localParams);
+ taskParams.resourceList(resourceList);
+ taskParams.rawScript("echo 123");
+
+ taskDefinitionRequestData.code(genNumId);
+ taskDefinitionRequestData.delayTime("0");
+ taskDefinitionRequestData.description("");
+ taskDefinitionRequestData.environmentCode("-1");
+ taskDefinitionRequestData.failRetryInterval("1");
+ taskDefinitionRequestData.failRetryTimes("0");
+ taskDefinitionRequestData.flag("YES");
+ taskDefinitionRequestData.name("echo_123");
+ taskDefinitionRequestData.taskParams(taskParams);
+ taskDefinitionRequestData.taskPriority("MEDIUM");
+ taskDefinitionRequestData.taskType("SHELL");
+ taskDefinitionRequestData.timeout(0);
+ taskDefinitionRequestData.timeoutFlag("CLOSE");
+ taskDefinitionRequestData.timeoutNotifyStrategy("");
+ taskDefinitionRequestData.workerGroup("default");
+
+ ArrayList<Object> taskDefinitionRequestDataList = new ArrayList<>();
+ taskDefinitionRequestDataList.add(taskDefinitionRequestData);
+
+ HashMap<String, Object> conditionParams = new HashMap();
+
+ taskRelationRequestData.name("");
+ taskRelationRequestData.preTaskCode(0);
+ taskRelationRequestData.preTaskVersion(0);
+ taskRelationRequestData.preTaskCode(0);
+ taskRelationRequestData.postTaskCode(genNumId);
+ taskRelationRequestData.conditionType("NONE");
Review Comment:
Same as L75.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowInstancesPage.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.TaskDefinitionRequestData;
+import org.apache.dolphinscheduler.api.test.entity.TaskParamsMap;
+import org.apache.dolphinscheduler.api.test.entity.TaskRelationRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowInstancesResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowInstancesResponseTotalListData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public final class WorkFlowInstancesPage {
+ private static String workFlowInstanceState = null;
+ private static final Logger logger = LoggerFactory.getLogger(WorkFlowInstancesPage.class);
+
+
+ public String queryWorkflowInstanceState(String sessionId, String projectName, String workFlowName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize",10);
+ params.put("pageNo",1);
+ params.put("searchVal",workFlowName);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ HttpResponse res = requestClient.get("/projects/"+ projectCode + "/process-instances", headers, params);
+
+ for (WorkFlowInstancesResponseTotalListData workFlowInstanceList : JSONUtils.convertValue(res.body().data(), WorkFlowInstancesResponseData.class).totalList()) {
+ workFlowInstanceState = workFlowInstanceList.state();
+ }
+
+ return workFlowInstanceState;
+ }
+
+
Review Comment:
Please avoid meaningless blank line.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowInstancesPage.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.TaskDefinitionRequestData;
+import org.apache.dolphinscheduler.api.test.entity.TaskParamsMap;
+import org.apache.dolphinscheduler.api.test.entity.TaskRelationRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowInstancesResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowInstancesResponseTotalListData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public final class WorkFlowInstancesPage {
+ private static String workFlowInstanceState = null;
+ private static final Logger logger = LoggerFactory.getLogger(WorkFlowInstancesPage.class);
+
+
Review Comment:
Please avoid meaningless blank line.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,205 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.TenantAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.TaskParamsMap;
+import org.apache.dolphinscheduler.api.test.entity.TaskDefinitionRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.TaskRelationRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+ private static final Logger logger = LoggerFactory.getLogger(WorkFlowDefinitionPage.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, String> headers = new HashMap<>();
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+ TaskDefinitionRequestData taskDefinitionRequestData = new TaskDefinitionRequestData();
+ TaskRelationRequestData taskRelationRequestData = new TaskRelationRequestData();
+
+ TaskParamsMap taskParams = new TaskParamsMap();
+ ArrayList<Object> localParams = new ArrayList<>();
+ ArrayList<Object> resourceList = new ArrayList<>();
+ taskParams.localParams(localParams);
+ taskParams.resourceList(resourceList);
+ taskParams.rawScript("echo 123");
+
+ taskDefinitionRequestData.code(genNumId);
+ taskDefinitionRequestData.delayTime("0");
+ taskDefinitionRequestData.description("");
+ taskDefinitionRequestData.environmentCode("-1");
+ taskDefinitionRequestData.failRetryInterval("1");
+ taskDefinitionRequestData.failRetryTimes("0");
+ taskDefinitionRequestData.flag("YES");
+ taskDefinitionRequestData.name("echo_123");
+ taskDefinitionRequestData.taskParams(taskParams);
+ taskDefinitionRequestData.taskPriority("MEDIUM");
+ taskDefinitionRequestData.taskType("SHELL");
+ taskDefinitionRequestData.timeout(0);
+ taskDefinitionRequestData.timeoutFlag("CLOSE");
+ taskDefinitionRequestData.timeoutNotifyStrategy("");
+ taskDefinitionRequestData.workerGroup("default");
+
+ ArrayList<Object> taskDefinitionRequestDataList = new ArrayList<>();
+ taskDefinitionRequestDataList.add(taskDefinitionRequestData);
+
+ HashMap<String, Object> conditionParams = new HashMap();
+
+ taskRelationRequestData.name("");
+ taskRelationRequestData.preTaskCode(0);
+ taskRelationRequestData.preTaskVersion(0);
+ taskRelationRequestData.preTaskCode(0);
+ taskRelationRequestData.postTaskCode(genNumId);
+ taskRelationRequestData.conditionType("NONE");
+ taskRelationRequestData.conditionParams(conditionParams);
+ ArrayList<Object> taskRelationRequestDataList = new ArrayList<>();
+ taskRelationRequestDataList.add(taskRelationRequestData);
+
+ HashMap<String, Object> locations = new HashMap();
+ locations.put("taskCode", genNumId);
+ locations.put("x", 33.5);
+ locations.put("y", 38.5);
+ ArrayList<Object> locationsList = new ArrayList<>();
+ locationsList.add(locations);
+
+ workFlowCreateRequestData.locations(JSONUtils.toJsonString(locationsList));
+ workFlowCreateRequestData.taskDefinitionJson(JSONUtils.toJsonString(taskDefinitionRequestDataList));
+ workFlowCreateRequestData.taskRelationJson(JSONUtils.toJsonString(taskRelationRequestDataList));
+ workFlowCreateRequestData.name(workFlowName);
+ workFlowCreateRequestData.tenantCode(TenantAPITest.tenantName);
+ workFlowCreateRequestData.executionType("PARALLEL");
+ workFlowCreateRequestData.description("");
+ workFlowCreateRequestData.globalParams("[]");
+ workFlowCreateRequestData.timeout(0);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/process-definition", headers, JSONUtils.convertValue(workFlowCreateRequestData, Map.class));
+ return res;
+ }
+
+ public HttpResponse queryWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize",10);
+ params.put("pageNo",1);
+ params.put("searchVal",workFlowName);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ HttpResponse res = requestClient.get("/projects/"+ projectCode + "/process-definition", headers, params);
+
+ for (WorkFlowResponseTotalList workFlowList : JSONUtils.convertValue(res.body().data(), WorkFlowResponseData.class).totalList()) {
+ workFlowCode = workFlowList.code();
+ }
+
+ return res;
+ }
+
+ public HttpResponse onLineWorkflow(String sessionId, String projectName, String workFlowName){
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.queryWorkflow(sessionId, projectName, workFlowName);
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("name", workFlowName);
+ params.put("releaseState", "ONLINE");
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/process-definition/"+workFlowCode+"/release", headers, params);
+
+ return res;
+
+ }
+
+ public HttpResponse runWorkflow(String sessionId, String projectName, String workFlowName){
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.queryWorkflow(sessionId, projectName, workFlowName);
+ workflow.onLineWorkflow(sessionId, projectName, workFlowName);
+ Map<String, String> headers = new HashMap<>();
+
+ WorkFlowRunRequestData workFlowRunRequestData = new WorkFlowRunRequestData();
+
+ workFlowRunRequestData.processDefinitionCode(workFlowCode);
+ workFlowRunRequestData.startEndTime("2022-06-25T16:00:00.000Z");
+ workFlowRunRequestData.scheduleTime("2022-06-26 00:00:00,2022-06-26 00:00:00");
+ workFlowRunRequestData.failureStrategy("CONTINUE");
+ workFlowRunRequestData.warningType("NONE");
+ workFlowRunRequestData.warningGroupId("");
+ workFlowRunRequestData.execType("START_PROCESS");
+ workFlowRunRequestData.startNodeList("");
+ workFlowRunRequestData.taskDependType("TASK_POST");
+ workFlowRunRequestData.dependentMode("OFF_MODE");
+ workFlowRunRequestData.runMode("RUN_MODE_SERIAL");
+ workFlowRunRequestData.processInstancePriority("MEDIUM");
+ workFlowRunRequestData.workerGroup("default");
+ workFlowRunRequestData.environmentCode("");
+ workFlowRunRequestData.startParams("");
+ workFlowRunRequestData.expectedParallelismNumber("");
+ workFlowRunRequestData.dryRun(0);
Review Comment:
Same as L75.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
SbloodyS commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r927325821
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowShellAPITest.java:
##########
@@ -0,0 +1,131 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowInstancesPage;
+import org.apache.dolphinscheduler.api.test.pages.security.TenantPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowShellAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case02_wen";
+
+ private static final String projectDesc = "123";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String tenantName = "wendada";
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ ProjectPage projectPage = new ProjectPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+ TenantPage tenantPage = new TenantPage();
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ projectPage.createProject(sessionId, projectName, projectDesc, user);
+ tenantPage.createTenant(sessionId, tenantName, 1, "");
+
+ }
+
+ @Test
+ @Order(1)
+ public void testCreateWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId, projectName);
+ HttpResponse res = flow.createWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Create workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+ }
+
+ @Test
+ @Order(2)
+ public void testOnlineWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ HttpResponse res = flow.onLineWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Online workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+
+ }
+
+ @Test
+ @Order(3)
+ public void testQueryWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId, projectName);
+ HttpResponse res = flow.queryWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Query workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+ }
+
+ @Test
+ @Order(4)
+ public void testRunWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ HttpResponse res = flow.runWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Run workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+
+ }
+
+ @Test
+ @Order(5)
+ public void testQueryWorkflowInstanceState() throws InterruptedException {
+ WorkFlowInstancesPage instance = new WorkFlowInstancesPage();
+ String state = null;
+
+ for (int i=0; i<5; i++){
+ state = instance.queryWorkflowInstanceState(sessionId, projectName, workFlowName);
+ Thread.sleep(1000);
+ }
Review Comment:
The waiting time and cycle times of querying workflow instances may be used in multiple tests. So I think we should put this into constants for public use.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1175722034
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=coverage&view=list) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
SbloodyS commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r914382918
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/TenantAPITest.java:
##########
@@ -76,38 +76,9 @@ public void testCreateTenant() {
public void testDuplicateCreateTenant() {
TenantPage tenantPage = new TenantPage();
- HttpResponse createTenantHttpResponse = tenantPage.createTenant(sessionId, tenant, 1, "");
+ HttpResponse createTenantHttpResponse = tenantPage.createTenant(sessionId, tenantName, 1, "");
Assertions.assertFalse(createTenantHttpResponse.body().success());
}
- @Test
- @Order(5)
- public void testGetTenantListPaging() {
- TenantPage tenantPage = new TenantPage();
-
- HttpResponse createTenantHttpResponse = tenantPage.getTenantListPaging(sessionId, 1, 10, "");
- boolean result = false;
-
- for (TenantListPagingResponseTotalList tenantListPagingResponseTotalList : JSONUtils.convertValue(createTenantHttpResponse.body().data(), TenantListPagingResponseData.class).totalList()) {
- if (tenantListPagingResponseTotalList.tenantCode().equals(tenant)) {
- result = true;
- existTenantId = tenantListPagingResponseTotalList.id();
- break;
- }
- }
-
- Assertions.assertTrue(createTenantHttpResponse.body().success());
- Assertions.assertTrue(result);
- }
-
- @Test
- @Order(10)
- public void testDeleteTenant() {
- TenantPage tenantPage = new TenantPage();
-
- HttpResponse deleteTenantHttpResponse = tenantPage.deleteTenant(sessionId, existTenantId);
-
- Assertions.assertTrue(deleteTenantHttpResponse.body().success());
- }
Review Comment:
I think starting checkstyle at the beginning is a good start. I'll enable checkstyle in api-test these days.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r914519033
##########
dolphinscheduler-api-test/pom.xml:
##########
@@ -37,7 +37,8 @@
<junit.version>5.7.2</junit.version>
<selenium.version>3.141.59</selenium.version>
- <lombok.version>1.18.24</lombok.version>
+ <lombok.version>1.18.10</lombok.version>
+<!-- <lombok.version>1.18.20</lombok.version>-->
Review Comment:
Thanks for the reminder, it has been restored
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
SbloodyS commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r909617016
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,156 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+
+ }
+
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ String taskDefinitionJson = "[{\"code\":" + genNumId + ",\"delayTime\":\"0\",\"description\":\"\",\"environmentCode\":-1,\"failRetryInterval\":\"1\",\"failRetryTimes\":\"0\",\"flag\":\"YES\",\"name\":\"echo_123\",\"taskParams\":{\"localParams\":[],\"rawScript\":\"echo 123\",\"resourceList\":[]},\"taskPriority\":\"MEDIUM\",\"taskType\":\"SHELL\",\"timeout\":0,\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"workerGroup\":\"default\"}]";
+ String taskRelationJson = "[{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":"+ genNumId + ",\"postTaskVersion\":0,\"conditionType\":\"NONE\",\"conditionParams\":{}}]";
+ String locations = "[{\"taskCode\":" + genNumId +",\"x\":33.5,\"y\":38.5}]";
+ params.put("taskDefinitionJson", taskDefinitionJson);
+ params.put("taskRelationJson", taskRelationJson);
+ params.put("locations", locations);
+ params.put("name", workFlowName);
+ params.put("tenantCode", "admin");
+ params.put("executionType", "PARALLEL");
+ params.put("description", "");
+ params.put("globalParams", "[]");
+ params.put("timeout", 0);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ System.out.printf("创建工作流 param是:%s",params);
+ System.out.printf("创建工作流header头是:%s", "/projects/"+projectCode+"/process-definition");
+ HttpResponse res = requestClient.post("/projects/"+projectCode+"/process-definition", headers, params);
+
+ System.out.printf("创建工作流结果:%s", res);
Review Comment:
We should not use `System.out` in any code. Please use `LOGGER`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] kezhenxu94 commented on a diff in pull request #10670: Project management basic test cases
Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r914437239
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowAPITest.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.pages.security.TenantPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case02_wen";
+
+ private static final String projectDesc = "123";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String tenantName = "admin";
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ ProjectPage projectPage = new ProjectPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+ TenantPage tenantPage = new TenantPage();
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ projectPage.createProject(sessionId, projectName, projectDesc, user);
+ tenantPage.createTenant(sessionId, tenantName, 1, "");
+
+ }
+
+ @Test
+ @Order(1)
+ public void testCreateWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId, projectName);
+ HttpResponse res = flow.createWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Create workflow res:%s", res);
Review Comment:
> I think we should better remove all the logger in the test cases, IMO is useless, but maybe we need to hear others' opinion @caishunfeng @SbloodyS
Adding logs like this might help people to check what's wrong if the response is not `200`, (when the test is flaky), I'm OK to keep this logs but we need to make sure these logs indeed help when diagnosing errors in CI
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
SbloodyS commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r930547365
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/ProjectAPITest.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import lombok.extern.slf4j.Slf4j;
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class ProjectAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case01_wen";
Review Comment:
Please avoid using personal name.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/ProjectAPITest.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import lombok.extern.slf4j.Slf4j;
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class ProjectAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case01_wen";
+
+ private static final String projectDesc = "123";
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ }
+
+ @Test
+ @Order(1)
+ public void testCreateProject() {
+ ProjectPage projectPage = new ProjectPage();
+
+ HttpResponse res = projectPage.createProject(sessionId, projectName, projectDesc, user);
Review Comment:
```suggestion
HttpResponse createProjectResponse = projectPage.createProject(sessionId, projectName, projectDesc, user);
```
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowShellAPITest.java:
##########
@@ -0,0 +1,211 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import org.apache.dolphinscheduler.api.test.Constants;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowInstancesPage;
+import org.apache.dolphinscheduler.api.test.pages.security.TenantPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import lombok.extern.slf4j.Slf4j;
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowShellAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case02_wen";
Review Comment:
Avoid using personal name.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowShellAPITest.java:
##########
@@ -0,0 +1,211 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import org.apache.dolphinscheduler.api.test.Constants;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowInstancesPage;
+import org.apache.dolphinscheduler.api.test.pages.security.TenantPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import lombok.extern.slf4j.Slf4j;
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowShellAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case02_wen";
+
+ private static final String projectDesc = "123";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String tenantName = System.getProperty("user.name");
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ ArrayList<Object> localParams = new ArrayList<>();
+
+ ArrayList<Object> resourceList = new ArrayList<>();
+
+ private static String rawScript = "echo 123";
+
+ private static String delayTime = "0";
+
+ private static String description = "";
+
+ private static String environmentCode = "-1";
+
+ private static String failRetryInterval = "1";
+
+ private static String failRetryTimes = "0";
+
+ private static String flag = "YES";
+
+ private static String taskDefinitionRequestDataName = "shell123";
+
+ private static String taskPriority = "MEDIUM";
+
+ private static String taskType = "SHELL";
+
+ private int timeout = 0;
+
+ private static String timeoutFlag = "CLOSE";
+
+ private static String timeoutNotifyStrategy = "";
+
+ private static String workerGroup = "default";
+
+ private static String taskRelationRequestDataName = "";
+
+ private int preTaskCode = 0;
+
+ private int preTaskVersion = 0;
+
+ private static String conditionType = "NONE";
+ private static String executionType = "PARALLEL";
+ HashMap<String, Object> conditionParams = new HashMap<>();
Review Comment:
```suggestion
private static String conditionType = "NONE";
private static String executionType = "PARALLEL";
HashMap<String, Object> conditionParams = new HashMap<>();
```
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowShellAPITest.java:
##########
@@ -0,0 +1,211 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import org.apache.dolphinscheduler.api.test.Constants;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowInstancesPage;
+import org.apache.dolphinscheduler.api.test.pages.security.TenantPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import lombok.extern.slf4j.Slf4j;
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowShellAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case02_wen";
+
+ private static final String projectDesc = "123";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String tenantName = System.getProperty("user.name");
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ ArrayList<Object> localParams = new ArrayList<>();
+
+ ArrayList<Object> resourceList = new ArrayList<>();
+
+ private static String rawScript = "echo 123";
+
+ private static String delayTime = "0";
+
+ private static String description = "";
+
+ private static String environmentCode = "-1";
+
+ private static String failRetryInterval = "1";
+
+ private static String failRetryTimes = "0";
+
+ private static String flag = "YES";
+
+ private static String taskDefinitionRequestDataName = "shell123";
+
+ private static String taskPriority = "MEDIUM";
+
+ private static String taskType = "SHELL";
+
+ private int timeout = 0;
+
+ private static String timeoutFlag = "CLOSE";
+
+ private static String timeoutNotifyStrategy = "";
+
+ private static String workerGroup = "default";
+
+ private static String taskRelationRequestDataName = "";
+
+ private int preTaskCode = 0;
+
+ private int preTaskVersion = 0;
+
+ private static String conditionType = "NONE";
+ private static String executionType = "PARALLEL";
+ HashMap<String, Object> conditionParams = new HashMap<>();
+ private String globalParams = "[]";
+
+ private static String startEndTime = "2022-06-25T16:00:00.000Z";
+
+ private static String scheduleTime = "2022-06-26 00:00:00,2022-06-26 00:00:00";
+
+ private static String failureStrategy = "CONTINUE";
+
+ private static String warningType = "NONE";
+
+ private static String warningGroupId = "";
+
+ private static String execType = "START_PROCESS";
+
+ private static String startNodeList = "";
+
+ private static String taskDependType = "TASK_POST";
+
+ private static String dependentMode = "OFF_MODE";
+
+ private static String runMode = "RUN_MODE_SERIAL";
+
+ private static String processInstancePriority = "MEDIUM";
+
+ private static String startParams = "";
+
+ private static String expectedParallelismNumber = "";
+
+ private static int dryRun = 0;
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ ProjectPage projectPage = new ProjectPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+ TenantPage tenantPage = new TenantPage();
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ projectPage.createProject(sessionId, projectName, projectDesc, user);
+ tenantPage.createTenant(sessionId, tenantName, 1, "");
+
+ }
+
+ @Test
+ @Order(1)
+ public void testCreateWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId, projectName);
+ HttpResponse res = flow.createWorkflow(sessionId, projectName, workFlowName, localParams, resourceList, rawScript, delayTime, description, environmentCode, failRetryInterval,
+ failRetryTimes, flag, taskDefinitionRequestDataName, taskPriority, taskType, timeout, timeoutFlag, timeoutNotifyStrategy, workerGroup, taskRelationRequestDataName, preTaskCode,
+ preTaskVersion, conditionType, conditionParams, executionType, globalParams);
+
+ logger.info("Create workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+ }
+
+ @Test
+ @Order(2)
+ public void testOnlineWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ HttpResponse res = flow.onLineWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Online workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+
+ }
+
+ @Test
+ @Order(3)
+ public void testQueryWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId, projectName);
+ HttpResponse res = flow.queryWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Query workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+ }
+
+ @Test
+ @Order(4)
+ public void testRunWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ HttpResponse res = flow.runWorkflow(sessionId, projectName, workFlowName, startEndTime, scheduleTime, failureStrategy, warningType,
+ warningGroupId, execType, startNodeList, taskDependType, dependentMode, runMode, processInstancePriority,
+ workerGroup, environmentCode, startParams, expectedParallelismNumber, dryRun);
+
+ logger.info("Run workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+
+ }
+
+ @Test
+ @Order(5)
+ public void testQueryWorkflowInstanceState() throws InterruptedException {
+ WorkFlowInstancesPage instance = new WorkFlowInstancesPage();
+ String state = null;
+
+ for (int i = 0; i < Constants.SLEEP_FREQUENCY; i++) {
+ state = instance.queryWorkflowInstanceState(sessionId, projectName, workFlowName);
+ Thread.sleep(Constants.SLEEP_INTERVAL);
+ }
+ logger.info("Run workflow state:%s", state);
Review Comment:
remove unnessnary log.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowShellAPITest.java:
##########
@@ -0,0 +1,211 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import org.apache.dolphinscheduler.api.test.Constants;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowInstancesPage;
+import org.apache.dolphinscheduler.api.test.pages.security.TenantPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import lombok.extern.slf4j.Slf4j;
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowShellAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case02_wen";
+
+ private static final String projectDesc = "123";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String tenantName = System.getProperty("user.name");
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ ArrayList<Object> localParams = new ArrayList<>();
+
+ ArrayList<Object> resourceList = new ArrayList<>();
+
+ private static String rawScript = "echo 123";
+
+ private static String delayTime = "0";
+
+ private static String description = "";
+
+ private static String environmentCode = "-1";
+
+ private static String failRetryInterval = "1";
+
+ private static String failRetryTimes = "0";
+
+ private static String flag = "YES";
+
+ private static String taskDefinitionRequestDataName = "shell123";
+
+ private static String taskPriority = "MEDIUM";
+
+ private static String taskType = "SHELL";
+
+ private int timeout = 0;
+
+ private static String timeoutFlag = "CLOSE";
+
+ private static String timeoutNotifyStrategy = "";
+
+ private static String workerGroup = "default";
+
+ private static String taskRelationRequestDataName = "";
+
+ private int preTaskCode = 0;
+
+ private int preTaskVersion = 0;
+
+ private static String conditionType = "NONE";
+ private static String executionType = "PARALLEL";
+ HashMap<String, Object> conditionParams = new HashMap<>();
+ private String globalParams = "[]";
+
+ private static String startEndTime = "2022-06-25T16:00:00.000Z";
+
+ private static String scheduleTime = "2022-06-26 00:00:00,2022-06-26 00:00:00";
+
+ private static String failureStrategy = "CONTINUE";
+
+ private static String warningType = "NONE";
+
+ private static String warningGroupId = "";
+
+ private static String execType = "START_PROCESS";
+
+ private static String startNodeList = "";
+
+ private static String taskDependType = "TASK_POST";
+
+ private static String dependentMode = "OFF_MODE";
+
+ private static String runMode = "RUN_MODE_SERIAL";
+
+ private static String processInstancePriority = "MEDIUM";
+
+ private static String startParams = "";
+
+ private static String expectedParallelismNumber = "";
+
+ private static int dryRun = 0;
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ ProjectPage projectPage = new ProjectPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+ TenantPage tenantPage = new TenantPage();
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ projectPage.createProject(sessionId, projectName, projectDesc, user);
+ tenantPage.createTenant(sessionId, tenantName, 1, "");
+
+ }
+
+ @Test
+ @Order(1)
+ public void testCreateWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId, projectName);
+ HttpResponse res = flow.createWorkflow(sessionId, projectName, workFlowName, localParams, resourceList, rawScript, delayTime, description, environmentCode, failRetryInterval,
+ failRetryTimes, flag, taskDefinitionRequestDataName, taskPriority, taskType, timeout, timeoutFlag, timeoutNotifyStrategy, workerGroup, taskRelationRequestDataName, preTaskCode,
+ preTaskVersion, conditionType, conditionParams, executionType, globalParams);
+
+ logger.info("Create workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+ }
+
+ @Test
+ @Order(2)
+ public void testOnlineWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ HttpResponse res = flow.onLineWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Online workflow res:%s", res);
Review Comment:
remove unnessnary log.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowShellAPITest.java:
##########
@@ -0,0 +1,211 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import org.apache.dolphinscheduler.api.test.Constants;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowInstancesPage;
+import org.apache.dolphinscheduler.api.test.pages.security.TenantPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import lombok.extern.slf4j.Slf4j;
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowShellAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case02_wen";
+
+ private static final String projectDesc = "123";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String tenantName = System.getProperty("user.name");
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ ArrayList<Object> localParams = new ArrayList<>();
+
+ ArrayList<Object> resourceList = new ArrayList<>();
+
+ private static String rawScript = "echo 123";
+
+ private static String delayTime = "0";
+
+ private static String description = "";
+
+ private static String environmentCode = "-1";
+
+ private static String failRetryInterval = "1";
+
+ private static String failRetryTimes = "0";
+
+ private static String flag = "YES";
+
+ private static String taskDefinitionRequestDataName = "shell123";
+
+ private static String taskPriority = "MEDIUM";
+
+ private static String taskType = "SHELL";
+
+ private int timeout = 0;
+
+ private static String timeoutFlag = "CLOSE";
+
+ private static String timeoutNotifyStrategy = "";
+
+ private static String workerGroup = "default";
+
+ private static String taskRelationRequestDataName = "";
+
+ private int preTaskCode = 0;
+
+ private int preTaskVersion = 0;
+
+ private static String conditionType = "NONE";
+ private static String executionType = "PARALLEL";
+ HashMap<String, Object> conditionParams = new HashMap<>();
+ private String globalParams = "[]";
+
+ private static String startEndTime = "2022-06-25T16:00:00.000Z";
+
+ private static String scheduleTime = "2022-06-26 00:00:00,2022-06-26 00:00:00";
+
+ private static String failureStrategy = "CONTINUE";
+
+ private static String warningType = "NONE";
+
+ private static String warningGroupId = "";
+
+ private static String execType = "START_PROCESS";
+
+ private static String startNodeList = "";
+
+ private static String taskDependType = "TASK_POST";
+
+ private static String dependentMode = "OFF_MODE";
+
+ private static String runMode = "RUN_MODE_SERIAL";
+
+ private static String processInstancePriority = "MEDIUM";
+
+ private static String startParams = "";
+
+ private static String expectedParallelismNumber = "";
+
+ private static int dryRun = 0;
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ ProjectPage projectPage = new ProjectPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+ TenantPage tenantPage = new TenantPage();
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ projectPage.createProject(sessionId, projectName, projectDesc, user);
+ tenantPage.createTenant(sessionId, tenantName, 1, "");
+
+ }
+
+ @Test
+ @Order(1)
+ public void testCreateWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId, projectName);
+ HttpResponse res = flow.createWorkflow(sessionId, projectName, workFlowName, localParams, resourceList, rawScript, delayTime, description, environmentCode, failRetryInterval,
Review Comment:
```suggestion
HttpResponse createWorkflowResponse = flow.createWorkflow(sessionId, projectName, workFlowName, localParams, resourceList, rawScript, delayTime, description, environmentCode, failRetryInterval,
```
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowShellAPITest.java:
##########
@@ -0,0 +1,211 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import org.apache.dolphinscheduler.api.test.Constants;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowInstancesPage;
+import org.apache.dolphinscheduler.api.test.pages.security.TenantPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import lombok.extern.slf4j.Slf4j;
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowShellAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case02_wen";
+
+ private static final String projectDesc = "123";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String tenantName = System.getProperty("user.name");
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ ArrayList<Object> localParams = new ArrayList<>();
+
+ ArrayList<Object> resourceList = new ArrayList<>();
+
+ private static String rawScript = "echo 123";
+
+ private static String delayTime = "0";
+
+ private static String description = "";
+
+ private static String environmentCode = "-1";
+
+ private static String failRetryInterval = "1";
+
+ private static String failRetryTimes = "0";
+
+ private static String flag = "YES";
+
+ private static String taskDefinitionRequestDataName = "shell123";
+
+ private static String taskPriority = "MEDIUM";
+
+ private static String taskType = "SHELL";
+
+ private int timeout = 0;
+
+ private static String timeoutFlag = "CLOSE";
+
+ private static String timeoutNotifyStrategy = "";
+
+ private static String workerGroup = "default";
+
+ private static String taskRelationRequestDataName = "";
+
+ private int preTaskCode = 0;
+
+ private int preTaskVersion = 0;
+
+ private static String conditionType = "NONE";
+ private static String executionType = "PARALLEL";
+ HashMap<String, Object> conditionParams = new HashMap<>();
+ private String globalParams = "[]";
Review Comment:
I think we should avoid using json with string.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/TenantAPITest.java:
##########
@@ -76,38 +76,9 @@ public void testCreateTenant() {
public void testDuplicateCreateTenant() {
TenantPage tenantPage = new TenantPage();
- HttpResponse createTenantHttpResponse = tenantPage.createTenant(sessionId, tenant, 1, "");
+ HttpResponse createTenantHttpResponse = tenantPage.createTenant(sessionId, tenantName, 1, "");
Assertions.assertFalse(createTenantHttpResponse.body().success());
}
- @Test
- @Order(5)
- public void testGetTenantListPaging() {
- TenantPage tenantPage = new TenantPage();
-
- HttpResponse createTenantHttpResponse = tenantPage.getTenantListPaging(sessionId, 1, 10, "");
- boolean result = false;
-
- for (TenantListPagingResponseTotalList tenantListPagingResponseTotalList : JSONUtils.convertValue(createTenantHttpResponse.body().data(), TenantListPagingResponseData.class).totalList()) {
- if (tenantListPagingResponseTotalList.tenantCode().equals(tenant)) {
- result = true;
- existTenantId = tenantListPagingResponseTotalList.id();
- break;
- }
- }
-
- Assertions.assertTrue(createTenantHttpResponse.body().success());
- Assertions.assertTrue(result);
- }
-
- @Test
- @Order(10)
- public void testDeleteTenant() {
- TenantPage tenantPage = new TenantPage();
-
- HttpResponse deleteTenantHttpResponse = tenantPage.deleteTenant(sessionId, existTenantId);
-
- Assertions.assertTrue(deleteTenantHttpResponse.body().success());
- }
Review Comment:
This has not been addressed.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowShellAPITest.java:
##########
@@ -0,0 +1,211 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import org.apache.dolphinscheduler.api.test.Constants;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowInstancesPage;
+import org.apache.dolphinscheduler.api.test.pages.security.TenantPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import lombok.extern.slf4j.Slf4j;
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowShellAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case02_wen";
+
+ private static final String projectDesc = "123";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String tenantName = System.getProperty("user.name");
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ ArrayList<Object> localParams = new ArrayList<>();
+
+ ArrayList<Object> resourceList = new ArrayList<>();
+
+ private static String rawScript = "echo 123";
+
+ private static String delayTime = "0";
+
+ private static String description = "";
+
+ private static String environmentCode = "-1";
+
+ private static String failRetryInterval = "1";
+
+ private static String failRetryTimes = "0";
+
+ private static String flag = "YES";
+
+ private static String taskDefinitionRequestDataName = "shell123";
+
+ private static String taskPriority = "MEDIUM";
+
+ private static String taskType = "SHELL";
+
+ private int timeout = 0;
+
+ private static String timeoutFlag = "CLOSE";
+
+ private static String timeoutNotifyStrategy = "";
+
+ private static String workerGroup = "default";
+
+ private static String taskRelationRequestDataName = "";
+
+ private int preTaskCode = 0;
+
+ private int preTaskVersion = 0;
+
+ private static String conditionType = "NONE";
+ private static String executionType = "PARALLEL";
+ HashMap<String, Object> conditionParams = new HashMap<>();
+ private String globalParams = "[]";
+
+ private static String startEndTime = "2022-06-25T16:00:00.000Z";
+
+ private static String scheduleTime = "2022-06-26 00:00:00,2022-06-26 00:00:00";
+
+ private static String failureStrategy = "CONTINUE";
+
+ private static String warningType = "NONE";
+
+ private static String warningGroupId = "";
+
+ private static String execType = "START_PROCESS";
+
+ private static String startNodeList = "";
+
+ private static String taskDependType = "TASK_POST";
+
+ private static String dependentMode = "OFF_MODE";
+
+ private static String runMode = "RUN_MODE_SERIAL";
+
+ private static String processInstancePriority = "MEDIUM";
+
+ private static String startParams = "";
+
+ private static String expectedParallelismNumber = "";
+
+ private static int dryRun = 0;
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ ProjectPage projectPage = new ProjectPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+ TenantPage tenantPage = new TenantPage();
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ projectPage.createProject(sessionId, projectName, projectDesc, user);
+ tenantPage.createTenant(sessionId, tenantName, 1, "");
+
+ }
+
+ @Test
+ @Order(1)
+ public void testCreateWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId, projectName);
+ HttpResponse res = flow.createWorkflow(sessionId, projectName, workFlowName, localParams, resourceList, rawScript, delayTime, description, environmentCode, failRetryInterval,
+ failRetryTimes, flag, taskDefinitionRequestDataName, taskPriority, taskType, timeout, timeoutFlag, timeoutNotifyStrategy, workerGroup, taskRelationRequestDataName, preTaskCode,
+ preTaskVersion, conditionType, conditionParams, executionType, globalParams);
+
+ logger.info("Create workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+ }
+
+ @Test
+ @Order(2)
+ public void testOnlineWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ HttpResponse res = flow.onLineWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Online workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+
+ }
+
+ @Test
+ @Order(3)
+ public void testQueryWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId, projectName);
+ HttpResponse res = flow.queryWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Query workflow res:%s", res);
Review Comment:
remove unnessnary log.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowShellAPITest.java:
##########
@@ -0,0 +1,211 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import org.apache.dolphinscheduler.api.test.Constants;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowInstancesPage;
+import org.apache.dolphinscheduler.api.test.pages.security.TenantPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import lombok.extern.slf4j.Slf4j;
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowShellAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case02_wen";
+
+ private static final String projectDesc = "123";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String tenantName = System.getProperty("user.name");
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ ArrayList<Object> localParams = new ArrayList<>();
+
+ ArrayList<Object> resourceList = new ArrayList<>();
+
+ private static String rawScript = "echo 123";
+
+ private static String delayTime = "0";
+
+ private static String description = "";
+
+ private static String environmentCode = "-1";
+
+ private static String failRetryInterval = "1";
+
+ private static String failRetryTimes = "0";
+
+ private static String flag = "YES";
+
+ private static String taskDefinitionRequestDataName = "shell123";
+
+ private static String taskPriority = "MEDIUM";
+
+ private static String taskType = "SHELL";
+
+ private int timeout = 0;
+
+ private static String timeoutFlag = "CLOSE";
+
+ private static String timeoutNotifyStrategy = "";
+
+ private static String workerGroup = "default";
+
+ private static String taskRelationRequestDataName = "";
+
+ private int preTaskCode = 0;
+
+ private int preTaskVersion = 0;
+
+ private static String conditionType = "NONE";
+ private static String executionType = "PARALLEL";
+ HashMap<String, Object> conditionParams = new HashMap<>();
+ private String globalParams = "[]";
+
+ private static String startEndTime = "2022-06-25T16:00:00.000Z";
+
+ private static String scheduleTime = "2022-06-26 00:00:00,2022-06-26 00:00:00";
+
+ private static String failureStrategy = "CONTINUE";
+
+ private static String warningType = "NONE";
+
+ private static String warningGroupId = "";
+
+ private static String execType = "START_PROCESS";
+
+ private static String startNodeList = "";
+
+ private static String taskDependType = "TASK_POST";
+
+ private static String dependentMode = "OFF_MODE";
+
+ private static String runMode = "RUN_MODE_SERIAL";
+
+ private static String processInstancePriority = "MEDIUM";
+
+ private static String startParams = "";
+
+ private static String expectedParallelismNumber = "";
+
+ private static int dryRun = 0;
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ ProjectPage projectPage = new ProjectPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+ TenantPage tenantPage = new TenantPage();
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ projectPage.createProject(sessionId, projectName, projectDesc, user);
+ tenantPage.createTenant(sessionId, tenantName, 1, "");
+
+ }
+
+ @Test
+ @Order(1)
+ public void testCreateWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId, projectName);
+ HttpResponse res = flow.createWorkflow(sessionId, projectName, workFlowName, localParams, resourceList, rawScript, delayTime, description, environmentCode, failRetryInterval,
+ failRetryTimes, flag, taskDefinitionRequestDataName, taskPriority, taskType, timeout, timeoutFlag, timeoutNotifyStrategy, workerGroup, taskRelationRequestDataName, preTaskCode,
+ preTaskVersion, conditionType, conditionParams, executionType, globalParams);
+
+ logger.info("Create workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+ }
+
+ @Test
+ @Order(2)
+ public void testOnlineWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ HttpResponse res = flow.onLineWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Online workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+
+ }
+
+ @Test
+ @Order(3)
+ public void testQueryWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId, projectName);
+ HttpResponse res = flow.queryWorkflow(sessionId, projectName, workFlowName);
+
+ logger.info("Query workflow res:%s", res);
+ Assertions.assertTrue(res.body().success());
+ }
+
+ @Test
+ @Order(4)
+ public void testRunWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ HttpResponse res = flow.runWorkflow(sessionId, projectName, workFlowName, startEndTime, scheduleTime, failureStrategy, warningType,
+ warningGroupId, execType, startNodeList, taskDependType, dependentMode, runMode, processInstancePriority,
+ workerGroup, environmentCode, startParams, expectedParallelismNumber, dryRun);
+
+ logger.info("Run workflow res:%s", res);
Review Comment:
remove unnessnary log.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowShellAPITest.java:
##########
@@ -0,0 +1,211 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import org.apache.dolphinscheduler.api.test.Constants;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowInstancesPage;
+import org.apache.dolphinscheduler.api.test.pages.security.TenantPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import lombok.extern.slf4j.Slf4j;
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowShellAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case02_wen";
+
+ private static final String projectDesc = "123";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String tenantName = System.getProperty("user.name");
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ ArrayList<Object> localParams = new ArrayList<>();
+
+ ArrayList<Object> resourceList = new ArrayList<>();
+
+ private static String rawScript = "echo 123";
+
+ private static String delayTime = "0";
+
+ private static String description = "";
+
+ private static String environmentCode = "-1";
+
+ private static String failRetryInterval = "1";
+
+ private static String failRetryTimes = "0";
+
+ private static String flag = "YES";
+
+ private static String taskDefinitionRequestDataName = "shell123";
+
+ private static String taskPriority = "MEDIUM";
+
+ private static String taskType = "SHELL";
+
+ private int timeout = 0;
+
+ private static String timeoutFlag = "CLOSE";
+
+ private static String timeoutNotifyStrategy = "";
+
+ private static String workerGroup = "default";
+
+ private static String taskRelationRequestDataName = "";
+
+ private int preTaskCode = 0;
+
+ private int preTaskVersion = 0;
+
+ private static String conditionType = "NONE";
+ private static String executionType = "PARALLEL";
+ HashMap<String, Object> conditionParams = new HashMap<>();
+ private String globalParams = "[]";
+
+ private static String startEndTime = "2022-06-25T16:00:00.000Z";
+
+ private static String scheduleTime = "2022-06-26 00:00:00,2022-06-26 00:00:00";
+
+ private static String failureStrategy = "CONTINUE";
+
+ private static String warningType = "NONE";
+
+ private static String warningGroupId = "";
+
+ private static String execType = "START_PROCESS";
+
+ private static String startNodeList = "";
+
+ private static String taskDependType = "TASK_POST";
+
+ private static String dependentMode = "OFF_MODE";
+
+ private static String runMode = "RUN_MODE_SERIAL";
+
+ private static String processInstancePriority = "MEDIUM";
+
+ private static String startParams = "";
+
+ private static String expectedParallelismNumber = "";
+
+ private static int dryRun = 0;
+
+ @BeforeAll
+ public static void setup() {
+ LoginPage loginPage = new LoginPage();
+ ProjectPage projectPage = new ProjectPage();
+ HttpResponse loginHttpResponse = loginPage.login(user, password);
+ TenantPage tenantPage = new TenantPage();
+
+ sessionId = JSONUtils.convertValue(loginHttpResponse.body().data(), LoginResponseData.class).sessionId();
+ projectPage.createProject(sessionId, projectName, projectDesc, user);
+ tenantPage.createTenant(sessionId, tenantName, 1, "");
+
+ }
+
+ @Test
+ @Order(1)
+ public void testCreateWorkflow() {
+ WorkFlowDefinitionPage flow = new WorkFlowDefinitionPage();
+ flow.getGenNumId(sessionId, projectName);
+ HttpResponse res = flow.createWorkflow(sessionId, projectName, workFlowName, localParams, resourceList, rawScript, delayTime, description, environmentCode, failRetryInterval,
+ failRetryTimes, flag, taskDefinitionRequestDataName, taskPriority, taskType, timeout, timeoutFlag, timeoutNotifyStrategy, workerGroup, taskRelationRequestDataName, preTaskCode,
+ preTaskVersion, conditionType, conditionParams, executionType, globalParams);
+
+ logger.info("Create workflow res:%s", res);
Review Comment:
remove unnessnary log.
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowShellAPITest.java:
##########
@@ -0,0 +1,211 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import org.apache.dolphinscheduler.api.test.Constants;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowInstancesPage;
+import org.apache.dolphinscheduler.api.test.pages.security.TenantPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import lombok.extern.slf4j.Slf4j;
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowShellAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case02_wen";
+
+ private static final String projectDesc = "123";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String tenantName = System.getProperty("user.name");
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ ArrayList<Object> localParams = new ArrayList<>();
+
+ ArrayList<Object> resourceList = new ArrayList<>();
+
+ private static String rawScript = "echo 123";
+
+ private static String delayTime = "0";
+
+ private static String description = "";
+
+ private static String environmentCode = "-1";
+
+ private static String failRetryInterval = "1";
+
+ private static String failRetryTimes = "0";
+
+ private static String flag = "YES";
+
+ private static String taskDefinitionRequestDataName = "shell123";
+
+ private static String taskPriority = "MEDIUM";
+
+ private static String taskType = "SHELL";
+
+ private int timeout = 0;
+
+ private static String timeoutFlag = "CLOSE";
+
+ private static String timeoutNotifyStrategy = "";
+
+ private static String workerGroup = "default";
+
+ private static String taskRelationRequestDataName = "";
+
+ private int preTaskCode = 0;
+
+ private int preTaskVersion = 0;
+
+ private static String conditionType = "NONE";
+ private static String executionType = "PARALLEL";
Review Comment:
I think we should create corresponding enumeration types for enumeration values instead of using strings. But I'm not quite sure whether we should do this. PTAL @kezhenxu94
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/WorkFlowDefinitionPage.java:
##########
@@ -0,0 +1,207 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+import org.apache.dolphinscheduler.api.test.cases.TenantAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.TaskDefinitionRequestData;
+import org.apache.dolphinscheduler.api.test.entity.TaskParamsMap;
+import org.apache.dolphinscheduler.api.test.entity.TaskRelationRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowCreateRequestData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseData;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowResponseTotalList;
+import org.apache.dolphinscheduler.api.test.entity.WorkFlowRunRequestData;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public final class WorkFlowDefinitionPage {
+ private static String genNumId = null;
+ private static String workFlowCode = null;
+
+ private static final Logger logger = LoggerFactory.getLogger(WorkFlowDefinitionPage.class);
+
+ public void getGenNumId(String sessionId, String projectName) {
+
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("genNum", 1);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ RequestClient requestClient = new RequestClient();
+ HttpResponse res = requestClient.get("/projects/" + projectCode + "/task-definition/gen-task-codes", headers, params);
+ ArrayList list = (ArrayList) res.body().data();
+ genNumId = list.get(0).toString();
+
+ }
+
+ public HttpResponse createWorkflow(String sessionId, String projectName, String workFlowName, ArrayList<Object> localParams, ArrayList<Object> resourceList,
+ String rawScript, String delayTime, String description,
+ String environmentCode, String failRetryInterval, String failRetryTimes, String flag, String taskDefinitionRequestDataName, String taskPriority,
+ String taskType, Integer timeout, String timeoutFlag, String timeoutNotifyStrategy, String workerGroup, String taskRelationRequestDataName,
+ Integer preTaskCode, Integer preTaskVersion, String conditionType, HashMap<String, Object> conditionParams,
+ String executionType, String globalParams) {
+ Map<String, String> headers = new HashMap<>();
+ WorkFlowCreateRequestData workFlowCreateRequestData = new WorkFlowCreateRequestData();
+ TaskDefinitionRequestData taskDefinitionRequestData = new TaskDefinitionRequestData();
+ TaskRelationRequestData taskRelationRequestData = new TaskRelationRequestData();
+
+ TaskParamsMap taskParams = new TaskParamsMap();
+ taskParams.localParams(localParams);
+ taskParams.resourceList(resourceList);
+ taskParams.rawScript(rawScript);
+
+ taskDefinitionRequestData.code(genNumId);
+ taskDefinitionRequestData.delayTime(delayTime);
+ taskDefinitionRequestData.description(description);
+ taskDefinitionRequestData.environmentCode(environmentCode);
+ taskDefinitionRequestData.failRetryInterval(failRetryInterval);
+ taskDefinitionRequestData.failRetryTimes(failRetryTimes);
+ taskDefinitionRequestData.flag(flag);
+ taskDefinitionRequestData.name(taskDefinitionRequestDataName);
+ taskDefinitionRequestData.taskParams(taskParams);
+ taskDefinitionRequestData.taskPriority(taskPriority);
+ taskDefinitionRequestData.taskType(taskType);
+ taskDefinitionRequestData.timeout(timeout);
+ taskDefinitionRequestData.timeoutFlag(timeoutFlag);
+ taskDefinitionRequestData.timeoutNotifyStrategy(timeoutNotifyStrategy);
+ taskDefinitionRequestData.workerGroup(workerGroup);
+
+ ArrayList<Object> taskDefinitionRequestDataList = new ArrayList<>();
+ taskDefinitionRequestDataList.add(taskDefinitionRequestData);
+
+ taskRelationRequestData.name(taskRelationRequestDataName);
+ taskRelationRequestData.preTaskCode(preTaskCode);
+ taskRelationRequestData.preTaskVersion(preTaskVersion);
+ taskRelationRequestData.preTaskCode(preTaskCode);
+ taskRelationRequestData.postTaskCode(genNumId);
+ taskRelationRequestData.conditionType(conditionType);
+ taskRelationRequestData.conditionParams(conditionParams);
+ ArrayList<Object> taskRelationRequestDataList = new ArrayList<>();
+ taskRelationRequestDataList.add(taskRelationRequestData);
+
+ HashMap<String, Object> locations = new HashMap();
+ locations.put("taskCode", genNumId);
+ locations.put("x", 33.5);
+ locations.put("y", 38.5);
+ ArrayList<Object> locationsList = new ArrayList<>();
+ locationsList.add(locations);
+
+ workFlowCreateRequestData.locations(JSONUtils.toJsonString(locationsList));
+ workFlowCreateRequestData.taskDefinitionJson(JSONUtils.toJsonString(taskDefinitionRequestDataList));
+ workFlowCreateRequestData.taskRelationJson(JSONUtils.toJsonString(taskRelationRequestDataList));
+ workFlowCreateRequestData.name(workFlowName);
+ workFlowCreateRequestData.tenantCode(TenantAPITest.tenantName);
+ workFlowCreateRequestData.executionType(executionType);
+ workFlowCreateRequestData.description("");
+ workFlowCreateRequestData.globalParams(globalParams);
+ workFlowCreateRequestData.timeout(0);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+
+ HttpResponse res = requestClient.post("/projects/" + projectCode + "/process-definition", headers, JSONUtils.convertValue(workFlowCreateRequestData, Map.class));
+ return res;
+ }
+
+ public HttpResponse queryWorkflow(String sessionId, String projectName, String workFlowName) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize", 10);
+ params.put("pageNo", 1);
+ params.put("searchVal", workFlowName);
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+ HttpResponse res = requestClient.get("/projects/" + projectCode + "/process-definition", headers, params);
+
+ for (WorkFlowResponseTotalList workFlowList : JSONUtils.convertValue(res.body().data(), WorkFlowResponseData.class).totalList()) {
+ workFlowCode = workFlowList.code();
+ }
+
+ return res;
+ }
+
+ public HttpResponse onLineWorkflow(String sessionId, String projectName, String workFlowName) {
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.queryWorkflow(sessionId, projectName, workFlowName);
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("name", workFlowName);
+ params.put("releaseState", "ONLINE");
Review Comment:
It's better to take this parameter as the input parameter of the method, and the on and off lines are implemented in this method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] kezhenxu94 commented on a diff in pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r930557657
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/cases/WorkFlowShellAPITest.java:
##########
@@ -0,0 +1,211 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.cases;
+
+import org.apache.dolphinscheduler.api.test.Constants;
+import org.apache.dolphinscheduler.api.test.core.DolphinScheduler;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.LoginResponseData;
+import org.apache.dolphinscheduler.api.test.pages.LoginPage;
+import org.apache.dolphinscheduler.api.test.pages.project.ProjectPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowDefinitionPage;
+import org.apache.dolphinscheduler.api.test.pages.project.WorkFlowInstancesPage;
+import org.apache.dolphinscheduler.api.test.pages.security.TenantPage;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import lombok.extern.slf4j.Slf4j;
+
+@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
+@Slf4j
+public class WorkFlowShellAPITest {
+ private static final Logger logger = LoggerFactory.getLogger(ProjectAPITest.class);
+
+ private static final String projectName = "case02_wen";
+
+ private static final String projectDesc = "123";
+
+ private static final String workFlowName = "shell123";
+
+ private static final String tenantName = System.getProperty("user.name");
+
+ private static final String user = "admin";
+
+ private static final String password = "dolphinscheduler123";
+
+ private static String sessionId = null;
+
+ ArrayList<Object> localParams = new ArrayList<>();
+
+ ArrayList<Object> resourceList = new ArrayList<>();
+
+ private static String rawScript = "echo 123";
+
+ private static String delayTime = "0";
+
+ private static String description = "";
+
+ private static String environmentCode = "-1";
+
+ private static String failRetryInterval = "1";
+
+ private static String failRetryTimes = "0";
+
+ private static String flag = "YES";
+
+ private static String taskDefinitionRequestDataName = "shell123";
+
+ private static String taskPriority = "MEDIUM";
+
+ private static String taskType = "SHELL";
+
+ private int timeout = 0;
+
+ private static String timeoutFlag = "CLOSE";
+
+ private static String timeoutNotifyStrategy = "";
+
+ private static String workerGroup = "default";
+
+ private static String taskRelationRequestDataName = "";
+
+ private int preTaskCode = 0;
+
+ private int preTaskVersion = 0;
+
+ private static String conditionType = "NONE";
+ private static String executionType = "PARALLEL";
Review Comment:
> I think we should create corresponding enumeration types for enumeration values instead of using strings. But I'm not quite sure whether we should do this. PTAL @kezhenxu94
Agree.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1193319041
SonarCloud Quality Gate failed. [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10670)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL) [1 Code Smell](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10670&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_coverage&view=list) [2.2% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list) [1.7% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10670&metric=new_duplicated_lines_density&view=list)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] welsh-wen commented on a diff in pull request #10670: [Feature] [API-TEST] Project management basic test cases
Posted by GitBox <gi...@apache.org>.
welsh-wen commented on code in PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#discussion_r927363671
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/pages/project/TaskInstancePage.java:
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to 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. Apache Software Foundation (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.test.pages.project;
+
+
+import org.apache.dolphinscheduler.api.test.cases.ProjectAPITest;
+import org.apache.dolphinscheduler.api.test.core.Constants;
+import org.apache.dolphinscheduler.api.test.entity.HttpResponse;
+import org.apache.dolphinscheduler.api.test.entity.TaskInstanceResponseData;
+import org.apache.dolphinscheduler.api.test.entity.TaskInstanceResponseTotalList;
+import org.apache.dolphinscheduler.api.test.utils.JSONUtils;
+import org.apache.dolphinscheduler.api.test.utils.RequestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class TaskInstancePage {
+ private static final Logger logger = LoggerFactory.getLogger(TaskInstancePage.class);
+ private static String taskState = null;
+ private static Integer taskInstanceId = null;
+
+ public String queryTaskInstance(String sessionId, String projectName, String workFlowName){
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+ params.put("pageSize", 10);
+ params.put("pageNo", 1);
+ params.put("searchVal", "");
+ params.put("processInstanceId", "");
+ params.put("host", "");
+ params.put("stateType", "");
+ params.put("startDate", "");
+ params.put("endDate", "");
+ params.put("executorName", "");
+ params.put("processInstanceName", workFlowName);
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ ProjectPage project = new ProjectPage();
+ String projectCode = project.getProjectCode(sessionId, projectName);
+
+ WorkFlowDefinitionPage workflow = new WorkFlowDefinitionPage();
+ workflow.runWorkflow(sessionId, projectName, workFlowName);
+
+ HttpResponse res = requestClient.get("/projects/"+projectCode+"/task-instances", headers, params);
+
+
+ for (TaskInstanceResponseTotalList taskInstanceRes : JSONUtils.convertValue(res.body().data(), TaskInstanceResponseData.class).totalList()) {
+
+ taskState = taskInstanceRes.state();
+ taskInstanceId = taskInstanceRes.id();
+ }
+
+ return taskState;
+
+ }
+
+ public HttpResponse queryTaskInstanceLog(String sessionId, String projectName, String workFlowName){
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> headers = new HashMap<>();
+
+ headers.put(Constants.SESSION_ID_KEY, sessionId);
+ RequestClient requestClient = new RequestClient();
+ TaskInstancePage taskInstance = new TaskInstancePage();
+ taskInstance.queryTaskInstance(sessionId, projectName, workFlowName);
+
+ params.put("taskInstanceId", taskInstanceId);
+ params.put("limit", 1000);
+ params.put("skipLineNum", 0);
+
+ HttpResponse res = requestClient.get("/log/detail", headers, params);
+ String res_log = (String) res.body().data();
+
+ logger.info("查询实例log:%s", res_log);
Review Comment:
Thanks for the reminder, it has been fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature] [API-TEST] Project management basic test cases [dolphinscheduler]
Posted by "zhongjiajie (via GitHub)" <gi...@apache.org>.
zhongjiajie commented on PR #10670:
URL: https://github.com/apache/dolphinscheduler/pull/10670#issuecomment-1848264480
Close due to no response
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org