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/03/30 08:08:59 UTC

[GitHub] [incubator-inlong] kipshi opened a new pull request #3469: [INLONG-3462] Add Manager Client Test modules

kipshi opened a new pull request #3469:
URL: https://github.com/apache/incubator-inlong/pull/3469


   ### Title Name: [INLONG-3462] Add Manager Client Test modules
   
   where *XYZ* should be replaced by the actual issue number.
   
   Fixes #3462 
   
   ### Motivation
   
   ### Modifications
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Documentation
   
     - Does this pull request introduce a new feature? (yes / no)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
     - If a feature is not applicable for documentation, explain why?
     - If a feature is not documented yet in this PR, please create a followup issue for adding the documentation
   


-- 
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] [incubator-inlong] healchow commented on a change in pull request #3469: [INLONG-3462] Add Manager Client Test modules

Posted by GitBox <gi...@apache.org>.
healchow commented on a change in pull request #3469:
URL: https://github.com/apache/incubator-inlong/pull/3469#discussion_r838243716



##########
File path: pom.xml
##########
@@ -100,6 +100,7 @@
         <module>inlong-sort-standalone</module>
         <module>inlong-dashboard</module>
         <module>inlong-distribution</module>
+        <module>manager-client-test</module>

Review comment:
       No need to add an inner module to the parent pom file.




-- 
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] [incubator-inlong] kipshi commented on a change in pull request #3469: [INLONG-3462] Add Manager Client Test modules

Posted by GitBox <gi...@apache.org>.
kipshi commented on a change in pull request #3469:
URL: https://github.com/apache/incubator-inlong/pull/3469#discussion_r838259455



##########
File path: pom.xml
##########
@@ -100,6 +100,7 @@
         <module>inlong-sort-standalone</module>
         <module>inlong-dashboard</module>
         <module>inlong-distribution</module>
+        <module>manager-client-test</module>

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] [incubator-inlong] healchow merged pull request #3469: [INLONG-3462][Manager] Add test module for manager client

Posted by GitBox <gi...@apache.org>.
healchow merged pull request #3469:
URL: https://github.com/apache/incubator-inlong/pull/3469


   


-- 
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] [incubator-inlong] kipshi commented on a change in pull request #3469: [INLONG-3462] Add Manager Client Test modules

Posted by GitBox <gi...@apache.org>.
kipshi commented on a change in pull request #3469:
URL: https://github.com/apache/incubator-inlong/pull/3469#discussion_r838260775



##########
File path: inlong-manager/manager-client-test/src/test/java/org/apache/inlong/manager/client/Binlog2KafkaTest.java
##########
@@ -0,0 +1,211 @@
+/*
+ * 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;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.inlong.manager.client.api.ClientConfiguration;
+import org.apache.inlong.manager.client.api.DataFormat;
+import org.apache.inlong.manager.client.api.DataSeparator;
+import org.apache.inlong.manager.client.api.FlinkSortBaseConf;
+import org.apache.inlong.manager.client.api.InlongClient;
+import org.apache.inlong.manager.client.api.InlongGroup;
+import org.apache.inlong.manager.client.api.InlongGroupConf;
+import org.apache.inlong.manager.client.api.InlongGroupContext;
+import org.apache.inlong.manager.client.api.InlongStreamBuilder;
+import org.apache.inlong.manager.client.api.InlongStreamConf;
+import org.apache.inlong.manager.client.api.PulsarBaseConf;
+import org.apache.inlong.manager.client.api.auth.DefaultAuthentication;
+import org.apache.inlong.manager.client.api.sink.KafkaSink;
+import org.apache.inlong.manager.client.api.source.MySQLBinlogSource;
+import org.apache.inlong.manager.common.enums.MQType;
+import org.junit.Test;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+@Slf4j
+public class Binlog2KafkaTest {
+
+    // Manager web url
+    public static String SERVICE_URL = "127.0.0.1:8083";
+    // Inlong user && passwd
+    public static DefaultAuthentication INLONG_AUTH = new DefaultAuthentication("admin", "inlong");
+    // Inlong group name
+    public static String GROUP_NAME = "{group.name}";
+    // Inlong stream name
+    public static String STREAM_NAME = "{stream.name}";
+    // Flink cluster url
+    public static String FLINK_URL = "{flink.cluster.url}";
+    // Pulsar cluster admin url
+    public static String PULSAR_ADMIN_URL = "{pulsar.admin.url}";
+    // Pulsar cluster service url
+    public static String PULSAR_SERVICE_URL = "{pulsar.service.url}";
+    // Pulsar tenant
+    public static String tenant = "{pulsar.tenant}";
+    // Pulsar topic
+    public static String topic = "{pulsar.topic}";
+
+    @Test
+    public void testCreateGroupForKafka() throws Exception {
+        ClientConfiguration configuration = new ClientConfiguration();
+        configuration.setWriteTimeout(10);
+        configuration.setReadTimeout(10);
+        configuration.setConnectTimeout(10);
+        configuration.setTimeUnit(TimeUnit.SECONDS);
+        configuration.setAuthentication(INLONG_AUTH);
+        InlongClient inlongClient = InlongClient.create(SERVICE_URL, configuration);
+        InlongGroupConf groupConf = createGroupConf();
+        try {
+            InlongGroup group = inlongClient.forGroup(groupConf);
+            InlongStreamConf streamConf = createStreamConf();
+            InlongStreamBuilder streamBuilder = group.createStream(streamConf);
+            streamBuilder.source(createMysqlSource());
+            streamBuilder.sink(createKafkaSink());
+            streamBuilder.initOrUpdate();
+            // start group
+            InlongGroupContext inlongGroupContext = group.init();
+            log.info("{}", inlongGroupContext);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testStopGroup() {
+        ClientConfiguration configuration = new ClientConfiguration();
+        configuration.setWriteTimeout(10);
+        configuration.setReadTimeout(10);
+        configuration.setConnectTimeout(10);
+        configuration.setTimeUnit(TimeUnit.SECONDS);
+        configuration.setAuthentication(INLONG_AUTH);
+        InlongClient inlongClient = InlongClient.create(SERVICE_URL, configuration);
+        InlongGroupConf groupConf = createGroupConf();
+        try {
+            InlongGroup group = inlongClient.forGroup(groupConf);
+            InlongGroupContext groupContext = group.delete(true);
+            log.info("{}", groupContext);

Review comment:
       It is unit case for users to infer, not need to Assert

##########
File path: inlong-manager/manager-client-test/src/test/java/org/apache/inlong/manager/client/Binlog2KafkaTest.java
##########
@@ -0,0 +1,211 @@
+/*
+ * 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;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.inlong.manager.client.api.ClientConfiguration;
+import org.apache.inlong.manager.client.api.DataFormat;
+import org.apache.inlong.manager.client.api.DataSeparator;
+import org.apache.inlong.manager.client.api.FlinkSortBaseConf;
+import org.apache.inlong.manager.client.api.InlongClient;
+import org.apache.inlong.manager.client.api.InlongGroup;
+import org.apache.inlong.manager.client.api.InlongGroupConf;
+import org.apache.inlong.manager.client.api.InlongGroupContext;
+import org.apache.inlong.manager.client.api.InlongStreamBuilder;
+import org.apache.inlong.manager.client.api.InlongStreamConf;
+import org.apache.inlong.manager.client.api.PulsarBaseConf;
+import org.apache.inlong.manager.client.api.auth.DefaultAuthentication;
+import org.apache.inlong.manager.client.api.sink.KafkaSink;
+import org.apache.inlong.manager.client.api.source.MySQLBinlogSource;
+import org.apache.inlong.manager.common.enums.MQType;
+import org.junit.Test;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+@Slf4j
+public class Binlog2KafkaTest {
+
+    // Manager web url
+    public static String SERVICE_URL = "127.0.0.1:8083";
+    // Inlong user && passwd
+    public static DefaultAuthentication INLONG_AUTH = new DefaultAuthentication("admin", "inlong");
+    // Inlong group name
+    public static String GROUP_NAME = "{group.name}";
+    // Inlong stream name
+    public static String STREAM_NAME = "{stream.name}";
+    // Flink cluster url
+    public static String FLINK_URL = "{flink.cluster.url}";
+    // Pulsar cluster admin url
+    public static String PULSAR_ADMIN_URL = "{pulsar.admin.url}";
+    // Pulsar cluster service url
+    public static String PULSAR_SERVICE_URL = "{pulsar.service.url}";
+    // Pulsar tenant
+    public static String tenant = "{pulsar.tenant}";
+    // Pulsar topic
+    public static String topic = "{pulsar.topic}";
+
+    @Test
+    public void testCreateGroupForKafka() throws Exception {
+        ClientConfiguration configuration = new ClientConfiguration();
+        configuration.setWriteTimeout(10);
+        configuration.setReadTimeout(10);
+        configuration.setConnectTimeout(10);
+        configuration.setTimeUnit(TimeUnit.SECONDS);
+        configuration.setAuthentication(INLONG_AUTH);
+        InlongClient inlongClient = InlongClient.create(SERVICE_URL, configuration);
+        InlongGroupConf groupConf = createGroupConf();
+        try {
+            InlongGroup group = inlongClient.forGroup(groupConf);
+            InlongStreamConf streamConf = createStreamConf();
+            InlongStreamBuilder streamBuilder = group.createStream(streamConf);
+            streamBuilder.source(createMysqlSource());
+            streamBuilder.sink(createKafkaSink());
+            streamBuilder.initOrUpdate();
+            // start group
+            InlongGroupContext inlongGroupContext = group.init();
+            log.info("{}", inlongGroupContext);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testStopGroup() {
+        ClientConfiguration configuration = new ClientConfiguration();
+        configuration.setWriteTimeout(10);
+        configuration.setReadTimeout(10);
+        configuration.setConnectTimeout(10);
+        configuration.setTimeUnit(TimeUnit.SECONDS);
+        configuration.setAuthentication(INLONG_AUTH);
+        InlongClient inlongClient = InlongClient.create(SERVICE_URL, configuration);
+        InlongGroupConf groupConf = createGroupConf();
+        try {
+            InlongGroup group = inlongClient.forGroup(groupConf);
+            InlongGroupContext groupContext = group.delete(true);
+            log.info("{}", groupContext);

Review comment:
       It is unit case for users to infer, not need to Assert




-- 
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] [incubator-inlong] healchow commented on a change in pull request #3469: [INLONG-3462] Add Manager Client Test modules

Posted by GitBox <gi...@apache.org>.
healchow commented on a change in pull request #3469:
URL: https://github.com/apache/incubator-inlong/pull/3469#discussion_r838258048



##########
File path: inlong-manager/manager-client-test/src/test/java/org/apache/inlong/manager/client/Binlog2KafkaTest.java
##########
@@ -0,0 +1,211 @@
+/*
+ * 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;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.inlong.manager.client.api.ClientConfiguration;
+import org.apache.inlong.manager.client.api.DataFormat;
+import org.apache.inlong.manager.client.api.DataSeparator;
+import org.apache.inlong.manager.client.api.FlinkSortBaseConf;
+import org.apache.inlong.manager.client.api.InlongClient;
+import org.apache.inlong.manager.client.api.InlongGroup;
+import org.apache.inlong.manager.client.api.InlongGroupConf;
+import org.apache.inlong.manager.client.api.InlongGroupContext;
+import org.apache.inlong.manager.client.api.InlongStreamBuilder;
+import org.apache.inlong.manager.client.api.InlongStreamConf;
+import org.apache.inlong.manager.client.api.PulsarBaseConf;
+import org.apache.inlong.manager.client.api.auth.DefaultAuthentication;
+import org.apache.inlong.manager.client.api.sink.KafkaSink;
+import org.apache.inlong.manager.client.api.source.MySQLBinlogSource;
+import org.apache.inlong.manager.common.enums.MQType;
+import org.junit.Test;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+@Slf4j
+public class Binlog2KafkaTest {
+
+    // Manager web url
+    public static String SERVICE_URL = "127.0.0.1:8083";
+    // Inlong user && passwd
+    public static DefaultAuthentication INLONG_AUTH = new DefaultAuthentication("admin", "inlong");
+    // Inlong group name
+    public static String GROUP_NAME = "{group.name}";
+    // Inlong stream name
+    public static String STREAM_NAME = "{stream.name}";
+    // Flink cluster url
+    public static String FLINK_URL = "{flink.cluster.url}";
+    // Pulsar cluster admin url
+    public static String PULSAR_ADMIN_URL = "{pulsar.admin.url}";
+    // Pulsar cluster service url
+    public static String PULSAR_SERVICE_URL = "{pulsar.service.url}";
+    // Pulsar tenant
+    public static String tenant = "{pulsar.tenant}";
+    // Pulsar topic
+    public static String topic = "{pulsar.topic}";
+
+    @Test
+    public void testCreateGroupForKafka() throws Exception {
+        ClientConfiguration configuration = new ClientConfiguration();
+        configuration.setWriteTimeout(10);
+        configuration.setReadTimeout(10);
+        configuration.setConnectTimeout(10);
+        configuration.setTimeUnit(TimeUnit.SECONDS);
+        configuration.setAuthentication(INLONG_AUTH);
+        InlongClient inlongClient = InlongClient.create(SERVICE_URL, configuration);
+        InlongGroupConf groupConf = createGroupConf();
+        try {
+            InlongGroup group = inlongClient.forGroup(groupConf);
+            InlongStreamConf streamConf = createStreamConf();
+            InlongStreamBuilder streamBuilder = group.createStream(streamConf);
+            streamBuilder.source(createMysqlSource());
+            streamBuilder.sink(createKafkaSink());
+            streamBuilder.initOrUpdate();
+            // start group
+            InlongGroupContext inlongGroupContext = group.init();
+            log.info("{}", inlongGroupContext);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testStopGroup() {
+        ClientConfiguration configuration = new ClientConfiguration();
+        configuration.setWriteTimeout(10);
+        configuration.setReadTimeout(10);
+        configuration.setConnectTimeout(10);
+        configuration.setTimeUnit(TimeUnit.SECONDS);
+        configuration.setAuthentication(INLONG_AUTH);
+        InlongClient inlongClient = InlongClient.create(SERVICE_URL, configuration);
+        InlongGroupConf groupConf = createGroupConf();
+        try {
+            InlongGroup group = inlongClient.forGroup(groupConf);
+            InlongGroupContext groupContext = group.delete(true);
+            log.info("{}", groupContext);

Review comment:
       It is recommended to use `Assert` to determine whether a method succeeded, rather than printing to a file or console.




-- 
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