docete commented on a change in pull request #10745:
[FLINK-15445][connectors/jdbc] JDBC Table Source didn't work for Type…
URL: https://github.com/apache/flink/pull/10745#discussion_r376894169
##########
File path:
flink-connectors/flink-jdbc/src/test/java/org/apache/flink/api/java/io/jdbc/JDBCTableSourceITCase.java
##########
@@ -18,93 +18,167 @@
package org.apache.flink.api.java.io.jdbc;
-import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.table.api.EnvironmentSettings;
-import org.apache.flink.table.api.Table;
+import org.apache.flink.table.api.TableException;
import org.apache.flink.table.api.java.StreamTableEnvironment;
import org.apache.flink.table.runtime.utils.StreamITCase;
+import org.apache.flink.test.util.AbstractTestBase;
import org.apache.flink.types.Row;
-import org.junit.BeforeClass;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
-import java.util.ArrayList;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Arrays;
import java.util.List;
+
/**
- * IT case for {@link JDBCTableSource}.
+ * ITCase for {@link JDBCTableSource}.
*/
-public class JDBCTableSourceITCase extends JDBCTestBase {
-
- private static final StreamExecutionEnvironment env =
StreamExecutionEnvironment.getExecutionEnvironment();
- private static final EnvironmentSettings bsSettings =
EnvironmentSettings.newInstance().useBlinkPlanner().inStreamingMode().build();
- private static final StreamTableEnvironment tEnv =
StreamTableEnvironment.create(env, bsSettings);
-
- static final String TABLE_SOURCE_SQL = "CREATE TABLE books (" +
- " id int, " +
- " title varchar, " +
- " author varchar, " +
- " price double, " +
- " qty int " +
- ") with (" +
- " 'connector.type' = 'jdbc', " +
- " 'connector.url' = 'jdbc:derby:memory:ebookshop', " +
- " 'connector.table' = 'books', " +
- " 'connector.driver' = 'org.apache.derby.jdbc.EmbeddedDriver' "
+
- ")";
-
- @BeforeClass
- public static void createTable() {
- tEnv.sqlUpdate(TABLE_SOURCE_SQL);
+public class JDBCTableSourceITCase extends AbstractTestBase {
+
+ public static final String DRIVER_CLASS =
"org.apache.derby.jdbc.EmbeddedDriver";
+ public static final String DB_URL = "jdbc:derby:memory:test";
+ public static final String INPUT_TABLE = "jdbcSource";
+
+ @Before
+ public void before() throws ClassNotFoundException, SQLException {
+ System.setProperty("derby.stream.error.field",
JDBCTestBase.class.getCanonicalName() + ".DEV_NULL");
Review comment:
We add this to get rid of derby.log or the UT will end up with the derby.log
file in the root of the project (flink-jdbc).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services