use of org.apache.flink.connector.jdbc.catalog.JdbcCatalog in project flink by apache.
the class JdbcCatalogFactoryTest method setup.
@BeforeClass
public static void setup() throws SQLException {
// jdbc:postgresql://localhost:50807/postgres?user=postgres
String embeddedJdbcUrl = pg.getEmbeddedPostgres().getJdbcUrl(TEST_USERNAME, TEST_PWD);
// jdbc:postgresql://localhost:50807/
baseUrl = embeddedJdbcUrl.substring(0, embeddedJdbcUrl.lastIndexOf("/") + 1);
catalog = new JdbcCatalog(TEST_CATALOG_NAME, PostgresCatalog.DEFAULT_DATABASE, TEST_USERNAME, TEST_PWD, baseUrl);
}
use of org.apache.flink.connector.jdbc.catalog.JdbcCatalog in project flink by apache.
the class JdbcCatalogFactoryTest method test.
@Test
public void test() {
final Map<String, String> options = new HashMap<>();
options.put(CommonCatalogOptions.CATALOG_TYPE.key(), JdbcCatalogFactoryOptions.IDENTIFIER);
options.put(JdbcCatalogFactoryOptions.DEFAULT_DATABASE.key(), PostgresCatalog.DEFAULT_DATABASE);
options.put(JdbcCatalogFactoryOptions.USERNAME.key(), TEST_USERNAME);
options.put(JdbcCatalogFactoryOptions.PASSWORD.key(), TEST_PWD);
options.put(JdbcCatalogFactoryOptions.BASE_URL.key(), baseUrl);
final Catalog actualCatalog = FactoryUtil.createCatalog(TEST_CATALOG_NAME, options, null, Thread.currentThread().getContextClassLoader());
checkEquals(catalog, (JdbcCatalog) actualCatalog);
assertTrue(((JdbcCatalog) actualCatalog).getInternal() instanceof PostgresCatalog);
}
Aggregations