You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/08/16 03:41:11 UTC

[GitHub] [inlong] haifxu opened a new pull request, #5563: [INLONG-5562][Manager] Add the workflow API in the manager client

haifxu opened a new pull request, #5563:
URL: https://github.com/apache/inlong/pull/5563

   - Fixes #5562 
   
   ### Motivation
   
   Supplement the API that the manager web exists but the client does not exist for manager client.
   
   ### Modifications
   
   Add the workflow API in the manager client
   
   ### Verifying this change
   
   - [ ] This change added tests and can be verified as follows:
     - *org.apache.inlong.manager.client.api.inner.ClientFactoryTest#testWorkflowStart*
     - *org.apache.inlong.manager.client.api.inner.ClientFactoryTest#testListProcess*
   


-- 
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@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] haifxu commented on a diff in pull request #5563: [INLONG-5562][Manager] Add the workflow API in the manager client

Posted by GitBox <gi...@apache.org>.
haifxu commented on code in PR #5563:
URL: https://github.com/apache/inlong/pull/5563#discussion_r948576574


##########
inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/WorkflowApi.java:
##########
@@ -37,8 +40,29 @@ public interface WorkflowApi {
     @POST("workflow/approve/{taskId}")
     Call<Response<WorkflowResult>> startInlongGroup(@Path("taskId") Integer taskId, @Body Map<String, Object> request);
 
-    @GET("workflow/event/list")
-    Call<Response<PageInfo<EventLogResponse>>> getInlongGroupError(@Query("inlongGroupId") String groupId,
-            @Query("status") Integer status);
+    @POST("workflow/start")
+    Call<Response<WorkflowResult>> start(@Body WorkflowOperationRequest request);
+
+    @POST("workflow/cancel/{taskId}")
+    Call<Response<WorkflowResult>> cancel(@Path("processId") Integer processId, @Body WorkflowOperationRequest request);

Review Comment:
   Done



-- 
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@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] haifxu commented on a diff in pull request #5563: [INLONG-5562][Manager] Add the workflow API in the manager client

Posted by GitBox <gi...@apache.org>.
haifxu commented on code in PR #5563:
URL: https://github.com/apache/inlong/pull/5563#discussion_r947804370


##########
inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/InlongStreamApi.java:
##########
@@ -45,24 +45,24 @@ public interface InlongStreamApi {
     Call<Response<InlongStreamInfo>> getStream(@Query("groupId") String groupId,
             @Query("streamId") String streamId);
 
-    @POST("/stream/list")
+    @POST("stream/list")
     Call<Response<PageInfo<InlongStreamBriefInfo>>> listByCondition(@Body InlongStreamPageRequest request);
 
     @POST("stream/listAll")
     Call<Response<PageInfo<InlongStreamInfo>>> listStream(@Body InlongStreamPageRequest request);
 
-    @POST("/stream/startProcess/{groupId}/{streamId}")

Review Comment:
   OK , I have reset and then fix it in next PR.



-- 
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@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] haifxu commented on a diff in pull request #5563: [INLONG-5562][Manager] Add the workflow API in the manager client

Posted by GitBox <gi...@apache.org>.
haifxu commented on code in PR #5563:
URL: https://github.com/apache/inlong/pull/5563#discussion_r946405374


##########
inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/WorkflowApi.java:
##########
@@ -37,8 +43,29 @@ public interface WorkflowApi {
     @POST("workflow/approve/{taskId}")
     Call<Response<WorkflowResult>> startInlongGroup(@Path("taskId") Integer taskId, @Body Map<String, Object> request);
 
-    @GET("workflow/event/list")
-    Call<Response<PageInfo<EventLogResponse>>> getInlongGroupError(@Query("inlongGroupId") String groupId,
-            @Query("status") Integer status);
+    @POST("workflow/start")
+    Call<Response<WorkflowResult>> start(@Body WorkflowOperationRequest request);
+
+    @POST("workflow/cancel/{taskId}")
+    Call<Response<WorkflowResult>> cancel(@Path("processId") Integer processId, @Body WorkflowOperationRequest request);
+
+    @POST("workflow/continue/{taskId}")
+    Call<Response<WorkflowResult>> continueProcess(@Path("processId") Integer processId,
+            @Body WorkflowOperationRequest request);
+
+    @POST("workflow/reject/{taskId}")
+    Call<Response<WorkflowResult>> reject(@Path("taskId") Integer taskId, @Body WorkflowOperationRequest request);
+
+    @POST("workflow/complete/{taskId}")
+    Call<Response<WorkflowResult>> complete(@Path("taskId") Integer taskId, @Body WorkflowOperationRequest request);
+
+    @GET("workflow/detail/{id}")
+    Call<Response<ProcessDetailResponse>> detail(@Path("processId") Integer processId, @Query("taskId") Integer taskId);
+
+    @GET("workflow/listProcess")

Review Comment:
   Yeah, the [user API](https://github.com/apache/inlong/pull/5494/files) has the same problem, I will fix it later.



-- 
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@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] haifxu commented on a diff in pull request #5563: [INLONG-5562][Manager] Add the workflow API in the manager client

Posted by GitBox <gi...@apache.org>.
haifxu commented on code in PR #5563:
URL: https://github.com/apache/inlong/pull/5563#discussion_r947801115


##########
inlong-manager/manager-client/src/test/java/org/apache/inlong/manager/client/api/inner/WorkflowClientTest.java:
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.manager.client.api.inner;
+
+import com.github.pagehelper.PageInfo;
+import com.google.common.collect.Lists;
+import org.apache.inlong.manager.client.api.inner.client.WorkflowClient;
+import org.apache.inlong.manager.common.enums.ProcessName;
+import org.apache.inlong.manager.common.util.JsonUtils;
+import org.apache.inlong.manager.pojo.common.Response;
+import org.apache.inlong.manager.pojo.group.pulsar.InlongPulsarInfo;
+import org.apache.inlong.manager.pojo.workflow.ProcessRequest;
+import org.apache.inlong.manager.pojo.workflow.ProcessResponse;
+import org.apache.inlong.manager.pojo.workflow.WorkflowOperationRequest;
+import org.apache.inlong.manager.pojo.workflow.WorkflowResult;
+import org.apache.inlong.manager.pojo.workflow.form.process.ApplyGroupProcessForm;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+
+public class WorkflowClientTest extends ClientFactoryTest {
+
+    private static final WorkflowClient workflowClient = clientFactory.getWorkflowClient();
+
+    @Test
+    void testWorkflowStart() {
+        WorkflowResult workflowResult = WorkflowResult.builder()
+                .processInfo(ProcessResponse.builder()
+                        .id(1)
+                        .name(ProcessName.APPLY_GROUP_PROCESS.getDisplayName())
+                        .applicant("test_user").build())
+                .build();
+
+        stubFor(
+                post(urlMatching("/inlong/manager/api/workflow/start.*"))
+                        .willReturn(
+                                okJson(JsonUtils.toJsonString(
+                                        Response.success(workflowResult))
+                                )
+                        )
+        );
+        WorkflowOperationRequest request = new WorkflowOperationRequest();
+        request.setName(ProcessName.APPLY_GROUP_PROCESS);
+        request.setApplicant("test_user");
+        ApplyGroupProcessForm form = new ApplyGroupProcessForm();
+        form.setGroupInfo(new InlongPulsarInfo());
+        request.setForm(form);
+
+        WorkflowResult workflowInfo = workflowClient.start(request);

Review Comment:
   Done



-- 
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@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] leosanqing commented on a diff in pull request #5563: [INLONG-5562][Manager] Add the workflow API in the manager client

Posted by GitBox <gi...@apache.org>.
leosanqing commented on code in PR #5563:
URL: https://github.com/apache/inlong/pull/5563#discussion_r947888183


##########
inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/WorkflowApi.java:
##########
@@ -37,8 +40,29 @@ public interface WorkflowApi {
     @POST("workflow/approve/{taskId}")
     Call<Response<WorkflowResult>> startInlongGroup(@Path("taskId") Integer taskId, @Body Map<String, Object> request);
 
-    @GET("workflow/event/list")
-    Call<Response<PageInfo<EventLogResponse>>> getInlongGroupError(@Query("inlongGroupId") String groupId,
-            @Query("status") Integer status);
+    @POST("workflow/start")
+    Call<Response<WorkflowResult>> start(@Body WorkflowOperationRequest request);
+
+    @POST("workflow/cancel/{taskId}")
+    Call<Response<WorkflowResult>> cancel(@Path("processId") Integer processId, @Body WorkflowOperationRequest request);

Review Comment:
   Is this "taskId"?



-- 
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@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] leosanqing commented on a diff in pull request #5563: [INLONG-5562][Manager] Add the workflow API in the manager client

Posted by GitBox <gi...@apache.org>.
leosanqing commented on code in PR #5563:
URL: https://github.com/apache/inlong/pull/5563#discussion_r946384155


##########
inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/WorkflowApi.java:
##########
@@ -37,8 +43,29 @@ public interface WorkflowApi {
     @POST("workflow/approve/{taskId}")
     Call<Response<WorkflowResult>> startInlongGroup(@Path("taskId") Integer taskId, @Body Map<String, Object> request);
 
-    @GET("workflow/event/list")
-    Call<Response<PageInfo<EventLogResponse>>> getInlongGroupError(@Query("inlongGroupId") String groupId,
-            @Query("status") Integer status);
+    @POST("workflow/start")
+    Call<Response<WorkflowResult>> start(@Body WorkflowOperationRequest request);
+
+    @POST("workflow/cancel/{taskId}")
+    Call<Response<WorkflowResult>> cancel(@Path("processId") Integer processId, @Body WorkflowOperationRequest request);
+
+    @POST("workflow/continue/{taskId}")
+    Call<Response<WorkflowResult>> continueProcess(@Path("processId") Integer processId,
+            @Body WorkflowOperationRequest request);
+
+    @POST("workflow/reject/{taskId}")
+    Call<Response<WorkflowResult>> reject(@Path("taskId") Integer taskId, @Body WorkflowOperationRequest request);
+
+    @POST("workflow/complete/{taskId}")
+    Call<Response<WorkflowResult>> complete(@Path("taskId") Integer taskId, @Body WorkflowOperationRequest request);
+
+    @GET("workflow/detail/{id}")
+    Call<Response<ProcessDetailResponse>> detail(@Path("processId") Integer processId, @Query("taskId") Integer taskId);
+
+    @GET("workflow/listProcess")

Review Comment:
   
   I remember Get doesn't use objects, please confirm. If not, you need to use Map to receive QueryParam
   
   You can refer this ISSUE https://github.com/square/retrofit/issues/2293#issuecomment-683286832
   
   https://github.com/square/retrofit/issues/2293#issuecomment-683286832



-- 
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@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] dockerzhang merged pull request #5563: [INLONG-5562][Manager] Add the workflow API in the manager client

Posted by GitBox <gi...@apache.org>.
dockerzhang merged PR #5563:
URL: https://github.com/apache/inlong/pull/5563


-- 
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@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] leosanqing commented on a diff in pull request #5563: [INLONG-5562][Manager] Add the workflow API in the manager client

Posted by GitBox <gi...@apache.org>.
leosanqing commented on code in PR #5563:
URL: https://github.com/apache/inlong/pull/5563#discussion_r947410151


##########
inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/InlongStreamApi.java:
##########
@@ -45,24 +45,24 @@ public interface InlongStreamApi {
     Call<Response<InlongStreamInfo>> getStream(@Query("groupId") String groupId,
             @Query("streamId") String streamId);
 
-    @POST("/stream/list")
+    @POST("stream/list")
     Call<Response<PageInfo<InlongStreamBriefInfo>>> listByCondition(@Body InlongStreamPageRequest request);
 
     @POST("stream/listAll")
     Call<Response<PageInfo<InlongStreamInfo>>> listStream(@Body InlongStreamPageRequest request);
 
-    @POST("/stream/startProcess/{groupId}/{streamId}")

Review Comment:
   These have nothing to do with this ISSUE, mention ISSUE and PR separately



##########
inlong-manager/manager-client/src/test/java/org/apache/inlong/manager/client/api/inner/WorkflowClientTest.java:
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.manager.client.api.inner;
+
+import com.github.pagehelper.PageInfo;
+import com.google.common.collect.Lists;
+import org.apache.inlong.manager.client.api.inner.client.WorkflowClient;
+import org.apache.inlong.manager.common.enums.ProcessName;
+import org.apache.inlong.manager.common.util.JsonUtils;
+import org.apache.inlong.manager.pojo.common.Response;
+import org.apache.inlong.manager.pojo.group.pulsar.InlongPulsarInfo;
+import org.apache.inlong.manager.pojo.workflow.ProcessRequest;
+import org.apache.inlong.manager.pojo.workflow.ProcessResponse;
+import org.apache.inlong.manager.pojo.workflow.WorkflowOperationRequest;
+import org.apache.inlong.manager.pojo.workflow.WorkflowResult;
+import org.apache.inlong.manager.pojo.workflow.form.process.ApplyGroupProcessForm;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+
+public class WorkflowClientTest extends ClientFactoryTest {
+
+    private static final WorkflowClient workflowClient = clientFactory.getWorkflowClient();
+
+    @Test
+    void testWorkflowStart() {
+        WorkflowResult workflowResult = WorkflowResult.builder()
+                .processInfo(ProcessResponse.builder()
+                        .id(1)
+                        .name(ProcessName.APPLY_GROUP_PROCESS.getDisplayName())
+                        .applicant("test_user").build())
+                .build();
+
+        stubFor(
+                post(urlMatching("/inlong/manager/api/workflow/start.*"))
+                        .willReturn(
+                                okJson(JsonUtils.toJsonString(
+                                        Response.success(workflowResult))
+                                )
+                        )
+        );
+        WorkflowOperationRequest request = new WorkflowOperationRequest();
+        request.setName(ProcessName.APPLY_GROUP_PROCESS);
+        request.setApplicant("test_user");
+        ApplyGroupProcessForm form = new ApplyGroupProcessForm();
+        form.setGroupInfo(new InlongPulsarInfo());
+        request.setForm(form);
+
+        WorkflowResult workflowInfo = workflowClient.start(request);

Review Comment:
   The order of the two is reversed, the first should be the expected value and the second is the actual value



-- 
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@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org