From a496aabbf414fce3482d3eccd5efef27960439a9 Mon Sep 17 00:00:00 2001 From: Ivan Vakhrushev Date: Sun, 8 Dec 2024 13:59:48 +0400 Subject: [PATCH] Add additional constructors to the IndexWithColumns and Column --- ...eIndexesOnArrayColumnsCheckOnHostTest.java | 4 +- ...ColumnsWithSerialTypesCheckOnHostTest.java | 10 ++--- ...umnsWithoutDescriptionCheckOnHostTest.java | 4 +- .../IndexesWithBooleanCheckOnHostTest.java | 4 +- ...aryKeysWithSerialTypesCheckOnHostTest.java | 2 +- .../mfvanek/pg/model/column/Column.java | 39 +++++++++++++++++- .../github/mfvanek/pg/model/index/Index.java | 2 +- .../pg/model/index/IndexWithBloat.java | 2 +- .../pg/model/index/IndexWithColumns.java | 41 +++++++++++++++++++ .../mfvanek/pg/model/column/ColumnTest.java | 8 +++- .../pg/model/index/IndexWithColumnsTest.java | 12 ++++-- ...dexesOnArrayColumnsCheckOnClusterTest.java | 4 +- ...umnsWithSerialTypesCheckOnClusterTest.java | 10 ++--- ...sWithoutDescriptionCheckOnClusterTest.java | 4 +- .../IndexesWithBooleanCheckOnClusterTest.java | 4 +- ...KeysWithSerialTypesCheckOnClusterTest.java | 2 +- 16 files changed, 120 insertions(+), 32 deletions(-) diff --git a/pg-index-health-core/src/test/java/io/github/mfvanek/pg/core/checks/host/BtreeIndexesOnArrayColumnsCheckOnHostTest.java b/pg-index-health-core/src/test/java/io/github/mfvanek/pg/core/checks/host/BtreeIndexesOnArrayColumnsCheckOnHostTest.java index 7cdfe693..7946e778 100644 --- a/pg-index-health-core/src/test/java/io/github/mfvanek/pg/core/checks/host/BtreeIndexesOnArrayColumnsCheckOnHostTest.java +++ b/pg-index-health-core/src/test/java/io/github/mfvanek/pg/core/checks/host/BtreeIndexesOnArrayColumnsCheckOnHostTest.java @@ -45,9 +45,9 @@ void onDatabaseWithThem(final String schemaName) { .executing(ctx) .hasSize(2) .containsExactlyInAnyOrder( - IndexWithColumns.ofSingle(accountsTableName, ctx.enrichWithSchema("accounts_roles_btree_idx"), 0L, + IndexWithColumns.ofSingle(ctx, accountsTableName, "accounts_roles_btree_idx", 0L, Column.ofNotNull(accountsTableName, "roles")), - IndexWithColumns.ofSingle(accountsTableName, ctx.enrichWithSchema("accounts_account_number_roles_btree_idx"), 0L, + IndexWithColumns.ofSingle(ctx, accountsTableName, "accounts_account_number_roles_btree_idx", 0L, Column.ofNotNull(accountsTableName, "roles")) ); diff --git a/pg-index-health-core/src/test/java/io/github/mfvanek/pg/core/checks/host/ColumnsWithSerialTypesCheckOnHostTest.java b/pg-index-health-core/src/test/java/io/github/mfvanek/pg/core/checks/host/ColumnsWithSerialTypesCheckOnHostTest.java index 173252dc..139f8468 100644 --- a/pg-index-health-core/src/test/java/io/github/mfvanek/pg/core/checks/host/ColumnsWithSerialTypesCheckOnHostTest.java +++ b/pg-index-health-core/src/test/java/io/github/mfvanek/pg/core/checks/host/ColumnsWithSerialTypesCheckOnHostTest.java @@ -74,7 +74,7 @@ void shouldIgnoreDroppedColumns(final String schemaName) { .hasSize(1) .containsExactly( ColumnWithSerialType.ofBigSerial( - Column.ofNotNull(ctx.enrichWithSchema("bad_accounts"), "real_client_id"), ctx.enrichWithSchema("bad_accounts_real_client_id_seq")) + Column.ofNotNull(ctx, "bad_accounts", "real_client_id"), ctx.enrichWithSchema("bad_accounts_real_client_id_seq")) ); assertThat(check) @@ -105,7 +105,7 @@ void shouldDetectSerialColumnsWithUniqueConstraints(final String schemaName) { .hasSize(1) .containsExactly( ColumnWithSerialType.ofBigSerial( - Column.ofNotNull(ctx.enrichWithSchema("one_more_table"), "id"), ctx.enrichWithSchema("one_more_table_id_seq")) + Column.ofNotNull(ctx, "one_more_table", "id"), ctx.enrichWithSchema("one_more_table_id_seq")) )); } @@ -118,11 +118,11 @@ void shouldDetectPrimaryKeysThatAreForeignKeysAsWell(final String schemaName) { .hasSize(3) .containsExactly( ColumnWithSerialType.ofBigSerial( - Column.ofNotNull(ctx.enrichWithSchema("one_more_table"), "id"), ctx.enrichWithSchema("one_more_table_id_seq")), + Column.ofNotNull(ctx, "one_more_table", "id"), ctx.enrichWithSchema("one_more_table_id_seq")), ColumnWithSerialType.ofBigSerial( - Column.ofNotNull(ctx.enrichWithSchema("test_table"), "id"), ctx.enrichWithSchema("test_table_id_seq")), + Column.ofNotNull(ctx, "test_table", "id"), ctx.enrichWithSchema("test_table_id_seq")), ColumnWithSerialType.ofBigSerial( - Column.ofNotNull(ctx.enrichWithSchema("test_table"), "num"), ctx.enrichWithSchema("test_table_num_seq")) + Column.ofNotNull(ctx, "test_table", "num"), ctx.enrichWithSchema("test_table_num_seq")) )); } } diff --git a/pg-index-health-core/src/test/java/io/github/mfvanek/pg/core/checks/host/ColumnsWithoutDescriptionCheckOnHostTest.java b/pg-index-health-core/src/test/java/io/github/mfvanek/pg/core/checks/host/ColumnsWithoutDescriptionCheckOnHostTest.java index 171cfb17..e3a65dd9 100644 --- a/pg-index-health-core/src/test/java/io/github/mfvanek/pg/core/checks/host/ColumnsWithoutDescriptionCheckOnHostTest.java +++ b/pg-index-health-core/src/test/java/io/github/mfvanek/pg/core/checks/host/ColumnsWithoutDescriptionCheckOnHostTest.java @@ -79,8 +79,8 @@ void shouldNotTakingIntoAccountBlankComments(final String schemaName) { .filteredOn(c -> "id".equalsIgnoreCase(c.getColumnName())) .hasSize(2) .containsExactly( - Column.ofNotNull(ctx.enrichWithSchema("accounts"), "id"), - Column.ofNotNull(ctx.enrichWithSchema("clients"), "id"))); + Column.ofNotNull(ctx, "accounts", "id"), + Column.ofNotNull(ctx, "clients", "id"))); } @ParameterizedTest diff --git a/pg-index-health-core/src/test/java/io/github/mfvanek/pg/core/checks/host/IndexesWithBooleanCheckOnHostTest.java b/pg-index-health-core/src/test/java/io/github/mfvanek/pg/core/checks/host/IndexesWithBooleanCheckOnHostTest.java index 3007c333..ebffe024 100644 --- a/pg-index-health-core/src/test/java/io/github/mfvanek/pg/core/checks/host/IndexesWithBooleanCheckOnHostTest.java +++ b/pg-index-health-core/src/test/java/io/github/mfvanek/pg/core/checks/host/IndexesWithBooleanCheckOnHostTest.java @@ -45,8 +45,8 @@ void onDatabaseWithThem(final String schemaName) { .executing(ctx) .hasSize(1) .containsExactly( - IndexWithColumns.ofSingle(ctx.enrichWithSchema("accounts"), ctx.enrichWithSchema("i_accounts_deleted"), 0L, - Column.ofNotNull(ctx.enrichWithSchema("accounts"), "deleted")) + IndexWithColumns.ofSingle(ctx, "accounts", "i_accounts_deleted", 0L, + Column.ofNotNull(ctx, "accounts", "deleted")) ); assertThat(check) diff --git a/pg-index-health-core/src/test/java/io/github/mfvanek/pg/core/checks/host/PrimaryKeysWithSerialTypesCheckOnHostTest.java b/pg-index-health-core/src/test/java/io/github/mfvanek/pg/core/checks/host/PrimaryKeysWithSerialTypesCheckOnHostTest.java index f5abc73c..53255006 100644 --- a/pg-index-health-core/src/test/java/io/github/mfvanek/pg/core/checks/host/PrimaryKeysWithSerialTypesCheckOnHostTest.java +++ b/pg-index-health-core/src/test/java/io/github/mfvanek/pg/core/checks/host/PrimaryKeysWithSerialTypesCheckOnHostTest.java @@ -47,7 +47,7 @@ void onDatabaseWithThem(final String schemaName) { .hasSize(1) .containsExactlyInAnyOrder( ColumnWithSerialType.of( - Column.ofNotNull(ctx.enrichWithSchema("bad_accounts"), "id"), SerialType.BIG_SERIAL, ctx.enrichWithSchema("bad_accounts_id_seq") + Column.ofNotNull(ctx, "bad_accounts", "id"), SerialType.BIG_SERIAL, ctx.enrichWithSchema("bad_accounts_id_seq") )); assertThat(check) diff --git a/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/column/Column.java b/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/column/Column.java index 5c07e8c6..da65f5b4 100644 --- a/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/column/Column.java +++ b/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/column/Column.java @@ -10,6 +10,7 @@ package io.github.mfvanek.pg.model.column; +import io.github.mfvanek.pg.model.context.PgContext; import io.github.mfvanek.pg.model.dbobject.DbObject; import io.github.mfvanek.pg.model.dbobject.PgObjectType; import io.github.mfvanek.pg.model.validation.Validators; @@ -151,10 +152,27 @@ public int compareTo(@Nonnull final Column other) { * @return {@code Column} */ @Nonnull - public static Column ofNotNull(@Nonnull final String tableName, @Nonnull final String columnName) { + public static Column ofNotNull(@Nonnull final String tableName, + @Nonnull final String columnName) { return new Column(tableName, columnName, true); } + /** + * Constructs a not null {@code Column} object with given context. + * + * @param pgContext the schema context to enrich table name; must be non-null. + * @param tableName table name; should be non-blank. + * @param columnName column name; should be non-blank. + * @return {@code Column} + * @since 0.14.3 + */ + @Nonnull + public static Column ofNotNull(@Nonnull final PgContext pgContext, + @Nonnull final String tableName, + @Nonnull final String columnName) { + return ofNotNull(PgContext.enrichWith(tableName, pgContext), columnName); + } + /** * Constructs a nullable {@code Column} object. * @@ -163,7 +181,24 @@ public static Column ofNotNull(@Nonnull final String tableName, @Nonnull final S * @return {@code Column} */ @Nonnull - public static Column ofNullable(@Nonnull final String tableName, @Nonnull final String columnName) { + public static Column ofNullable(@Nonnull final String tableName, + @Nonnull final String columnName) { return new Column(tableName, columnName, false); } + + /** + * Constructs a nullable {@code Column} object with given context. + * + * @param pgContext the schema context to enrich table name; must be non-null. + * @param tableName table name; should be non-blank. + * @param columnName column name; should be non-blank. + * @return {@code Column} + * @since 0.14.3 + */ + @Nonnull + public static Column ofNullable(@Nonnull final PgContext pgContext, + @Nonnull final String tableName, + @Nonnull final String columnName) { + return ofNullable(PgContext.enrichWith(tableName, pgContext), columnName); + } } diff --git a/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/index/Index.java b/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/index/Index.java index a75877e1..d63e332d 100644 --- a/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/index/Index.java +++ b/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/index/Index.java @@ -156,7 +156,7 @@ public static Index of(@Nonnull final String tableName, /** * Constructs an {@code Index} object with given context. * - * @param pgContext the schema context to enrich index name; must be non-null. + * @param pgContext the schema context to enrich table and index name; must be non-null. * @param tableName table name; should be non-blank. * @param indexName index name; should be non-blank. * @return {@code Index} diff --git a/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/index/IndexWithBloat.java b/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/index/IndexWithBloat.java index 99519ab3..02a64b5f 100644 --- a/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/index/IndexWithBloat.java +++ b/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/index/IndexWithBloat.java @@ -95,7 +95,7 @@ public static IndexWithBloat of(@Nonnull final String tableName, /** * Constructs a {@code IndexWithBloat} object with given context. * - * @param pgContext the schema context to enrich index name; must be non-null. + * @param pgContext the schema context to enrich table and index name; must be non-null. * @param tableName table name; should be non-blank. * @param indexName index name; should be non-blank. * @param indexSizeInBytes index size in bytes; should be positive or zero. diff --git a/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/index/IndexWithColumns.java b/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/index/IndexWithColumns.java index 5b3c6b45..9cfebd3f 100644 --- a/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/index/IndexWithColumns.java +++ b/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/index/IndexWithColumns.java @@ -11,6 +11,7 @@ package io.github.mfvanek.pg.model.index; import io.github.mfvanek.pg.model.column.Column; +import io.github.mfvanek.pg.model.context.PgContext; import io.github.mfvanek.pg.model.validation.Validators; import java.util.List; @@ -94,6 +95,26 @@ public static IndexWithColumns ofSingle(@Nonnull final String tableName, return new IndexWithColumns(tableName, indexName, indexSizeInBytes, columns); } + /** + * Constructs an {@code IndexWithColumns} object with one column and given context. + * + * @param pgContext the schema context to enrich table and index name; must be non-null. + * @param tableName table name; should be non-blank. + * @param indexName index name; should be non-blank. + * @param indexSizeInBytes index size in bytes; should be positive or zero. + * @param column column in index. + * @return {@code IndexWithColumns} + * @since 0.14.3 + */ + @Nonnull + public static IndexWithColumns ofSingle(@Nonnull final PgContext pgContext, + @Nonnull final String tableName, + @Nonnull final String indexName, + final long indexSizeInBytes, + @Nonnull final Column column) { + return ofSingle(PgContext.enrichWith(tableName, pgContext), PgContext.enrichWith(indexName, pgContext), indexSizeInBytes, column); + } + /** * Constructs an {@code IndexWithColumns} object with given columns. * @@ -110,4 +131,24 @@ public static IndexWithColumns ofColumns(@Nonnull final String tableName, @Nonnull final List columns) { return new IndexWithColumns(tableName, indexName, indexSizeInBytes, columns); } + + /** + * Constructs an {@code IndexWithColumns} object with given columns and context. + * + * @param pgContext the schema context to enrich table and index name; must be non-null. + * @param tableName table name; should be non-blank. + * @param indexName index name; should be non-blank. + * @param indexSizeInBytes index size in bytes; should be positive or zero. + * @param columns columns in index. + * @return {@code IndexWithColumns} + * @since 0.14.3 + */ + @Nonnull + public static IndexWithColumns ofColumns(@Nonnull final PgContext pgContext, + @Nonnull final String tableName, + @Nonnull final String indexName, + final long indexSizeInBytes, + @Nonnull final List columns) { + return ofColumns(PgContext.enrichWith(tableName, pgContext), PgContext.enrichWith(indexName, pgContext), indexSizeInBytes, columns); + } } diff --git a/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/column/ColumnTest.java b/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/column/ColumnTest.java index e597cc80..20082d1d 100644 --- a/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/column/ColumnTest.java +++ b/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/column/ColumnTest.java @@ -10,6 +10,7 @@ package io.github.mfvanek.pg.model.column; +import io.github.mfvanek.pg.model.context.PgContext; import io.github.mfvanek.pg.model.dbobject.PgObjectType; import nl.jqno.equalsverifier.EqualsVerifier; import org.junit.jupiter.api.Test; @@ -79,9 +80,14 @@ void withInvalidValuesShouldThrowException() { void testToString() { assertThat(Column.ofNotNull("t1", "c1")) .hasToString("Column{tableName='t1', columnName='c1', notNull=true}"); - assertThat(Column.ofNullable("t2", "c2")) .hasToString("Column{tableName='t2', columnName='c2', notNull=false}"); + + final PgContext ctx = PgContext.of("tst"); + assertThat(Column.ofNotNull(ctx, "t1", "c1")) + .hasToString("Column{tableName='tst.t1', columnName='c1', notNull=true}"); + assertThat(Column.ofNullable(ctx, "t2", "c2")) + .hasToString("Column{tableName='tst.t2', columnName='c2', notNull=false}"); } @SuppressWarnings("ConstantConditions") diff --git a/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/index/IndexWithColumnsTest.java b/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/index/IndexWithColumnsTest.java index f8a6d068..f3943a76 100644 --- a/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/index/IndexWithColumnsTest.java +++ b/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/index/IndexWithColumnsTest.java @@ -11,6 +11,7 @@ package io.github.mfvanek.pg.model.index; import io.github.mfvanek.pg.model.column.Column; +import io.github.mfvanek.pg.model.context.PgContext; import io.github.mfvanek.pg.model.dbobject.PgObjectType; import nl.jqno.equalsverifier.EqualsVerifier; import org.junit.jupiter.api.Test; @@ -75,9 +76,14 @@ void tableShouldBeTheSame() { @Test void testToString() { - final Column column = Column.ofNullable("t", "f"); - assertThat(IndexWithColumns.ofSingle("t", "i", 22L, column)) - .hasToString("IndexWithColumns{tableName='t', indexName='i', " + "indexSizeInBytes=22, columns=[Column{tableName='t', columnName='f', notNull=false}]}"); + assertThat(IndexWithColumns.ofSingle("t", "i", 22L, Column.ofNullable("t", "f"))) + .hasToString("IndexWithColumns{tableName='t', indexName='i', indexSizeInBytes=22, columns=[Column{tableName='t', columnName='f', notNull=false}]}"); + final PgContext ctx = PgContext.of("tst"); + final Column column = Column.ofNullable(ctx, "t", "f"); + assertThat(IndexWithColumns.ofSingle(ctx, "t", "i", 22L, column)) + .hasToString("IndexWithColumns{tableName='tst.t', indexName='tst.i', indexSizeInBytes=22, columns=[Column{tableName='tst.t', columnName='f', notNull=false}]}"); + assertThat(IndexWithColumns.ofColumns(ctx, "t", "i", 22L, List.of(column))) + .hasToString("IndexWithColumns{tableName='tst.t', indexName='tst.i', indexSizeInBytes=22, columns=[Column{tableName='tst.t', columnName='f', notNull=false}]}"); } @SuppressWarnings("ConstantConditions") diff --git a/pg-index-health/src/test/java/io/github/mfvanek/pg/health/checks/cluster/BtreeIndexesOnArrayColumnsCheckOnClusterTest.java b/pg-index-health/src/test/java/io/github/mfvanek/pg/health/checks/cluster/BtreeIndexesOnArrayColumnsCheckOnClusterTest.java index 8ebb4ad1..7f41ca0d 100644 --- a/pg-index-health/src/test/java/io/github/mfvanek/pg/health/checks/cluster/BtreeIndexesOnArrayColumnsCheckOnClusterTest.java +++ b/pg-index-health/src/test/java/io/github/mfvanek/pg/health/checks/cluster/BtreeIndexesOnArrayColumnsCheckOnClusterTest.java @@ -53,9 +53,9 @@ void onDatabaseWithThem(final String schemaName) { .executing(ctx) .hasSize(2) .containsExactlyInAnyOrder( - IndexWithColumns.ofSingle(accountsTableName, ctx.enrichWithSchema("accounts_roles_btree_idx"), 0L, + IndexWithColumns.ofSingle(ctx, accountsTableName, "accounts_roles_btree_idx", 0L, Column.ofNotNull(accountsTableName, "roles")), - IndexWithColumns.ofSingle(accountsTableName, ctx.enrichWithSchema("accounts_account_number_roles_btree_idx"), 0L, + IndexWithColumns.ofSingle(ctx, accountsTableName, "accounts_account_number_roles_btree_idx", 0L, Column.ofNotNull(accountsTableName, "roles")) ); diff --git a/pg-index-health/src/test/java/io/github/mfvanek/pg/health/checks/cluster/ColumnsWithSerialTypesCheckOnClusterTest.java b/pg-index-health/src/test/java/io/github/mfvanek/pg/health/checks/cluster/ColumnsWithSerialTypesCheckOnClusterTest.java index bc8b0100..10bf66cb 100644 --- a/pg-index-health/src/test/java/io/github/mfvanek/pg/health/checks/cluster/ColumnsWithSerialTypesCheckOnClusterTest.java +++ b/pg-index-health/src/test/java/io/github/mfvanek/pg/health/checks/cluster/ColumnsWithSerialTypesCheckOnClusterTest.java @@ -72,7 +72,7 @@ void shouldIgnoreDroppedColumns(final String schemaName) { .hasSize(1) .containsExactly( ColumnWithSerialType.ofBigSerial( - Column.ofNotNull(ctx.enrichWithSchema("bad_accounts"), "real_client_id"), ctx.enrichWithSchema("bad_accounts_real_client_id_seq")) + Column.ofNotNull(ctx, "bad_accounts", "real_client_id"), ctx.enrichWithSchema("bad_accounts_real_client_id_seq")) ); assertThat(check) @@ -103,7 +103,7 @@ void shouldDetectSerialColumnsWithUniqueConstraints(final String schemaName) { .hasSize(1) .containsExactly( ColumnWithSerialType.ofBigSerial( - Column.ofNotNull(ctx.enrichWithSchema("one_more_table"), "id"), ctx.enrichWithSchema("one_more_table_id_seq")) + Column.ofNotNull(ctx, "one_more_table", "id"), ctx.enrichWithSchema("one_more_table_id_seq")) )); } @@ -116,11 +116,11 @@ void shouldDetectPrimaryKeysThatAreForeignKeysAsWell(final String schemaName) { .hasSize(3) .containsExactly( ColumnWithSerialType.ofBigSerial( - Column.ofNotNull(ctx.enrichWithSchema("one_more_table"), "id"), ctx.enrichWithSchema("one_more_table_id_seq")), + Column.ofNotNull(ctx, "one_more_table", "id"), ctx.enrichWithSchema("one_more_table_id_seq")), ColumnWithSerialType.ofBigSerial( - Column.ofNotNull(ctx.enrichWithSchema("test_table"), "id"), ctx.enrichWithSchema("test_table_id_seq")), + Column.ofNotNull(ctx, "test_table", "id"), ctx.enrichWithSchema("test_table_id_seq")), ColumnWithSerialType.ofBigSerial( - Column.ofNotNull(ctx.enrichWithSchema("test_table"), "num"), ctx.enrichWithSchema("test_table_num_seq")) + Column.ofNotNull(ctx, "test_table", "num"), ctx.enrichWithSchema("test_table_num_seq")) )); } } diff --git a/pg-index-health/src/test/java/io/github/mfvanek/pg/health/checks/cluster/ColumnsWithoutDescriptionCheckOnClusterTest.java b/pg-index-health/src/test/java/io/github/mfvanek/pg/health/checks/cluster/ColumnsWithoutDescriptionCheckOnClusterTest.java index c4d491ee..b2bb6f00 100644 --- a/pg-index-health/src/test/java/io/github/mfvanek/pg/health/checks/cluster/ColumnsWithoutDescriptionCheckOnClusterTest.java +++ b/pg-index-health/src/test/java/io/github/mfvanek/pg/health/checks/cluster/ColumnsWithoutDescriptionCheckOnClusterTest.java @@ -78,8 +78,8 @@ void shouldNotTakingIntoAccountBlankComments(final String schemaName) { .filteredOn(c -> "id".equalsIgnoreCase(c.getColumnName())) .hasSize(2) .containsExactly( - Column.ofNotNull(ctx.enrichWithSchema("accounts"), "id"), - Column.ofNotNull(ctx.enrichWithSchema("clients"), "id"))); + Column.ofNotNull(ctx, "accounts", "id"), + Column.ofNotNull(ctx, "clients", "id"))); } @ParameterizedTest diff --git a/pg-index-health/src/test/java/io/github/mfvanek/pg/health/checks/cluster/IndexesWithBooleanCheckOnClusterTest.java b/pg-index-health/src/test/java/io/github/mfvanek/pg/health/checks/cluster/IndexesWithBooleanCheckOnClusterTest.java index 0375629d..7770164f 100644 --- a/pg-index-health/src/test/java/io/github/mfvanek/pg/health/checks/cluster/IndexesWithBooleanCheckOnClusterTest.java +++ b/pg-index-health/src/test/java/io/github/mfvanek/pg/health/checks/cluster/IndexesWithBooleanCheckOnClusterTest.java @@ -44,8 +44,8 @@ void onDatabaseWithThem(final String schemaName) { .executing(ctx) .hasSize(1) .containsExactly( - IndexWithColumns.ofSingle(ctx.enrichWithSchema("accounts"), ctx.enrichWithSchema("i_accounts_deleted"), 0L, - Column.ofNotNull(ctx.enrichWithSchema("accounts"), "deleted"))); + IndexWithColumns.ofSingle(ctx, "accounts", "i_accounts_deleted", 0L, + Column.ofNotNull(ctx, "accounts", "deleted"))); assertThat(check) .executing(ctx, SkipTablesByNamePredicate.ofName(ctx, "accounts")) diff --git a/pg-index-health/src/test/java/io/github/mfvanek/pg/health/checks/cluster/PrimaryKeysWithSerialTypesCheckOnClusterTest.java b/pg-index-health/src/test/java/io/github/mfvanek/pg/health/checks/cluster/PrimaryKeysWithSerialTypesCheckOnClusterTest.java index 4bf04ff9..cadc7240 100644 --- a/pg-index-health/src/test/java/io/github/mfvanek/pg/health/checks/cluster/PrimaryKeysWithSerialTypesCheckOnClusterTest.java +++ b/pg-index-health/src/test/java/io/github/mfvanek/pg/health/checks/cluster/PrimaryKeysWithSerialTypesCheckOnClusterTest.java @@ -46,7 +46,7 @@ void onDatabaseWithThem(final String schemaName) { .hasSize(1) .containsExactlyInAnyOrder( ColumnWithSerialType.of( - Column.ofNotNull(ctx.enrichWithSchema("bad_accounts"), "id"), SerialType.BIG_SERIAL, ctx.enrichWithSchema("bad_accounts_id_seq") + Column.ofNotNull(ctx, "bad_accounts", "id"), SerialType.BIG_SERIAL, ctx.enrichWithSchema("bad_accounts_id_seq") )); assertThat(check)