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/06/07 02:13:01 UTC

[GitHub] [incubator-inlong] kipshi commented on a diff in pull request #4539: [INLONG-4534][Manager] Add complete create data flow task unit test

kipshi commented on code in PR #4539:
URL: https://github.com/apache/incubator-inlong/pull/4539#discussion_r890704735


##########
inlong-manager/manager-client-examples/src/test/java/org/apache/inlong/manager/client/ut/BaseTest.java:
##########
@@ -0,0 +1,170 @@
+/*
+ * 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.ut;
+
+import com.github.tomakehurst.wiremock.WireMockServer;
+import com.github.tomakehurst.wiremock.client.WireMock;
+import com.google.common.collect.Lists;
+import org.apache.inlong.manager.client.api.ClientConfiguration;
+import org.apache.inlong.manager.client.api.InlongClient;
+import org.apache.inlong.manager.common.auth.DefaultAuthentication;
+import org.apache.inlong.manager.common.enums.DataSeparator;
+import org.apache.inlong.manager.common.enums.FieldType;
+import org.apache.inlong.manager.common.enums.FileFormat;
+import org.apache.inlong.manager.common.enums.GlobalConstants;
+import org.apache.inlong.manager.common.pojo.group.InlongGroupInfo;
+import org.apache.inlong.manager.common.pojo.group.pulsar.InlongPulsarInfo;
+import org.apache.inlong.manager.common.pojo.sink.SinkField;
+import org.apache.inlong.manager.common.pojo.sink.hive.HiveSink;
+import org.apache.inlong.manager.common.pojo.sort.FlinkSortConf;
+import org.apache.inlong.manager.common.pojo.stream.InlongStreamInfo;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
+
+public class BaseTest {
+
+    // Manager web url
+    public static final String SERVICE_URL = "127.0.0.1:8084";
+    // Inlong user && passwd
+    public static DefaultAuthentication inlongAuth = new DefaultAuthentication("admin", "inlong");
+    // Inlong group ID
+    public static final String GROUP_ID = "test_group009";
+    // Inlong stream ID
+    public static final String STREAM_ID = "test_stream009";
+    // Flink cluster url
+    public static final String FLINK_URL = "127.0.0.1";
+    // Pulsar cluster admin url
+    public static final String PULSAR_ADMIN_URL = "127.0.0.1";
+    // Pulsar cluster service url
+    public static final String PULSAR_SERVICE_URL = "127.0.0.1";
+    // Pulsar tenant
+    public static final String TENANT = "tenant";
+    // Pulsar tenant
+    public static final String NAMESPACE = "test_namespace";
+    // Pulsar topic
+    public static final String TOPIC = "test_topic";
+    public static final String IN_CHARGES = "test_inCharges,admin";
+
+    public static WireMockServer wireMockServer;
+    public static final String MANAGER_URL_PREFIX = "/api/inlong/manager";
+
+    public static InlongGroupInfo groupInfo;
+    public static InlongClient inlongClient;
+
+    /**
+     * Create inlong group info
+     */
+    public static InlongGroupInfo createGroupInfo() {
+        InlongPulsarInfo pulsarInfo = new InlongPulsarInfo();
+        pulsarInfo.setInlongGroupId(GROUP_ID);
+        pulsarInfo.setInCharges(IN_CHARGES);
+
+        // pulsar conf
+        pulsarInfo.setServiceUrl(PULSAR_SERVICE_URL);
+        pulsarInfo.setAdminUrl(PULSAR_ADMIN_URL);
+        pulsarInfo.setTenant(TENANT);
+        pulsarInfo.setMqResource(NAMESPACE);
+
+        // set enable zk, create resource, lightweight mode, and cluster tag
+        pulsarInfo.setEnableZookeeper(0);
+        pulsarInfo.setEnableCreateResource(1);
+        pulsarInfo.setLightweight(1);
+        pulsarInfo.setInlongClusterTag("default_cluster");
+
+        pulsarInfo.setDailyRecords(10000000);
+        pulsarInfo.setDailyStorage(10000);
+        pulsarInfo.setPeakRecords(100000);
+        pulsarInfo.setMaxLength(10000);
+
+        // flink conf
+        FlinkSortConf sortConf = new FlinkSortConf();
+        sortConf.setServiceUrl(FLINK_URL);
+        Map<String, String> map = new HashMap<>(16);
+        sortConf.setProperties(map);
+        pulsarInfo.setSortConf(sortConf);
+
+        return pulsarInfo;
+    }
+
+    @AfterAll
+    static void teardown() {
+        wireMockServer.stop();
+    }
+
+    @BeforeAll

Review Comment:
   @BeforeAll method should be put before @AfterAll 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@inlong.apache.org

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