You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ad...@apache.org on 2018/12/07 16:13:17 UTC
[09/11] james-project git commit: JAMES-2590 IndexCreationFactory
should depend on ES configuration
JAMES-2590 IndexCreationFactory should depend on ES configuration
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/1d6aae0f
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/1d6aae0f
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/1d6aae0f
Branch: refs/heads/3.2.x
Commit: 1d6aae0f0b6b055716d432aae546e44ce3a01fd5
Parents: a3f6c0b
Author: Antoine Duprat <ad...@linagora.com>
Authored: Mon Nov 12 21:09:39 2018 +0100
Committer: Antoine Duprat <ad...@linagora.com>
Committed: Fri Dec 7 17:11:56 2018 +0100
----------------------------------------------------------------------
.../backends/es/ElasticSearchConfiguration.java | 14 +++++----
.../james/backends/es/IndexCreationFactory.java | 32 ++++++--------------
.../es/ElasticSearchConfigurationTest.java | 23 ++++++++++++++
.../backends/es/ElasticSearchIndexerTest.java | 2 +-
.../backends/es/IndexCreationFactoryTest.java | 32 +++-----------------
.../backends/es/NodeMappingFactoryTest.java | 2 +-
.../backends/es/search/ScrollIterableTest.java | 3 +-
.../elasticsearch/MailboxIndexCreationUtil.java | 11 ++++---
.../ElasticSearchIntegrationTest.java | 4 ++-
.../QuotaSearchIndexCreationUtil.java | 11 ++++---
...ticSearchQuotaSearchTestSystemExtension.java | 3 +-
.../ElasticSearchQuotaMailboxListenerTest.java | 3 +-
.../host/ElasticSearchHostSystem.java | 4 ++-
.../mailbox/ElasticSearchMailboxModule.java | 6 ++--
.../james/modules/TestElasticSearchModule.java | 3 +-
.../ElasticSearchQuotaSearchExtension.java | 4 ++-
16 files changed, 81 insertions(+), 76 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/1d6aae0f/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchConfiguration.java
----------------------------------------------------------------------
diff --git a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchConfiguration.java b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchConfiguration.java
index abb9026..b97d9d7 100644
--- a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchConfiguration.java
+++ b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchConfiguration.java
@@ -137,13 +137,15 @@ public class ElasticSearchConfiguration {
return this;
}
- public Builder nbShards(Optional<Integer> nbShards) {
- this.nbShards = nbShards;
+ public Builder nbShards(int nbShards) {
+ Preconditions.checkArgument(nbShards > 0, "You need the number of shards to be strictly positive");
+ this.nbShards = Optional.of(nbShards);
return this;
}
- public Builder nbReplica(Optional<Integer> nbReplica) {
- this.nbReplica = nbReplica;
+ public Builder nbReplica(int nbReplica) {
+ Preconditions.checkArgument(nbReplica >= 0, "You need the number of replica to be positive");
+ this.nbReplica = Optional.of(nbReplica);
return this;
}
@@ -220,8 +222,8 @@ public class ElasticSearchConfiguration {
.indexQuotaRatioName(computeQuotaSearchIndexName(configuration))
.readAliasQuotaRatioName(computeQuotaSearchReadAlias(configuration))
.writeAliasQuotaRatioName(computeQuotaSearchWriteAlias(configuration))
- .nbShards(Optional.ofNullable(configuration.getInteger(ELASTICSEARCH_NB_SHARDS, null)))
- .nbReplica(Optional.ofNullable(configuration.getInteger(ELASTICSEARCH_NB_REPLICA, null)))
+ .nbShards(configuration.getInteger(ELASTICSEARCH_NB_SHARDS, DEFAULT_NB_SHARDS))
+ .nbReplica(configuration.getInteger(ELASTICSEARCH_NB_REPLICA, DEFAULT_NB_REPLICA))
.minDelay(Optional.ofNullable(configuration.getInteger(ELASTICSEARCH_RETRY_CONNECTION_MIN_DELAY, null)))
.maxRetries(Optional.ofNullable(configuration.getInteger(ELASTICSEARCH_RETRY_CONNECTION_MAX_RETRIES, null)))
.indexAttachment(provideIndexAttachments(configuration))
http://git-wip-us.apache.org/repos/asf/james-project/blob/1d6aae0f/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/IndexCreationFactory.java
----------------------------------------------------------------------
diff --git a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/IndexCreationFactory.java b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/IndexCreationFactory.java
index 7da3d8a..586c3bf 100644
--- a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/IndexCreationFactory.java
+++ b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/IndexCreationFactory.java
@@ -23,7 +23,8 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Optional;
+
+import javax.inject.Inject;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
@@ -38,8 +39,6 @@ import com.google.common.base.Preconditions;
public class IndexCreationFactory {
private static final Logger LOGGER = LoggerFactory.getLogger(IndexCreationFactory.class);
- private static final int DEFAULT_NB_SHARDS = 1;
- private static final int DEFAULT_NB_REPLICA = 0;
public static final String CASE_INSENSITIVE = "case_insensitive";
public static final String KEEP_MAIL_AND_URL = "keep_mail_and_url";
public static final String SNOWBALL_KEEP_MAIL_AND_URL = "snowball_keep_mail_and_token";
@@ -47,14 +46,15 @@ public class IndexCreationFactory {
private IndexName indexName;
private ArrayList<AliasName> aliases;
- private Optional<Integer> nbShards;
- private Optional<Integer> nbReplica;
+ private int nbShards;
+ private int nbReplica;
- public IndexCreationFactory() {
+ @Inject
+ public IndexCreationFactory(ElasticSearchConfiguration configuration) {
indexName = null;
aliases = new ArrayList<>();
- nbShards = Optional.empty();
- nbReplica = Optional.empty();
+ nbShards = configuration.getNbShards();
+ nbReplica = configuration.getNbReplica();
}
public IndexCreationFactory useIndex(IndexName indexName) {
@@ -69,24 +69,10 @@ public class IndexCreationFactory {
return this;
}
- public IndexCreationFactory nbShards(int nbShards) {
- Preconditions.checkArgument(nbShards > 0, "You need the number of shards to be strictly positive");
- this.nbShards = Optional.of(nbShards);
- return this;
- }
-
- public IndexCreationFactory nbReplica(int nbReplica) {
- Preconditions.checkArgument(nbReplica >= 0, "You need the number of replica to be positive");
- this.nbReplica = Optional.of(nbReplica);
- return this;
- }
-
public Client createIndexAndAliases(Client client) {
Preconditions.checkNotNull(indexName);
try {
- createIndexIfNeeded(client, indexName, generateSetting(
- nbShards.orElse(DEFAULT_NB_SHARDS),
- nbReplica.orElse(DEFAULT_NB_REPLICA)));
+ createIndexIfNeeded(client, indexName, generateSetting(nbShards, nbReplica));
aliases.forEach(alias -> createAliasIfNeeded(client, indexName, alias));
} catch (IOException e) {
LOGGER.error("Error while creating index : ", e);
http://git-wip-us.apache.org/repos/asf/james-project/blob/1d6aae0f/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ElasticSearchConfigurationTest.java
----------------------------------------------------------------------
diff --git a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ElasticSearchConfigurationTest.java b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ElasticSearchConfigurationTest.java
index 6fa85ac..3021a08 100644
--- a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ElasticSearchConfigurationTest.java
+++ b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ElasticSearchConfigurationTest.java
@@ -509,4 +509,27 @@ public class ElasticSearchConfigurationTest {
}
+ @Test
+ public void nbReplicaShouldThrowWhenNegative() {
+ assertThatThrownBy(() ->
+ ElasticSearchConfiguration.builder()
+ .nbReplica(-1))
+ .isInstanceOf(IllegalArgumentException.class);
+ }
+
+ @Test
+ public void nbShardsShouldThrowWhenNegative() {
+ assertThatThrownBy(() ->
+ ElasticSearchConfiguration.builder()
+ .nbShards(-1))
+ .isInstanceOf(IllegalArgumentException.class);
+ }
+
+ @Test
+ public void nbShardsShouldThrowWhenZero() {
+ assertThatThrownBy(() ->
+ ElasticSearchConfiguration.builder()
+ .nbShards(0))
+ .isInstanceOf(IllegalArgumentException.class);
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/1d6aae0f/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ElasticSearchIndexerTest.java
----------------------------------------------------------------------
diff --git a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ElasticSearchIndexerTest.java b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ElasticSearchIndexerTest.java
index ee37e80..fa51c8f 100644
--- a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ElasticSearchIndexerTest.java
+++ b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ElasticSearchIndexerTest.java
@@ -57,7 +57,7 @@ public class ElasticSearchIndexerTest {
public void setup() {
node = embeddedElasticSearch.getNode();
TestingClientProvider clientProvider = new TestingClientProvider(node);
- new IndexCreationFactory()
+ new IndexCreationFactory(ElasticSearchConfiguration.DEFAULT_CONFIGURATION)
.useIndex(INDEX_NAME)
.addAlias(ALIAS_NAME)
.createIndexAndAliases(clientProvider.get());
http://git-wip-us.apache.org/repos/asf/james-project/blob/1d6aae0f/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/IndexCreationFactoryTest.java
----------------------------------------------------------------------
diff --git a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/IndexCreationFactoryTest.java b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/IndexCreationFactoryTest.java
index 1c9f1d8..8c51bc2 100644
--- a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/IndexCreationFactoryTest.java
+++ b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/IndexCreationFactoryTest.java
@@ -43,7 +43,7 @@ public class IndexCreationFactoryTest {
@Before
public void setUp() {
clientProvider = new TestingClientProvider(embeddedElasticSearch.getNode());
- new IndexCreationFactory()
+ new IndexCreationFactory(ElasticSearchConfiguration.DEFAULT_CONFIGURATION)
.useIndex(INDEX_NAME)
.addAlias(ALIAS_NAME)
.createIndexAndAliases(clientProvider.get());
@@ -51,7 +51,7 @@ public class IndexCreationFactoryTest {
@Test
public void createIndexAndAliasShouldNotThrowWhenCalledSeveralTime() {
- new IndexCreationFactory()
+ new IndexCreationFactory(ElasticSearchConfiguration.DEFAULT_CONFIGURATION)
.useIndex(INDEX_NAME)
.addAlias(ALIAS_NAME)
.createIndexAndAliases(clientProvider.get());
@@ -60,7 +60,7 @@ public class IndexCreationFactoryTest {
@Test
public void useIndexShouldThrowWhenNull() {
assertThatThrownBy(() ->
- new IndexCreationFactory()
+ new IndexCreationFactory(ElasticSearchConfiguration.DEFAULT_CONFIGURATION)
.useIndex(null))
.isInstanceOf(NullPointerException.class);
}
@@ -68,32 +68,8 @@ public class IndexCreationFactoryTest {
@Test
public void addAliasShouldThrowWhenNull() {
assertThatThrownBy(() ->
- new IndexCreationFactory()
+ new IndexCreationFactory(ElasticSearchConfiguration.DEFAULT_CONFIGURATION)
.addAlias(null))
.isInstanceOf(NullPointerException.class);
}
-
- @Test
- public void nbReplicaShouldThrowWhenNegative() {
- assertThatThrownBy(() ->
- new IndexCreationFactory()
- .nbReplica(-1))
- .isInstanceOf(IllegalArgumentException.class);
- }
-
- @Test
- public void nbShardsShouldThrowWhenNegative() {
- assertThatThrownBy(() ->
- new IndexCreationFactory()
- .nbShards(-1))
- .isInstanceOf(IllegalArgumentException.class);
- }
-
- @Test
- public void nbShardsShouldThrowWhenZero() {
- assertThatThrownBy(() ->
- new IndexCreationFactory()
- .nbShards(0))
- .isInstanceOf(IllegalArgumentException.class);
- }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/1d6aae0f/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/NodeMappingFactoryTest.java
----------------------------------------------------------------------
diff --git a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/NodeMappingFactoryTest.java b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/NodeMappingFactoryTest.java
index 50e2f1e..60170a5 100644
--- a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/NodeMappingFactoryTest.java
+++ b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/NodeMappingFactoryTest.java
@@ -46,7 +46,7 @@ public class NodeMappingFactoryTest {
@Before
public void setUp() throws Exception {
clientProvider = new TestingClientProvider(embeddedElasticSearch.getNode());
- new IndexCreationFactory()
+ new IndexCreationFactory(ElasticSearchConfiguration.DEFAULT_CONFIGURATION)
.useIndex(INDEX_NAME)
.addAlias(ALIAS_NAME)
.createIndexAndAliases(clientProvider.get());
http://git-wip-us.apache.org/repos/asf/james-project/blob/1d6aae0f/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/search/ScrollIterableTest.java
----------------------------------------------------------------------
diff --git a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/search/ScrollIterableTest.java b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/search/ScrollIterableTest.java
index 4c65a9b..01032e6 100644
--- a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/search/ScrollIterableTest.java
+++ b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/search/ScrollIterableTest.java
@@ -29,6 +29,7 @@ import java.util.List;
import java.util.stream.Collectors;
import org.apache.james.backends.es.ClientProvider;
+import org.apache.james.backends.es.ElasticSearchConfiguration;
import org.apache.james.backends.es.EmbeddedElasticSearch;
import org.apache.james.backends.es.IndexCreationFactory;
import org.apache.james.backends.es.IndexName;
@@ -67,7 +68,7 @@ public class ScrollIterableTest {
@Before
public void setUp() throws Exception {
clientProvider = new TestingClientProvider(embeddedElasticSearch.getNode());
- new IndexCreationFactory()
+ new IndexCreationFactory(ElasticSearchConfiguration.DEFAULT_CONFIGURATION)
.useIndex(INDEX_NAME)
.addAlias(ALIAS_NAME)
.createIndexAndAliases(clientProvider.get());
http://git-wip-us.apache.org/repos/asf/james-project/blob/1d6aae0f/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/MailboxIndexCreationUtil.java
----------------------------------------------------------------------
diff --git a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/MailboxIndexCreationUtil.java b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/MailboxIndexCreationUtil.java
index 506c05b..c03773b 100644
--- a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/MailboxIndexCreationUtil.java
+++ b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/MailboxIndexCreationUtil.java
@@ -19,6 +19,7 @@
package org.apache.james.mailbox.elasticsearch;
+import org.apache.james.backends.es.ElasticSearchConfiguration;
import org.apache.james.backends.es.IndexCreationFactory;
import org.apache.james.backends.es.IndexName;
import org.apache.james.backends.es.MailboxElasticSearchConstants;
@@ -32,10 +33,11 @@ public class MailboxIndexCreationUtil {
public static Client prepareClient(Client client,
ReadAliasName readAlias,
WriteAliasName writeAlias,
- IndexName indexName) {
+ IndexName indexName,
+ ElasticSearchConfiguration configuration) {
return NodeMappingFactory.applyMapping(
- new IndexCreationFactory()
+ new IndexCreationFactory(configuration)
.useIndex(indexName)
.addAlias(readAlias)
.addAlias(writeAlias)
@@ -45,10 +47,11 @@ public class MailboxIndexCreationUtil {
MailboxMappingFactory.getMappingContent());
}
- public static Client prepareDefaultClient(Client client) {
+ public static Client prepareDefaultClient(Client client, ElasticSearchConfiguration configuration) {
return prepareClient(client,
MailboxElasticSearchConstants.DEFAULT_MAILBOX_READ_ALIAS,
MailboxElasticSearchConstants.DEFAULT_MAILBOX_WRITE_ALIAS,
- MailboxElasticSearchConstants.DEFAULT_MAILBOX_INDEX);
+ MailboxElasticSearchConstants.DEFAULT_MAILBOX_INDEX,
+ configuration);
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/1d6aae0f/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIntegrationTest.java
----------------------------------------------------------------------
diff --git a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIntegrationTest.java b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIntegrationTest.java
index bb22f74..991453a 100644
--- a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIntegrationTest.java
+++ b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIntegrationTest.java
@@ -25,6 +25,7 @@ import java.nio.charset.StandardCharsets;
import java.time.ZoneId;
import java.util.concurrent.Executors;
+import org.apache.james.backends.es.ElasticSearchConfiguration;
import org.apache.james.backends.es.ElasticSearchIndexer;
import org.apache.james.backends.es.EmbeddedElasticSearch;
import org.apache.james.backends.es.IndexAttachments;
@@ -94,7 +95,8 @@ public class ElasticSearchIntegrationTest extends AbstractMessageSearchIndexTest
@Override
protected void initializeMailboxManager() throws Exception {
Client client = MailboxIndexCreationUtil.prepareDefaultClient(
- new TestingClientProvider(embeddedElasticSearch.getNode()).get());
+ new TestingClientProvider(embeddedElasticSearch.getNode()).get(),
+ ElasticSearchConfiguration.DEFAULT_CONFIGURATION);
storeMailboxManager = new InMemoryIntegrationResources()
.createMailboxManager(new SimpleGroupMembershipResolver());
http://git-wip-us.apache.org/repos/asf/james-project/blob/1d6aae0f/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/QuotaSearchIndexCreationUtil.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/QuotaSearchIndexCreationUtil.java b/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/QuotaSearchIndexCreationUtil.java
index a4a1103..5f8d654 100644
--- a/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/QuotaSearchIndexCreationUtil.java
+++ b/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/QuotaSearchIndexCreationUtil.java
@@ -20,6 +20,7 @@
package org.apache.james.quota.search.elasticsearch;
import org.apache.james.backends.es.AliasName;
+import org.apache.james.backends.es.ElasticSearchConfiguration;
import org.apache.james.backends.es.IndexCreationFactory;
import org.apache.james.backends.es.IndexName;
import org.apache.james.backends.es.NodeMappingFactory;
@@ -31,10 +32,11 @@ public class QuotaSearchIndexCreationUtil {
public static Client prepareClient(Client client,
AliasName readAlias,
AliasName writeAlias,
- IndexName indexName) {
+ IndexName indexName,
+ ElasticSearchConfiguration configuration) {
return NodeMappingFactory.applyMapping(
- new IndexCreationFactory()
+ new IndexCreationFactory(configuration)
.useIndex(indexName)
.addAlias(readAlias)
.addAlias(writeAlias)
@@ -44,10 +46,11 @@ public class QuotaSearchIndexCreationUtil {
QuotaRatioMappingFactory.getMappingContent());
}
- public static Client prepareDefaultClient(Client client) {
+ public static Client prepareDefaultClient(Client client, ElasticSearchConfiguration configuration) {
return prepareClient(client,
QuotaRatioElasticSearchConstants.DEFAULT_QUOTA_RATIO_READ_ALIAS,
QuotaRatioElasticSearchConstants.DEFAULT_QUOTA_RATIO_WRITE_ALIAS,
- QuotaRatioElasticSearchConstants.DEFAULT_QUOTA_RATIO_INDEX);
+ QuotaRatioElasticSearchConstants.DEFAULT_QUOTA_RATIO_INDEX,
+ configuration);
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/1d6aae0f/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/ElasticSearchQuotaSearchTestSystemExtension.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/ElasticSearchQuotaSearchTestSystemExtension.java b/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/ElasticSearchQuotaSearchTestSystemExtension.java
index e38b37d..cf3ba91 100644
--- a/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/ElasticSearchQuotaSearchTestSystemExtension.java
+++ b/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/ElasticSearchQuotaSearchTestSystemExtension.java
@@ -23,6 +23,7 @@ import static org.mockito.Mockito.mock;
import java.util.concurrent.Executors;
+import org.apache.james.backends.es.ElasticSearchConfiguration;
import org.apache.james.backends.es.ElasticSearchIndexer;
import org.apache.james.backends.es.EmbeddedElasticSearch;
import org.apache.james.backends.es.QuotaRatioElasticSearchConstants;
@@ -59,7 +60,7 @@ public class ElasticSearchQuotaSearchTestSystemExtension implements ParameterRes
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException {
try {
Client client = QuotaSearchIndexCreationUtil.prepareDefaultClient(
- new TestingClientProvider(embeddedElasticSearch.getNode()).get());
+ new TestingClientProvider(embeddedElasticSearch.getNode()).get(), ElasticSearchConfiguration.DEFAULT_CONFIGURATION);
InMemoryIntegrationResources.Resources resources = new InMemoryIntegrationResources().createResources(new SimpleGroupMembershipResolver());
http://git-wip-us.apache.org/repos/asf/james-project/blob/1d6aae0f/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/events/ElasticSearchQuotaMailboxListenerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/events/ElasticSearchQuotaMailboxListenerTest.java b/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/events/ElasticSearchQuotaMailboxListenerTest.java
index fa94dbe..6e8e678 100644
--- a/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/events/ElasticSearchQuotaMailboxListenerTest.java
+++ b/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/events/ElasticSearchQuotaMailboxListenerTest.java
@@ -27,6 +27,7 @@ import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
import java.util.concurrent.Executors;
+import org.apache.james.backends.es.ElasticSearchConfiguration;
import org.apache.james.backends.es.ElasticSearchIndexer;
import org.apache.james.backends.es.EmbeddedElasticSearch;
import org.apache.james.backends.es.utils.TestingClientProvider;
@@ -63,7 +64,7 @@ public class ElasticSearchQuotaMailboxListenerTest {
@Before
public void setUp() {
client = QuotaSearchIndexCreationUtil.prepareDefaultClient(
- new TestingClientProvider(embeddedElasticSearch.getNode()).get());
+ new TestingClientProvider(embeddedElasticSearch.getNode()).get(), ElasticSearchConfiguration.DEFAULT_CONFIGURATION);
quotaMailboxListener = new ElasticSearchQuotaMailboxListener(
new ElasticSearchIndexer(client,
http://git-wip-us.apache.org/repos/asf/james-project/blob/1d6aae0f/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java b/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java
index 93ce690..72042d0 100644
--- a/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java
+++ b/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java
@@ -26,6 +26,7 @@ import java.util.concurrent.Executors;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.NotImplementedException;
+import org.apache.james.backends.es.ElasticSearchConfiguration;
import org.apache.james.backends.es.ElasticSearchIndexer;
import org.apache.james.backends.es.EmbeddedElasticSearch;
import org.apache.james.backends.es.utils.TestingClientProvider;
@@ -89,7 +90,8 @@ public class ElasticSearchHostSystem extends JamesImapHostSystem {
private void initFields() throws MailboxException {
Client client = MailboxIndexCreationUtil.prepareDefaultClient(
- new TestingClientProvider(embeddedElasticSearch.getNode()).get());
+ new TestingClientProvider(embeddedElasticSearch.getNode()).get(),
+ ElasticSearchConfiguration.DEFAULT_CONFIGURATION);
InMemoryMailboxSessionMapperFactory factory = new InMemoryMailboxSessionMapperFactory();
InMemoryMessageId.Factory messageIdFactory = new InMemoryMessageId.Factory();
http://git-wip-us.apache.org/repos/asf/james-project/blob/1d6aae0f/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ElasticSearchMailboxModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ElasticSearchMailboxModule.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ElasticSearchMailboxModule.java
index 3d89665..ed5de5e 100644
--- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ElasticSearchMailboxModule.java
+++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ElasticSearchMailboxModule.java
@@ -131,12 +131,14 @@ public class ElasticSearchMailboxModule extends AbstractModule {
MailboxIndexCreationUtil.prepareClient(client,
configuration.getReadAliasMailboxName(),
configuration.getWriteAliasMailboxName(),
- configuration.getIndexMailboxName());
+ configuration.getIndexMailboxName(),
+ configuration);
QuotaSearchIndexCreationUtil.prepareClient(client,
configuration.getReadAliasQuotaRatioName(),
configuration.getWriteAliasMailboxName(),
- configuration.getIndexQuotaRatioName());
+ configuration.getIndexQuotaRatioName(),
+ configuration);
return client;
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/1d6aae0f/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/TestElasticSearchModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/TestElasticSearchModule.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/TestElasticSearchModule.java
index e8e41d7..0ada1f6 100644
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/TestElasticSearchModule.java
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/TestElasticSearchModule.java
@@ -21,6 +21,7 @@ package org.apache.james.modules;
import javax.inject.Singleton;
+import org.apache.james.backends.es.ElasticSearchConfiguration;
import org.apache.james.backends.es.EmbeddedElasticSearch;
import org.apache.james.backends.es.utils.TestingClientProvider;
import org.apache.james.mailbox.elasticsearch.MailboxIndexCreationUtil;
@@ -46,6 +47,6 @@ public class TestElasticSearchModule extends AbstractModule {
@Singleton
protected Client provideClientProvider() {
Client client = new TestingClientProvider(embeddedElasticSearch.getNode()).get();
- return MailboxIndexCreationUtil.prepareDefaultClient(client);
+ return MailboxIndexCreationUtil.prepareDefaultClient(client, ElasticSearchConfiguration.DEFAULT_CONFIGURATION);
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/1d6aae0f/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/ElasticSearchQuotaSearchExtension.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/ElasticSearchQuotaSearchExtension.java b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/ElasticSearchQuotaSearchExtension.java
index cf42497..5388cfa 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/ElasticSearchQuotaSearchExtension.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/ElasticSearchQuotaSearchExtension.java
@@ -23,6 +23,7 @@ import static org.mockito.Mockito.mock;
import java.util.concurrent.Executors;
+import org.apache.james.backends.es.ElasticSearchConfiguration;
import org.apache.james.backends.es.ElasticSearchIndexer;
import org.apache.james.backends.es.EmbeddedElasticSearch;
import org.apache.james.backends.es.utils.TestingClientProvider;
@@ -60,7 +61,8 @@ public class ElasticSearchQuotaSearchExtension implements ParameterResolver, Bef
embeddedElasticSearch.before();
Client client = QuotaSearchIndexCreationUtil.prepareDefaultClient(
- new TestingClientProvider(embeddedElasticSearch.getNode()).get());
+ new TestingClientProvider(embeddedElasticSearch.getNode()).get(),
+ ElasticSearchConfiguration.DEFAULT_CONFIGURATION);
InMemoryIntegrationResources.Resources resources = new InMemoryIntegrationResources().createResources(new SimpleGroupMembershipResolver());
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org