You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/10/26 15:06:05 UTC

[GitHub] [incubator-seatunnel] laglangyue commented on a diff in pull request #2410: [Feature][Connector-V2][JDBC] Support DB2 Source & Sink

laglangyue commented on code in PR #2410:
URL: https://github.com/apache/incubator-seatunnel/pull/2410#discussion_r1005812130


##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/JdbcDb2IT.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.jdbc;
+
+import org.apache.seatunnel.connectors.seatunnel.jdbc.util.JdbcCompareUtil;
+import org.apache.seatunnel.e2e.common.TestResource;
+import org.apache.seatunnel.e2e.common.TestSuiteBase;
+import org.apache.seatunnel.e2e.common.container.TestContainer;
+
+import com.google.common.collect.Lists;
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.Container;
+import org.testcontainers.containers.Db2Container;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Properties;
+
+public class JdbcDb2IT extends TestSuiteBase implements TestResource {
+
+    private static final Logger LOG = LoggerFactory.getLogger(JdbcDb2IT.class);
+    /**
+     * <a href="https://hub.docker.com/r/ibmcom/db2">db2 in dockerhub</a>
+     */
+    private static final String IMAGE = "ibmcom/db2";
+    private static final String HOST = "e2e_db2";
+    private static final int PORT = 50000;
+    private static final int LOCAL_PORT = 50000;
+    private static final String USER = "db2inst1";
+    private static final String PASSWORD = "123456";
+
+    private static final String DATABASE = "E2E";
+    private static final String SOURCE_TABLE = "E2E_TABLE_SOURCE";
+    private static final String SINK_TABLE = "E2E_TABLE_SINK";
+    private String jdbcUrl;
+    private Db2Container db2;
+    private Connection jdbcConnection;
+
+    @BeforeAll
+    @Override
+    public void startUp() throws Exception {
+        db2 = new Db2Container(IMAGE)
+            .withExposedPorts(PORT)
+            .withNetwork(NETWORK)
+            .withNetworkAliases(HOST)
+            .withDatabaseName(DATABASE)
+            .withUsername(USER)
+            .withPassword(PASSWORD)
+            .withLogConsumer(new Slf4jLogConsumer(LOG))

Review Comment:
   done. BTW can you tell me why.



##########
seatunnel-examples/seatunnel-spark-connector-v2-example/src/main/resources/examples/jdbc_db2_source_and_sink.conf:
##########
@@ -0,0 +1,90 @@
+#

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

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