diff --git a/chunjun-connectors/chunjun-connector-oracle/pom.xml b/chunjun-connectors/chunjun-connector-oracle/pom.xml index 6b467dc5cb..7209a6192a 100644 --- a/chunjun-connectors/chunjun-connector-oracle/pom.xml +++ b/chunjun-connectors/chunjun-connector-oracle/pom.xml @@ -1,70 +1,105 @@ - - chunjun-connectors - com.dtstack.chunjun - 1.12-SNAPSHOT - - 4.0.0 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + chunjun-connectors + com.dtstack.chunjun + 1.12-SNAPSHOT + + 4.0.0 - chunjun-connector-oracle - ChunJun : Connectors : Oracle + chunjun-connector-oracle + ChunJun : Connectors : Oracle - - - com.dtstack.chunjun - chunjun-connector-jdbc-base - ${project.version} - + + + com.dtstack.chunjun + chunjun-connector-jdbc-base + ${project.version} + - - com.github.noraui - ojdbc8 - 12.2.0.1 - - + + com.github.noraui + ojdbc8 + 12.2.0.1 + + - - - - org.apache.maven.plugins - maven-shade-plugin - + + + + org.apache.maven.plugins + maven-shade-plugin + 3.1.0 + + + package + + shade + + + false + + + org.slf4j:slf4j-api + log4j:log4j + ch.qos.logback:* + + + + + com.google.common + shade.core.com.google.common + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + + - - maven-antrun-plugin - - - copy-resources - - package - - run - - - - - - - - - - - - - - - com.diffplug.spotless - spotless-maven-plugin - - - + + maven-antrun-plugin + + + copy-resources + + package + + run + + + + + + + + + + + + + + + com.diffplug.spotless + spotless-maven-plugin + + + diff --git a/chunjun-e2e/pom.xml b/chunjun-e2e/pom.xml index 9a80eeab8b..1ee92ad640 100644 --- a/chunjun-e2e/pom.xml +++ b/chunjun-e2e/pom.xml @@ -29,10 +29,16 @@ test - + + com.github.noraui + ojdbc8 + 12.2.0.1 + test + + org.testcontainers - mysql + jdbc ${testcontainers.version} test diff --git a/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/containers/oracle/OracleContainer.java b/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/containers/oracle/OracleContainer.java new file mode 100644 index 0000000000..999c88d732 --- /dev/null +++ b/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/containers/oracle/OracleContainer.java @@ -0,0 +1,105 @@ +/* + * 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 com.dtstack.chunjun.connector.containers.oracle; + +import org.testcontainers.containers.JdbcDatabaseContainer; +import org.testcontainers.containers.wait.strategy.WaitStrategy; +import org.testcontainers.containers.wait.strategy.WaitStrategyTarget; +import org.testcontainers.images.builder.ImageFromDockerfile; + +import java.net.URISyntaxException; +import java.net.URL; +import java.nio.file.Paths; +import java.time.Duration; + +public class OracleContainer extends JdbcDatabaseContainer { + private static final URL ORACLE_DOCKERFILE = + OracleContainer.class.getClassLoader().getResource("docker/oracle/Dockerfile"); + + private static final String ORACLE_HOST = "chunjun-e2e-oracle11"; + + private static final String ORACLE_DRIVER_CLASS = "oracle.jdbc.driver.OracleDriver"; + + private static final Integer ORACLE_PORT = 1521; + + private static final String SID = "xe"; + + private static final String USERNAME = "system"; + + private static final String PASSWORD = "oracle"; + + public OracleContainer() throws URISyntaxException { + super( + new ImageFromDockerfile(ORACLE_HOST, true) + .withDockerfile(Paths.get(ORACLE_DOCKERFILE.toURI()))); + withExposedPorts(ORACLE_PORT); + waitingFor( + new WaitStrategy() { + @Override + public void waitUntilReady(WaitStrategyTarget waitStrategyTarget) {} + + @Override + public WaitStrategy withStartupTimeout(Duration startupTimeout) { + return null; + } + }); + } + + @Override + public String getDriverClassName() { + return ORACLE_DRIVER_CLASS; + } + + @Override + public String getJdbcUrl() { + return "jdbc:oracle:thin:" + + this.getUsername() + + "/" + + this.getPassword() + + "@" + + this.getHost() + + ":" + + getMappedPort(ORACLE_PORT) + + ":" + + this.getSid(); + } + + @Override + public String getUsername() { + return USERNAME; + } + + @Override + public String getPassword() { + return PASSWORD; + } + + @Override + public String getTestQueryString() { + return "SELECT 1 FROM DUAL"; + } + + public String getSid() { + return SID; + } + + public Integer getOraclePort() { + return this.getMappedPort(1521); + } +} diff --git a/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/ChunjunFlinkStandaloneE2eTest.java b/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/ChunjunFlinkStandaloneE2eTest.java index d5c98c27df..a5bbc56cfe 100644 --- a/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/ChunjunFlinkStandaloneE2eTest.java +++ b/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/ChunjunFlinkStandaloneE2eTest.java @@ -19,9 +19,9 @@ package com.dtstack.chunjun.connector.test; import com.dtstack.chunjun.client.Launcher; +import com.dtstack.chunjun.connector.containers.flink.FlinkStandaloneContainer; import com.dtstack.chunjun.connector.entity.JobAccumulatorResult; import com.dtstack.chunjun.connector.entity.LaunchCommandBuilder; -import com.dtstack.chunjun.connector.test.containers.FlinkStandaloneContainer; import com.dtstack.chunjun.enums.ClusterMode; import com.dtstack.chunjun.util.GsonUtil; diff --git a/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/containers/FlinkStandaloneContainer.java b/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/containers/FlinkStandaloneContainer.java deleted file mode 100644 index ca68b90680..0000000000 --- a/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/containers/FlinkStandaloneContainer.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 com.dtstack.chunjun.connector.test.containers; - -import org.testcontainers.containers.GenericContainer; -import org.testcontainers.images.builder.ImageFromDockerfile; - -import java.net.URISyntaxException; -import java.net.URL; -import java.nio.file.Paths; - -/** - * @author jayce - * @version 1.0 - * @date 2022/8/11 17:00 - */ -public class FlinkStandaloneContainer extends GenericContainer { - private static final URL FLINK_STANDALONE_DOCKFILE = - FlinkStandaloneContainer.class - .getClassLoader() - .getResource("docker/flink/standalone/Dockerfile"); - - public FlinkStandaloneContainer(String imageName) throws URISyntaxException { - super( - new ImageFromDockerfile(imageName, false) - .withDockerfile(Paths.get(FLINK_STANDALONE_DOCKFILE.toURI()))); - } -} diff --git a/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/standalone/mysql/sync/Mysql5SyncE2eITCase.java b/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/standalone/mysql/sync/Mysql5SyncE2eITCase.java index 69b79a8387..e9b0bd8e0d 100644 --- a/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/standalone/mysql/sync/Mysql5SyncE2eITCase.java +++ b/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/standalone/mysql/sync/Mysql5SyncE2eITCase.java @@ -29,7 +29,6 @@ import org.testcontainers.containers.output.Slf4jLogConsumer; import org.testcontainers.lifecycle.Startables; -import java.net.URISyntaxException; import java.util.stream.Stream; public class Mysql5SyncE2eITCase extends MysqlBaseSyncE2eITCase { @@ -38,7 +37,7 @@ public class Mysql5SyncE2eITCase extends MysqlBaseSyncE2eITCase { protected MysqlBaseContainer mysql5Container; @Before - public void before() throws URISyntaxException, InterruptedException { + public void before() throws Exception { super.before(); LOG.info("Starting mysql5 containers..."); mysql5Container = new Mysql5Container(); diff --git a/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/standalone/mysql/sync/Mysql8SyncE2eITCase.java b/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/standalone/mysql/sync/Mysql8SyncE2eITCase.java index 8f5faf460f..c10f096eb9 100644 --- a/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/standalone/mysql/sync/Mysql8SyncE2eITCase.java +++ b/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/standalone/mysql/sync/Mysql8SyncE2eITCase.java @@ -29,7 +29,6 @@ import org.testcontainers.containers.output.Slf4jLogConsumer; import org.testcontainers.lifecycle.Startables; -import java.net.URISyntaxException; import java.util.stream.Stream; public class Mysql8SyncE2eITCase extends MysqlBaseSyncE2eITCase { @@ -38,7 +37,7 @@ public class Mysql8SyncE2eITCase extends MysqlBaseSyncE2eITCase { protected MysqlBaseContainer mysql8Container; @Before - public void before() throws URISyntaxException, InterruptedException { + public void before() throws Exception { super.before(); LOG.info("Starting mysql8 containers..."); mysql8Container = new Mysql8Container(); diff --git a/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/standalone/oracle/sql/OracleSqlE2eITCase.java b/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/standalone/oracle/sql/OracleSqlE2eITCase.java new file mode 100644 index 0000000000..94719b6819 --- /dev/null +++ b/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/standalone/oracle/sql/OracleSqlE2eITCase.java @@ -0,0 +1,21 @@ +/* + * 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 com.dtstack.chunjun.connector.test.standalone.oracle.sql; + +public class OracleSqlE2eITCase {} diff --git a/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/standalone/oracle/sync/OracleSyncE2eITCase.java b/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/standalone/oracle/sync/OracleSyncE2eITCase.java new file mode 100644 index 0000000000..d1029e3cbc --- /dev/null +++ b/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/standalone/oracle/sync/OracleSyncE2eITCase.java @@ -0,0 +1,146 @@ +/* + * 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 com.dtstack.chunjun.connector.test.standalone.oracle.sync; + +import com.dtstack.chunjun.connector.containers.oracle.OracleContainer; +import com.dtstack.chunjun.connector.entity.JobAccumulatorResult; +import com.dtstack.chunjun.connector.test.utils.ChunjunFlinkStandaloneTestEnvironment; +import com.dtstack.chunjun.connector.test.utils.JdbcProxy; + +import org.apache.commons.io.FileUtils; +import org.junit.Assert; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testcontainers.containers.output.Slf4jLogConsumer; +import org.testcontainers.lifecycle.Startables; +import org.testcontainers.shaded.org.apache.commons.lang.StringUtils; + +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.sql.Statement; +import java.time.Duration; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class OracleSyncE2eITCase extends ChunjunFlinkStandaloneTestEnvironment { + + private static final Logger LOG = LoggerFactory.getLogger(OracleSyncE2eITCase.class); + + private static final URL ORACLE_INIT_SQL_URL = + OracleSyncE2eITCase.class.getClassLoader().getResource("docker/oracle/init.sql"); + + protected static final String ORACLE_HOST = "chunjun-e2e-oracle"; + + public OracleContainer oracle; + + @Override + public void before() throws Exception { + super.before(); + LOG.info("Starting containers..."); + oracle = new OracleContainer(); + oracle.withNetwork(NETWORK); + oracle.withNetworkAliases(ORACLE_HOST); + oracle.withLogConsumer(new Slf4jLogConsumer(LOG)); + Startables.deepStart(Stream.of(oracle)).join(); + Thread.sleep(5000); + initOracle(); + LOG.info("Containers are started."); + } + + @Override + public void after() { + if (oracle != null) { + oracle.stop(); + } + super.after(); + } + + @Test + public void testOracleToOracle() throws Exception { + submitSyncJobOnStandLone( + ChunjunFlinkStandaloneTestEnvironment.CHUNJUN_HOME + + "/chunjun-examples/json/oracle/oracle_oracle.json"); + JobAccumulatorResult jobAccumulatorResult = waitUntilJobFinished(Duration.ofMinutes(30)); + + Assert.assertEquals(jobAccumulatorResult.getNumRead(), 10); + Assert.assertEquals(jobAccumulatorResult.getNumWrite(), 10); + + JdbcProxy proxy = + new JdbcProxy( + oracle.getJdbcUrl(), + oracle.getUsername(), + oracle.getPassword(), + oracle.getDriverClassName()); + List expectResult = + Arrays.asList( + "1,4086.104923538155,2095-02-04 15:59:22.0,2022-08-03 14:11:12.651,FdTY,Abc,Hello", + "2,9401.154078754176,1984-10-27 23:04:04.0,2022-08-03 14:11:12.665,kPDM,Abc,Hello", + "3,3654.8354065891676,2082-11-01 05:25:45.0,2022-08-03 14:11:12.665,fwhi7A,Abc,Hello", + "4,1700.5049489644764,2060-02-01 03:18:48.0,2022-08-03 14:11:12.666,Vam,Abc,Hello", + "5,7213.916066384409,2027-11-14 21:55:03.0,2022-08-03 14:11:12.666,X2QZAo,Abc,Hello", + "7,7494.472210715716,2096-02-08 06:28:10.0,2022-08-03 14:11:12.668,zW6QXgrz,Abc,Hello", + "8,4082.4893142314077,2064-02-09 08:22:15.0,2022-08-03 14:11:12.668,bLLICJ4,Abc,Hello", + "9,2248.440916449925,2089-10-14 08:56:57.0,2022-08-03 14:11:12.669,OYB4jD8s,Abc,Hello", + "10,1363.0987942903073,1991-11-11 00:46:38.0,2022-08-03 14:11:12.67,NqDOi,Abc,Hello", + "11,9036.620205198631,2040-03-20 13:40:13.0,2022-08-03 14:11:12.671,l4bezLJ,Abc,Hello"); + proxy.checkResultWithTimeout( + expectResult, + "SYSTEM.TEST_SINK", + new String[] { + "INT_VAL", + "DOUBLE_VAL", + "DATE_VAL", + "TIMESTAMP_VAL", + "VAR_VAL", + "NAME", + "MESSAGE" + }, + 150000L); + } + + private void initOracle() throws IOException, SQLException { + String initSqls = + FileUtils.readFileToString(new File(ORACLE_INIT_SQL_URL.getPath()), "UTF-8"); + List executeSqls = + Arrays.stream(initSqls.split(";")) + .filter(sql -> StringUtils.isNotEmpty(StringUtils.strip(sql))) + .collect(Collectors.toList()); + try (Connection conn = getOracleJdbcConnection(); + Statement statement = conn.createStatement()) { + for (String sql : executeSqls) { + statement.execute(sql); + } + } catch (SQLException e) { + LOG.error("Execute Oracle init sql failed.", e); + throw e; + } + } + + private Connection getOracleJdbcConnection() throws SQLException { + return DriverManager.getConnection( + oracle.getJdbcUrl(), oracle.getUsername(), oracle.getPassword()); + } +} diff --git a/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/utils/ChunjunFlinkStandaloneTestEnvironment.java b/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/utils/ChunjunFlinkStandaloneTestEnvironment.java index e7c9d4e38e..14cf1d34f4 100644 --- a/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/utils/ChunjunFlinkStandaloneTestEnvironment.java +++ b/chunjun-e2e/src/test/java/com/dtstack/chunjun/connector/test/utils/ChunjunFlinkStandaloneTestEnvironment.java @@ -50,7 +50,6 @@ import javax.annotation.Nullable; import java.io.File; -import java.net.URISyntaxException; import java.net.URL; import java.time.Duration; import java.util.Collection; @@ -98,7 +97,7 @@ public class ChunjunFlinkStandaloneTestEnvironment { @Nullable private RestClusterClient restClusterClient; @Before - public void before() throws URISyntaxException, InterruptedException { + public void before() throws Exception { Assert.assertTrue("chunjun-dist directory must exists", new File(CHUNJUN_DIST).exists()); LOG.info("Starting flink standalone containers..."); diff --git a/chunjun-e2e/src/test/resources/docker/oracle/Dockerfile b/chunjun-e2e/src/test/resources/docker/oracle/Dockerfile new file mode 100644 index 0000000000..375d4635f3 --- /dev/null +++ b/chunjun-e2e/src/test/resources/docker/oracle/Dockerfile @@ -0,0 +1,16 @@ +FROM rohitbasu77/oracle11g:latest + +#hostname: localhost or docker machine ip +#port: 1521 +#sid: xe +#username: system +#password: oracle +#Password for SYS & SYSTEM is oracle +#Password for fareuser, searchuser, bookinguser, checkinuser is rohit123 + +LABEL maintainer="www.dtstack.com" + + +EXPOSE 1521 +EXPOSE 22 + diff --git a/chunjun-e2e/src/test/resources/docker/oracle/init.sql b/chunjun-e2e/src/test/resources/docker/oracle/init.sql new file mode 100644 index 0000000000..6c700d2235 --- /dev/null +++ b/chunjun-e2e/src/test/resources/docker/oracle/init.sql @@ -0,0 +1,52 @@ +create table SYSTEM.TEST_SOURCE +( +INT_VAL NUMBER, +DOUBLE_VAL FLOAT, +DATE_VAL DATE, +TIMESTAMP_VAL TIMESTAMP(6), +VAR_VAL VARCHAR2(255), +NAME VARCHAR2(255), +MESSAGE VARCHAR2(255) +); + +create table SYSTEM.TEST_SINK +( +INT_VAL NUMBER, +DOUBLE_VAL FLOAT, +DATE_VAL DATE, +TIMESTAMP_VAL TIMESTAMP(6), +VAR_VAL VARCHAR2(255), +NAME VARCHAR2(255), +MESSAGE VARCHAR2(255) +); + +INSERT INTO SYSTEM.TEST_SOURCE (INT_VAL, DOUBLE_VAL, DATE_VAL, TIMESTAMP_VAL, VAR_VAL, NAME, MESSAGE) +VALUES (1, 4086.104923538155, TO_DATE('2095-02-04 15:59:22', 'YYYY-MM-DD HH24:MI:SS'), +TO_TIMESTAMP('2022-08-03 14:11:12.651000', 'YYYY-MM-DD HH24:MI:SS.FF6'), 'FdTY', 'Abc', 'Hello'); +INSERT INTO SYSTEM.TEST_SOURCE (INT_VAL, DOUBLE_VAL, DATE_VAL, TIMESTAMP_VAL, VAR_VAL, NAME, MESSAGE) +VALUES (2, 9401.154078754176, TO_DATE('1984-10-27 23:04:04', 'YYYY-MM-DD HH24:MI:SS'), +TO_TIMESTAMP('2022-08-03 14:11:12.665000', 'YYYY-MM-DD HH24:MI:SS.FF6'), 'kPDM', 'Abc', 'Hello'); +INSERT INTO SYSTEM.TEST_SOURCE (INT_VAL, DOUBLE_VAL, DATE_VAL, TIMESTAMP_VAL, VAR_VAL, NAME, MESSAGE) +VALUES (3, 3654.8354065891676, TO_DATE('2082-11-01 05:25:45', 'YYYY-MM-DD HH24:MI:SS'), +TO_TIMESTAMP('2022-08-03 14:11:12.665000', 'YYYY-MM-DD HH24:MI:SS.FF6'), 'fwhi7A', 'Abc', 'Hello'); +INSERT INTO SYSTEM.TEST_SOURCE (INT_VAL, DOUBLE_VAL, DATE_VAL, TIMESTAMP_VAL, VAR_VAL, NAME, MESSAGE) +VALUES (4, 1700.5049489644764, TO_DATE('2060-02-01 03:18:48', 'YYYY-MM-DD HH24:MI:SS'), +TO_TIMESTAMP('2022-08-03 14:11:12.666000', 'YYYY-MM-DD HH24:MI:SS.FF6'), 'Vam', 'Abc', 'Hello'); +INSERT INTO SYSTEM.TEST_SOURCE (INT_VAL, DOUBLE_VAL, DATE_VAL, TIMESTAMP_VAL, VAR_VAL, NAME, MESSAGE) +VALUES (5, 7213.916066384409, TO_DATE('2027-11-14 21:55:03', 'YYYY-MM-DD HH24:MI:SS'), +TO_TIMESTAMP('2022-08-03 14:11:12.666000', 'YYYY-MM-DD HH24:MI:SS.FF6'), 'X2QZAo', 'Abc', 'Hello'); +INSERT INTO SYSTEM.TEST_SOURCE (INT_VAL, DOUBLE_VAL, DATE_VAL, TIMESTAMP_VAL, VAR_VAL, NAME, MESSAGE) +VALUES (7, 7494.472210715716, TO_DATE('2096-02-08 06:28:10', 'YYYY-MM-DD HH24:MI:SS'), +TO_TIMESTAMP('2022-08-03 14:11:12.668000', 'YYYY-MM-DD HH24:MI:SS.FF6'), 'zW6QXgrz', 'Abc', 'Hello'); +INSERT INTO SYSTEM.TEST_SOURCE (INT_VAL, DOUBLE_VAL, DATE_VAL, TIMESTAMP_VAL, VAR_VAL, NAME, MESSAGE) +VALUES (8, 4082.4893142314077, TO_DATE('2064-02-09 08:22:15', 'YYYY-MM-DD HH24:MI:SS'), +TO_TIMESTAMP('2022-08-03 14:11:12.668000', 'YYYY-MM-DD HH24:MI:SS.FF6'), 'bLLICJ4', 'Abc', 'Hello'); +INSERT INTO SYSTEM.TEST_SOURCE (INT_VAL, DOUBLE_VAL, DATE_VAL, TIMESTAMP_VAL, VAR_VAL, NAME, MESSAGE) +VALUES (9, 2248.440916449925, TO_DATE('2089-10-14 08:56:57', 'YYYY-MM-DD HH24:MI:SS'), +TO_TIMESTAMP('2022-08-03 14:11:12.669000', 'YYYY-MM-DD HH24:MI:SS.FF6'), 'OYB4jD8s', 'Abc', 'Hello'); +INSERT INTO SYSTEM.TEST_SOURCE (INT_VAL, DOUBLE_VAL, DATE_VAL, TIMESTAMP_VAL, VAR_VAL, NAME, MESSAGE) +VALUES (10, 1363.0987942903073, TO_DATE('1991-11-11 00:46:38', 'YYYY-MM-DD HH24:MI:SS'), +TO_TIMESTAMP('2022-08-03 14:11:12.670000', 'YYYY-MM-DD HH24:MI:SS.FF6'), 'NqDOi', 'Abc', 'Hello'); +INSERT INTO SYSTEM.TEST_SOURCE (INT_VAL, DOUBLE_VAL, DATE_VAL, TIMESTAMP_VAL, VAR_VAL, NAME, MESSAGE) +VALUES (11, 9036.620205198631, TO_DATE('2040-03-20 13:40:13', 'YYYY-MM-DD HH24:MI:SS'), +TO_TIMESTAMP('2022-08-03 14:11:12.671000', 'YYYY-MM-DD HH24:MI:SS.FF6'), 'l4bezLJ', 'Abc', 'Hello'); diff --git a/chunjun-examples/json/oracle/oracle_oracle.json b/chunjun-examples/json/oracle/oracle_oracle.json index f059cc6ec5..12d03c0b6e 100644 --- a/chunjun-examples/json/oracle/oracle_oracle.json +++ b/chunjun-examples/json/oracle/oracle_oracle.json @@ -4,101 +4,33 @@ { "reader": { "parameter": { - "username": "oracle", + "username": "system", "password": "oracle", "connection": [{ - "jdbcUrl": ["jdbc:oracle:thin:@localhost:1521:orcl"], - "table": ["oracle_all_type_source"] + "jdbcUrl": ["jdbc:oracle:thin:@chunjun-e2e-oracle:1521:xe"], + "table": ["SYSTEM.TEST_SOURCE"] }], - "increColumn": "t_timestamp", - "startLocation": "1530439980000", "column": [{ - "name": "id", - "type": "decimal" + "name": "INT_VAL", + "type": "number" },{ - "name": "t_binary_double", - "type": "decimal" + "name": "DOUBLE_VAL", + "type": "float" },{ - "name": "t_binary_float", - "type": "decimal" - },{ - "name": "t_char", - "type": "string" - },{ - "name": "t_char_varying", - "type": "string" - },{ - "name": "t_character", - "type": "string" - },{ - "name": "t_character_varying", - "type": "string" - },{ - "name": "t_date", + "name": "DATE_VAL", "type": "date" },{ - "name": "t_decimal", - "type": "decimal" - },{ - "name": "t_double_precision", - "type": "double" - },{ - "name": "t_float", - "type": "double" - },{ - "name": "t_int", - "type": "int" - },{ - "name": "t_integer", - "type": "decimal" - },{ - "name": "t_national_char", - "type": "string" - },{ - "name": "t_national_char_varying", - "type": "string" - },{ - "name": "t_national_character", - "type": "string" - },{ - "name": "t_national_character_varying", - "type": "string" - },{ - "name": "t_nchar", - "type": "string" - },{ - "name": "t_nchar_varying", - "type": "string" - },{ - "name": "t_number_1", - "type": "decimal" - },{ - "name": "t_number_2", - "type": "decimal" - },{ - "name": "t_number_3", - "type": "decimal" - },{ - "name": "t_numeric", - "type": "decimal" - },{ - "name": "t_nvarchar2", - "type": "string" - },{ - "name": "t_raw", - "type": "bytes" - },{ - "name": "t_real", - "type": "double" - },{ - "name": "t_timestamp", + "name": "TIMESTAMP_VAL", "type": "timestamp" },{ - "name": "t_varchar", - "type": "string" + "name": "VAR_VAL", + "type": "varchar" + },{ + "name": "NAME", + "type": "varchar" },{ - "name": "t_varchar2", - "type": "string" + "name": "MESSAGE", + "type": "varchar" }] }, "name": "oraclereader" @@ -107,103 +39,37 @@ "name": "oraclewriter", "parameter": { "mode": "insert", - "updateKey": ["id"], + "updateKey": [], "allReplace": true, - "username": "oracle", + "username": "system", "password": "oracle", "connection": [ { - "jdbcUrl": "jdbc:oracle:thin:@localhost:1521:orcl", - "table": ["oracle_all_type_sink"] + "jdbcUrl": "jdbc:oracle:thin:@chunjun-e2e-oracle:1521:xe", + "table": ["SYSTEM.TEST_SINK"] } ], "column": [{ - "name": "id", - "type": "decimal" + "name": "INT_VAL", + "type": "number" },{ - "name": "t_binary_double", - "type": "decimal" + "name": "DOUBLE_VAL", + "type": "float" },{ - "name": "t_binary_float", - "type": "decimal" - },{ - "name": "t_char", - "type": "string" - },{ - "name": "t_char_varying", - "type": "string" - },{ - "name": "t_character", - "type": "string" - },{ - "name": "t_character_varying", - "type": "string" + "name": "DATE_VAL", + "type": "date" },{ - "name": "t_date", + "name": "TIMESTAMP_VAL", "type": "timestamp" },{ - "name": "t_decimal", - "type": "decimal" - },{ - "name": "t_double_precision", - "type": "double" - },{ - "name": "t_float", - "type": "double" - },{ - "name": "t_int", - "type": "int" - },{ - "name": "t_integer", - "type": "decimal" - },{ - "name": "t_national_char", - "type": "string" - },{ - "name": "t_national_char_varying", - "type": "string" - },{ - "name": "t_national_character", - "type": "string" - },{ - "name": "t_national_character_varying", - "type": "string" - },{ - "name": "t_nchar", - "type": "string" - },{ - "name": "t_nchar_varying", - "type": "string" - },{ - "name": "t_number_1", - "type": "decimal" - },{ - "name": "t_number_2", - "type": "decimal" - },{ - "name": "t_number_3", - "type": "decimal" - },{ - "name": "t_numeric", - "type": "decimal" - },{ - "name": "t_nvarchar2", - "type": "string" - },{ - "name": "t_raw", - "type": "bytes" - },{ - "name": "t_real", - "type": "double" - },{ - "name": "t_timestamp", - "type": "timestamp" + "name": "VAR_VAL", + "type": "varchar" },{ - "name": "t_varchar", - "type": "string" + "name": "NAME", + "type": "varchar" },{ - "name": "t_varchar2", - "type": "string" + "name": "MESSAGE", + "type": "varchar" }] } }