File tree Expand file tree Collapse file tree
test/java/it/aboutbits/postgresql/_support/testdata/persisted Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11quarkus :
2- datasource :
3- devservices :
4- port : 5433
52 operator-sdk :
63 activate-leader-election-for-profiles :
74 - test
Original file line number Diff line number Diff line change 99import org .eclipse .microprofile .config .inject .ConfigProperty ;
1010import org .jspecify .annotations .NullMarked ;
1111
12+ import java .net .URI ;
13+
1214@ NullMarked
1315@ ApplicationScoped
1416@ RequiredArgsConstructor
@@ -21,12 +23,12 @@ public class Given {
2123 @ ConfigProperty (name = "quarkus.datasource.devservices.password" )
2224 String password ;
2325
24- @ ConfigProperty (name = "quarkus.datasource.devservices.port " )
25- Integer port ;
26+ @ ConfigProperty (name = "quarkus.datasource.jdbc.url " )
27+ String jdbcUrl ;
2628
2729 DBConnectionDetails dbConnectionDetails () {
2830 return new DBConnectionDetails (
29- port ,
31+ parsePortFromJdbcUrl ( jdbcUrl ) ,
3032 username ,
3133 password
3234 );
@@ -85,4 +87,12 @@ public record DBConnectionDetails(
8587 String password
8688 ) {
8789 }
90+
91+ private int parsePortFromJdbcUrl (String url ) {
92+ // Typical format: jdbc:postgresql://localhost:5432/db
93+ // We strip "jdbc:" so URI.create can handle the "postgresql://..." part
94+ return URI .create (
95+ url .replace ("jdbc:" , "" )
96+ ).getPort ();
97+ }
8898}
You can’t perform that action at this time.
0 commit comments