davidradl commented on code in PR #79: URL: https://github.com/apache/flink-connector-jdbc/pull/79#discussion_r1423897841
########## flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/table/JdbcDynamicTableSourceITCase.java: ########## @@ -368,37 +577,48 @@ private List<Row> executeQuery(String query) { return CollectionUtil.iteratorToList(tEnv.executeSql(query).collect()); } - private void validateCachedValues() { + private void validateCachedValues(Map<RowData, Collection<RowData>> expectedCachedEntries) { // Validate cache Map<String, LookupCacheManager.RefCountedCache> managedCaches = LookupCacheManager.getInstance().getManagedCaches(); assertThat(managedCaches).as("There should be only 1 shared cache registered").hasSize(1); LookupCache cache = managedCaches.get(managedCaches.keySet().iterator().next()).getCache(); // jdbc does support project push down, the cached row has been projected - RowData key1 = GenericRowData.of(1L); - RowData value1 = - GenericRowData.of( - 1L, - DecimalData.fromBigDecimal(BigDecimal.valueOf(100.1234), 10, 4), - TimestampData.fromLocalDateTime( - truncateTime(LocalDateTime.parse("2020-01-01T15:35:00.123456")))); - - RowData key2 = GenericRowData.of(2L); - RowData value2 = - GenericRowData.of( - 2L, - DecimalData.fromBigDecimal(BigDecimal.valueOf(101.1234), 10, 4), - TimestampData.fromLocalDateTime( - truncateTime(LocalDateTime.parse("2020-01-01T15:36:01.123456")))); - - RowData key3 = GenericRowData.of(3L); - - Map<RowData, Collection<RowData>> expectedEntries = new HashMap<>(); - expectedEntries.put(key1, Collections.singletonList(value1)); - expectedEntries.put(key2, Collections.singletonList(value2)); - expectedEntries.put(key3, Collections.emptyList()); + LookupCacheAssert.assertThat(cache).containsExactlyEntriesOf(expectedCachedEntries); + } - LookupCacheAssert.assertThat(cache).containsExactlyEntriesOf(expectedEntries); + @Test + public void testResolvingParams() { Review Comment: changed ########## flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/table/JdbcDynamicTableSourceITCase.java: ########## @@ -368,37 +577,48 @@ private List<Row> executeQuery(String query) { return CollectionUtil.iteratorToList(tEnv.executeSql(query).collect()); } - private void validateCachedValues() { + private void validateCachedValues(Map<RowData, Collection<RowData>> expectedCachedEntries) { // Validate cache Map<String, LookupCacheManager.RefCountedCache> managedCaches = LookupCacheManager.getInstance().getManagedCaches(); assertThat(managedCaches).as("There should be only 1 shared cache registered").hasSize(1); LookupCache cache = managedCaches.get(managedCaches.keySet().iterator().next()).getCache(); // jdbc does support project push down, the cached row has been projected - RowData key1 = GenericRowData.of(1L); - RowData value1 = - GenericRowData.of( - 1L, - DecimalData.fromBigDecimal(BigDecimal.valueOf(100.1234), 10, 4), - TimestampData.fromLocalDateTime( - truncateTime(LocalDateTime.parse("2020-01-01T15:35:00.123456")))); - - RowData key2 = GenericRowData.of(2L); - RowData value2 = - GenericRowData.of( - 2L, - DecimalData.fromBigDecimal(BigDecimal.valueOf(101.1234), 10, 4), - TimestampData.fromLocalDateTime( - truncateTime(LocalDateTime.parse("2020-01-01T15:36:01.123456")))); - - RowData key3 = GenericRowData.of(3L); - - Map<RowData, Collection<RowData>> expectedEntries = new HashMap<>(); - expectedEntries.put(key1, Collections.singletonList(value1)); - expectedEntries.put(key2, Collections.singletonList(value2)); - expectedEntries.put(key3, Collections.emptyList()); + LookupCacheAssert.assertThat(cache).containsExactlyEntriesOf(expectedCachedEntries); + } - LookupCacheAssert.assertThat(cache).containsExactlyEntriesOf(expectedEntries); + @Test + public void testResolvingParams() { + + Map<String, String> properties = JdbcDynamicTableFactoryTest.getAllOptions(); + properties.put("driver", "org.apache.derby.jdbc.EmbeddedDriver"); + properties.put("username", "user"); + properties.put("password", "pass"); + properties.put("connection.max-retry-timeout", "120s"); + + // validation for source + DynamicTableSource testSource = createTableSource(SCHEMA, properties); + InternalJdbcConnectionOptions options = + InternalJdbcConnectionOptions.builder() + .setDBUrl("jdbc:derby:memory:mydb") + .setTableName("mytable") + .setDriverName("org.apache.derby.jdbc.EmbeddedDriver") + .setUsername("user") + .setPassword("pass") + .setConnectionCheckTimeoutSeconds(120) + .build(); Review Comment: removed -- 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. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org