james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [06/14] james-project git commit: MAILBOX-355 MailboxManagertest should assert MailboxId carried in events
Date Wed, 05 Dec 2018 09:44:37 GMT
MAILBOX-355 MailboxManagertest should assert MailboxId carried in events


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

Branch: refs/heads/master
Commit: 577d661f351ada8be0f516989ee5f4346d96e430
Parents: 387861a
Author: Benoit Tellier <btellier@linagora.com>
Authored: Tue Dec 4 10:37:03 2018 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Wed Dec 5 16:34:24 2018 +0700

----------------------------------------------------------------------
 .../james/mailbox/MailboxManagerTest.java       | 25 ++++++++++----------
 1 file changed, 13 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/577d661f/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
index 59593cb..6a22dab 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
@@ -364,6 +364,7 @@ public abstract class MailboxManagerTest {
         private final QuotaRoot quotaRoot = QuotaRoot.quotaRoot("#private&USER_1", Optional.empty());
         private EventCollector listener;
         private MailboxPath inbox;
+        private MailboxId inboxId;
         private MessageManager inboxManager;
         private MailboxPath newPath;
 
@@ -374,7 +375,7 @@ public abstract class MailboxManagerTest {
             newPath = MailboxPath.forUser(USER_1, "specialMailbox");
 
             listener = new EventCollector();
-            mailboxManager.createMailbox(inbox, session);
+            inboxId = mailboxManager.createMailbox(inbox, session).get();
             inboxManager = mailboxManager.getMailbox(inbox, session);
         }
 
@@ -390,7 +391,7 @@ public abstract class MailboxManagerTest {
                 .hasSize(1)
                 .extracting(event -> (MailboxListener.MailboxDeletion) event)
                 .element(0)
-                .satisfies(event -> assertThat(event.getMailboxPath()).isEqualTo(inbox))
+                .satisfies(event -> assertThat(event.getMailboxId()).isEqualTo(inboxId))
                 .satisfies(event -> assertThat(event.getQuotaRoot()).isEqualTo(quotaRoot))
                 .satisfies(event -> assertThat(event.getDeletedMessageCount()).isEqualTo(QuotaCount.count(0)))
                 .satisfies(event -> assertThat(event.getTotalDeletedSize()).isEqualTo(QuotaSize.size(0)));
@@ -401,14 +402,14 @@ public abstract class MailboxManagerTest {
             assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Quota));
             mailboxManager.addGlobalListener(listener, session);
 
-            mailboxManager.createMailbox(newPath, session);
+            Optional<MailboxId> newId = mailboxManager.createMailbox(newPath, session);
 
             assertThat(listener.getEvents())
                 .filteredOn(event -> event instanceof MailboxListener.MailboxAdded)
                 .hasSize(1)
                 .extracting(event -> (MailboxListener.MailboxAdded) event)
                 .element(0)
-                .satisfies(event -> assertThat(event.getMailboxPath()).isEqualTo(newPath));
+                .satisfies(event -> assertThat(event.getMailboxId()).isEqualTo(newId.get()));
         }
 
         @Test
@@ -446,7 +447,7 @@ public abstract class MailboxManagerTest {
                 .hasSize(1)
                 .extracting(event -> (MailboxListener.Added) event)
                 .element(0)
-                .satisfies(event -> assertThat(event.getMailboxPath()).isEqualTo(inbox))
+                .satisfies(event -> assertThat(event.getMailboxId()).isEqualTo(inboxId))
                 .satisfies(event -> assertThat(event.getUids()).hasSize(1));
         }
 
@@ -463,7 +464,7 @@ public abstract class MailboxManagerTest {
                 .hasSize(1)
                 .extracting(event -> (MailboxListener.Expunged) event)
                 .element(0)
-                .satisfies(event -> assertThat(event.getMailboxPath()).isEqualTo(inbox))
+                .satisfies(event -> assertThat(event.getMailboxId()).isEqualTo(inboxId))
                 .satisfies(event -> assertThat(event.getUids()).hasSize(1));
         }
 
@@ -479,14 +480,14 @@ public abstract class MailboxManagerTest {
                 .hasSize(1)
                 .extracting(event -> (MailboxListener.FlagsUpdated) event)
                 .element(0)
-                .satisfies(event -> assertThat(event.getMailboxPath()).isEqualTo(inbox))
+                .satisfies(event -> assertThat(event.getMailboxId()).isEqualTo(inboxId))
                 .satisfies(event -> assertThat(event.getUids()).hasSize(1));
         }
 
         @Test
         void moveShouldFireAddedEventInTargetMailbox() throws Exception {
             assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Move));
-            mailboxManager.createMailbox(newPath, session);
+            Optional<MailboxId> targetMailboxId = mailboxManager.createMailbox(newPath,
session);
             inboxManager.appendMessage(AppendCommand.builder().build(message), session);
 
             mailboxManager.addGlobalListener(listener, session);
@@ -497,7 +498,7 @@ public abstract class MailboxManagerTest {
                 .hasSize(1)
                 .extracting(event -> (MailboxListener.Added) event)
                 .element(0)
-                .satisfies(event -> assertThat(event.getMailboxPath()).isEqualTo(newPath))
+                .satisfies(event -> assertThat(event.getMailboxId()).isEqualTo(targetMailboxId.get()))
                 .satisfies(event -> assertThat(event.getUids()).hasSize(1));
         }
 
@@ -515,13 +516,13 @@ public abstract class MailboxManagerTest {
                 .hasSize(1)
                 .extracting(event -> (MailboxListener.Expunged) event)
                 .element(0)
-                .satisfies(event -> assertThat(event.getMailboxPath()).isEqualTo(inbox))
+                .satisfies(event -> assertThat(event.getMailboxId()).isEqualTo(inboxId))
                 .satisfies(event -> assertThat(event.getUids()).hasSize(1));
         }
 
         @Test
         void copyShouldFireAddedEventInTargetMailbox() throws Exception {
-            mailboxManager.createMailbox(newPath, session);
+            Optional<MailboxId> targetMailboxId = mailboxManager.createMailbox(newPath,
session);
             inboxManager.appendMessage(AppendCommand.builder().build(message), session);
 
             mailboxManager.addGlobalListener(listener, session);
@@ -532,7 +533,7 @@ public abstract class MailboxManagerTest {
                 .hasSize(1)
                 .extracting(event -> (MailboxListener.Added) event)
                 .element(0)
-                .satisfies(event -> assertThat(event.getMailboxPath()).isEqualTo(newPath))
+                .satisfies(event -> assertThat(event.getMailboxId()).isEqualTo(targetMailboxId.get()))
                 .satisfies(event -> assertThat(event.getUids()).hasSize(1));
         }
 


---------------------------------------------------------------------
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