You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/01/08 08:00:51 UTC

[32/47] james-project git commit: MAILBOX-364 Builder for QuotaUsageUpdatedEvent

MAILBOX-364 Builder for QuotaUsageUpdatedEvent


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

Branch: refs/heads/master
Commit: 5392ad98b35860b26a63fd8e7b7bcbe256da8966
Parents: 7097446
Author: Benoit Tellier <bt...@linagora.com>
Authored: Thu Jan 3 13:46:21 2019 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Tue Jan 8 14:41:11 2019 +0700

----------------------------------------------------------------------
 .../QuotaThresholdConfigurationChangesTest.java | 206 ++++++++++++++---
 .../QuotaThresholdMailingIntegrationTest.java   | 223 ++++++++++++++++---
 .../ElasticSearchQuotaMailboxListenerTest.java  |  10 +-
 .../json/QuotaRatioToElasticSearchJsonTest.java |  34 +--
 .../james/mailbox/store/event/EventFactory.java |  48 +++-
 5 files changed, 444 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/5392ad98/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/listeners/QuotaThresholdConfigurationChangesTest.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/listeners/QuotaThresholdConfigurationChangesTest.java b/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/listeners/QuotaThresholdConfigurationChangesTest.java
index 87d720d..3114c65 100644
--- a/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/listeners/QuotaThresholdConfigurationChangesTest.java
+++ b/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/listeners/QuotaThresholdConfigurationChangesTest.java
@@ -29,10 +29,10 @@ import static org.apache.james.mailbox.quota.model.QuotaThresholdFixture.mailetC
 import static org.assertj.core.api.Assertions.assertThat;
 
 import org.apache.james.eventsourcing.eventstore.EventStore;
-import org.apache.james.mailbox.MailboxListener.QuotaUsageUpdatedEvent;
 import org.apache.james.mailbox.quota.QuotaFixture.Counts;
 import org.apache.james.mailbox.quota.QuotaFixture.Sizes;
 import org.apache.james.mailbox.quota.mailing.QuotaMailingListenerConfiguration;
+import org.apache.james.mailbox.store.event.EventFactory;
 import org.apache.mailet.base.test.FakeMailContext;
 import org.junit.jupiter.api.Test;
 
@@ -56,13 +56,25 @@ public interface QuotaThresholdConfigurationChangesTest {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, CONFIGURATION_50);
 
-
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._55_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._55_PERCENT)
+            .instant(NOW)
+            .build());
 
         testee = new QuotaThresholdListenersTestSystem(mailetContext, store, CONFIGURATION_75);
 
         mailetContext.resetSentMails();
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._55_PERCENT, NOW));
+
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._55_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).isEmpty();
     }
@@ -72,12 +84,25 @@ public interface QuotaThresholdConfigurationChangesTest {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, CONFIGURATION_75);
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._92_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._92_PERCENT)
+            .instant(NOW)
+            .build());
 
         testee = new QuotaThresholdListenersTestSystem(mailetContext, store, CONFIGURATION_50);
 
         mailetContext.resetSentMails();
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._92_PERCENT, NOW));
+
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._92_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).isEmpty();
     }
@@ -87,12 +112,25 @@ public interface QuotaThresholdConfigurationChangesTest {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, CONFIGURATION_50);
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._92_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._92_PERCENT)
+            .instant(NOW)
+            .build());
 
         testee = new QuotaThresholdListenersTestSystem(mailetContext, store, CONFIGURATION_75);
 
         mailetContext.resetSentMails();
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._92_PERCENT, NOW));
+
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._92_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).hasSize(1);
     }
@@ -102,12 +140,25 @@ public interface QuotaThresholdConfigurationChangesTest {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, CONFIGURATION_50);
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._30_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._30_PERCENT)
+            .instant(NOW)
+            .build());
 
         testee = new QuotaThresholdListenersTestSystem(mailetContext, store, CONFIGURATION_75);
 
         mailetContext.resetSentMails();
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._30_PERCENT, NOW));
+
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._30_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).isEmpty();
     }
@@ -117,12 +168,24 @@ public interface QuotaThresholdConfigurationChangesTest {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, CONFIGURATION_75);
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._30_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._30_PERCENT)
+            .instant(NOW)
+            .build());
 
         testee = new QuotaThresholdListenersTestSystem(mailetContext, store, CONFIGURATION_50);
 
         mailetContext.resetSentMails();
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._30_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._30_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).isEmpty();
     }
@@ -132,12 +195,25 @@ public interface QuotaThresholdConfigurationChangesTest {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, CONFIGURATION_75);
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._60_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._60_PERCENT)
+            .instant(NOW)
+            .build());
 
         testee = new QuotaThresholdListenersTestSystem(mailetContext, store, CONFIGURATION_50);
 
         mailetContext.resetSentMails();
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._60_PERCENT, NOW));
+
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._60_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).hasSize(1);
     }
@@ -147,13 +223,26 @@ public interface QuotaThresholdConfigurationChangesTest {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, CONFIGURATION_50);
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._92_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._92_PERCENT)
+            .instant(NOW)
+            .build());
 
         testee = new QuotaThresholdListenersTestSystem(mailetContext, store,
             CONFIGURATION_50_75);
 
         mailetContext.resetSentMails();
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._92_PERCENT, NOW));
+
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._92_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).hasSize(1);
     }
@@ -163,13 +252,26 @@ public interface QuotaThresholdConfigurationChangesTest {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, CONFIGURATION_50);
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._60_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._60_PERCENT)
+            .instant(NOW)
+            .build());
 
         testee = new QuotaThresholdListenersTestSystem(mailetContext, store,
             CONFIGURATION_50_75);
 
         mailetContext.resetSentMails();
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._60_PERCENT, NOW));
+
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._60_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).isEmpty();
     }
@@ -179,13 +281,26 @@ public interface QuotaThresholdConfigurationChangesTest {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, CONFIGURATION_75);
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._92_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._92_PERCENT)
+            .instant(NOW)
+            .build());
 
         testee = new QuotaThresholdListenersTestSystem(mailetContext, store,
             CONFIGURATION_50_75);
 
         mailetContext.resetSentMails();
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._92_PERCENT, NOW));
+
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._92_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).isEmpty();
     }
@@ -196,12 +311,25 @@ public interface QuotaThresholdConfigurationChangesTest {
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store,
             CONFIGURATION_50_75);
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._92_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._92_PERCENT)
+            .instant(NOW)
+            .build());
 
         testee = new QuotaThresholdListenersTestSystem(mailetContext, store, CONFIGURATION_75);
 
         mailetContext.resetSentMails();
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._92_PERCENT, NOW));
+
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._92_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).isEmpty();
     }
@@ -212,12 +340,25 @@ public interface QuotaThresholdConfigurationChangesTest {
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store,
             CONFIGURATION_50_75);
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._92_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._92_PERCENT)
+            .instant(NOW)
+            .build());
 
         testee = new QuotaThresholdListenersTestSystem(mailetContext, store, CONFIGURATION_50);
 
         mailetContext.resetSentMails();
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._92_PERCENT, NOW));
+
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._92_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).isEmpty();
     }
@@ -228,12 +369,25 @@ public interface QuotaThresholdConfigurationChangesTest {
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store,
             CONFIGURATION_50_75);
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._60_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._60_PERCENT)
+            .instant(NOW)
+            .build());
 
         testee = new QuotaThresholdListenersTestSystem(mailetContext, store, CONFIGURATION_50);
 
         mailetContext.resetSentMails();
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._60_PERCENT, NOW));
+
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._60_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).isEmpty();
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/5392ad98/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/listeners/QuotaThresholdMailingIntegrationTest.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/listeners/QuotaThresholdMailingIntegrationTest.java b/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/listeners/QuotaThresholdMailingIntegrationTest.java
index f1a8343..cefec6e 100644
--- a/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/listeners/QuotaThresholdMailingIntegrationTest.java
+++ b/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/listeners/QuotaThresholdMailingIntegrationTest.java
@@ -38,10 +38,10 @@ import static org.assertj.core.api.Assertions.assertThat;
 import java.time.Duration;
 
 import org.apache.james.eventsourcing.eventstore.EventStore;
-import org.apache.james.mailbox.MailboxListener.QuotaUsageUpdatedEvent;
 import org.apache.james.mailbox.quota.QuotaFixture.Counts;
 import org.apache.james.mailbox.quota.QuotaFixture.Sizes;
 import org.apache.james.mailbox.quota.mailing.QuotaMailingListenerConfiguration;
+import org.apache.james.mailbox.store.event.EventFactory;
 import org.apache.james.util.concurrency.ConcurrentTestRunner;
 import org.apache.mailet.base.test.FakeMailContext;
 import org.junit.jupiter.api.Test;
@@ -53,7 +53,13 @@ public interface QuotaThresholdMailingIntegrationTest {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, DEFAULT_CONFIGURATION);
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._30_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._30_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).isEmpty();
     }
@@ -62,10 +68,23 @@ public interface QuotaThresholdMailingIntegrationTest {
     default void shouldNotSendMailWhenNoThresholdUpdate(EventStore store) throws Exception {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, DEFAULT_CONFIGURATION);
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._55_PERCENT, ONE_HOUR_AGO));
+
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._55_PERCENT)
+            .instant(ONE_HOUR_AGO)
+            .build());
         mailetContext.resetSentMails();
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._55_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._55_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).isEmpty();
     }
@@ -74,11 +93,29 @@ public interface QuotaThresholdMailingIntegrationTest {
     default void shouldNotSendMailWhenThresholdOverPassedRecently(EventStore store) throws Exception {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, DEFAULT_CONFIGURATION);
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._55_PERCENT, TWELVE_HOURS_AGO));
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._30_PERCENT, SIX_HOURS_AGO));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._55_PERCENT)
+            .instant(TWELVE_HOURS_AGO)
+            .build());
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._30_PERCENT)
+            .instant(SIX_HOURS_AGO)
+            .build());
         mailetContext.resetSentMails();
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._55_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._55_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).isEmpty();
     }
@@ -88,7 +125,13 @@ public interface QuotaThresholdMailingIntegrationTest {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, DEFAULT_CONFIGURATION);
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._55_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._55_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).hasSize(1);
     }
@@ -97,9 +140,21 @@ public interface QuotaThresholdMailingIntegrationTest {
     default void shouldNotSendDuplicates(EventStore store) throws Exception {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, DEFAULT_CONFIGURATION);
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._55_PERCENT, ONE_HOUR_AGO));
-
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._55_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._55_PERCENT)
+            .instant(ONE_HOUR_AGO)
+            .build());
+
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._55_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).hasSize(1);
     }
@@ -108,9 +163,21 @@ public interface QuotaThresholdMailingIntegrationTest {
     default void shouldNotifySeparatelyCountAndSize(EventStore store) throws Exception {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, DEFAULT_CONFIGURATION);
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._55_PERCENT, ONE_HOUR_AGO));
-
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._52_PERCENT, Sizes._60_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._55_PERCENT)
+            .instant(ONE_HOUR_AGO)
+            .build());
+
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._52_PERCENT)
+            .quotaSize(Sizes._60_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).hasSize(2);
     }
@@ -120,7 +187,13 @@ public interface QuotaThresholdMailingIntegrationTest {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, DEFAULT_CONFIGURATION);
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._52_PERCENT, Sizes._55_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._52_PERCENT)
+            .quotaSize(Sizes._55_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).hasSize(1);
     }
@@ -129,11 +202,29 @@ public interface QuotaThresholdMailingIntegrationTest {
     default void shouldSendMailWhenThresholdOverPassedOverGracePeriod(EventStore store) throws Exception {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, DEFAULT_CONFIGURATION);
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._55_PERCENT, TWELVE_DAYS_AGO));
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._30_PERCENT, SIX_DAYS_AGO));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._55_PERCENT)
+            .instant(TWELVE_DAYS_AGO)
+            .build());
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._30_PERCENT)
+            .instant(SIX_DAYS_AGO)
+            .build());
         mailetContext.resetSentMails();
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._55_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._55_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).hasSize(1);
     }
@@ -142,10 +233,22 @@ public interface QuotaThresholdMailingIntegrationTest {
     default void shouldNotSendMailWhenNoThresholdUpdateForCount(EventStore store) throws Exception {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, DEFAULT_CONFIGURATION);
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._32_PERCENT, Sizes._55_PERCENT, TWO_DAYS_AGO));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._32_PERCENT)
+            .quotaSize(Sizes._55_PERCENT)
+            .instant(TWO_DAYS_AGO)
+            .build());
         mailetContext.resetSentMails();
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._60_PERCENT, TWO_DAYS_AGO));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._60_PERCENT)
+            .instant(TWO_DAYS_AGO)
+            .build());
 
         assertThat(mailetContext.getSentMails()).isEmpty();
     }
@@ -154,11 +257,29 @@ public interface QuotaThresholdMailingIntegrationTest {
     default void shouldNotSendMailWhenThresholdOverPassedRecentlyForCount(EventStore store) throws Exception {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, DEFAULT_CONFIGURATION);
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._52_PERCENT, Sizes._30_PERCENT, TWELVE_HOURS_AGO));
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._30_PERCENT, SIX_HOURS_AGO));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._52_PERCENT)
+            .quotaSize(Sizes._30_PERCENT)
+            .instant(TWELVE_HOURS_AGO)
+            .build());
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._30_PERCENT)
+            .instant(SIX_HOURS_AGO)
+            .build());
         mailetContext.resetSentMails();
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._52_PERCENT, Sizes._30_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._52_PERCENT)
+            .quotaSize(Sizes._30_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).isEmpty();
     }
@@ -168,7 +289,13 @@ public interface QuotaThresholdMailingIntegrationTest {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, DEFAULT_CONFIGURATION);
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._52_PERCENT, Sizes._30_PERCENT, TWELVE_HOURS_AGO));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._52_PERCENT)
+            .quotaSize(Sizes._30_PERCENT)
+            .instant(TWELVE_HOURS_AGO)
+            .build());
 
         assertThat(mailetContext.getSentMails()).hasSize(1);
     }
@@ -177,11 +304,29 @@ public interface QuotaThresholdMailingIntegrationTest {
     default void shouldSendMailWhenThresholdOverPassedOverGracePeriodForCount(EventStore store) throws Exception {
         FakeMailContext mailetContext = mailetContext();
         QuotaThresholdListenersTestSystem testee = new QuotaThresholdListenersTestSystem(mailetContext, store, DEFAULT_CONFIGURATION);
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._52_PERCENT, Sizes._30_PERCENT, TWELVE_DAYS_AGO));
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._30_PERCENT, SIX_DAYS_AGO));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._52_PERCENT)
+            .quotaSize(Sizes._30_PERCENT)
+            .instant(TWELVE_DAYS_AGO)
+            .build());
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._40_PERCENT)
+            .quotaSize(Sizes._30_PERCENT)
+            .instant(SIX_DAYS_AGO)
+            .build());
         mailetContext.resetSentMails();
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._52_PERCENT, Sizes._30_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._52_PERCENT)
+            .quotaSize(Sizes._30_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails()).hasSize(1);
     }
@@ -195,8 +340,20 @@ public interface QuotaThresholdMailingIntegrationTest {
                 .gracePeriod(GRACE_PERIOD)
                 .build());
 
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._52_PERCENT, Sizes._30_PERCENT, NOW));
-        testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._85_PERCENT, Sizes._42_PERCENT, NOW));
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._52_PERCENT)
+            .quotaSize(Sizes._30_PERCENT)
+            .instant(NOW)
+            .build());
+        testee.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._85_PERCENT)
+            .quotaSize(Sizes._42_PERCENT)
+            .instant(NOW)
+            .build());
 
         assertThat(mailetContext.getSentMails())
             .hasSize(2);
@@ -212,7 +369,13 @@ public interface QuotaThresholdMailingIntegrationTest {
                 .build());
 
         ConcurrentTestRunner.builder()
-            .operation((threadNb, step) -> testee.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._40_PERCENT, Sizes._55_PERCENT, NOW)))
+            .operation((threadNb, step) -> testee.event(EventFactory.quotaUpdated()
+                    .user(BOB_USER)
+                    .quotaRoot(QUOTAROOT)
+                    .quotaCount(Counts._40_PERCENT)
+                    .quotaSize(Sizes._55_PERCENT)
+                    .instant(NOW)
+                    .build()))
             .threadCount(10)
             .runSuccessfullyWithin(Duration.ofMinutes(1));
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/5392ad98/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/events/ElasticSearchQuotaMailboxListenerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/events/ElasticSearchQuotaMailboxListenerTest.java b/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/events/ElasticSearchQuotaMailboxListenerTest.java
index d749146..4f33fe5 100644
--- a/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/events/ElasticSearchQuotaMailboxListenerTest.java
+++ b/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/events/ElasticSearchQuotaMailboxListenerTest.java
@@ -34,9 +34,9 @@ import org.apache.james.backends.es.ElasticSearchIndexer;
 import org.apache.james.backends.es.EmbeddedElasticSearch;
 import org.apache.james.backends.es.utils.TestingClientProvider;
 import org.apache.james.mailbox.Event;
-import org.apache.james.mailbox.MailboxListener.QuotaUsageUpdatedEvent;
 import org.apache.james.mailbox.quota.QuotaFixture.Counts;
 import org.apache.james.mailbox.quota.QuotaFixture.Sizes;
+import org.apache.james.mailbox.store.event.EventFactory;
 import org.apache.james.quota.search.elasticsearch.QuotaRatioElasticSearchConstants;
 import org.apache.james.quota.search.elasticsearch.QuotaSearchIndexCreationUtil;
 import org.apache.james.quota.search.elasticsearch.json.QuotaRatioToElasticSearchJson;
@@ -93,7 +93,13 @@ public class ElasticSearchQuotaMailboxListenerTest {
 
     @Test
     public void eventShouldIndexEventWhenQuotaEvent() throws Exception {
-        quotaMailboxListener.event(new QuotaUsageUpdatedEvent(BOB_USER, QUOTAROOT, Counts._52_PERCENT, Sizes._55_PERCENT, NOW));
+        quotaMailboxListener.event(EventFactory.quotaUpdated()
+            .user(BOB_USER)
+            .quotaRoot(QUOTAROOT)
+            .quotaCount(Counts._52_PERCENT)
+            .quotaSize(Sizes._55_PERCENT)
+            .instant(NOW)
+            .build());
 
         embeddedElasticSearch.awaitForElasticSearch();
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/5392ad98/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/json/QuotaRatioToElasticSearchJsonTest.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/json/QuotaRatioToElasticSearchJsonTest.java b/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/json/QuotaRatioToElasticSearchJsonTest.java
index 4564be1..be9a938 100644
--- a/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/json/QuotaRatioToElasticSearchJsonTest.java
+++ b/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/json/QuotaRatioToElasticSearchJsonTest.java
@@ -30,21 +30,22 @@ import org.apache.james.core.User;
 import org.apache.james.mailbox.MailboxListener.QuotaUsageUpdatedEvent;
 import org.apache.james.mailbox.model.QuotaRoot;
 import org.apache.james.mailbox.quota.QuotaFixture;
+import org.apache.james.mailbox.store.event.EventFactory;
 import org.apache.james.util.ClassLoaderUtils;
 import org.junit.jupiter.api.Test;
 
-public class QuotaRatioToElasticSearchJsonTest {
+class QuotaRatioToElasticSearchJsonTest {
 
     @Test
-    public void quotaRatioShouldBeWellConvertedToJson() throws IOException {
+    void quotaRatioShouldBeWellConvertedToJson() throws IOException {
         String user = "user@domain.org";
-        QuotaUsageUpdatedEvent event = new QuotaUsageUpdatedEvent(
-                User.fromUsername(user),
-                QuotaRoot.quotaRoot("any", Optional.of(Domain.of("domain.org"))),
-                QuotaFixture.Counts._52_PERCENT,
-                QuotaFixture.Sizes._55_PERCENT,
-                Instant.now());
-        
+        QuotaUsageUpdatedEvent event = EventFactory.quotaUpdated()
+            .user(User.fromUsername(user))
+            .quotaRoot(QuotaRoot.quotaRoot(user, Optional.of(Domain.of("domain.org"))))
+            .quotaCount(QuotaFixture.Counts._52_PERCENT)
+            .quotaSize(QuotaFixture.Sizes._55_PERCENT)
+            .instant(Instant.now())
+            .build();
 
         QuotaRatioToElasticSearchJson quotaRatioToElasticSearchJson = new QuotaRatioToElasticSearchJson();
         String convertToJson = quotaRatioToElasticSearchJson.convertToJson(user, event);
@@ -55,14 +56,15 @@ public class QuotaRatioToElasticSearchJsonTest {
     }
 
     @Test
-    public void quotaRatioShouldBeWellConvertedToJsonWhenNoDomain() throws IOException {
+    void quotaRatioShouldBeWellConvertedToJsonWhenNoDomain() throws IOException {
         String user = "user";
-        QuotaUsageUpdatedEvent event = new QuotaUsageUpdatedEvent(
-                User.fromUsername(user),
-                QuotaRoot.quotaRoot("any", Optional.empty()),
-                QuotaFixture.Counts._52_PERCENT,
-                QuotaFixture.Sizes._55_PERCENT,
-                Instant.now());
+        QuotaUsageUpdatedEvent event = EventFactory.quotaUpdated()
+            .user(User.fromUsername(user))
+            .quotaRoot(QuotaRoot.quotaRoot(user, Optional.empty()))
+            .quotaCount(QuotaFixture.Counts._52_PERCENT)
+            .quotaSize(QuotaFixture.Sizes._55_PERCENT)
+            .instant(Instant.now())
+            .build();
 
 
         QuotaRatioToElasticSearchJson quotaRatioToElasticSearchJson = new QuotaRatioToElasticSearchJson();

http://git-wip-us.apache.org/repos/asf/james-project/blob/5392ad98/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/EventFactory.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/EventFactory.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/EventFactory.java
index 5695c6f..e4a96e8 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/EventFactory.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/EventFactory.java
@@ -19,6 +19,8 @@
 
 package org.apache.james.mailbox.store.event;
 
+import java.time.Instant;
+
 import org.apache.james.core.User;
 import org.apache.james.core.quota.QuotaCount;
 import org.apache.james.core.quota.QuotaSize;
@@ -30,6 +32,7 @@ import org.apache.james.mailbox.acl.ACLDiff;
 import org.apache.james.mailbox.model.MailboxId;
 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.store.mail.model.Mailbox;
@@ -137,16 +140,31 @@ public class EventFactory {
     }
 
     @FunctionalInterface
-    public interface RequireQuotaCount<T> {
+    public interface RequireQuotaCountValue<T> {
         T quotaCount(QuotaCount quotaCount);
     }
 
     @FunctionalInterface
-    public interface RequireQuotaSize<T> {
+    public interface RequireQuotaSizeValue<T> {
         T quotaSize(QuotaSize quotaSize);
     }
 
     @FunctionalInterface
+    public interface RequireQuotaCount<T> {
+        T quotaCount(Quota<QuotaCount> quotaCount);
+    }
+
+    @FunctionalInterface
+    public interface RequireQuotaSize<T> {
+        T quotaSize(Quota<QuotaSize> quotaSize);
+    }
+
+    @FunctionalInterface
+    public interface RequireInstant<T> {
+        T instant(Instant instant);
+    }
+
+    @FunctionalInterface
     public interface RequireMailboxEvent<T> extends RequireSession<RequireMailbox<T>> {}
 
     public static class MailboxAddedFinalStage {
@@ -336,6 +354,26 @@ public class EventFactory {
         }
     }
 
+    public static final class QuotaUsageUpdatedFinalStage {
+        private final User user;
+        private final QuotaRoot quotaRoot;
+        private final Quota<QuotaCount> countQuota;
+        private final Quota<QuotaSize> sizeQuota;
+        private final Instant instant;
+
+        QuotaUsageUpdatedFinalStage(User user, QuotaRoot quotaRoot, Quota<QuotaCount> countQuota, Quota<QuotaSize> sizeQuota, Instant instant) {
+            this.user = user;
+            this.quotaRoot = quotaRoot;
+            this.countQuota = countQuota;
+            this.sizeQuota = sizeQuota;
+            this.instant = instant;
+        }
+
+        public MailboxListener.QuotaUsageUpdatedEvent build() {
+            return new MailboxListener.QuotaUsageUpdatedEvent(user, quotaRoot, countQuota, sizeQuota, instant);
+        }
+    }
+
     public static RequireMailboxEvent<RequireMetadata<AddedFinalStage>> added() {
         return user -> sessionId -> mailboxId -> path -> metaData -> new AddedFinalStage(path, mailboxId, user, sessionId, metaData);
     }
@@ -352,7 +390,7 @@ public class EventFactory {
         return user -> sessionId -> mailboxId -> oldPath -> newPath -> new MailboxRenamedFinalStage(oldPath, mailboxId, user, sessionId, newPath);
     }
 
-    public static  RequireMailboxEvent<RequireQuotaRoot<RequireQuotaCount<RequireQuotaSize<MailboxDeletionFinalStage>>>> mailboxDeleted() {
+    public static  RequireMailboxEvent<RequireQuotaRoot<RequireQuotaCountValue<RequireQuotaSizeValue<MailboxDeletionFinalStage>>>> mailboxDeleted() {
         return user -> sessionId -> mailboxId -> path -> quotaRoot -> quotaCount -> quotaSize -> new MailboxDeletionFinalStage(
             path, mailboxId, user, sessionId, quotaRoot, quotaCount, quotaSize);
     }
@@ -365,6 +403,10 @@ public class EventFactory {
         return user -> sessionId -> mailboxId -> path -> aclDiff -> new MailboxAclUpdatedFinalStage(path, mailboxId, user, sessionId, aclDiff);
     }
 
+    public static RequireUser<RequireQuotaRoot<RequireQuotaCount<RequireQuotaSize<RequireInstant<QuotaUsageUpdatedFinalStage>>>>> quotaUpdated() {
+        return user -> quotaRoot -> quotaCount -> quotaSize -> instant -> new QuotaUsageUpdatedFinalStage(user, quotaRoot, quotaCount, quotaSize, instant);
+    }
+
     public static MessageMoveEvent.Builder moved() {
         return MessageMoveEvent.builder();
     }


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