Skip to content

Commit

Permalink
add bytes type test
Browse files Browse the repository at this point in the history
  • Loading branch information
laglangyue committed Aug 31, 2022
1 parent 83f56d8 commit 8e6bf12
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@

package org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.dm;

import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import org.apache.seatunnel.api.table.type.SeaTunnelRow;
import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
import org.apache.seatunnel.connectors.seatunnel.jdbc.internal.converter.AbstractJdbcRowConverter;

import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;

public class DmdbJdbcRowConverter extends AbstractJdbcRowConverter {

@Override
Expand All @@ -33,6 +34,6 @@ public String converterName() {

@Override
public SeaTunnelRow toInternal(ResultSet rs, ResultSetMetaData metaData, SeaTunnelRowType typeInfo) throws SQLException {
return super.toInternal(rs,metaData,typeInfo);
return super.toInternal(rs, metaData, typeInfo);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public abstract class SparkContainer {

private static final int WAIT_SPARK_JOB_SUBMIT = 5000;

protected static List<String> DRIVER_FROM_HTTP = new ArrayList<>();

@BeforeEach
public void before() {
master = new GenericContainer<>(SPARK_DOCKER_IMAGE)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,48 @@
/*
* 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.e2e.spark.v2.jdbc.dm;

import org.apache.seatunnel.e2e.spark.SparkContainer;

import com.google.common.collect.Lists;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.stream.Stream;
import lombok.extern.slf4j.Slf4j;
import org.apache.seatunnel.e2e.spark.SparkContainer;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.Container;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.lifecycle.Startables;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.stream.Stream;

@Slf4j
public class DMSourceTOConsoleIT extends SparkContainer {

Expand All @@ -42,9 +62,7 @@ public class DMSourceTOConsoleIT extends SparkContainer {
static void beforeAll() {
try {
DMDB = new GenericContainer<>(DM_DOCKER_IMAGE);
DMDB.withNetwork(NETWORK)
.withNetworkAliases(DM_NETWORK)
.withLogConsumer(new Slf4jLogConsumer(log));
DMDB.withNetwork(NETWORK).withNetworkAliases(DM_NETWORK).withLogConsumer(new Slf4jLogConsumer(log));
DMDB.setPortBindings(Lists.newArrayList("5236:5236"));
Startables.deepStart(Stream.of(DMDB)).join();
log.info("dm container started");
Expand All @@ -64,6 +82,11 @@ static void beforeAll() {
}
}

@BeforeEach
void setUp() {

}

private static String realUrl() {
return URL.replace(DM_NETWORK, DMDB.getContainerIpAddress());
}
Expand Down Expand Up @@ -106,6 +129,4 @@ public void testDMDBSourceToJdbcSink() throws SQLException, IOException, Interru
Container.ExecResult execResult = executeSeaTunnelSparkJob("/jdbc/dm/dm_to_console.conf");
Assertions.assertEquals(0, execResult.getExitCode());
}


}

0 comments on commit 8e6bf12

Please sign in to comment.