Skip to content

Commit 694b2ec

Browse files
committed
rename ClusterConnection#maintenanceDatabase to database
1 parent f2ffb4c commit 694b2ec

7 files changed

Lines changed: 15 additions & 15 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ spec:
130130
name: quarkus-db-secret
131131
host: localhost
132132
port: 5432
133-
maintenanceDatabase: postgres
133+
database: postgres
134134
```
135135

136136
![Established Cluster Connection](docs/established-cluster-connection.png)

operator/src/main/java/it/aboutbits/postgresql/core/PostgreSQLContextFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class PostgreSQLContextFactory {
2424
public CloseableDSLContext getDSLContext(ClusterConnection clusterConnection) {
2525
return getDSLContext(
2626
clusterConnection,
27-
clusterConnection.getSpec().getMaintenanceDatabase()
27+
clusterConnection.getSpec().getDatabase()
2828
);
2929
}
3030

operator/src/main/java/it/aboutbits/postgresql/crd/clusterconnection/ClusterConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public String getName() {
5353
var jdbcUrl = "jdbc:postgresql://%s:%d/%s".formatted(
5454
spec.getHost(),
5555
spec.getPort(),
56-
spec.getMaintenanceDatabase()
56+
spec.getDatabase()
5757
);
5858

5959
if (spec.getParameters().isEmpty()) {

operator/src/main/java/it/aboutbits/postgresql/crd/clusterconnection/ClusterConnectionSpec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public class ClusterConnectionSpec {
3131
@Required
3232
@ValidationRule(
3333
value = "self.size() > 0",
34-
message = "The ClusterConnection maintenanceDatabase must not be empty."
34+
message = "The ClusterConnection database must not be empty."
3535
)
36-
private String maintenanceDatabase = "postgres";
36+
private String database = "postgres";
3737

3838
@Required
3939
private SecretRef adminSecretRef = new SecretRef();

operator/src/test/java/it/aboutbits/postgresql/_support/testdata/persisted/creator/ClusterConnectionCreate.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class ClusterConnectionCreate extends TestDataCreator<ClusterConnection>
4040
private Integer withPort;
4141

4242
@Nullable
43-
private String withMaintenanceDatabase;
43+
private String withDatabase;
4444

4545
@Nullable
4646
private SecretRef withAdminSecretRef;
@@ -83,7 +83,7 @@ protected ClusterConnection create(int index) {
8383
var spec = new ClusterConnectionSpec();
8484
spec.setHost(getHost());
8585
spec.setPort(getPort());
86-
spec.setMaintenanceDatabase(getMaintenanceDatabase());
86+
spec.setDatabase(getDatabase());
8787
spec.setAdminSecretRef(getAdminSecretRef());
8888
spec.setParameters(getParameters());
8989

@@ -142,9 +142,9 @@ private int getPort() {
142142
return dbConnectionDetails.port();
143143
}
144144

145-
private String getMaintenanceDatabase() {
145+
private String getDatabase() {
146146
return Objects.requireNonNullElse(
147-
withMaintenanceDatabase,
147+
withDatabase,
148148
"postgres"
149149
);
150150
}

operator/src/test/java/it/aboutbits/postgresql/crd/clusterconnection/ClusterConnectionReconcilerErrorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void setUp() {
4646

4747
when(spec.getHost()).thenReturn("localhost");
4848
when(spec.getPort()).thenReturn(5432);
49-
when(spec.getMaintenanceDatabase()).thenReturn("postgres");
49+
when(spec.getDatabase()).thenReturn("postgres");
5050
when(spec.getParameters()).thenReturn(Collections.emptyMap());
5151

5252
resource.setSpec(spec);

operator/src/test/java/it/aboutbits/postgresql/crd/grant/GrantReconcilerTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ void grantOnSchema() {
415415
// To create a Schema in the new database, we need a ClusterConnection pointing to it
416416
var clusterConnectionDb = given.one()
417417
.clusterConnection()
418-
.withMaintenanceDatabase(database.getSpec().getName())
418+
.withDatabase(database.getSpec().getName())
419419
.returnFirst();
420420

421421
var schema = given.one()
@@ -477,7 +477,7 @@ void grantOnTable() {
477477

478478
var clusterConnectionDb = given.one()
479479
.clusterConnection()
480-
.withMaintenanceDatabase(database.getSpec().getName())
480+
.withDatabase(database.getSpec().getName())
481481
.returnFirst();
482482

483483
var schema = given.one()
@@ -545,7 +545,7 @@ void grantOnAllTables() {
545545

546546
var clusterConnectionDb = given.one()
547547
.clusterConnection()
548-
.withMaintenanceDatabase(database.getSpec().getName())
548+
.withDatabase(database.getSpec().getName())
549549
.returnFirst();
550550

551551
var schema = given.one()
@@ -629,7 +629,7 @@ void grantOnSequence() {
629629

630630
var clusterConnectionDb = given.one()
631631
.clusterConnection()
632-
.withMaintenanceDatabase(database.getSpec().getName())
632+
.withDatabase(database.getSpec().getName())
633633
.returnFirst();
634634

635635
var schema = given.one()
@@ -699,7 +699,7 @@ void grantOnAllSequences() {
699699

700700
var clusterConnectionDb = given.one()
701701
.clusterConnection()
702-
.withMaintenanceDatabase(database.getSpec().getName())
702+
.withDatabase(database.getSpec().getName())
703703
.returnFirst();
704704

705705
var schema = given.one()

0 commit comments

Comments
 (0)