linjianchang commented on code in PR #3995:
URL: https://github.com/apache/flink-cdc/pull/3995#discussion_r2675515705


##########
flink-cdc-e2e-tests/flink-cdc-pipeline-e2e-tests/src/test/java/org/apache/flink/cdc/pipeline/tests/OracleE2eITCase.java:
##########
@@ -0,0 +1,238 @@
+/*
+ * 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.flink.cdc.pipeline.tests;
+
+import org.apache.flink.cdc.common.test.utils.TestUtils;
+import org.apache.flink.cdc.connectors.oracle.source.OracleSourceTestBase;
+import org.apache.flink.cdc.pipeline.tests.utils.PipelineTestEnvironment;
+import org.apache.flink.util.FlinkRuntimeException;
+
+import io.debezium.relational.TableId;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.DockerClientFactory;
+import org.testcontainers.containers.OracleContainer;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
+import org.testcontainers.lifecycle.Startables;
+import org.testcontainers.utility.DockerImageName;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static 
org.apache.flink.cdc.connectors.oracle.source.OracleSourceTestBase.TOP_SECRET;
+import static 
org.apache.flink.cdc.connectors.oracle.source.OracleSourceTestBase.TOP_USER;
+
+/** End-to-end tests for Oracle cdc pipeline job. */
+public class OracleE2eITCase extends PipelineTestEnvironment {
+    private static final Logger LOG = 
LoggerFactory.getLogger(OracleE2eITCase.class);
+    protected static final Pattern COMMENT_PATTERN = 
Pattern.compile("^(.*)--.*$");
+    private static OracleContainer oracle;
+    // 
------------------------------------------------------------------------------------------
+    // Oracle Variables (we always use Oracle as the data source for easier 
verifying)
+    // 
------------------------------------------------------------------------------------------
+    public static final String ORACLE_DATABASE = "ORCLCDB";
+    public static final String CONNECTOR_USER = "dbzuser";
+    public static final String CONNECTOR_PWD = "dbz";
+    public static final String TEST_USER = "debezium";
+    public static final String TEST_PWD = "dbz";
+    public static final String ORACLE_IMAGE = "goodboy008/oracle-19.3.0-ee";
+    private static final String INTER_CONTAINER_ORACLE_ALIAS = "oracle";
+    private static final Path oracleOjdbcJar = 
TestUtils.getResource("oracle-ojdbc.jar");
+
+    @BeforeEach
+    public void before() throws Exception {
+        super.before();
+        LOG.info("Starting containers...");
+
+        oracle =
+                new OracleContainer(
+                                DockerImageName.parse(ORACLE_IMAGE)
+                                        .withTag(
+                                                DockerClientFactory.instance()
+                                                                .client()
+                                                                .versionCmd()
+                                                                .exec()
+                                                                .getArch()
+                                                                
.equals("amd64")
+                                                        ? "non-cdb"
+                                                        : "arm-non-cdb"))
+                        .withUsername(CONNECTOR_USER)
+                        .withPassword(CONNECTOR_PWD)
+                        .withDatabaseName(ORACLE_DATABASE)
+                        .withNetwork(NETWORK)
+                        .withNetworkAliases(INTER_CONTAINER_ORACLE_ALIAS)
+                        .withLogConsumer(new Slf4jLogConsumer(LOG))
+                        .withReuse(true);
+
+        Startables.deepStart(Stream.of(oracle)).join();
+        initializeOracleTable("product");
+        LOG.info("Containers are started.");
+    }
+
+    @AfterEach
+    public void after() {
+        super.after();
+    }
+
+    @Test
+    void testSyncWholeDatabase() throws Exception {
+        String pipelineJob =
+                String.format(
+                        "source:\n"
+                                + "  type: oracle\n"
+                                + "  hostname: %s\n"
+                                + "  port: %d\n"
+                                + "  username: %s\n"
+                                + "  password: %s\n"
+                                + "  tables: %s.PRODUCTS\n"

Review Comment:
   > There is only one table here, you can add a few more tables.
   
   modified



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

Reply via email to