JNSimba commented on code in PR #466:
URL: 
https://github.com/apache/doris-flink-connector/pull/466#discussion_r1741558446


##########
flink-doris-connector/src/test/java/org/apache/doris/flink/container/AbstractE2EService.java:
##########
@@ -0,0 +1,155 @@
+// 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.doris.flink.container;
+
+import org.apache.flink.api.common.restartstrategy.RestartStrategies;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
+
+import org.apache.doris.flink.container.e2e.CustomerSingleThreadExecutor;
+import org.apache.doris.flink.container.instance.ContainerService;
+import org.apache.doris.flink.container.instance.MySQLContainer;
+import org.apache.doris.flink.exception.DorisRuntimeException;
+import org.apache.doris.flink.tools.cdc.CdcTools;
+import org.apache.doris.flink.tools.cdc.DatabaseSyncConfig;
+import org.junit.BeforeClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Connection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.Semaphore;
+
+public abstract class AbstractE2EService extends AbstractContainerTestBase {
+    private static final Logger LOG = 
LoggerFactory.getLogger(AbstractE2EService.class);
+    private static ContainerService mysqlContainerService;
+    private static final CustomerSingleThreadExecutor singleThreadExecutor =
+            new CustomerSingleThreadExecutor();
+    protected static final Semaphore SEMAPHORE = new Semaphore(1);
+    protected static final String SINK_CONF = "--" + 
DatabaseSyncConfig.SINK_CONF;
+    protected static final String DORIS_DATABASE = "--database";
+    protected static final String HOSTNAME = "hostname";
+    protected static final String PORT = "port";
+    protected static final String USERNAME = "username";
+    protected static final String PASSWORD = "password";
+    protected static final String DATABASE_NAME = "database-name";
+    protected static final String FENODES = "fenodes";
+    protected static final String JDBC_URL = "jdbc-url";
+    protected static final String SINK_LABEL_PREFIX = "sink.label-prefix";
+
+    @BeforeClass
+    public static void initE2EContainers() {
+        LOG.info("Trying to Start init E2E containers.");
+        initMySQLContainer();
+    }
+
+    private static void initMySQLContainer() {
+        if (Objects.nonNull(mysqlContainerService) && 
mysqlContainerService.isRunning()) {
+            LOG.info("The MySQL container has been started and is running 
status.");
+            return;
+        }
+        mysqlContainerService = new MySQLContainer();
+        mysqlContainerService.startContainer();
+        LOG.info("Mysql container was started.");
+    }
+
+    protected String getMySQLInstanceHost() {
+        return mysqlContainerService.getInstanceHost();
+    }
+
+    protected Integer getMySQLQueryPort() {
+        return mysqlContainerService.getMappedPort(3306);
+    }
+
+    protected String getMySQLUsername() {
+        return mysqlContainerService.getUsername();
+    }
+
+    protected String getMySQLPassword() {
+        return mysqlContainerService.getPassword();
+    }
+
+    protected Connection getMySQLQueryConnection() {
+        return mysqlContainerService.getQueryConnection();
+    }
+
+    protected void submitE2EJob(String jobName, String[] args) {
+        singleThreadExecutor.submitJob(
+                jobName,
+                () -> {
+                    try {
+                        LOG.info("{} e2e job will submit to start.", jobName);
+                        
CdcTools.setStreamExecutionEnvironmentForTesting(configFlinkEnvironment());
+                        CdcTools.main(args);
+                        Thread.sleep(10000);
+                    } catch (Exception e) {
+                        throw new DorisRuntimeException(e);
+                    }
+                });
+    }
+
+    protected void cancelCurrentE2EJob(String jobName) {
+        LOG.info("{} e2e job will cancel", jobName);
+        singleThreadExecutor.cancelCurrentJob(jobName);
+    }

Review Comment:
   This doesn't seem to be used?



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to