Skip to content

Commit 66e9535

Browse files
committed
WIP multiple DS
1 parent 045464c commit 66e9535

File tree

4 files changed

+64
-14
lines changed

4 files changed

+64
-14
lines changed

quarkus/admin/src/main/resources/application.properties

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,17 @@ quarkus.index-dependency.guava.group-id=com.google.guava
4949
quarkus.index-dependency.guava.artifact-id=guava
5050
quarkus.index-dependency.protobuf.group-id=com.google.protobuf
5151
quarkus.index-dependency.protobuf.artifact-id=protobuf-java
52+
53+
quarkus.datasource.\"realm1\".db-kind=pgsql
54+
quarkus.datasource.\"realm1\".jdbc.url=polaris
55+
quarkus.datasource.\"realm1\".username=polaris
56+
quarkus.datasource.\"realm1\".password=polaris
57+
quarkus.datasource.\"realm2\".db-kind=pgsql
58+
quarkus.datasource.\"realm2\".jdbc.url=polaris
59+
quarkus.datasource.\"realm2\".username=polaris
60+
quarkus.datasource.\"realm2\".password=polaris
61+
quarkus.datasource.\"realm3\".db-kind=pgsql
62+
quarkus.datasource.\"realm3\".jdbc.url=polaris
63+
quarkus.datasource.\"realm3\".username=polaris
64+
quarkus.datasource.\"realm3\".password=polaris
65+

quarkus/admin/src/test/java/org/apache/polaris/admintool/relational/jdbc/RelationalJdbcAdminProfile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ public List<TestResourceEntry> testResources() {
3636
return List.of(
3737
new TestResourceEntry(
3838
PostgresRelationalJdbcLifeCycleManagement.class,
39-
Map.of(INIT_SCRIPT, "org/apache/polaris/admintool/init.sql")));
39+
Map.of(INIT_SCRIPT, "org/apache/polaris/admintool/jdbc/init.sql")));
4040
}
4141
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
-- Create two more databases for testing. The first database, polaris_realm1, is created
21+
-- during container initialization. See PostgresTestResourceLifecycleManager.
22+
23+
-- Note: the database names must follow the pattern polaris_{realm}. That's the pattern
24+
-- specified by the persistence.xml file used in tests.
25+
26+
CREATE DATABASE realm2;
27+
GRANT ALL PRIVILEGES ON DATABASE realm2 TO polaris;
28+
29+
CREATE DATABASE realm3;
30+
GRANT ALL PRIVILEGES ON DATABASE realm3 TO polaris;

quarkus/test-commons/src/main/java/org/apache/polaris/test/commons/PostgresRelationalJdbcLifeCycleManagement.java

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,25 @@ public Map<String, String> start() {
5353

5454
context.containerNetworkId().ifPresent(postgres::withNetworkMode);
5555
postgres.start();
56-
return Map.of(
57-
"polaris.persistence.type",
58-
"relational-jdbc",
59-
"quarkus.datasource.realm1.db-kind",
60-
"pgsql",
61-
"quarkus.datasource.realm1.active",
62-
"true",
63-
"quarkus.datasource.realm1.jdbc.url",
64-
postgres.getJdbcUrl(),
65-
"quarkus.datasource.realm1.username",
66-
postgres.getUsername(),
67-
"quarkus.datasource.realm1.password",
68-
postgres.getPassword());
56+
// Use Map.ofEntries to create the map with more than 10 entries
57+
return Map.ofEntries(
58+
Map.entry("polaris.persistence.type", "relational-jdbc"),
59+
Map.entry("quarkus.datasource.realm1.db-kind", "pgsql"),
60+
Map.entry("quarkus.datasource.realm1.active", "true"),
61+
Map.entry("quarkus.datasource.realm1.jdbc.url", postgres.getJdbcUrl()),
62+
Map.entry("quarkus.datasource.realm1.username", postgres.getUsername()),
63+
Map.entry("quarkus.datasource.realm1.password", postgres.getPassword()),
64+
Map.entry("quarkus.datasource.realm2.db-kind", "pgsql"),
65+
Map.entry("quarkus.datasource.realm2.active", "true"),
66+
Map.entry("quarkus.datasource.realm2.jdbc.url", postgres.getJdbcUrl().replace("realm1", "realm2")),
67+
Map.entry("quarkus.datasource.realm2.username", postgres.getUsername()),
68+
Map.entry("quarkus.datasource.realm2.password", postgres.getPassword()),
69+
Map.entry("quarkus.datasource.realm3.db-kind", "pgsql"),
70+
Map.entry("quarkus.datasource.realm3.active", "true"),
71+
Map.entry("quarkus.datasource.realm3.jdbc.url", postgres.getJdbcUrl().replace("realm1", "realm3")),
72+
Map.entry("quarkus.datasource.realm3.username", postgres.getUsername()),
73+
Map.entry("quarkus.datasource.realm3.password", postgres.getPassword())
74+
);
6975
}
7076

7177
@Override

0 commit comments

Comments
 (0)