james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [james-project] 02/05: JAMES-2694 refactor MailboxMessageFixture
Date Mon, 15 Apr 2019 07:42:19 GMT
This is an automated email from the ASF dual-hosted git repository.

aduprat pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit ff3728ecf8e0f9fbb44d54904c200a8de558476e
Author: RĂ©mi Kowalski <rkowalski@linagora.com>
AuthorDate: Mon Mar 25 15:47:28 2019 +0100

    JAMES-2694 refactor MailboxMessageFixture
---
 .../mailbox/backup/DefaultMailboxBackupTest.java   |  8 --------
 .../mailbox/backup/MailboxMessageFixture.java      | 22 +++++++++++++++++-----
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/mailbox/backup/src/test/java/org/apache/james/mailbox/backup/DefaultMailboxBackupTest.java
b/mailbox/backup/src/test/java/org/apache/james/mailbox/backup/DefaultMailboxBackupTest.java
index 964e00b..98582a4 100644
--- a/mailbox/backup/src/test/java/org/apache/james/mailbox/backup/DefaultMailboxBackupTest.java
+++ b/mailbox/backup/src/test/java/org/apache/james/mailbox/backup/DefaultMailboxBackupTest.java
@@ -24,7 +24,6 @@ import java.io.IOException;
 import java.util.Arrays;
 import java.util.HashSet;
 
-import org.apache.james.core.User;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageManager;
@@ -41,13 +40,6 @@ import com.github.fge.lambdas.Throwing;
 
 class DefaultMailboxBackupTest implements MailboxMessageFixture {
 
-    private static final String USER = "user";
-    private static final String OTHER_USER = "otherUser";
-
-    private static final User USER1 = User.fromUsername(USER);
-    private static final MailboxPath MAILBOX_PATH_USER1_MAILBOX1 = MailboxPath.forUser(USER,
MAILBOX_1_NAME);
-    private static final MailboxPath MAILBOX_PATH_USER1_MAILBOX2 = MailboxPath.forUser(USER,
MAILBOX_2_NAME);
-    private static final MailboxPath MAILBOX_PATH_OTHER_USER_MAILBOX1 = MailboxPath.forUser(OTHER_USER,
MAILBOX_OTHER_USER_NAME);
     private static final HashSet<PreDeletionHook> PRE_DELETION_HOOKS = new HashSet<>();
 
     private static final int BUFFER_SIZE = 4096;
diff --git a/mailbox/backup/src/test/java/org/apache/james/mailbox/backup/MailboxMessageFixture.java
b/mailbox/backup/src/test/java/org/apache/james/mailbox/backup/MailboxMessageFixture.java
index 104d54a..257a9f8 100644
--- a/mailbox/backup/src/test/java/org/apache/james/mailbox/backup/MailboxMessageFixture.java
+++ b/mailbox/backup/src/test/java/org/apache/james/mailbox/backup/MailboxMessageFixture.java
@@ -28,6 +28,7 @@ import java.util.List;
 import javax.mail.Flags;
 import javax.mail.util.SharedByteArrayInputStream;
 
+import org.apache.james.core.User;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MailboxSessionUtil;
 import org.apache.james.mailbox.MessageUid;
@@ -46,6 +47,11 @@ import com.google.common.collect.ImmutableList;
 
 public interface MailboxMessageFixture {
 
+    String USER = "user";
+    String OTHER_USER = "otherUser";
+
+    User USER1 = User.fromUsername(USER);
+
     String DATE_STRING_1 = "2018-02-15T15:54:02Z";
     String DATE_STRING_2 = "2018-03-15T15:54:02Z";
     ZonedDateTime DATE_1 = ZonedDateTime.parse(DATE_STRING_1);
@@ -75,15 +81,21 @@ public interface MailboxMessageFixture {
     MailboxId MAILBOX_ID_11 = TestId.of(11L);
     Flags flags1 = new Flags("myFlags");
 
-    MailboxSession MAILBOX_SESSION = MailboxSessionUtil.create("user");
+    MailboxSession MAILBOX_SESSION = MailboxSessionUtil.create(USER);
 
     String MAILBOX_1_NAME = "mailbox1";
     String MAILBOX_2_NAME = "mailbox2";
     String MAILBOX_OTHER_USER_NAME = "mailbox_other";
-    Mailbox MAILBOX_1 = new Mailbox(MailboxPath.forUser("user", MAILBOX_1_NAME), 42, MAILBOX_ID_1);
-    Mailbox MAILBOX_1_OTHER_USER = new Mailbox(MailboxPath.forUser("otherUser", MAILBOX_OTHER_USER_NAME),
42, MAILBOX_ID_11);
-    Mailbox MAILBOX_1_SUB_1 = new Mailbox(MailboxPath.forUser("user", MAILBOX_1_NAME + MAILBOX_SESSION.getPathDelimiter()
+ "sub1"), 420, TestId.of(11L));
-    Mailbox MAILBOX_2 = new Mailbox(MailboxPath.forUser("user", MAILBOX_2_NAME), 43, MAILBOX_ID_2);
+
+    MailboxPath MAILBOX_PATH_USER1_MAILBOX1 = MailboxPath.forUser(USER, MAILBOX_1_NAME);
+    MailboxPath MAILBOX_PATH_USER1_MAILBOX1_SUB_1 = MailboxPath.forUser(USER, MAILBOX_1_NAME
+ MAILBOX_SESSION.getPathDelimiter() + "sub1");
+    MailboxPath MAILBOX_PATH_USER1_MAILBOX2 = MailboxPath.forUser(USER, MAILBOX_2_NAME);
+    MailboxPath MAILBOX_PATH_OTHER_USER_MAILBOX1 = MailboxPath.forUser(OTHER_USER, MAILBOX_OTHER_USER_NAME);
+
+    Mailbox MAILBOX_1 = new Mailbox(MAILBOX_PATH_USER1_MAILBOX1, 42, MAILBOX_ID_1);
+    Mailbox MAILBOX_1_OTHER_USER = new Mailbox(MAILBOX_PATH_OTHER_USER_MAILBOX1, 42, MAILBOX_ID_11);
+    Mailbox MAILBOX_1_SUB_1 = new Mailbox(MAILBOX_PATH_USER1_MAILBOX1_SUB_1, 420, TestId.of(11L));
+    Mailbox MAILBOX_2 = new Mailbox(MAILBOX_PATH_USER1_MAILBOX2, 43, MAILBOX_ID_2);
 
     List<MailboxAnnotation> NO_ANNOTATION = ImmutableList.of();
 


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