This is an automated email from the ASF dual-hosted git repository. fanng pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push: new 0cecdbfc87 [#6217] flink-connector: Add Integration Tests for GravitinoPaimonCatalog with Catalog-backend as JDBC in the Flink (#6856) 0cecdbfc87 is described below commit 0cecdbfc8799b0abf820cf8b7735767ff307891a Author: yangyang zhong <35210666+hdyg...@users.noreply.github.com> AuthorDate: Tue Apr 8 09:39:47 2025 +0800 [#6217] flink-connector: Add Integration Tests for GravitinoPaimonCatalog with Catalog-backend as JDBC in the Flink (#6856) ### What changes were proposed in this pull request? Add Integration Tests for GravitinoPaimonCatalog with Catalog-backend as JDBC in the Flink ### Why are the changes needed? Fix: #6217 ### Does this PR introduce _any_ user-facing change? None ### How was this patch tested? org.apache.gravitino.flink.connector.integration.test.paimon.FlinkPaimonJdbcBackendIT --- .../test/paimon/FlinkPaimonJdbcBackendIT.java | 97 ++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/flink-connector/flink/src/test/java/org/apache/gravitino/flink/connector/integration/test/paimon/FlinkPaimonJdbcBackendIT.java b/flink-connector/flink/src/test/java/org/apache/gravitino/flink/connector/integration/test/paimon/FlinkPaimonJdbcBackendIT.java new file mode 100644 index 0000000000..97acd07627 --- /dev/null +++ b/flink-connector/flink/src/test/java/org/apache/gravitino/flink/connector/integration/test/paimon/FlinkPaimonJdbcBackendIT.java @@ -0,0 +1,97 @@ +/* + * 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.gravitino.flink.connector.integration.test.paimon; + +import static org.apache.gravitino.integration.test.util.TestDatabaseName.MYSQL_CATALOG_MYSQL_IT; + +import com.google.common.collect.ImmutableMap; +import java.nio.file.Path; +import java.util.Map; +import org.apache.gravitino.catalog.lakehouse.paimon.PaimonConstants; +import org.apache.gravitino.integration.test.container.ContainerSuite; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.io.TempDir; + +@Tag("gravitino-docker-test") +public class FlinkPaimonJdbcBackendIT extends FlinkPaimonCatalogIT { + + private static final String DEFAULT_PAIMON_CATALOG = "test_flink_paimon_jdbc_catalog"; + + @TempDir private static Path warehouseDir; + + private String mysqlUsername; + + private String mysqlPassword; + + private String databaseUrl; + + private String mysqlDriver; + + @Override + protected void createGravitinoCatalogByFlinkSql(String catalogName) { + tableEnv.executeSql( + String.format( + "create catalog %s with (" + + "'type'='gravitino-paimon', " + + "'warehouse'='%s'," + + "'metastore'='jdbc'," + + "'uri'='%s'," + + "'jdbc.user'='%s'," + + "'jdbc.password'='%s'" + + ")", + catalogName, warehouseDir, databaseUrl, mysqlUsername, mysqlPassword)); + } + + @Override + protected void initCatalogEnv() throws Exception { + ContainerSuite containerSuite = ContainerSuite.getInstance(); + containerSuite.startMySQLContainer(MYSQL_CATALOG_MYSQL_IT); + String mysqlUrl = containerSuite.getMySQLContainer().getJdbcUrl(); + mysqlUsername = containerSuite.getMySQLContainer().getUsername(); + mysqlPassword = containerSuite.getMySQLContainer().getPassword(); + mysqlDriver = containerSuite.getMySQLContainer().getDriverClassName(MYSQL_CATALOG_MYSQL_IT); + databaseUrl = mysqlUrl + "/" + MYSQL_CATALOG_MYSQL_IT.name(); + } + + @Override + protected String getPaimonCatalogName() { + return DEFAULT_PAIMON_CATALOG; + } + + @Override + protected Map<String, String> getPaimonCatalogOptions() { + return ImmutableMap.of( + PaimonConstants.CATALOG_BACKEND, + "jdbc", + "warehouse", + warehouseDir.toString(), + "uri", + databaseUrl, + "jdbc-user", + mysqlUsername, + "jdbc-password", + mysqlPassword, + "jdbc-driver", + mysqlDriver); + } + + @Override + protected String getWarehouse() { + return warehouseDir.toString(); + } +}