james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [08/20] james-project git commit: JAMES-2151 SieveRepository strong typing for User
Date Tue, 26 Jun 2018 09:13:04 GMT
JAMES-2151 SieveRepository strong typing for User


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

Branch: refs/heads/master
Commit: 3d0a55344e4656150c10ffba69d7dd3d78128888
Parents: 1914c7b
Author: benwa <btellier@linagora.com>
Authored: Fri Jun 22 10:14:34 2018 +0700
Committer: benwa <btellier@linagora.com>
Committed: Tue Jun 26 16:06:31 2018 +0700

----------------------------------------------------------------------
 core/pom.xml                                    | 20 +++-
 .../main/java/org/apache/james/core/User.java   |  6 ++
 .../org/apache/james/core/quota/QuotaCount.java | 94 +++++++++++++++++++
 .../org/apache/james/core/quota/QuotaSize.java  | 96 ++++++++++++++++++++
 .../org/apache/james/core/quota/QuotaValue.java | 36 ++++++++
 .../apache/james/core/quota/QuotaCountTest.java | 42 +++++++++
 .../apache/james/core/quota/QuotaSizeTest.java  | 42 +++++++++
 .../apache/james/core/quota/QuotaValueTest.java | 75 +++++++++++++++
 .../apache/james/mailbox/MailboxListener.java   |  4 +-
 .../mailbox/exception/OverQuotaException.java   |  2 +-
 .../org/apache/james/mailbox/model/Quota.java   |  2 +-
 .../apache/james/mailbox/model/QuotaRatio.java  |  4 +-
 .../mailbox/quota/CurrentQuotaManager.java      |  2 +
 .../james/mailbox/quota/MaxQuotaManager.java    |  2 +
 .../apache/james/mailbox/quota/QuotaCount.java  | 94 -------------------
 .../james/mailbox/quota/QuotaManager.java       |  2 +
 .../apache/james/mailbox/quota/QuotaSize.java   | 96 --------------------
 .../apache/james/mailbox/quota/QuotaValue.java  | 36 --------
 .../mailbox/manager/ManagerTestResources.java   |  4 +-
 .../manager/QuotaMessageManagerTest.java        |  4 +-
 .../james/mailbox/model/QuotaRatioTest.java     |  4 +-
 .../apache/james/mailbox/model/QuotaTest.java   |  4 +-
 .../james/mailbox/quota/QuotaCountTest.java     | 42 ---------
 .../james/mailbox/quota/QuotaFixture.java       |  2 +
 .../james/mailbox/quota/QuotaSizeTest.java      | 42 ---------
 .../james/mailbox/quota/QuotaValueTest.java     | 75 ---------------
 .../quota/CassandraCurrentQuotaManager.java     |  4 +-
 .../quota/CassandraGlobalMaxQuotaDao.java       |  4 +-
 .../quota/CassandraPerDomainMaxQuotaDao.java    |  4 +-
 .../quota/CassandraPerUserMaxQuotaDao.java      |  4 +-
 .../quota/CassandraPerUserMaxQuotaManager.java  |  4 +-
 .../mailbox/cassandra/quota/QuotaCodec.java     |  6 +-
 .../jpa/quota/JPAPerUserMaxQuotaDAO.java        |  6 +-
 .../jpa/quota/JPAPerUserMaxQuotaManager.java    |  4 +-
 .../jpa/quota/JpaCurrentQuotaManager.java       |  4 +-
 .../jpa/quota/model/JpaCurrentQuota.java        |  4 +-
 .../quota/InMemoryCurrentQuotaManager.java      |  4 +-
 .../quota/InMemoryPerUserMaxQuotaManager.java   |  4 +-
 .../quota/InMemoryCurrentQuotaManagerTest.java  |  4 +-
 .../mailbox/quota/cassandra/dto/QuotaDTO.java   |  4 +-
 .../mailbox/quota/cassandra/dto/DTOTest.java    |  4 +-
 .../mailing/aggregates/UserQuotaThresholds.java |  4 +-
 .../commands/DetectThresholdCrossing.java       |  4 +-
 .../events/QuotaThresholdChangedEvent.java      |  4 +-
 .../subscribers/QuotaThresholdNotice.java       |  4 +-
 .../subscribers/QuotaThresholdNoticeTest.java   |  4 +-
 .../mailbox/quota/model/QuotaThresholdTest.java |  2 +-
 .../quota/model/QuotaThresholdsTest.java        |  2 +-
 .../json/QuotaRatioAsJsonTest.java              |  4 +-
 .../quota/search/scanning/ClauseConverter.java  |  4 +-
 .../quota/search/QuotaSearcherContract.java     |  2 +-
 .../store/event/MailboxEventDispatcher.java     |  4 +-
 .../store/mail/model/SerializableQuota.java     |  2 +-
 .../mail/model/SerializableQuotaValue.java      |  2 +-
 .../james/mailbox/store/probe/QuotaProbe.java   |  4 +-
 .../store/quota/FixedMaxQuotaManager.java       |  4 +-
 .../mailbox/store/quota/NoMaxQuotaManager.java  |  4 +-
 .../mailbox/store/quota/NoQuotaManager.java     |  4 +-
 .../james/mailbox/store/quota/QuotaChecker.java |  4 +-
 .../mailbox/store/quota/StoreQuotaManager.java  |  4 +-
 .../AbstractMessageIdManagerQuotaTest.java      |  4 +-
 .../AbstractMessageIdManagerSideEffectTest.java |  4 +-
 .../store/quota/GenericMaxQuotaManagerTest.java |  4 +-
 .../mailbox/store/quota/QuotaCheckerTest.java   |  4 +-
 .../quota/StoreCurrentQuotaManagerTest.java     |  4 +-
 .../store/quota/StoreQuotaManagerTest.java      |  4 +-
 .../apache/james/mpt/api/ImapHostSystem.java    |  4 +-
 .../james/mpt/host/ExternalHostSystem.java      |  4 +-
 .../cassandra/host/CassandraHostSystem.java     |  4 +-
 .../james/mpt/imapmailbox/suite/QuotaTest.java  |  4 +-
 .../imapmailbox/cyrus/host/CyrusHostSystem.java |  4 +-
 .../host/ElasticSearchHostSystem.java           |  4 +-
 .../james/host/ExternalJamesHostSystem.java     |  4 +-
 .../imapmailbox/hbase/host/HBaseHostSystem.java |  4 +-
 .../inmemory/host/InMemoryHostSystem.java       |  4 +-
 .../mpt/imapmailbox/jcr/host/JCRHostSystem.java |  4 +-
 .../mpt/imapmailbox/jpa/host/JPAHostSystem.java |  4 +-
 .../host/LuceneSearchHostSystem.java            |  4 +-
 .../maildir/host/MaildirHostSystem.java         |  4 +-
 .../mpt/host/JamesManageSieveHostSystem.java    |  6 +-
 .../james/imap/processor/GetQuotaProcessor.java |  4 +-
 .../imap/processor/GetQuotaRootProcessor.java   |  4 +-
 .../imap/encode/QuotaResponseEncoderTest.java   |  4 +-
 .../imap/processor/GetQuotaProcessorTest.java   |  4 +-
 .../processor/GetQuotaRootProcessorTest.java    |  4 +-
 .../james/managesieve/core/CoreProcessor.java   | 35 +++----
 .../java/org/apache/james/cli/ServerCmd.java    |  6 +-
 .../james/cli/probe/impl/JmxQuotaProbe.java     |  4 +-
 .../org/apache/james/cli/ServerCmdTest.java     |  4 +-
 .../org/apache/james/JPAJamesServerTest.java    |  2 +-
 .../apache/james/modules/QuotaProbesImpl.java   |  4 +-
 .../james/modules/protocols/SieveProbeImpl.java | 21 +++--
 .../james/adapter/mailbox/QuotaManagement.java  |  4 +-
 .../adapter/mailbox/QuotaManagementMBean.java   |  4 +-
 .../mailbox/MaxQuotaConfigurationReader.java    |  4 +-
 .../sieverepository/api/ScriptContent.java      | 62 +++++++++++++
 .../james/sieverepository/api/ScriptName.java   | 58 ++++++++++++
 .../sieverepository/api/ScriptSummary.java      |  6 +-
 .../api/SieveQuotaRepository.java               | 14 +--
 .../sieverepository/api/SieveRepository.java    | 21 +++--
 .../sieverepository/api/ScriptNameTest.java     | 32 +++++++
 .../cassandra/CassandraActiveScriptDAO.java     | 18 ++--
 .../sieve/cassandra/CassandraSieveDAO.java      | 36 ++++----
 .../sieve/cassandra/CassandraSieveQuotaDAO.java | 36 ++++----
 .../cassandra/CassandraSieveRepository.java     | 66 ++++++++------
 .../sieve/cassandra/model/ActiveScriptInfo.java |  9 +-
 .../james/sieve/cassandra/model/Script.java     | 30 ++++--
 .../james/sieve/cassandra/model/SieveQuota.java |  9 +-
 .../cassandra/CassandraActiveScriptDAOTest.java |  8 +-
 .../sieve/cassandra/CassandraSieveDAOTest.java  |  8 +-
 .../cassandra/CassandraSieveQuotaDAOTest.java   | 52 +++++------
 .../james/sieve/cassandra/model/ScriptTest.java |  3 +-
 .../sieve/cassandra/model/SieveQuotaTest.java   |  7 +-
 .../file/SieveDefaultRepository.java            | 38 ++++----
 .../file/SieveFileRepository.java               | 85 +++++++++--------
 .../lib/SieveRepositoryManagement.java          | 12 ++-
 .../lib/AbstractSieveRepositoryTest.java        | 42 +++++----
 .../memory/InMemorySieveQuotaRepository.java    | 20 ++--
 .../mailets/IsOverQuotaMatcherTest.java         |  4 +-
 .../mailets/jsieve/ResourceLocator.java         | 10 +-
 .../transport/mailets/ResourceLocatorTest.java  |  6 +-
 .../managesieve/ManageSieveMailetTestCase.java  | 58 +++++++-----
 .../transport/matchers/IsOverQuotaTest.java     |  4 +-
 .../integration/GetMailboxesMethodTest.java     |  4 +-
 .../methods/integration/QuotaMailingTest.java   |  2 +-
 .../methods/integration/SendMDNMethodTest.java  |  2 +-
 .../integration/SetMessagesMethodTest.java      |  2 +-
 .../apache/james/jmap/model/MailboxFactory.java |  2 +-
 .../apache/james/jmap/model/mailbox/Quotas.java |  6 +-
 .../james/webadmin/routes/SieveQuotaRoutes.java | 24 ++---
 .../james/webadmin/dto/OccupationDTO.java       |  4 +-
 .../james/webadmin/dto/OccupationRatioDTO.java  |  4 +-
 .../org/apache/james/webadmin/dto/QuotaDTO.java |  4 +-
 .../james/webadmin/dto/QuotaDetailsDTO.java     |  4 +-
 .../webadmin/dto/QuotaValueDeserializer.java    |  2 +-
 .../webadmin/dto/QuotaValueSerializer.java      |  2 +-
 .../james/webadmin/jackson/QuotaModule.java     |  4 +-
 .../webadmin/routes/DomainQuotaRoutes.java      |  4 +-
 .../webadmin/routes/GlobalQuotaRoutes.java      |  4 +-
 .../james/webadmin/routes/UserQuotaRoutes.java  |  4 +-
 .../webadmin/service/DomainQuotaService.java    |  4 +-
 .../webadmin/service/GlobalQuotaService.java    |  4 +-
 .../webadmin/service/UserQuotaService.java      |  4 +-
 .../james/webadmin/validation/Quotas.java       |  4 +-
 .../dto/QuotaValueDeserializerTest.java         |  4 +-
 .../webadmin/dto/UsersQuotaDetailsDTOTest.java  |  4 +-
 .../webadmin/routes/DomainQuotaRoutesTest.java  |  4 +-
 .../webadmin/routes/GlobalQuotaRoutesTest.java  |  4 +-
 .../webadmin/routes/UserQuotaRoutesTest.java    |  4 +-
 .../webadmin/validation/QuotaValueTest.java     |  4 +-
 150 files changed, 1135 insertions(+), 889 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index d096b67..336d7e4 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -57,11 +57,6 @@
             <artifactId>javax.mail</artifactId>
         </dependency>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>nl.jqno.equalsverifier</groupId>
             <artifactId>equalsverifier</artifactId>
             <scope>test</scope>
@@ -71,6 +66,21 @@
             <artifactId>assertj-core</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.platform</groupId>
+            <artifactId>junit-platform-launcher</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.vintage</groupId>
+            <artifactId>junit-vintage-engine</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/core/src/main/java/org/apache/james/core/User.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/james/core/User.java b/core/src/main/java/org/apache/james/core/User.java
index a327da3..299f767 100644
--- a/core/src/main/java/org/apache/james/core/User.java
+++ b/core/src/main/java/org/apache/james/core/User.java
@@ -58,6 +58,12 @@ public class User {
         return new User(localPart, Optional.of(domain));
     }
 
+    public static User fromMailAddress(MailAddress address) {
+        Preconditions.checkNotNull(address);
+
+        return new User(address.getLocalPart(), Optional.of(address.getDomain()));
+    }
+
     public static User fromLocalPartWithoutDomain(String localPart) {
         return from(localPart,
             Optional.empty());

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/core/src/main/java/org/apache/james/core/quota/QuotaCount.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/james/core/quota/QuotaCount.java b/core/src/main/java/org/apache/james/core/quota/QuotaCount.java
new file mode 100644
index 0000000..eef03fa
--- /dev/null
+++ b/core/src/main/java/org/apache/james/core/quota/QuotaCount.java
@@ -0,0 +1,94 @@
+/****************************************************************
+ * 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.core.quota;
+
+import java.util.Optional;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+
+public class QuotaCount implements QuotaValue<QuotaCount> {
+
+    public static QuotaCount unlimited() {
+        return new QuotaCount(Optional.empty());
+    }
+
+    public static QuotaCount count(long value) {
+        return count(Optional.of(value));
+    }
+
+    public static QuotaCount count(Optional<Long> value) {
+        return new QuotaCount(value);
+    }
+
+    private final Optional<Long> value;
+
+    private QuotaCount(Optional<Long> value) {
+        this.value = value;
+    }
+
+    @Override
+    public long asLong() {
+        return value.orElseThrow(IllegalStateException::new);
+    }
+
+    @Override
+    public boolean isLimited() {
+        return value.isPresent();
+    }
+
+    @Override
+    public QuotaCount add(long additionalValue) {
+        return new QuotaCount(value.map(x -> x + additionalValue));
+    }
+
+    @Override
+    public QuotaCount add(QuotaCount additionalValue) {
+        if (additionalValue.isUnlimited()) {
+            return unlimited();
+        }
+        return new QuotaCount(value.map(x -> x + additionalValue.asLong()));
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(this)
+            .add("value", value.map(String::valueOf).orElse("unlimited"))
+            .toString();
+    }
+
+    @Override
+    public boolean isGreaterThan(QuotaCount other) {
+        return value.orElse(Long.MAX_VALUE) > other.value.orElse(Long.MAX_VALUE);
+    }
+
+    @Override
+    public final boolean equals(Object o) {
+        if (o instanceof QuotaCount) {
+            QuotaCount that = (QuotaCount) o;
+            return Objects.equal(this.value, that.value);
+        }
+        return false;
+    }
+
+    @Override
+    public final int hashCode() {
+        return Objects.hashCode(value);
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/core/src/main/java/org/apache/james/core/quota/QuotaSize.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/james/core/quota/QuotaSize.java b/core/src/main/java/org/apache/james/core/quota/QuotaSize.java
new file mode 100644
index 0000000..6d1f2ac
--- /dev/null
+++ b/core/src/main/java/org/apache/james/core/quota/QuotaSize.java
@@ -0,0 +1,96 @@
+/****************************************************************
+ * 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.core.quota;
+
+import java.util.Optional;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+
+public class QuotaSize implements QuotaValue<QuotaSize> {
+
+    public static final QuotaSize QUOTA_SIZE = new QuotaSize(Optional.empty());
+
+    public static QuotaSize unlimited() {
+        return QUOTA_SIZE;
+    }
+
+    public static QuotaSize size(long value) {
+        return size(Optional.of(value));
+    }
+
+    public static QuotaSize size(Optional<Long> value) {
+        return new QuotaSize(value);
+    }
+
+    private final Optional<Long> value;
+
+    private QuotaSize(Optional<Long> value) {
+        this.value = value;
+    }
+
+    @Override
+    public long asLong() {
+        return value.orElseThrow(IllegalStateException::new);
+    }
+
+    @Override
+    public boolean isLimited() {
+        return value.isPresent();
+    }
+
+    @Override
+    public QuotaSize add(long additionalValue) {
+        return new QuotaSize(value.map(x -> x + additionalValue));
+    }
+
+    @Override
+    public QuotaSize add(QuotaSize additionalValue) {
+        if (additionalValue.isUnlimited()) {
+            return unlimited();
+        }
+        return new QuotaSize(value.map(x -> x + additionalValue.asLong()));
+    }
+
+    @Override
+    public boolean isGreaterThan(QuotaSize other) {
+        return value.orElse(Long.MAX_VALUE) > other.value.orElse(Long.MAX_VALUE);
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(this)
+            .add("value", value.map(String::valueOf).orElse("unlimited"))
+            .toString();
+    }
+
+    @Override
+    public final boolean equals(Object o) {
+        if (o instanceof QuotaSize) {
+            QuotaSize that = (QuotaSize) o;
+            return Objects.equal(this.value, that.value);
+        }
+        return false;
+    }
+
+    @Override
+    public final int hashCode() {
+        return Objects.hashCode(value);
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/core/src/main/java/org/apache/james/core/quota/QuotaValue.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/james/core/quota/QuotaValue.java b/core/src/main/java/org/apache/james/core/quota/QuotaValue.java
new file mode 100644
index 0000000..f4342d3
--- /dev/null
+++ b/core/src/main/java/org/apache/james/core/quota/QuotaValue.java
@@ -0,0 +1,36 @@
+/****************************************************************
+ * 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.core.quota;
+
+public interface QuotaValue<T extends QuotaValue<T>> {
+
+    long asLong();
+
+    boolean isLimited();
+
+    default boolean isUnlimited() {
+        return !isLimited();
+    }
+
+    T add(long additionalValue);
+
+    T add(T additionalValue);
+
+    boolean isGreaterThan(T other);
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/core/src/test/java/org/apache/james/core/quota/QuotaCountTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/james/core/quota/QuotaCountTest.java b/core/src/test/java/org/apache/james/core/quota/QuotaCountTest.java
new file mode 100644
index 0000000..d704687
--- /dev/null
+++ b/core/src/test/java/org/apache/james/core/quota/QuotaCountTest.java
@@ -0,0 +1,42 @@
+/****************************************************************
+ * 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.core.quota;
+
+import org.junit.jupiter.api.Test;
+
+import nl.jqno.equalsverifier.EqualsVerifier;
+
+public class QuotaCountTest implements QuotaValueTest<QuotaCount> {
+
+    @Override
+    public QuotaCount instance(long value) {
+        return QuotaCount.count(value);
+    }
+
+    @Override
+    public QuotaCount unlimited() {
+        return QuotaCount.unlimited();
+    }
+
+    @Test
+    public void shouldRespectBeanContract() {
+        EqualsVerifier.forClass(QuotaCount.class).verify();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/core/src/test/java/org/apache/james/core/quota/QuotaSizeTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/james/core/quota/QuotaSizeTest.java b/core/src/test/java/org/apache/james/core/quota/QuotaSizeTest.java
new file mode 100644
index 0000000..f89223b
--- /dev/null
+++ b/core/src/test/java/org/apache/james/core/quota/QuotaSizeTest.java
@@ -0,0 +1,42 @@
+/****************************************************************
+ * 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.core.quota;
+
+import org.junit.jupiter.api.Test;
+
+import nl.jqno.equalsverifier.EqualsVerifier;
+
+public class QuotaSizeTest implements QuotaValueTest<QuotaSize> {
+
+    @Override
+    public QuotaSize instance(long value) {
+        return QuotaSize.size(value);
+    }
+
+    @Override
+    public QuotaSize unlimited() {
+        return QuotaSize.unlimited();
+    }
+
+    @Test
+    public void shouldRespectBeanContract() {
+        EqualsVerifier.forClass(QuotaSize.class).verify();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/core/src/test/java/org/apache/james/core/quota/QuotaValueTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/james/core/quota/QuotaValueTest.java b/core/src/test/java/org/apache/james/core/quota/QuotaValueTest.java
new file mode 100644
index 0000000..8545e31
--- /dev/null
+++ b/core/src/test/java/org/apache/james/core/quota/QuotaValueTest.java
@@ -0,0 +1,75 @@
+/****************************************************************
+ * 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.core.quota;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.jupiter.api.Test;
+
+public interface QuotaValueTest<T extends QuotaValue<T>> {
+
+    T instance(long i);
+
+    T unlimited();
+
+    @Test
+    default void greaterThanShouldReturnFalseWhenFirstEqualToSecond() {
+        assertThat(instance(1).isGreaterThan(instance(1))).isFalse();
+    }
+
+    @Test
+    default void greaterThanShouldReturnFalseWhenFirstSmallerThanSecond() {
+        assertThat(instance(1).isGreaterThan(instance(2))).isFalse();
+    }
+
+    @Test
+    default void greaterThanShouldReturnTrueWhenFirstGreaterThanSecond() {
+        assertThat(instance(2).isGreaterThan(instance(1))).isTrue();
+    }
+
+    @Test
+    default void greaterThanShouldReturnFalseWhenFirstIsLimitedAndSecondUnlimited() {
+        assertThat(instance(1).isGreaterThan(unlimited())).isFalse();
+    }
+
+    @Test
+    default void greaterThanShouldReturnFalseWhenBothAreUnlimited() {
+        assertThat(unlimited().isGreaterThan(unlimited())).isFalse();
+    }
+
+    @Test
+    default void greaterThanShouldReturnTrueWhenFirstIsUnlimitedAndSecondLimited() {
+        assertThat(unlimited().isGreaterThan(instance(1))).isTrue();
+    }
+
+    @Test
+    default void addShouldReturnUnlimitedWhenThisIsUnlimited() {
+        assertThat(unlimited().add(2)).isEqualTo(unlimited());
+    }
+
+    @Test
+    default void addShouldReturnUnlimitedWhenBothAre() {
+        assertThat(unlimited().add(unlimited())).isEqualTo(unlimited());
+    }
+
+    @Test
+    default void addShouldReturnSumResult() {
+        assertThat(instance(12).add(instance(23))).isEqualTo(instance(35));
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/api/src/main/java/org/apache/james/mailbox/MailboxListener.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/MailboxListener.java b/mailbox/api/src/main/java/org/apache/james/mailbox/MailboxListener.java
index 9021aa9..5329b87 100644
--- a/mailbox/api/src/main/java/org/apache/james/mailbox/MailboxListener.java
+++ b/mailbox/api/src/main/java/org/apache/james/mailbox/MailboxListener.java
@@ -24,14 +24,14 @@ import java.time.Instant;
 import java.util.List;
 import java.util.Objects;
 
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.acl.ACLDiff;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.model.MessageMetaData;
 import org.apache.james.mailbox.model.Quota;
 import org.apache.james.mailbox.model.QuotaRoot;
 import org.apache.james.mailbox.model.UpdatedFlags;
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/api/src/main/java/org/apache/james/mailbox/exception/OverQuotaException.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/exception/OverQuotaException.java b/mailbox/api/src/main/java/org/apache/james/mailbox/exception/OverQuotaException.java
index ef4fb3e..b8b13bd 100644
--- a/mailbox/api/src/main/java/org/apache/james/mailbox/exception/OverQuotaException.java
+++ b/mailbox/api/src/main/java/org/apache/james/mailbox/exception/OverQuotaException.java
@@ -18,7 +18,7 @@
  ****************************************************************/
 package org.apache.james.mailbox.exception;
 
-import org.apache.james.mailbox.quota.QuotaValue;
+import org.apache.james.core.quota.QuotaValue;
 
 /**
  * {@link MailboxException} which identicate that a user was over-quota

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/api/src/main/java/org/apache/james/mailbox/model/Quota.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/model/Quota.java b/mailbox/api/src/main/java/org/apache/james/mailbox/model/Quota.java
index 8b2a2a8..0ea126f 100644
--- a/mailbox/api/src/main/java/org/apache/james/mailbox/model/Quota.java
+++ b/mailbox/api/src/main/java/org/apache/james/mailbox/model/Quota.java
@@ -20,7 +20,7 @@ package org.apache.james.mailbox.model;
 
 import java.util.Map;
 
-import org.apache.james.mailbox.quota.QuotaValue;
+import org.apache.james.core.quota.QuotaValue;
 
 import com.google.common.base.Objects;
 import com.google.common.base.Preconditions;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/api/src/main/java/org/apache/james/mailbox/model/QuotaRatio.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/model/QuotaRatio.java b/mailbox/api/src/main/java/org/apache/james/mailbox/model/QuotaRatio.java
index 5ba6bf1..649439f 100644
--- a/mailbox/api/src/main/java/org/apache/james/mailbox/model/QuotaRatio.java
+++ b/mailbox/api/src/main/java/org/apache/james/mailbox/model/QuotaRatio.java
@@ -20,8 +20,8 @@ package org.apache.james.mailbox.model;
 
 import java.util.Objects;
 
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 
 import com.google.common.base.MoreObjects;
 import com.google.common.base.Preconditions;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/api/src/main/java/org/apache/james/mailbox/quota/CurrentQuotaManager.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/quota/CurrentQuotaManager.java b/mailbox/api/src/main/java/org/apache/james/mailbox/quota/CurrentQuotaManager.java
index ab9ea88..4fe63b5 100644
--- a/mailbox/api/src/main/java/org/apache/james/mailbox/quota/CurrentQuotaManager.java
+++ b/mailbox/api/src/main/java/org/apache/james/mailbox/quota/CurrentQuotaManager.java
@@ -19,6 +19,8 @@
 
 package org.apache.james.mailbox.quota;
 
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.QuotaRoot;
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/api/src/main/java/org/apache/james/mailbox/quota/MaxQuotaManager.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/quota/MaxQuotaManager.java b/mailbox/api/src/main/java/org/apache/james/mailbox/quota/MaxQuotaManager.java
index 355e786..884ed14 100644
--- a/mailbox/api/src/main/java/org/apache/james/mailbox/quota/MaxQuotaManager.java
+++ b/mailbox/api/src/main/java/org/apache/james/mailbox/quota/MaxQuotaManager.java
@@ -23,6 +23,8 @@ import java.util.Map;
 import java.util.Optional;
 
 import org.apache.james.core.Domain;
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.Quota;
 import org.apache.james.mailbox.model.QuotaRoot;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/api/src/main/java/org/apache/james/mailbox/quota/QuotaCount.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/quota/QuotaCount.java b/mailbox/api/src/main/java/org/apache/james/mailbox/quota/QuotaCount.java
deleted file mode 100644
index ac17fa0..0000000
--- a/mailbox/api/src/main/java/org/apache/james/mailbox/quota/QuotaCount.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************
- * 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.mailbox.quota;
-
-import java.util.Optional;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-
-public class QuotaCount implements QuotaValue<QuotaCount> {
-
-    public static QuotaCount unlimited() {
-        return new QuotaCount(Optional.empty());
-    }
-
-    public static QuotaCount count(long value) {
-        return count(Optional.of(value));
-    }
-
-    public static QuotaCount count(Optional<Long> value) {
-        return new QuotaCount(value);
-    }
-
-    private final Optional<Long> value;
-
-    private QuotaCount(Optional<Long> value) {
-        this.value = value;
-    }
-
-    @Override
-    public long asLong() {
-        return value.orElseThrow(IllegalStateException::new);
-    }
-
-    @Override
-    public boolean isLimited() {
-        return value.isPresent();
-    }
-
-    @Override
-    public QuotaCount add(long additionalValue) {
-        return new QuotaCount(value.map(x -> x + additionalValue));
-    }
-
-    @Override
-    public QuotaCount add(QuotaCount additionalValue) {
-        if (additionalValue.isUnlimited()) {
-            return unlimited();
-        }
-        return new QuotaCount(value.map(x -> x + additionalValue.asLong()));
-    }
-
-    @Override
-    public String toString() {
-        return MoreObjects.toStringHelper(this)
-            .add("value", value.map(String::valueOf).orElse("unlimited"))
-            .toString();
-    }
-
-    @Override
-    public boolean isGreaterThan(QuotaCount other) {
-        return value.orElse(Long.MAX_VALUE) > other.value.orElse(Long.MAX_VALUE);
-    }
-
-    @Override
-    public final boolean equals(Object o) {
-        if (o instanceof QuotaCount) {
-            QuotaCount that = (QuotaCount) o;
-            return Objects.equal(this.value, that.value);
-        }
-        return false;
-    }
-
-    @Override
-    public final int hashCode() {
-        return Objects.hashCode(value);
-    }
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/api/src/main/java/org/apache/james/mailbox/quota/QuotaManager.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/quota/QuotaManager.java b/mailbox/api/src/main/java/org/apache/james/mailbox/quota/QuotaManager.java
index 37a3c9e..231d6ad 100644
--- a/mailbox/api/src/main/java/org/apache/james/mailbox/quota/QuotaManager.java
+++ b/mailbox/api/src/main/java/org/apache/james/mailbox/quota/QuotaManager.java
@@ -18,6 +18,8 @@
  ****************************************************************/
 package org.apache.james.mailbox.quota;
 
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.Quota;
 import org.apache.james.mailbox.model.QuotaRoot;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/api/src/main/java/org/apache/james/mailbox/quota/QuotaSize.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/quota/QuotaSize.java b/mailbox/api/src/main/java/org/apache/james/mailbox/quota/QuotaSize.java
deleted file mode 100644
index 4d16e52..0000000
--- a/mailbox/api/src/main/java/org/apache/james/mailbox/quota/QuotaSize.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************
- * 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.mailbox.quota;
-
-import java.util.Optional;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-
-public class QuotaSize implements QuotaValue<QuotaSize> {
-
-    public static final QuotaSize QUOTA_SIZE = new QuotaSize(Optional.empty());
-
-    public static QuotaSize unlimited() {
-        return QUOTA_SIZE;
-    }
-
-    public static QuotaSize size(long value) {
-        return size(Optional.of(value));
-    }
-
-    public static QuotaSize size(Optional<Long> value) {
-        return new QuotaSize(value);
-    }
-
-    private final Optional<Long> value;
-
-    private QuotaSize(Optional<Long> value) {
-        this.value = value;
-    }
-
-    @Override
-    public long asLong() {
-        return value.orElseThrow(IllegalStateException::new);
-    }
-
-    @Override
-    public boolean isLimited() {
-        return value.isPresent();
-    }
-
-    @Override
-    public QuotaSize add(long additionalValue) {
-        return new QuotaSize(value.map(x -> x + additionalValue));
-    }
-
-    @Override
-    public QuotaSize add(QuotaSize additionalValue) {
-        if (additionalValue.isUnlimited()) {
-            return unlimited();
-        }
-        return new QuotaSize(value.map(x -> x + additionalValue.asLong()));
-    }
-
-    @Override
-    public boolean isGreaterThan(QuotaSize other) {
-        return value.orElse(Long.MAX_VALUE) > other.value.orElse(Long.MAX_VALUE);
-    }
-
-    @Override
-    public String toString() {
-        return MoreObjects.toStringHelper(this)
-            .add("value", value.map(String::valueOf).orElse("unlimited"))
-            .toString();
-    }
-
-    @Override
-    public final boolean equals(Object o) {
-        if (o instanceof QuotaSize) {
-            QuotaSize that = (QuotaSize) o;
-            return Objects.equal(this.value, that.value);
-        }
-        return false;
-    }
-
-    @Override
-    public final int hashCode() {
-        return Objects.hashCode(value);
-    }
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/api/src/main/java/org/apache/james/mailbox/quota/QuotaValue.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/quota/QuotaValue.java b/mailbox/api/src/main/java/org/apache/james/mailbox/quota/QuotaValue.java
deleted file mode 100644
index 5fe9c89..0000000
--- a/mailbox/api/src/main/java/org/apache/james/mailbox/quota/QuotaValue.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/****************************************************************
- * 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.mailbox.quota;
-
-public interface QuotaValue<T extends QuotaValue<T>> {
-
-    long asLong();
-
-    boolean isLimited();
-
-    default boolean isUnlimited() {
-        return !isLimited();
-    }
-
-    T add(long additionalValue);
-
-    T add(T additionalValue);
-
-    boolean isGreaterThan(T other);
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/api/src/test/java/org/apache/james/mailbox/manager/ManagerTestResources.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/manager/ManagerTestResources.java b/mailbox/api/src/test/java/org/apache/james/mailbox/manager/ManagerTestResources.java
index 774c06a..58b7292 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/manager/ManagerTestResources.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/manager/ManagerTestResources.java
@@ -25,6 +25,8 @@ import java.util.Calendar;
 
 import javax.mail.Flags;
 
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.FlagsBuilder;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxSession;
@@ -35,10 +37,8 @@ import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.mock.MockMail;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.quota.MaxQuotaManager;
-import org.apache.james.mailbox.quota.QuotaCount;
 import org.apache.james.mailbox.quota.QuotaManager;
 import org.apache.james.mailbox.quota.QuotaRootResolver;
-import org.apache.james.mailbox.quota.QuotaSize;
 
 /**
  * Provide an initialized Mailbox environment where we can run managers tests

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/api/src/test/java/org/apache/james/mailbox/manager/QuotaMessageManagerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/manager/QuotaMessageManagerTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/manager/QuotaMessageManagerTest.java
index d763de3..f8e6308 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/manager/QuotaMessageManagerTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/manager/QuotaMessageManagerTest.java
@@ -21,6 +21,8 @@ package org.apache.james.mailbox.manager;
 
 import javax.mail.Flags;
 
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.FlagsBuilder;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxSession;
@@ -30,9 +32,7 @@ import org.apache.james.mailbox.mock.MockMail;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.model.MessageRange;
 import org.apache.james.mailbox.quota.MaxQuotaManager;
-import org.apache.james.mailbox.quota.QuotaCount;
 import org.apache.james.mailbox.quota.QuotaRootResolver;
-import org.apache.james.mailbox.quota.QuotaSize;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/api/src/test/java/org/apache/james/mailbox/model/QuotaRatioTest.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/QuotaRatioTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/QuotaRatioTest.java
index ac3ad9c..98fc6ce 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/QuotaRatioTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/QuotaRatioTest.java
@@ -21,8 +21,8 @@ package org.apache.james.mailbox.model;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/api/src/test/java/org/apache/james/mailbox/model/QuotaTest.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/QuotaTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/QuotaTest.java
index bcf360b..e11ebdc 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/QuotaTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/QuotaTest.java
@@ -22,8 +22,8 @@ package org.apache.james.mailbox.model;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.junit.Test;
 
 public class QuotaTest {

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/api/src/test/java/org/apache/james/mailbox/quota/QuotaCountTest.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/quota/QuotaCountTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/quota/QuotaCountTest.java
deleted file mode 100644
index 9148001..0000000
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/quota/QuotaCountTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************
- * 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.mailbox.quota;
-
-import org.junit.jupiter.api.Test;
-
-import nl.jqno.equalsverifier.EqualsVerifier;
-
-public class QuotaCountTest implements QuotaValueTest<QuotaCount> {
-
-    @Override
-    public QuotaCount instance(long value) {
-        return QuotaCount.count(value);
-    }
-
-    @Override
-    public QuotaCount unlimited() {
-        return QuotaCount.unlimited();
-    }
-
-    @Test
-    public void shouldRespectBeanContract() {
-        EqualsVerifier.forClass(QuotaCount.class).verify();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/api/src/test/java/org/apache/james/mailbox/quota/QuotaFixture.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/quota/QuotaFixture.java b/mailbox/api/src/test/java/org/apache/james/mailbox/quota/QuotaFixture.java
index 740f8c4..594c787 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/quota/QuotaFixture.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/quota/QuotaFixture.java
@@ -19,6 +19,8 @@
 
 package org.apache.james.mailbox.quota;
 
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.model.Quota;
 
 public interface QuotaFixture {

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/api/src/test/java/org/apache/james/mailbox/quota/QuotaSizeTest.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/quota/QuotaSizeTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/quota/QuotaSizeTest.java
deleted file mode 100644
index cc036d8..0000000
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/quota/QuotaSizeTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************
- * 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.mailbox.quota;
-
-import org.junit.jupiter.api.Test;
-
-import nl.jqno.equalsverifier.EqualsVerifier;
-
-public class QuotaSizeTest implements QuotaValueTest<QuotaSize> {
-
-    @Override
-    public QuotaSize instance(long value) {
-        return QuotaSize.size(value);
-    }
-
-    @Override
-    public QuotaSize unlimited() {
-        return QuotaSize.unlimited();
-    }
-
-    @Test
-    public void shouldRespectBeanContract() {
-        EqualsVerifier.forClass(QuotaSize.class).verify();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/api/src/test/java/org/apache/james/mailbox/quota/QuotaValueTest.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/quota/QuotaValueTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/quota/QuotaValueTest.java
deleted file mode 100644
index 57d6b9e..0000000
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/quota/QuotaValueTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************
- * 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.mailbox.quota;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import org.junit.jupiter.api.Test;
-
-public interface QuotaValueTest<T extends QuotaValue<T>> {
-
-    T instance(long i);
-
-    T unlimited();
-
-    @Test
-    default void greaterThanShouldReturnFalseWhenFirstEqualToSecond() {
-        assertThat(instance(1).isGreaterThan(instance(1))).isFalse();
-    }
-
-    @Test
-    default void greaterThanShouldReturnFalseWhenFirstSmallerThanSecond() {
-        assertThat(instance(1).isGreaterThan(instance(2))).isFalse();
-    }
-
-    @Test
-    default void greaterThanShouldReturnTrueWhenFirstGreaterThanSecond() {
-        assertThat(instance(2).isGreaterThan(instance(1))).isTrue();
-    }
-
-    @Test
-    default void greaterThanShouldReturnFalseWhenFirstIsLimitedAndSecondUnlimited() {
-        assertThat(instance(1).isGreaterThan(unlimited())).isFalse();
-    }
-
-    @Test
-    default void greaterThanShouldReturnFalseWhenBothAreUnlimited() {
-        assertThat(unlimited().isGreaterThan(unlimited())).isFalse();
-    }
-
-    @Test
-    default void greaterThanShouldReturnTrueWhenFirstIsUnlimitedAndSecondLimited() {
-        assertThat(unlimited().isGreaterThan(instance(1))).isTrue();
-    }
-
-    @Test
-    default void addShouldReturnUnlimitedWhenThisIsUnlimited() {
-        assertThat(unlimited().add(2)).isEqualTo(unlimited());
-    }
-
-    @Test
-    default void addShouldReturnUnlimitedWhenBothAre() {
-        assertThat(unlimited().add(unlimited())).isEqualTo(unlimited());
-    }
-
-    @Test
-    default void addShouldReturnSumResult() {
-        assertThat(instance(12).add(instance(23))).isEqualTo(instance(35));
-    }
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraCurrentQuotaManager.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraCurrentQuotaManager.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraCurrentQuotaManager.java
index d6f495c..79f8aa2 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraCurrentQuotaManager.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraCurrentQuotaManager.java
@@ -28,12 +28,12 @@ import static com.datastax.driver.core.querybuilder.QueryBuilder.update;
 
 import javax.inject.Inject;
 
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.MailboxListener;
 import org.apache.james.mailbox.cassandra.table.CassandraCurrentQuota;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.QuotaRoot;
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
 import org.apache.james.mailbox.store.quota.StoreCurrentQuotaManager;
 
 import com.datastax.driver.core.PreparedStatement;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraGlobalMaxQuotaDao.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraGlobalMaxQuotaDao.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraGlobalMaxQuotaDao.java
index 3497ab6..eda028e 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraGlobalMaxQuotaDao.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraGlobalMaxQuotaDao.java
@@ -29,9 +29,9 @@ import java.util.Optional;
 
 import javax.inject.Inject;
 
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.cassandra.table.CassandraGlobalMaxQuota;
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
 
 import com.datastax.driver.core.PreparedStatement;
 import com.datastax.driver.core.ResultSet;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraPerDomainMaxQuotaDao.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraPerDomainMaxQuotaDao.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraPerDomainMaxQuotaDao.java
index d72f432..0b34759 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraPerDomainMaxQuotaDao.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraPerDomainMaxQuotaDao.java
@@ -30,9 +30,9 @@ import java.util.Optional;
 import javax.inject.Inject;
 
 import org.apache.james.core.Domain;
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.cassandra.table.CassandraDomainMaxQuota;
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
 
 import com.datastax.driver.core.PreparedStatement;
 import com.datastax.driver.core.ResultSet;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraPerUserMaxQuotaDao.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraPerUserMaxQuotaDao.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraPerUserMaxQuotaDao.java
index 1a861c7..5eeff8f 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraPerUserMaxQuotaDao.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraPerUserMaxQuotaDao.java
@@ -29,10 +29,10 @@ import java.util.Optional;
 
 import javax.inject.Inject;
 
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.cassandra.table.CassandraMaxQuota;
 import org.apache.james.mailbox.model.QuotaRoot;
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
 
 import com.datastax.driver.core.PreparedStatement;
 import com.datastax.driver.core.ResultSet;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraPerUserMaxQuotaManager.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraPerUserMaxQuotaManager.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraPerUserMaxQuotaManager.java
index fb2178c..e4f7327 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraPerUserMaxQuotaManager.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraPerUserMaxQuotaManager.java
@@ -29,11 +29,11 @@ import javax.inject.Inject;
 
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.james.core.Domain;
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.model.Quota;
 import org.apache.james.mailbox.model.QuotaRoot;
 import org.apache.james.mailbox.quota.MaxQuotaManager;
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
 import org.apache.james.util.OptionalUtils;
 
 import com.github.fge.lambdas.Throwing;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/QuotaCodec.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/QuotaCodec.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/QuotaCodec.java
index 3ab6eaa..85470cd 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/QuotaCodec.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/QuotaCodec.java
@@ -21,9 +21,9 @@ package org.apache.james.mailbox.cassandra.quota;
 import java.util.Optional;
 import java.util.function.Function;
 
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
-import org.apache.james.mailbox.quota.QuotaValue;
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
+import org.apache.james.core.quota.QuotaValue;
 
 public class QuotaCodec {
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java
----------------------------------------------------------------------
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java
index 19e83d8..f0b21d2 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java
@@ -28,6 +28,9 @@ import javax.persistence.EntityManagerFactory;
 
 import org.apache.james.backends.jpa.TransactionRunner;
 import org.apache.james.core.Domain;
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
+import org.apache.james.core.quota.QuotaValue;
 import org.apache.james.mailbox.jpa.quota.model.MaxDomainMessageCount;
 import org.apache.james.mailbox.jpa.quota.model.MaxDomainStorage;
 import org.apache.james.mailbox.jpa.quota.model.MaxGlobalMessageCount;
@@ -35,9 +38,6 @@ import org.apache.james.mailbox.jpa.quota.model.MaxGlobalStorage;
 import org.apache.james.mailbox.jpa.quota.model.MaxUserMessageCount;
 import org.apache.james.mailbox.jpa.quota.model.MaxUserStorage;
 import org.apache.james.mailbox.model.QuotaRoot;
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
-import org.apache.james.mailbox.quota.QuotaValue;
 
 public class JPAPerUserMaxQuotaDAO {
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaManager.java
----------------------------------------------------------------------
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaManager.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaManager.java
index e7de42d..dd24bd2 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaManager.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaManager.java
@@ -29,11 +29,11 @@ import javax.inject.Inject;
 
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.james.core.Domain;
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.model.Quota;
 import org.apache.james.mailbox.model.QuotaRoot;
 import org.apache.james.mailbox.quota.MaxQuotaManager;
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
 import org.apache.james.util.OptionalUtils;
 
 import com.github.fge.lambdas.Throwing;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JpaCurrentQuotaManager.java
----------------------------------------------------------------------
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JpaCurrentQuotaManager.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JpaCurrentQuotaManager.java
index a8f2c54..222a96b 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JpaCurrentQuotaManager.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JpaCurrentQuotaManager.java
@@ -26,12 +26,12 @@ import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
 
 import org.apache.james.backends.jpa.TransactionRunner;
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.MailboxListener;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.jpa.quota.model.JpaCurrentQuota;
 import org.apache.james.mailbox.model.QuotaRoot;
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
 import org.apache.james.mailbox.store.quota.StoreCurrentQuotaManager;
 
 import com.google.common.base.Preconditions;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/model/JpaCurrentQuota.java
----------------------------------------------------------------------
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/model/JpaCurrentQuota.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/model/JpaCurrentQuota.java
index 0b0a201..0011e41 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/model/JpaCurrentQuota.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/model/JpaCurrentQuota.java
@@ -24,8 +24,8 @@ import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.Table;
 
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 
 @Entity(name = "CurrentQuota")
 @Table(name = "JAMES_QUOTA_CURRENTQUOTA")

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/quota/InMemoryCurrentQuotaManager.java
----------------------------------------------------------------------
diff --git a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/quota/InMemoryCurrentQuotaManager.java b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/quota/InMemoryCurrentQuotaManager.java
index d41ad0e..673ac44 100644
--- a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/quota/InMemoryCurrentQuotaManager.java
+++ b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/quota/InMemoryCurrentQuotaManager.java
@@ -24,12 +24,12 @@ import java.util.concurrent.atomic.AtomicLong;
 
 import javax.inject.Inject;
 
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.MailboxListener;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.QuotaRoot;
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
 import org.apache.james.mailbox.store.quota.CurrentQuotaCalculator;
 import org.apache.james.mailbox.store.quota.StoreCurrentQuotaManager;
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/quota/InMemoryPerUserMaxQuotaManager.java
----------------------------------------------------------------------
diff --git a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/quota/InMemoryPerUserMaxQuotaManager.java b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/quota/InMemoryPerUserMaxQuotaManager.java
index 9c42e38..b2b56a7 100644
--- a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/quota/InMemoryPerUserMaxQuotaManager.java
+++ b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/quota/InMemoryPerUserMaxQuotaManager.java
@@ -26,11 +26,11 @@ import java.util.stream.Stream;
 
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.james.core.Domain;
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.model.Quota;
 import org.apache.james.mailbox.model.QuotaRoot;
 import org.apache.james.mailbox.quota.MaxQuotaManager;
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
 import org.apache.james.util.OptionalUtils;
 
 import com.github.fge.lambdas.Throwing;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/quota/InMemoryCurrentQuotaManagerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/quota/InMemoryCurrentQuotaManagerTest.java b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/quota/InMemoryCurrentQuotaManagerTest.java
index 3ea0438..4707ea4 100644
--- a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/quota/InMemoryCurrentQuotaManagerTest.java
+++ b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/quota/InMemoryCurrentQuotaManagerTest.java
@@ -25,10 +25,10 @@ import static org.mockito.Mockito.when;
 
 import java.util.Optional;
 
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.model.QuotaRoot;
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
 import org.apache.james.mailbox.store.quota.CurrentQuotaCalculator;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/plugin/quota-mailing-cassandra/src/main/java/org/apache/james/mailbox/quota/cassandra/dto/QuotaDTO.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-mailing-cassandra/src/main/java/org/apache/james/mailbox/quota/cassandra/dto/QuotaDTO.java b/mailbox/plugin/quota-mailing-cassandra/src/main/java/org/apache/james/mailbox/quota/cassandra/dto/QuotaDTO.java
index bf204c8..30b0685 100644
--- a/mailbox/plugin/quota-mailing-cassandra/src/main/java/org/apache/james/mailbox/quota/cassandra/dto/QuotaDTO.java
+++ b/mailbox/plugin/quota-mailing-cassandra/src/main/java/org/apache/james/mailbox/quota/cassandra/dto/QuotaDTO.java
@@ -21,9 +21,9 @@ package org.apache.james.mailbox.quota.cassandra.dto;
 
 import java.util.Optional;
 
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.model.Quota;
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
 
 import com.fasterxml.jackson.annotation.JsonCreator;
 import com.fasterxml.jackson.annotation.JsonIgnore;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/plugin/quota-mailing-cassandra/src/test/java/org/apache/james/mailbox/quota/cassandra/dto/DTOTest.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-mailing-cassandra/src/test/java/org/apache/james/mailbox/quota/cassandra/dto/DTOTest.java b/mailbox/plugin/quota-mailing-cassandra/src/test/java/org/apache/james/mailbox/quota/cassandra/dto/DTOTest.java
index 5ed61ab..93a9a35 100644
--- a/mailbox/plugin/quota-mailing-cassandra/src/test/java/org/apache/james/mailbox/quota/cassandra/dto/DTOTest.java
+++ b/mailbox/plugin/quota-mailing-cassandra/src/test/java/org/apache/james/mailbox/quota/cassandra/dto/DTOTest.java
@@ -27,11 +27,11 @@ import static org.assertj.core.api.Assertions.assertThat;
 import java.time.Instant;
 
 import org.apache.james.core.User;
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.eventsourcing.EventId;
 import org.apache.james.eventsourcing.eventstore.cassandra.JsonEventSerializer;
 import org.apache.james.mailbox.model.Quota;
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
 import org.apache.james.mailbox.quota.mailing.aggregates.UserQuotaThresholds;
 import org.apache.james.mailbox.quota.mailing.events.QuotaThresholdChangedEvent;
 import org.apache.james.mailbox.quota.model.HistoryEvolution;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/plugin/quota-mailing/src/main/java/org/apache/james/mailbox/quota/mailing/aggregates/UserQuotaThresholds.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-mailing/src/main/java/org/apache/james/mailbox/quota/mailing/aggregates/UserQuotaThresholds.java b/mailbox/plugin/quota-mailing/src/main/java/org/apache/james/mailbox/quota/mailing/aggregates/UserQuotaThresholds.java
index 5ae7835..9b09e13 100644
--- a/mailbox/plugin/quota-mailing/src/main/java/org/apache/james/mailbox/quota/mailing/aggregates/UserQuotaThresholds.java
+++ b/mailbox/plugin/quota-mailing/src/main/java/org/apache/james/mailbox/quota/mailing/aggregates/UserQuotaThresholds.java
@@ -26,11 +26,11 @@ import java.util.Objects;
 import java.util.stream.Collectors;
 
 import org.apache.james.core.User;
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.eventsourcing.AggregateId;
 import org.apache.james.eventsourcing.eventstore.History;
 import org.apache.james.mailbox.model.Quota;
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
 import org.apache.james.mailbox.quota.mailing.QuotaMailingListenerConfiguration;
 import org.apache.james.mailbox.quota.mailing.commands.DetectThresholdCrossing;
 import org.apache.james.mailbox.quota.mailing.events.QuotaThresholdChangedEvent;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/plugin/quota-mailing/src/main/java/org/apache/james/mailbox/quota/mailing/commands/DetectThresholdCrossing.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-mailing/src/main/java/org/apache/james/mailbox/quota/mailing/commands/DetectThresholdCrossing.java b/mailbox/plugin/quota-mailing/src/main/java/org/apache/james/mailbox/quota/mailing/commands/DetectThresholdCrossing.java
index 1128c0b..2f9547a 100644
--- a/mailbox/plugin/quota-mailing/src/main/java/org/apache/james/mailbox/quota/mailing/commands/DetectThresholdCrossing.java
+++ b/mailbox/plugin/quota-mailing/src/main/java/org/apache/james/mailbox/quota/mailing/commands/DetectThresholdCrossing.java
@@ -23,10 +23,10 @@ import java.time.Instant;
 import java.util.Objects;
 
 import org.apache.james.core.User;
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.eventsourcing.Command;
 import org.apache.james.mailbox.model.Quota;
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
 
 public class DetectThresholdCrossing implements Command {
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/plugin/quota-mailing/src/main/java/org/apache/james/mailbox/quota/mailing/events/QuotaThresholdChangedEvent.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-mailing/src/main/java/org/apache/james/mailbox/quota/mailing/events/QuotaThresholdChangedEvent.java b/mailbox/plugin/quota-mailing/src/main/java/org/apache/james/mailbox/quota/mailing/events/QuotaThresholdChangedEvent.java
index 1c036f7..99022f3 100644
--- a/mailbox/plugin/quota-mailing/src/main/java/org/apache/james/mailbox/quota/mailing/events/QuotaThresholdChangedEvent.java
+++ b/mailbox/plugin/quota-mailing/src/main/java/org/apache/james/mailbox/quota/mailing/events/QuotaThresholdChangedEvent.java
@@ -21,11 +21,11 @@ package org.apache.james.mailbox.quota.mailing.events;
 
 import java.util.Objects;
 
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.eventsourcing.Event;
 import org.apache.james.eventsourcing.EventId;
 import org.apache.james.mailbox.model.Quota;
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
 import org.apache.james.mailbox.quota.mailing.aggregates.UserQuotaThresholds;
 import org.apache.james.mailbox.quota.model.HistoryEvolution;
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/plugin/quota-mailing/src/main/java/org/apache/james/mailbox/quota/mailing/subscribers/QuotaThresholdNotice.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-mailing/src/main/java/org/apache/james/mailbox/quota/mailing/subscribers/QuotaThresholdNotice.java b/mailbox/plugin/quota-mailing/src/main/java/org/apache/james/mailbox/quota/mailing/subscribers/QuotaThresholdNotice.java
index 1d3fdc8..884f4a1 100644
--- a/mailbox/plugin/quota-mailing/src/main/java/org/apache/james/mailbox/quota/mailing/subscribers/QuotaThresholdNotice.java
+++ b/mailbox/plugin/quota-mailing/src/main/java/org/apache/james/mailbox/quota/mailing/subscribers/QuotaThresholdNotice.java
@@ -34,10 +34,10 @@ import java.util.stream.Stream;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.james.core.builder.MimeMessageBuilder;
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.mailbox.model.Quota;
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
 import org.apache.james.mailbox.quota.mailing.QuotaMailingListenerConfiguration;
 import org.apache.james.mailbox.quota.model.HistoryEvolution;
 import org.apache.james.mailbox.quota.model.QuotaThreshold;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/subscribers/QuotaThresholdNoticeTest.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/subscribers/QuotaThresholdNoticeTest.java b/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/subscribers/QuotaThresholdNoticeTest.java
index 8ddcf64..f62ad85 100644
--- a/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/subscribers/QuotaThresholdNoticeTest.java
+++ b/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/subscribers/QuotaThresholdNoticeTest.java
@@ -29,12 +29,12 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 import java.util.Optional;
 
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.mailbox.model.Quota;
-import org.apache.james.mailbox.quota.QuotaCount;
 import org.apache.james.mailbox.quota.QuotaFixture.Counts;
 import org.apache.james.mailbox.quota.QuotaFixture.Sizes;
-import org.apache.james.mailbox.quota.QuotaSize;
 import org.apache.james.mailbox.quota.mailing.QuotaMailingListenerConfiguration;
 import org.apache.james.mailbox.quota.mailing.QuotaMailingListenerConfiguration.RenderingInformation;
 import org.apache.james.mailbox.quota.model.HistoryEvolution;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/model/QuotaThresholdTest.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/model/QuotaThresholdTest.java b/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/model/QuotaThresholdTest.java
index 2d850be..f316459 100644
--- a/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/model/QuotaThresholdTest.java
+++ b/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/model/QuotaThresholdTest.java
@@ -26,9 +26,9 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatCode;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.model.Quota;
 import org.apache.james.mailbox.quota.QuotaFixture.Sizes;
-import org.apache.james.mailbox.quota.QuotaSize;
 import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/model/QuotaThresholdsTest.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/model/QuotaThresholdsTest.java b/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/model/QuotaThresholdsTest.java
index f7f18f6..4674f02 100644
--- a/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/model/QuotaThresholdsTest.java
+++ b/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/model/QuotaThresholdsTest.java
@@ -25,9 +25,9 @@ import static org.apache.james.mailbox.quota.model.QuotaThresholdFixture._95;
 import static org.apache.james.mailbox.quota.model.QuotaThresholdFixture._99;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.model.Quota;
 import org.apache.james.mailbox.quota.QuotaFixture.Sizes;
-import org.apache.james.mailbox.quota.QuotaSize;
 import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.ImmutableList;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0a5534/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/json/QuotaRatioAsJsonTest.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/json/QuotaRatioAsJsonTest.java b/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/json/QuotaRatioAsJsonTest.java
index 32a1aca..b2c6411 100644
--- a/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/json/QuotaRatioAsJsonTest.java
+++ b/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/json/QuotaRatioAsJsonTest.java
@@ -23,10 +23,10 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.util.Optional;
 
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.model.Quota;
 import org.apache.james.mailbox.model.QuotaRatio;
-import org.apache.james.mailbox.quota.QuotaCount;
-import org.apache.james.mailbox.quota.QuotaSize;
 import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;


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


Mime
View raw message