From 05840d58df3eef34ec835fe104a234ea16b5cae3 Mon Sep 17 00:00:00 2001 From: Ivan Vakhrushev Date: Sun, 24 Nov 2024 16:31:13 +0400 Subject: [PATCH] DatabaseChecks class was renamed to DatabaseChecksOnCluster (#510) --- .../mfvanek/pg/health/logger/AbstractHealthLogger.java | 6 +++--- .../{DatabaseChecks.java => DatabaseChecksOnCluster.java} | 4 ++-- .../mfvanek/pg/health/logger/KeyValueFileHealthLogger.java | 2 +- .../mfvanek/pg/health/logger/StandardHealthLogger.java | 2 +- ...baseChecksTest.java => DatabaseChecksOnClusterTest.java} | 6 +++--- .../github/mfvanek/pg/health/logger/HealthLoggerTest.java | 2 +- .../mfvanek/pg/health/logger/StandardHealthLoggerTest.java | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) rename pg-index-health-logger/src/main/java/io/github/mfvanek/pg/health/logger/{DatabaseChecks.java => DatabaseChecksOnCluster.java} (97%) rename pg-index-health-logger/src/test/java/io/github/mfvanek/pg/health/logger/{DatabaseChecksTest.java => DatabaseChecksOnClusterTest.java} (93%) diff --git a/pg-index-health-logger/src/main/java/io/github/mfvanek/pg/health/logger/AbstractHealthLogger.java b/pg-index-health-logger/src/main/java/io/github/mfvanek/pg/health/logger/AbstractHealthLogger.java index a01412a3..97308cfc 100644 --- a/pg-index-health-logger/src/main/java/io/github/mfvanek/pg/health/logger/AbstractHealthLogger.java +++ b/pg-index-health-logger/src/main/java/io/github/mfvanek/pg/health/logger/AbstractHealthLogger.java @@ -57,14 +57,14 @@ public abstract class AbstractHealthLogger implements HealthLogger { private final ConnectionCredentials credentials; private final HighAvailabilityPgConnectionFactory connectionFactory; - private final Function databaseChecksFactory; - private final AtomicReference databaseChecksHolder = new AtomicReference<>(); + private final Function databaseChecksFactory; + private final AtomicReference databaseChecksHolder = new AtomicReference<>(); private final AtomicReference pgContextHolder = new AtomicReference<>(); @SuppressWarnings("WeakerAccess") protected AbstractHealthLogger(@Nonnull final ConnectionCredentials credentials, @Nonnull final HighAvailabilityPgConnectionFactory connectionFactory, - @Nonnull final Function databaseChecksFactory) { + @Nonnull final Function databaseChecksFactory) { this.credentials = Objects.requireNonNull(credentials, "credentials cannot be null"); this.connectionFactory = Objects.requireNonNull(connectionFactory, "connectionFactory cannot be null"); this.databaseChecksFactory = Objects.requireNonNull(databaseChecksFactory, "databaseChecksFactory cannot be null"); diff --git a/pg-index-health-logger/src/main/java/io/github/mfvanek/pg/health/logger/DatabaseChecks.java b/pg-index-health-logger/src/main/java/io/github/mfvanek/pg/health/logger/DatabaseChecksOnCluster.java similarity index 97% rename from pg-index-health-logger/src/main/java/io/github/mfvanek/pg/health/logger/DatabaseChecks.java rename to pg-index-health-logger/src/main/java/io/github/mfvanek/pg/health/logger/DatabaseChecksOnCluster.java index 2398f0a9..72c788b3 100644 --- a/pg-index-health-logger/src/main/java/io/github/mfvanek/pg/health/logger/DatabaseChecks.java +++ b/pg-index-health-logger/src/main/java/io/github/mfvanek/pg/health/logger/DatabaseChecksOnCluster.java @@ -50,11 +50,11 @@ @SuppressWarnings({"checkstyle:ClassDataAbstractionCoupling", "checkstyle:ClassFanOutComplexity"}) @ThreadSafe -public class DatabaseChecks { +public final class DatabaseChecksOnCluster { private final ConcurrentMap> checks = new ConcurrentHashMap<>(); - public DatabaseChecks(@Nonnull final HighAvailabilityPgConnection haPgConnection) { + public DatabaseChecksOnCluster(@Nonnull final HighAvailabilityPgConnection haPgConnection) { final Stream> allChecks = Stream.of( new TablesWithBloatCheckOnCluster(haPgConnection), new TablesWithMissingIndexesCheckOnCluster(haPgConnection), diff --git a/pg-index-health-logger/src/main/java/io/github/mfvanek/pg/health/logger/KeyValueFileHealthLogger.java b/pg-index-health-logger/src/main/java/io/github/mfvanek/pg/health/logger/KeyValueFileHealthLogger.java index d5cf027f..831853fd 100644 --- a/pg-index-health-logger/src/main/java/io/github/mfvanek/pg/health/logger/KeyValueFileHealthLogger.java +++ b/pg-index-health-logger/src/main/java/io/github/mfvanek/pg/health/logger/KeyValueFileHealthLogger.java @@ -47,7 +47,7 @@ public class KeyValueFileHealthLogger extends AbstractHealthLogger { public KeyValueFileHealthLogger(@Nonnull final ConnectionCredentials credentials, @Nonnull final HighAvailabilityPgConnectionFactory connectionFactory, - @Nonnull final Function databaseChecksFactory) { + @Nonnull final Function databaseChecksFactory) { super(credentials, connectionFactory, databaseChecksFactory); } diff --git a/pg-index-health-logger/src/main/java/io/github/mfvanek/pg/health/logger/StandardHealthLogger.java b/pg-index-health-logger/src/main/java/io/github/mfvanek/pg/health/logger/StandardHealthLogger.java index 146efcdc..775cff80 100644 --- a/pg-index-health-logger/src/main/java/io/github/mfvanek/pg/health/logger/StandardHealthLogger.java +++ b/pg-index-health-logger/src/main/java/io/github/mfvanek/pg/health/logger/StandardHealthLogger.java @@ -26,7 +26,7 @@ public class StandardHealthLogger extends AbstractHealthLogger { public StandardHealthLogger(@Nonnull final ConnectionCredentials credentials, @Nonnull final HighAvailabilityPgConnectionFactory connectionFactory, - @Nonnull final Function databaseChecksFactory) { + @Nonnull final Function databaseChecksFactory) { super(credentials, connectionFactory, databaseChecksFactory); } diff --git a/pg-index-health-logger/src/test/java/io/github/mfvanek/pg/health/logger/DatabaseChecksTest.java b/pg-index-health-logger/src/test/java/io/github/mfvanek/pg/health/logger/DatabaseChecksOnClusterTest.java similarity index 93% rename from pg-index-health-logger/src/test/java/io/github/mfvanek/pg/health/logger/DatabaseChecksTest.java rename to pg-index-health-logger/src/test/java/io/github/mfvanek/pg/health/logger/DatabaseChecksOnClusterTest.java index 7dc68b9e..bdd00e80 100644 --- a/pg-index-health-logger/src/test/java/io/github/mfvanek/pg/health/logger/DatabaseChecksTest.java +++ b/pg-index-health-logger/src/test/java/io/github/mfvanek/pg/health/logger/DatabaseChecksOnClusterTest.java @@ -30,11 +30,11 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -class DatabaseChecksTest extends DatabaseAwareTestBase { +class DatabaseChecksOnClusterTest extends DatabaseAwareTestBase { private static final String[] SCHEMAS = {PgContext.DEFAULT_SCHEMA_NAME, "custom"}; - private final DatabaseChecks checks = new DatabaseChecks(getHaPgConnection()); + private final DatabaseChecksOnCluster checks = new DatabaseChecksOnCluster(getHaPgConnection()); @Test void shouldThrowExceptionForInvalidType() { @@ -62,7 +62,7 @@ void getAllChecksShouldWork() { @Test @SuppressForbidden void shouldThrowExceptionIfCheckNotFound() throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { - final DatabaseChecks databaseChecks = new DatabaseChecks(getHaPgConnection()); + final DatabaseChecksOnCluster databaseChecks = new DatabaseChecksOnCluster(getHaPgConnection()); final Field field = databaseChecks.getClass().getDeclaredField("checks"); field.setAccessible(true); final Object fieldValue = field.get(databaseChecks); diff --git a/pg-index-health-logger/src/test/java/io/github/mfvanek/pg/health/logger/HealthLoggerTest.java b/pg-index-health-logger/src/test/java/io/github/mfvanek/pg/health/logger/HealthLoggerTest.java index b15bff82..79898a42 100644 --- a/pg-index-health-logger/src/test/java/io/github/mfvanek/pg/health/logger/HealthLoggerTest.java +++ b/pg-index-health-logger/src/test/java/io/github/mfvanek/pg/health/logger/HealthLoggerTest.java @@ -47,7 +47,7 @@ static void tearDown() { @Nonnull @Override protected HealthLogger getHealthLogger() { - return new KeyValueFileHealthLogger(getConnectionCredentials(), getConnectionFactory(), DatabaseChecks::new); + return new KeyValueFileHealthLogger(getConnectionCredentials(), getConnectionFactory(), DatabaseChecksOnCluster::new); } @Nonnull diff --git a/pg-index-health-logger/src/test/java/io/github/mfvanek/pg/health/logger/StandardHealthLoggerTest.java b/pg-index-health-logger/src/test/java/io/github/mfvanek/pg/health/logger/StandardHealthLoggerTest.java index eb475600..e0c16032 100644 --- a/pg-index-health-logger/src/test/java/io/github/mfvanek/pg/health/logger/StandardHealthLoggerTest.java +++ b/pg-index-health-logger/src/test/java/io/github/mfvanek/pg/health/logger/StandardHealthLoggerTest.java @@ -19,7 +19,7 @@ class StandardHealthLoggerTest extends HealthLoggerTestBase { @Nonnull @Override protected HealthLogger getHealthLogger() { - return new StandardHealthLogger(getConnectionCredentials(), getConnectionFactory(), DatabaseChecks::new); + return new StandardHealthLogger(getConnectionCredentials(), getConnectionFactory(), DatabaseChecksOnCluster::new); } @Nonnull