JAMES-2631 ReIndent InMemoryHostSystem
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/9cdf4ba8 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/9cdf4ba8 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/9cdf4ba8 Branch: refs/heads/master Commit: 9cdf4ba815bcbd06d2d332018e59b2f76d67739f Parents: 185810d Author: Benoit Tellier <btell...@linagora.com> Authored: Mon Jan 7 15:16:25 2019 +0700 Committer: Benoit Tellier <btell...@linagora.com> Committed: Tue Jan 8 14:46:16 2019 +0700 ---------------------------------------------------------------------- .../inmemory/host/InMemoryHostSystem.java | 223 ++++++++++--------- 1 file changed, 112 insertions(+), 111 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/9cdf4ba8/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryHostSystem.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryHostSystem.java b/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryHostSystem.java index aa8bc22..3e4f238 100644 --- a/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryHostSystem.java +++ b/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryHostSystem.java @@ -1,111 +1,112 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the * - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations * - * under the License. * - ****************************************************************/ - -package org.apache.james.mpt.imapmailbox.inmemory.host; - -import org.apache.james.core.quota.QuotaCount; -import org.apache.james.core.quota.QuotaSize; -import org.apache.james.imap.api.process.ImapProcessor; -import org.apache.james.imap.encode.main.DefaultImapEncoderFactory; -import org.apache.james.imap.main.DefaultImapDecoderFactory; -import org.apache.james.imap.processor.main.DefaultImapProcessorFactory; -import org.apache.james.mailbox.MailboxManager; -import org.apache.james.mailbox.MailboxSessionUtil; -import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver; -import org.apache.james.mailbox.exception.MailboxException; -import org.apache.james.mailbox.inmemory.manager.InMemoryIntegrationResources; -import org.apache.james.mailbox.inmemory.quota.InMemoryCurrentQuotaManager; -import org.apache.james.mailbox.inmemory.quota.InMemoryPerUserMaxQuotaManager; -import org.apache.james.mailbox.quota.QuotaRootResolver; -import org.apache.james.mailbox.store.StoreMailboxManager; -import org.apache.james.mailbox.store.StoreSubscriptionManager; -import org.apache.james.mailbox.store.quota.CurrentQuotaCalculator; -import org.apache.james.mailbox.store.quota.DefaultUserQuotaRootResolver; -import org.apache.james.mailbox.store.quota.ListeningCurrentQuotaUpdater; -import org.apache.james.mailbox.store.quota.StoreQuotaManager; -import org.apache.james.metrics.logger.DefaultMetricFactory; -import org.apache.james.mpt.api.ImapFeatures; -import org.apache.james.mpt.api.ImapFeatures.Feature; -import org.apache.james.mpt.host.JamesImapHostSystem; - -public class InMemoryHostSystem extends JamesImapHostSystem { - - private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT, - Feature.MOVE_SUPPORT, - Feature.USER_FLAGS_SUPPORT, - Feature.QUOTA_SUPPORT, - Feature.ANNOTATION_SUPPORT, - Feature.MOD_SEQ_SEARCH); - - private StoreMailboxManager mailboxManager; - private InMemoryPerUserMaxQuotaManager perUserMaxQuotaManager; - - public static JamesImapHostSystem build() throws Exception { - return new InMemoryHostSystem(); - } - - @Override - public void beforeTest() throws Exception { - super.beforeTest(); - this.mailboxManager = new InMemoryIntegrationResources() - .createMailboxManager(new SimpleGroupMembershipResolver(), authenticator, authorizator); - QuotaRootResolver quotaRootResolver = new DefaultUserQuotaRootResolver(mailboxManager, mailboxManager.getMapperFactory()); - - perUserMaxQuotaManager = new InMemoryPerUserMaxQuotaManager(); - - InMemoryCurrentQuotaManager currentQuotaManager = new InMemoryCurrentQuotaManager( - new CurrentQuotaCalculator(mailboxManager.getMapperFactory(), quotaRootResolver), - mailboxManager); - - StoreQuotaManager quotaManager = new StoreQuotaManager(currentQuotaManager, perUserMaxQuotaManager); - - ListeningCurrentQuotaUpdater quotaUpdater = new ListeningCurrentQuotaUpdater(currentQuotaManager, quotaRootResolver, mailboxManager.getEventDispatcher(), quotaManager); - - mailboxManager.setQuotaRootResolver(quotaRootResolver); - mailboxManager.setQuotaManager(quotaManager); - mailboxManager.setQuotaUpdater(quotaUpdater); - mailboxManager.addGlobalListener(quotaUpdater, MailboxSessionUtil.create("admin")); - - final ImapProcessor defaultImapProcessorFactory = DefaultImapProcessorFactory.createDefaultProcessor(mailboxManager, new StoreSubscriptionManager(mailboxManager.getMapperFactory()), quotaManager, quotaRootResolver, new DefaultMetricFactory()); - configure(new DefaultImapDecoderFactory().buildImapDecoder(), - new DefaultImapEncoderFactory().buildImapEncoder(), - defaultImapProcessorFactory); - } - - @Override - protected MailboxManager getMailboxManager() { - return mailboxManager; - } - - @Override - public boolean supports(Feature... features) { - return SUPPORTED_FEATURES.supports(features); - } - - @Override - public void setQuotaLimits(QuotaCount maxMessageQuota, QuotaSize maxStorageQuota) throws MailboxException { - perUserMaxQuotaManager.setGlobalMaxMessage(maxMessageQuota); - perUserMaxQuotaManager.setGlobalMaxStorage(maxStorageQuota); - } - - @Override - protected void await() { - - } -} +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ + + +package org.apache.james.mpt.imapmailbox.inmemory.host; + +import org.apache.james.core.quota.QuotaCount; +import org.apache.james.core.quota.QuotaSize; +import org.apache.james.imap.api.process.ImapProcessor; +import org.apache.james.imap.encode.main.DefaultImapEncoderFactory; +import org.apache.james.imap.main.DefaultImapDecoderFactory; +import org.apache.james.imap.processor.main.DefaultImapProcessorFactory; +import org.apache.james.mailbox.MailboxManager; +import org.apache.james.mailbox.MailboxSessionUtil; +import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver; +import org.apache.james.mailbox.exception.MailboxException; +import org.apache.james.mailbox.inmemory.manager.InMemoryIntegrationResources; +import org.apache.james.mailbox.inmemory.quota.InMemoryCurrentQuotaManager; +import org.apache.james.mailbox.inmemory.quota.InMemoryPerUserMaxQuotaManager; +import org.apache.james.mailbox.quota.QuotaRootResolver; +import org.apache.james.mailbox.store.StoreMailboxManager; +import org.apache.james.mailbox.store.StoreSubscriptionManager; +import org.apache.james.mailbox.store.quota.CurrentQuotaCalculator; +import org.apache.james.mailbox.store.quota.DefaultUserQuotaRootResolver; +import org.apache.james.mailbox.store.quota.ListeningCurrentQuotaUpdater; +import org.apache.james.mailbox.store.quota.StoreQuotaManager; +import org.apache.james.metrics.logger.DefaultMetricFactory; +import org.apache.james.mpt.api.ImapFeatures; +import org.apache.james.mpt.api.ImapFeatures.Feature; +import org.apache.james.mpt.host.JamesImapHostSystem; + +public class InMemoryHostSystem extends JamesImapHostSystem { + + private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT, + Feature.MOVE_SUPPORT, + Feature.USER_FLAGS_SUPPORT, + Feature.QUOTA_SUPPORT, + Feature.ANNOTATION_SUPPORT, + Feature.MOD_SEQ_SEARCH); + + private StoreMailboxManager mailboxManager; + private InMemoryPerUserMaxQuotaManager perUserMaxQuotaManager; + + public static JamesImapHostSystem build() throws Exception { + return new InMemoryHostSystem(); + } + + @Override + public void beforeTest() throws Exception { + super.beforeTest(); + this.mailboxManager = new InMemoryIntegrationResources() + .createMailboxManager(new SimpleGroupMembershipResolver(), authenticator, authorizator); + QuotaRootResolver quotaRootResolver = new DefaultUserQuotaRootResolver(mailboxManager, mailboxManager.getMapperFactory()); + + perUserMaxQuotaManager = new InMemoryPerUserMaxQuotaManager(); + + InMemoryCurrentQuotaManager currentQuotaManager = new InMemoryCurrentQuotaManager( + new CurrentQuotaCalculator(mailboxManager.getMapperFactory(), quotaRootResolver), + mailboxManager); + + StoreQuotaManager quotaManager = new StoreQuotaManager(currentQuotaManager, perUserMaxQuotaManager); + + ListeningCurrentQuotaUpdater quotaUpdater = new ListeningCurrentQuotaUpdater(currentQuotaManager, quotaRootResolver, mailboxManager.getEventDispatcher(), quotaManager); + + mailboxManager.setQuotaRootResolver(quotaRootResolver); + mailboxManager.setQuotaManager(quotaManager); + mailboxManager.setQuotaUpdater(quotaUpdater); + mailboxManager.addGlobalListener(quotaUpdater, MailboxSessionUtil.create("admin")); + + final ImapProcessor defaultImapProcessorFactory = DefaultImapProcessorFactory.createDefaultProcessor(mailboxManager, new StoreSubscriptionManager(mailboxManager.getMapperFactory()), quotaManager, quotaRootResolver, new DefaultMetricFactory()); + configure(new DefaultImapDecoderFactory().buildImapDecoder(), + new DefaultImapEncoderFactory().buildImapEncoder(), + defaultImapProcessorFactory); + } + + @Override + protected MailboxManager getMailboxManager() { + return mailboxManager; + } + + @Override + public boolean supports(Feature... features) { + return SUPPORTED_FEATURES.supports(features); + } + + @Override + public void setQuotaLimits(QuotaCount maxMessageQuota, QuotaSize maxStorageQuota) throws MailboxException { + perUserMaxQuotaManager.setGlobalMaxMessage(maxMessageQuota); + perUserMaxQuotaManager.setGlobalMaxStorage(maxStorageQuota); + } + + @Override + protected void await() { + + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org