Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1941#discussion_r63664643
  
    --- Diff: 
flink-batch-connectors/flink-jdbc/src/test/java/org/apache/flink/api/java/io/jdbc/JDBCOutputFormatTest.java
 ---
    @@ -156,88 +63,97 @@ public void testInvalidQuery() throws IOException {
        @Test(expected = IllegalArgumentException.class)
        public void testIncompleteConfiguration() throws IOException {
                jdbcOutputFormat = JDBCOutputFormat.buildJDBCOutputFormat()
    -                           
.setDrivername("org.apache.derby.jdbc.EmbeddedDriver")
    -                           .setQuery("insert into books (id, title, 
author, price, qty) values (?,?,?,?,?)")
    +                           .setDrivername(DRIVER_CLASS)
    +                           .setQuery(String.format(INSERT_TEMPLATE, 
INPUT_TABLE))
                                .finish();
        }
     
     
        @Test(expected = IllegalArgumentException.class)
        public void testIncompatibleTypes() throws IOException {
                jdbcOutputFormat = JDBCOutputFormat.buildJDBCOutputFormat()
    -                           
.setDrivername("org.apache.derby.jdbc.EmbeddedDriver")
    -                           .setDBUrl("jdbc:derby:memory:ebookshop")
    -                           .setQuery("insert into books (id, title, 
author, price, qty) values (?,?,?,?,?)")
    +                           .setDrivername(DRIVER_CLASS)
    +                           .setDBUrl(DB_URL)
    +                           .setQuery(String.format(INSERT_TEMPLATE, 
INPUT_TABLE))
                                .finish();
                jdbcOutputFormat.open(0, 1);
     
    -           Tuple5 tuple5 = new Tuple5();
                tuple5.setField(4, 0);
                tuple5.setField("hello", 1);
                tuple5.setField("world", 2);
                tuple5.setField(0.99, 3);
                tuple5.setField("imthewrongtype", 4);
     
    -           jdbcOutputFormat.writeRecord(tuple5);
    +           Row row = new Row(tuple5.getArity());
    +           for (int i = 0; i < tuple5.getArity(); i++) {
    +                   row.setField(i, tuple5.getField(i));
    +           }
    +           jdbcOutputFormat.writeRecord(row);
                jdbcOutputFormat.close();
        }
     
        @Test
    -   public void testJDBCOutputFormat() throws IOException {
    -           String sourceTable = "books";
    -           String targetTable = "newbooks";
    -           String driverPath = "org.apache.derby.jdbc.EmbeddedDriver";
    -           String dbUrl = "jdbc:derby:memory:ebookshop";
    +   public void testJDBCOutputFormat() throws IOException, 
InstantiationException, IllegalAccessException {
    --- End diff --
    
    Can you change this test to no use the JdbcInputFormat, i.e., directly 
insert the test data and query it with SQL from the Derby instance? Otherwise, 
the test does not only test the JdbcOutputFormat.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to