lasdf1234 commented on code in PR #11153:
URL: https://github.com/apache/gravitino/pull/11153#discussion_r3270945253


##########
iceberg/iceberg-rest-server/src/test/java/org/apache/gravitino/iceberg/service/provider/TestDynamicIcebergConfigProvider.java:
##########
@@ -257,6 +257,97 @@ void testIcebergConfig() {
         
icebergConfig.getIcebergCatalogProperties().get("catalog.backend-name"), 
"custom_backend");
   }
 
+  @Test
+  void testLoadServerCatalogConfigs() {
+    Map<String, String> properties = new HashMap<>();
+    properties.put(IcebergConstants.GRAVITINO_METALAKE, "test_metalake");
+    properties.put(IcebergConstants.TABLE_METADATA_CACHE_IMPL, 
"default-cache");
+    properties.put("catalog.jdbc_backend.catalog-backend", "jdbc");
+    properties.put("catalog.jdbc_backend.jdbc.user", "static-user");
+
+    Map<String, IcebergConfig> catalogConfigs =
+        StaticIcebergConfigProvider.initCatalogConfigs(properties);
+
+    Assertions.assertEquals(
+        "default-cache",
+        catalogConfigs
+            .get(IcebergConstants.ICEBERG_REST_DEFAULT_CATALOG)
+            .get(IcebergConfig.TABLE_METADATA_CACHE_IMPL));
+    Assertions.assertEquals(
+        "jdbc", 
catalogConfigs.get("jdbc_backend").get(IcebergConfig.CATALOG_BACKEND));
+    Assertions.assertEquals(
+        "static-user", 
catalogConfigs.get("jdbc_backend").getAllConfig().get("jdbc.user"));
+  }
+
+  @Test
+  void testNamedDynamicCatalogMergesNamedStaticConfigOnly() {
+    String metalakeName = "test_metalake";
+    String catalogName = "jdbc_backend";
+    Catalog mockCatalog = Mockito.mock(Catalog.class);
+    Mockito.when(mockCatalog.provider()).thenReturn("lakehouse-iceberg");
+    Mockito.when(mockCatalog.properties())
+        .thenReturn(
+            new HashMap<String, String>() {
+              {
+                put(IcebergConstants.CATALOG_BACKEND, "jdbc");
+                put(IcebergConstants.CATALOG_BACKEND_NAME, catalogName);
+                put(IcebergConstants.URI, "jdbc:sqlite::memory:");
+              }
+            });

Review Comment:
   Got resolved



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to