From 821745406e779a80d3e544f91a5256c64b7aab52 Mon Sep 17 00:00:00 2001 From: Jon Schneider Date: Wed, 18 Jul 2018 22:03:31 -0500 Subject: [PATCH] Polish --- .../io/micrometer/influx/InfluxConfig.java | 42 +++++------ .../CreateDatabaseQueryBuilderTest.java | 72 +++++++++---------- 2 files changed, 56 insertions(+), 58 deletions(-) diff --git a/implementations/micrometer-registry-influx/src/main/java/io/micrometer/influx/InfluxConfig.java b/implementations/micrometer-registry-influx/src/main/java/io/micrometer/influx/InfluxConfig.java index 46ce09ee7..850438470 100644 --- a/implementations/micrometer-registry-influx/src/main/java/io/micrometer/influx/InfluxConfig.java +++ b/implementations/micrometer-registry-influx/src/main/java/io/micrometer/influx/InfluxConfig.java @@ -79,30 +79,30 @@ default String retentionPolicy() { return get(prefix() + ".retentionPolicy"); } - /** - * @return Time period for which influx should retain data in the current database (e.g. 2h, 52w). - */ - @Nullable - default String retentionDuration(){ - return get(prefix() + ".retentionDuration"); - } + /** + * @return Time period for which influx should retain data in the current database (e.g. 2h, 52w). + */ + @Nullable + default String retentionDuration() { + return get(prefix() + ".retentionDuration"); + } - /** - * @return How many copies of the data are stored in the cluster. Must be 1 for a single node instance. - */ - @Nullable - default Integer retentionReplicationFactor(){ - String v = get(prefix() + ".retentionReplicationFactor"); - return v == null ? null : Integer.parseInt(v); - } + /** + * @return How many copies of the data are stored in the cluster. Must be 1 for a single node instance. + */ + @Nullable + default Integer retentionReplicationFactor() { + String v = get(prefix() + ".retentionReplicationFactor"); + return v == null ? null : Integer.parseInt(v); + } /** - * @return The time range covered by a shard group (e.g. 2h, 52w). - */ - @Nullable - default String retentionShardDuration(){ - return get(prefix() + ".retentionShardDuration"); - } + * @return The time range covered by a shard group (e.g. 2h, 52w). + */ + @Nullable + default String retentionShardDuration() { + return get(prefix() + ".retentionShardDuration"); + } /** diff --git a/implementations/micrometer-registry-influx/src/test/java/io/micrometer/influx/CreateDatabaseQueryBuilderTest.java b/implementations/micrometer-registry-influx/src/test/java/io/micrometer/influx/CreateDatabaseQueryBuilderTest.java index 33466bedd..fdbc1596b 100644 --- a/implementations/micrometer-registry-influx/src/test/java/io/micrometer/influx/CreateDatabaseQueryBuilderTest.java +++ b/implementations/micrometer-registry-influx/src/test/java/io/micrometer/influx/CreateDatabaseQueryBuilderTest.java @@ -15,54 +15,52 @@ */ package io.micrometer.influx; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; class CreateDatabaseQueryBuilderTest { - private static String TEST_DB_NAME = "dummy_database_0"; + private static String TEST_DB_NAME = "dummy_database_0"; - /** - * Class Parameters: - * - * - database name - * - retention clauses - * - * Class Criteria - * - database name is not null -> true false - * - retention clauses -> no one all - */ - private final CreateDatabaseQueryBuilder createDatabaseQueryBuilder = new CreateDatabaseQueryBuilder(TEST_DB_NAME); + /** + * Class Parameters: + *

+ * - database name + * - retention clauses + *

+ * Class Criteria + * - database name is not null -> true false + * - retention clauses -> no one all + */ + private final CreateDatabaseQueryBuilder createDatabaseQueryBuilder = new CreateDatabaseQueryBuilder(TEST_DB_NAME); - @Test - void noEmptyDatabaseName() { - assertThrows(IllegalArgumentException.class, () -> new CreateDatabaseQueryBuilder(null)); - } + @Test + void noEmptyDatabaseName() { + assertThrows(IllegalArgumentException.class, () -> new CreateDatabaseQueryBuilder(null)); + } - @Test - void noRetentionPolicy() { - String query = createDatabaseQueryBuilder.build(); - assertEquals("CREATE DATABASE dummy_database_0", query); - } + @Test + void noRetentionPolicy() { + String query = createDatabaseQueryBuilder.build(); + assertEquals("CREATE DATABASE dummy_database_0", query); + } - @Test - void oneClauseInRetentionPolicy() { - String query = createDatabaseQueryBuilder.setRetentionPolicyName("dummy_policy").build(); - assertEquals("CREATE DATABASE dummy_database_0 WITH NAME dummy_policy", query); - } + @Test + void oneClauseInRetentionPolicy() { + String query = createDatabaseQueryBuilder.setRetentionPolicyName("dummy_policy").build(); + assertEquals("CREATE DATABASE dummy_database_0 WITH NAME dummy_policy", query); + } - @Test - void allClausesInRetentionPolicy() { - String query = createDatabaseQueryBuilder.setRetentionPolicyName("dummy_policy") - .setRetentionDuration("2d") - .setRetentionReplicationFactor(1) - .setRetentionShardDuration("3") - .build(); - assertEquals("CREATE DATABASE dummy_database_0 WITH DURATION 2d REPLICATION 1 SHARD DURATION 3 NAME dummy_policy", query); - } + @Test + void allClausesInRetentionPolicy() { + String query = createDatabaseQueryBuilder.setRetentionPolicyName("dummy_policy") + .setRetentionDuration("2d") + .setRetentionReplicationFactor(1) + .setRetentionShardDuration("3") + .build(); + assertEquals("CREATE DATABASE dummy_database_0 WITH DURATION 2d REPLICATION 1 SHARD DURATION 3 NAME dummy_policy", query); + } }