JAMES-2344 Solve a Spring error with Quotas

Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/565b1802
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/565b1802
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/565b1802

Branch: refs/heads/master
Commit: 565b18022c13cb981eddd3a770c6678fb91b5cda
Parents: 630bf0a
Author: benwa <btell...@linagora.com>
Authored: Tue Mar 13 10:59:19 2018 +0700
Committer: Matthieu Baechler <matth...@apache.org>
Committed: Tue Mar 13 16:10:28 2018 +0100

----------------------------------------------------------------------
 .../apache/james/mailbox/store/quota/NoQuotaManager.java | 11 ++---------
 .../apache/james/app/spring/JamesSpringContextTest.java  |  4 ++--
 .../apache/james/modules/mailbox/DefaultQuotaModule.java |  2 +-
 3 files changed, 5 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/565b1802/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/NoQuotaManager.java
----------------------------------------------------------------------
diff --git 
a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/NoQuotaManager.java
 
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/NoQuotaManager.java
index 878effa..852f91c 100644
--- 
a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/NoQuotaManager.java
+++ 
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/NoQuotaManager.java
@@ -19,9 +19,6 @@
 
 package org.apache.james.mailbox.store.quota;
 
-import javax.inject.Inject;
-
-import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.Quota;
 import org.apache.james.mailbox.model.QuotaRoot;
 import org.apache.james.mailbox.quota.QuotaCount;
@@ -33,12 +30,8 @@ import org.apache.james.mailbox.quota.QuotaSize;
  */
 public class NoQuotaManager implements QuotaManager {
 
-    @Inject
-    public NoQuotaManager() {
-    }
-
     @Override
-    public Quota<QuotaCount> getMessageQuota(QuotaRoot quotaRoot) throws 
MailboxException {
+    public Quota<QuotaCount> getMessageQuota(QuotaRoot quotaRoot) {
         return Quota.<QuotaCount>builder()
             .used(QuotaCount.count(0))
             .computedLimit(QuotaCount.unlimited())
@@ -46,7 +39,7 @@ public class NoQuotaManager implements QuotaManager {
     }
 
     @Override
-    public Quota<QuotaSize> getStorageQuota(QuotaRoot quotaRoot) throws 
MailboxException {
+    public Quota<QuotaSize> getStorageQuota(QuotaRoot quotaRoot) {
         return Quota.<QuotaSize>builder()
             .used(QuotaSize.size(0))
             .computedLimit(QuotaSize.unlimited())

http://git-wip-us.apache.org/repos/asf/james-project/blob/565b1802/server/app/src/test/java/org/apache/james/app/spring/JamesSpringContextTest.java
----------------------------------------------------------------------
diff --git 
a/server/app/src/test/java/org/apache/james/app/spring/JamesSpringContextTest.java
 
b/server/app/src/test/java/org/apache/james/app/spring/JamesSpringContextTest.java
index 9478de1..5ff4917 100644
--- 
a/server/app/src/test/java/org/apache/james/app/spring/JamesSpringContextTest.java
+++ 
b/server/app/src/test/java/org/apache/james/app/spring/JamesSpringContextTest.java
@@ -41,14 +41,14 @@ public class JamesSpringContextTest {
     private JamesServerApplicationContext context;
 
     @Before
-    public void setup() throws Exception {
+    public void setup() {
         context = new JamesServerApplicationContext(new String[] { 
"META-INF/org/apache/james/spring-server.xml" });
         context.registerShutdownHook();
         context.start();
     }
 
     @After
-    public void tearDown() throws Exception {
+    public void tearDown() {
         context.stop();
         context.destroy();
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/565b1802/server/container/guice/mailbox/src/main/java/org/apache/james/modules/mailbox/DefaultQuotaModule.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/mailbox/src/main/java/org/apache/james/modules/mailbox/DefaultQuotaModule.java
 
b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/mailbox/DefaultQuotaModule.java
index f746791..831288c 100644
--- 
a/server/container/guice/mailbox/src/main/java/org/apache/james/modules/mailbox/DefaultQuotaModule.java
+++ 
b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/mailbox/DefaultQuotaModule.java
@@ -38,7 +38,7 @@ public class DefaultQuotaModule extends AbstractModule {
         bind(DefaultUserQuotaRootResolver.class).in(Scopes.SINGLETON);
         bind(NoMaxQuotaManager.class).in(Scopes.SINGLETON);
 
-        bind(MaxQuotaManager.class).to(NoMaxQuotaManager.class);
+        bind(MaxQuotaManager.class).toInstance(new NoMaxQuotaManager());
         bind(QuotaManager.class).to(NoQuotaManager.class);
         bind(QuotaRootResolver.class).to(DefaultUserQuotaRootResolver.class);
         
bind(UserQuotaRootResolver.class).to(DefaultUserQuotaRootResolver.class);


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to