You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by do...@apache.org on 2022/03/22 09:47:39 UTC

[incubator-inlong] branch master updated: [INLONG-3294][Manager] Fix protocol of client and manager is inconsistent (#3296)

This is an automated email from the ASF dual-hosted git repository.

dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new 6de03ee  [INLONG-3294][Manager] Fix protocol of client and manager is inconsistent (#3296)
6de03ee is described below

commit 6de03eeea1599a63d9f83b9bcb7204444447d97c
Author: pacino <ge...@gmail.com>
AuthorDate: Tue Mar 22 17:47:35 2022 +0800

    [INLONG-3294][Manager] Fix protocol of client and manager is inconsistent (#3296)
---
 .../client/api/inner/InnerInlongManagerClient.java |  9 ++++-
 .../api/impl/InnerInlongManagerClientTest.java     | 44 ++++++++++++++++++++++
 2 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/InnerInlongManagerClient.java b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/InnerInlongManagerClient.java
index b0af77d..7879686 100644
--- a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/InnerInlongManagerClient.java
+++ b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/InnerInlongManagerClient.java
@@ -51,6 +51,7 @@ import org.apache.inlong.manager.common.pojo.stream.FullStreamResponse;
 import org.apache.inlong.manager.common.pojo.stream.InlongStreamApproveRequest;
 import org.apache.inlong.manager.common.pojo.stream.InlongStreamConfigLogListResponse;
 import org.apache.inlong.manager.common.pojo.stream.InlongStreamInfo;
+import org.apache.inlong.manager.common.pojo.stream.InlongStreamPageRequest;
 import org.apache.inlong.manager.common.pojo.workflow.EventLogView;
 import org.apache.inlong.manager.common.pojo.workflow.WorkflowResult;
 import org.apache.inlong.manager.common.util.JsonUtils;
@@ -350,9 +351,13 @@ public class InnerInlongManagerClient {
     public List<FullStreamResponse> listStreamInfo(String inlongGroupId) {
         final String path = HTTP_PATH + "/stream/listAll";
         String url = formatUrl(path);
-        url = url + "&inlongGroupId=" + inlongGroupId;
-        Request request = new Request.Builder().get()
+        InlongStreamPageRequest inlongStreamPageRequest = new InlongStreamPageRequest();
+        inlongStreamPageRequest.setInlongGroupId(inlongGroupId);
+        final String source = GsonUtil.toJson(inlongStreamPageRequest);
+        final RequestBody sourceBody = RequestBody.create(MediaType.parse("application/json"), source);
+        Request request = new Request.Builder()
                 .url(url)
+                .post(sourceBody)
                 .build();
 
         Call call = httpClient.newCall(request);
diff --git a/inlong-manager/manager-client/src/test/java/org/apache/inlong/manager/client/api/impl/InnerInlongManagerClientTest.java b/inlong-manager/manager-client/src/test/java/org/apache/inlong/manager/client/api/impl/InnerInlongManagerClientTest.java
new file mode 100644
index 0000000..d62c67c
--- /dev/null
+++ b/inlong-manager/manager-client/src/test/java/org/apache/inlong/manager/client/api/impl/InnerInlongManagerClientTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.impl;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.inlong.manager.client.api.ClientConfiguration;
+import org.apache.inlong.manager.client.api.auth.DefaultAuthentication;
+import org.apache.inlong.manager.client.api.inner.InnerInlongManagerClient;
+import org.apache.inlong.manager.common.pojo.stream.FullStreamResponse;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.List;
+
+@Slf4j
+public class InnerInlongManagerClientTest {
+
+    @Test(expected = RuntimeException.class)
+    public void testListStreamInfo() {
+        String serviceUrl = "127.0.0.1:8083";
+        ClientConfiguration configuration = new ClientConfiguration();
+        configuration.setAuthentication(new DefaultAuthentication("admin", "inlong"));
+        InlongClientImpl inlongClient = new InlongClientImpl(serviceUrl, configuration);
+        InnerInlongManagerClient innerInlongManagerClient = new InnerInlongManagerClient(inlongClient);
+        List<FullStreamResponse> fullStreamResponseList = innerInlongManagerClient.listStreamInfo("test");
+        Assert.assertNull(fullStreamResponseList);
+    }
+
+}