this.addGlobalListener((MailboxListener) index, session); this.addGlobalListener((MailboxListener) quotaUpdater, session); this.addGlobalListener(new MailboxAnnotationListener(mailboxSessionMapperFactory), session);
@Override public QuotaManager createQuotaManager(MaxQuotaManager maxQuotaManager, StoreMailboxManager mailboxManager) throws Exception { QuotaRootResolver quotaRootResolver = createQuotaRootResolver(mailboxManager); InMemoryCurrentQuotaManager currentQuotaManager = createCurrentQuotaManager(mailboxManager); StoreQuotaManager quotaManager = new StoreQuotaManager(currentQuotaManager, maxQuotaManager); ListeningCurrentQuotaUpdater listeningCurrentQuotaUpdater = new ListeningCurrentQuotaUpdater(currentQuotaManager, quotaRootResolver, mailboxManager.getEventDispatcher(), quotaManager); mailboxManager.setQuotaManager(quotaManager); mailboxManager.addGlobalListener(listeningCurrentQuotaUpdater, null); return quotaManager; }
@Before public void setup() throws Exception { GroupMembershipResolver groupMembershipResolver = new SimpleGroupMembershipResolver(); InMemoryIntegrationResources.Resources resources = new InMemoryIntegrationResources() .createResources(groupMembershipResolver); storeMailboxManager = resources.getMailboxManager(); storeRightManager = resources.getStoreRightManager(); mailboxMapper = storeMailboxManager.getMapperFactory(); testee = new PropagateLookupRightListener(storeRightManager); storeMailboxManager.addGlobalListener(testee, mailboxSession); parentMailboxId = storeMailboxManager.createMailbox(PARENT_MAILBOX, mailboxSession).get(); parentMailboxId1 = storeMailboxManager.createMailbox(PARENT_MAILBOX1, mailboxSession).get(); childMailboxId = storeMailboxManager.createMailbox(CHILD_MAILBOX, mailboxSession).get(); childMailboxId1 = storeMailboxManager.createMailbox(CHILD_MAILBOX1, mailboxSession).get(); grandChildMailboxId = storeMailboxManager.createMailbox(GRAND_CHILD_MAILBOX, mailboxSession).get(); lookupEntry = new Entry(SHARED_USER, "l"); }
@Override protected void initializeMailboxManager() throws Exception { Client client = MailboxIndexCreationUtil.prepareDefaultClient( new TestingClientProvider(embeddedElasticSearch.getNode()).get()); storeMailboxManager = new InMemoryIntegrationResources() .createMailboxManager(new SimpleGroupMembershipResolver()); ElasticSearchListeningMessageSearchIndex elasticSearchListeningMessageSearchIndex = new ElasticSearchListeningMessageSearchIndex( storeMailboxManager.getMapperFactory(), new ElasticSearchIndexer(client, Executors.newSingleThreadExecutor(), MailboxElasticSearchConstants.DEFAULT_MAILBOX_WRITE_ALIAS, MailboxElasticSearchConstants.MESSAGE_TYPE, BATCH_SIZE), new ElasticSearchSearcher(client, new QueryConverter(new CriterionConverter()), SEARCH_SIZE, new InMemoryId.Factory(), storeMailboxManager.getMessageIdFactory(), MailboxElasticSearchConstants.DEFAULT_MAILBOX_READ_ALIAS, MailboxElasticSearchConstants.MESSAGE_TYPE), new MessageToElasticSearchJson(textExtractor, ZoneId.of("Europe/Paris"), IndexAttachments.YES)); messageIdManager = new StoreMessageIdManager( storeMailboxManager, storeMailboxManager.getMapperFactory(), storeMailboxManager.getEventDispatcher(), storeMailboxManager.getMessageIdFactory(), storeMailboxManager.getQuotaManager(), storeMailboxManager.getQuotaRootResolver()); storeMailboxManager.setMessageSearchIndex(elasticSearchListeningMessageSearchIndex); storeMailboxManager.addGlobalListener(elasticSearchListeningMessageSearchIndex, new MockMailboxSession("admin")); this.messageSearchIndex = elasticSearchListeningMessageSearchIndex; }