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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to