MAILBOX-357 Correct ElasticSearch host system This host system was using two distinct Mapper factories. This causes some failures while retrieving mailboxes in the ElasticSearch indexer
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/2dab033f Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/2dab033f Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/2dab033f Branch: refs/heads/master Commit: 2dab033fba415345411b0cdffe869f67d6800097 Parents: d972ed5 Author: Benoit Tellier <[email protected]> Authored: Tue Dec 11 14:26:04 2018 +0700 Committer: Benoit Tellier <[email protected]> Committed: Wed Dec 12 17:50:58 2018 +0700 ---------------------------------------------------------------------- .../elasticsearch/host/ElasticSearchHostSystem.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/2dab033f/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 ac854a4..971c99b 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 @@ -49,7 +49,6 @@ import org.apache.james.mailbox.elasticsearch.query.QueryConverter; import org.apache.james.mailbox.elasticsearch.search.ElasticSearchSearcher; import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.inmemory.InMemoryId; -import org.apache.james.mailbox.inmemory.InMemoryMailboxSessionMapperFactory; import org.apache.james.mailbox.inmemory.InMemoryMessageId; import org.apache.james.mailbox.inmemory.manager.InMemoryIntegrationResources; import org.apache.james.mailbox.mock.MockMailboxSession; @@ -95,16 +94,15 @@ public class ElasticSearchHostSystem extends JamesImapHostSystem { new TestingClientProvider(embeddedElasticSearch.getNode()).get(), ElasticSearchConfiguration.DEFAULT_CONFIGURATION); - InMemoryMailboxSessionMapperFactory factory = new InMemoryMailboxSessionMapperFactory(); InMemoryMessageId.Factory messageIdFactory = new InMemoryMessageId.Factory(); - this.mailboxManager = new InMemoryIntegrationResources() + mailboxManager = new InMemoryIntegrationResources() .createMailboxManager(new SimpleGroupMembershipResolver(), authenticator, authorizator); ThreadFactory threadFactory = NamedThreadFactory.withClassName(getClass()); ElasticSearchListeningMessageSearchIndex searchIndex = new ElasticSearchListeningMessageSearchIndex( - factory, + mailboxManager.getMapperFactory(), new ElasticSearchIndexer(client, Executors.newSingleThreadExecutor(threadFactory), MailboxElasticSearchConstants.DEFAULT_MAILBOX_WRITE_ALIAS, @@ -117,14 +115,14 @@ public class ElasticSearchHostSystem extends JamesImapHostSystem { new MessageToElasticSearchJson(new DefaultTextExtractor(), ZoneId.systemDefault(), IndexAttachments.YES), mailboxManager); - this.mailboxManager.setMessageSearchIndex(searchIndex); - this.mailboxManager.addGlobalListener(searchIndex, new MockMailboxSession("admin")); + mailboxManager.setMessageSearchIndex(searchIndex); + mailboxManager.addGlobalListener(searchIndex, new MockMailboxSession("admin")); ImapProcessor defaultImapProcessorFactory = - DefaultImapProcessorFactory.createDefaultProcessor(this.mailboxManager, - new StoreSubscriptionManager(factory), + DefaultImapProcessorFactory.createDefaultProcessor(mailboxManager, + new StoreSubscriptionManager(mailboxManager.getMapperFactory()), new NoQuotaManager(), - new DefaultUserQuotaRootResolver(mailboxManager, factory), + new DefaultUserQuotaRootResolver(mailboxManager, mailboxManager.getMapperFactory()), new DefaultMetricFactory()); configure(new DefaultImapDecoderFactory().buildImapDecoder(), new DefaultImapEncoderFactory().buildImapEncoder(), --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
