JAMES-2549 Remove unused properties
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/9e66ddb1 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/9e66ddb1 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/9e66ddb1 Branch: refs/heads/master Commit: 9e66ddb133d12e9564f2ad154e164dedfb14b4e9 Parents: 0f08a46 Author: Antoine Duprat <adup...@linagora.com> Authored: Tue Sep 18 08:51:05 2018 +0200 Committer: Antoine Duprat <adup...@linagora.com> Committed: Tue Sep 18 08:51:05 2018 +0200 ---------------------------------------------------------------------- .../backends/cassandra/init/ClusterBuilder.java | 30 +------------------ .../cassandra/init/ClusterBuilderTest.java | 31 -------------------- 2 files changed, 1 insertion(+), 60 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/9e66ddb1/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/ClusterBuilder.java ---------------------------------------------------------------------- diff --git a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/ClusterBuilder.java b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/ClusterBuilder.java index 851b302..8ba0d6a 100644 --- a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/ClusterBuilder.java +++ b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/ClusterBuilder.java @@ -51,9 +51,6 @@ public class ClusterBuilder { private Optional<Integer> port; private Optional<Collection<Host>> servers; - private Optional<Integer> refreshSchemaIntervalMillis; - private boolean forTest; - private Optional<QueryLoggerConfiguration> queryLogger; private Optional<Integer> readTimeoutMillis; private Optional<Integer> connectTimeoutMillis; @@ -67,9 +64,6 @@ public class ClusterBuilder { port = Optional.empty(); servers = Optional.empty(); - refreshSchemaIntervalMillis = Optional.empty(); - forTest = false; - queryLogger = Optional.empty(); readTimeoutMillis = Optional.empty(); connectTimeoutMillis = Optional.empty(); @@ -110,12 +104,6 @@ public class ClusterBuilder { return this; } - public ClusterBuilder refreshSchemaIntervalMillis(int refreshSchemaIntervalMillis) { - this.refreshSchemaIntervalMillis = Optional.of(refreshSchemaIntervalMillis); - - return this; - } - public ClusterBuilder servers(Host... servers) { this.servers = Optional.of(ImmutableList.copyOf(servers)); @@ -128,12 +116,6 @@ public class ClusterBuilder { return this; } - public ClusterBuilder forTest() { - this.forTest = true; - - return this; - } - public ClusterBuilder queryLoggerConfiguration(QueryLoggerConfiguration queryLogger) { this.queryLogger = Optional.of(queryLogger); @@ -154,7 +136,6 @@ public class ClusterBuilder { Preconditions.checkState(!(servers.isPresent() && host.isPresent()), "You can't specify a list of servers and a host at the same time"); Preconditions.checkState(!(servers.isPresent() && port.isPresent()), "You can't specify a list of servers and a port at the same time"); Preconditions.checkState(username.isPresent() == password.isPresent(), "If you specify username, you must specify password"); - Preconditions.checkState(forTest == refreshSchemaIntervalMillis.isPresent(), "You can't specify refreshSchemaIntervalMillis for test"); Cluster.Builder clusterBuilder = Cluster.builder(); getServers().forEach( @@ -185,17 +166,8 @@ public class ClusterBuilder { } private QueryOptions queryOptions() { - QueryOptions queryOptions = new QueryOptions() + return new QueryOptions() .setConsistencyLevel(ConsistencyLevel.QUORUM); - - getRefreshSchemaIntervalMillis().ifPresent(refreshSchemaIntervalMillis -> - queryOptions.setRefreshSchemaIntervalMillis(refreshSchemaIntervalMillis)); - - return queryOptions; - } - - private Optional<Integer> getRefreshSchemaIntervalMillis() { - return refreshSchemaIntervalMillis; } private Collection<Host> getServers() { http://git-wip-us.apache.org/repos/asf/james-project/blob/9e66ddb1/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/init/ClusterBuilderTest.java ---------------------------------------------------------------------- diff --git a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/init/ClusterBuilderTest.java b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/init/ClusterBuilderTest.java index 9f081c2..9c440f4 100644 --- a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/init/ClusterBuilderTest.java +++ b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/init/ClusterBuilderTest.java @@ -40,35 +40,4 @@ class ClusterBuilderTest { assertThat(consistencyLevel).isEqualTo(ConsistencyLevel.QUORUM); } - - @Test - void refreshSchemaIntervalMillisShouldReturnDefaultValueWhenNotGiven() { - Cluster cluster = ClusterBuilder.builder() - .host("localhost") - .port(ClusterBuilder.DEFAULT_CASSANDRA_PORT) - .build(); - - int refreshSchemaIntervalMillis = cluster.getConfiguration() - .getQueryOptions() - .getRefreshSchemaIntervalMillis(); - - assertThat(refreshSchemaIntervalMillis).isEqualTo(1000); - } - - @Test - void refreshSchemaIntervalMillisShouldReturnCustomValueWhenGiven() { - int expected = 123; - Cluster cluster = ClusterBuilder.builder() - .host("localhost") - .port(ClusterBuilder.DEFAULT_CASSANDRA_PORT) - .forTest() - .refreshSchemaIntervalMillis(expected) - .build(); - - int refreshSchemaIntervalMillis = cluster.getConfiguration() - .getQueryOptions() - .getRefreshSchemaIntervalMillis(); - - assertThat(refreshSchemaIntervalMillis).isEqualTo(expected); - } } --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org