You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "dlg99 (via GitHub)" <gi...@apache.org> on 2023/03/23 23:59:24 UTC

[GitHub] [pulsar] dlg99 commented on a diff in pull request #19821: [WIP] Added Debezium DB2 connector for Pulsar

dlg99 commented on code in PR #19821:
URL: https://github.com/apache/pulsar/pull/19821#discussion_r1146986919


##########
tests/integration/src/test/java/org/apache/pulsar/tests/integration/io/sources/debezium/DebeziumDB2DbSourceTester.java:
##########
@@ -0,0 +1,171 @@
+/*
+ * 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.pulsar.tests.integration.io.sources.debezium;
+
+import com.google.common.base.Preconditions;
+import java.util.Map;
+import lombok.Getter;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.pulsar.tests.integration.containers.DebeziumDB2DbContainer;
+import org.apache.pulsar.tests.integration.containers.DebeziumOracleDbContainer;
+import org.apache.pulsar.tests.integration.containers.PulsarContainer;
+import org.apache.pulsar.tests.integration.docker.ContainerExecResult;
+import org.apache.pulsar.tests.integration.io.sources.SourceTester;
+import org.apache.pulsar.tests.integration.topologies.PulsarCluster;
+import org.testng.util.Strings;
+
+/**
+ * A tester for testing Debezium OracleDb source.
+ */
+@Slf4j
+public class DebeziumDB2DbSourceTester extends SourceTester<DebeziumDB2DbContainer> {
+
+    private static final String NAME = "debezium-db2";
+    private static final long SLEEP_AFTER_COMMAND_MS = 30_000;
+
+    private final String pulsarServiceUrl;
+
+    @Getter
+    private DebeziumDB2DbContainer debeziumDB2DbContainer;
+
+    private final PulsarCluster pulsarCluster;
+
+    public DebeziumDB2DbSourceTester(PulsarCluster cluster) {
+        super(NAME);
+        this.pulsarCluster = cluster;
+        this.numEntriesToInsert = 1;
+        this.numEntriesExpectAfterStart = 0;
+
+        pulsarServiceUrl = "pulsar://pulsar-proxy:" + PulsarContainer.BROKER_PORT;
+        sourceConfig.put("connector.class", "io.debezium.connector.db2.Db2Connector");
+        sourceConfig.put("database.hostname", DebeziumDB2DbContainer.NAME);
+        sourceConfig.put("database.port", "50000");
+        sourceConfig.put("database.user", "db2inst1");
+        sourceConfig.put("database.password", "admin");
+        sourceConfig.put("database.dbname", "mydb2");
+        sourceConfig.put("topic.prefix", "stores");
+        sourceConfig.put("table.include.list", "DB2INST1.STORES");
+
+        //sourceConfig.put("snapshot.mode", "schema_only");  //??
+
+        //sourceConfig.put("schema.include.list", "inv"); //??

Review Comment:
   please remove



##########
tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/DebeziumDB2DbContainer.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.pulsar.tests.integration.containers;
+
+
+import java.time.Duration;
+import java.time.temporal.ChronoUnit;
+import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy;
+
+public class DebeziumDB2DbContainer extends ChaosContainer<DebeziumDB2DbContainer> {
+
+    public static final String NAME = "debezium-db2";
+    static final Integer[] PORTS = { 50000 };
+
+    //
+    private static final String IMAGE_NAME = "devingbost/debezium-db2:0.0.1";
+
+    public DebeziumDB2DbContainer(String clusterName) {
+        super(clusterName, IMAGE_NAME);
+    }
+
+    @Override
+    public String getContainerName() {
+        return clusterName;
+    }
+
+    @Override
+    protected void configure() {
+        super.configure();
+        this.withNetworkAliases(NAME)
+            .withExposedPorts(PORTS)
+                .withEnv("LICENSE", "accept")
+                .withEnv("DB2INSTANCE", "db2inst1")
+                .withEnv("DB2INST1_PASSWORD", "admin")
+                .withEnv("DBNAME", "mydb2")
+                .withEnv("BLU", "false")
+                .withEnv("ENABLE_ORACLE_COMPATIBILITY", "false")
+                .withEnv("UPDATEAVAIL", "NO")
+                .withEnv("TO_CREATE_SAMPLEDB", "false")
+                .withEnv("REPODB", "false")
+                .withEnv("IS_OSXFS", "false")
+                .withEnv("PERSISTENT_HOME", "true")
+                .withEnv("HADR_ENABLED", "false")
+               // .withEnv("ETCD_ENDPOINT", "")
+               // .withEnv("ETCD_USERNAME", "")
+               // .withEnv("ETCD_PASSWORD", "")

Review Comment:
   please remove



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

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