dimas-b commented on code in PR #1287:
URL: https://github.com/apache/polaris/pull/1287#discussion_r2025859562
##########
quarkus/admin/src/test/java/org/apache/polaris/admintool/el/EclipselinkProfile.java:
##########
@@ -37,6 +37,6 @@ public List<TestResourceEntry> testResources() {
return List.of(
new TestResourceEntry(
PostgresTestResourceLifecycleManager.class,
- Map.of(INIT_SCRIPT, "org/apache/polaris/admintool/init.sql")));
+ Map.of(INIT_SCRIPT, "org/apache/polaris/admintool/el/init.sql")));
Review Comment:
I'd prefer to defer this change to the PR that actually adds integration
tests to the admin tool for the new JDBC persistence impl.
##########
extension/persistence/relational-jdbc/src/test/java/org/apache/polaris/extension/persistence/impl/relational/jdbc/ConnectionManagerTest.java:
##########
@@ -0,0 +1,69 @@
+/*
+ * 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.polaris.extension.persistence.impl.relational.jdbc;
+
+import static org.junit.jupiter.api.Assertions.*;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+import org.apache.commons.dbcp2.BasicDataSource;
+import
org.apache.polaris.extension.persistence.relational.jdbc.ConnectionManager;
+import org.junit.jupiter.api.Test;
+
+public class ConnectionManagerTest {
+
+ private ConnectionManager connectionManager;
+
+ @Test
+ void testReadProperties() throws Exception {
+ // To test the db.properties is correctly read and properties are set
correctly.
+ BasicDataSource bds = (BasicDataSource) new
ConnectionManager("db.properties").getDataSource();
+ assertEquals("jdbc:postgresql://localhost:5432/postgres", bds.getUrl());
+ assertEquals("sa", bds.getUsername());
+ assertEquals("", bds.getPassword());
+ assertEquals("org.postgresql.Driver", bds.getDriverClassName());
+ assertEquals(5, bds.getInitialSize());
+ assertEquals(20, bds.getMaxTotal());
+ }
+
+ @Test
+ void testCloseDataSource() throws Exception {
+ // Mocking BasicDataSource to verify that close is called
+ BasicDataSource mockBds = mock(BasicDataSource.class);
+ connectionManager = new ConnectionManager("db.properties");
Review Comment:
As I proposed in another comment, I believe it would be nicer if we had an
`@Immutable` config interface for these settings.
Tests can inject config values from code. Quarkus will be able to
automatically inject its own implementation in the server.
Plus, the `initializeDataSource` method will have compile time checks for
types and property names.
--
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]