Skip to content

Commit

Permalink
[Test][E2E] chunjun-e2e complete oracle tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
chaozwn authored and FlechazoW committed Aug 25, 2022
1 parent f6979a4 commit d9a616d
Show file tree
Hide file tree
Showing 13 changed files with 480 additions and 280 deletions.
155 changes: 95 additions & 60 deletions chunjun-connectors/chunjun-connector-oracle/pom.xml
Original file line number Diff line number Diff line change
@@ -1,70 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/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">
<parent>
<artifactId>chunjun-connectors</artifactId>
<groupId>com.dtstack.chunjun</groupId>
<version>1.12-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
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">
<parent>
<artifactId>chunjun-connectors</artifactId>
<groupId>com.dtstack.chunjun</groupId>
<version>1.12-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>chunjun-connector-oracle</artifactId>
<name>ChunJun : Connectors : Oracle</name>
<artifactId>chunjun-connector-oracle</artifactId>
<name>ChunJun : Connectors : Oracle</name>


<dependencies>
<dependency>
<groupId>com.dtstack.chunjun</groupId>
<artifactId>chunjun-connector-jdbc-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependencies>
<dependency>
<groupId>com.dtstack.chunjun</groupId>
<artifactId>chunjun-connector-jdbc-base</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.github.noraui</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1</version>
</dependency>
</dependencies>
<dependency>
<groupId>com.github.noraui</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
</plugin>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<artifactSet>
<excludes>
<exclude>org.slf4j:slf4j-api</exclude>
<exclude>log4j:log4j</exclude>
<exclude>ch.qos.logback:*</exclude>
</excludes>
</artifactSet>
<relocations>
<relocation>
<pattern>com.google.common</pattern>
<shadedPattern>shade.core.com.google.common</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy todir="${basedir}/../../${dist.dir}/connector/oracle/"
file="${basedir}/target/${project.artifactId}-${project.version}.jar"/>
<move file="${basedir}/../../${dist.dir}/connector/oracle/${project.artifactId}-${project.version}.jar"
tofile="${basedir}/../../${dist.dir}/connector/oracle/${project.artifactId}.jar"/>
<delete>
<fileset dir="${basedir}/../../${dist.dir}/connector/oracle/"
includes="${project.artifactId}-*.jar"
excludes="${project.artifactId}.jar"/>
</delete>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy todir="${basedir}/../../${dist.dir}/connector/oracle/"
file="${basedir}/target/${project.artifactId}-${project.version}.jar"/>
<move file="${basedir}/../../${dist.dir}/connector/oracle/${project.artifactId}-${project.version}.jar"
tofile="${basedir}/../../${dist.dir}/connector/oracle/${project.artifactId}.jar"/>
<delete>
<fileset dir="${basedir}/../../${dist.dir}/connector/oracle/"
includes="${project.artifactId}-*.jar"
excludes="${project.artifactId}.jar"/>
</delete>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
10 changes: 8 additions & 2 deletions chunjun-e2e/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,16 @@
<scope>test</scope>
</dependency>

<!-- test dependencies on TestContainers -->
<dependency>
<groupId>com.github.noraui</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mysql</artifactId>
<artifactId>jdbc</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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();
Expand Down
Loading

0 comments on commit d9a616d

Please sign in to comment.