james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [17/29] james-project git commit: JAMES-2169 Use MailboxPath::forUser more widely
Date Wed, 04 Oct 2017 09:28:40 GMT
http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMailboxesMethodStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMailboxesMethodStepdefs.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMailboxesMethodStepdefs.java
index 6e7ee4c..59fef05 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMailboxesMethodStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMailboxesMethodStepdefs.java
@@ -33,7 +33,6 @@ import org.apache.http.HttpResponse;
 import org.apache.http.client.fluent.Request;
 import org.apache.http.entity.ContentType;
 import org.apache.james.mailbox.exception.MailboxException;
-import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.store.mail.model.Mailbox;
 
@@ -66,7 +65,7 @@ public class SetMailboxesMethodStepdefs {
     @Given("^mailbox \"([^\"]*)\" with (\\d+) messages$")
     public void mailboxWithMessages(String mailboxName, int messageCount) throws Throwable
{
         mainStepdefs.mailboxProbe.createMailbox("#private", userStepdefs.lastConnectedUser,
mailboxName);
-        MailboxPath mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, userStepdefs.lastConnectedUser,
mailboxName);
+        MailboxPath mailboxPath = MailboxPath.forUser(userStepdefs.lastConnectedUser, mailboxName);
         IntStream
             .range(0, messageCount)
             .forEach(Throwing.intConsumer(i -> appendMessage(mailboxPath, i)));

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/server/protocols/jmap/src/main/java/org/apache/james/jmap/utils/SystemMailboxesProviderImpl.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/utils/SystemMailboxesProviderImpl.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/utils/SystemMailboxesProviderImpl.java
index d17dd84..043d808 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/utils/SystemMailboxesProviderImpl.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/utils/SystemMailboxesProviderImpl.java
@@ -29,7 +29,6 @@ import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageManager;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.exception.MailboxNotFoundException;
-import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailbox.model.MailboxMetaData;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.model.MailboxQuery;
@@ -50,7 +49,7 @@ public class SystemMailboxesProviderImpl implements SystemMailboxesProvider
{
 
     @Override
     public Stream<MessageManager> getMailboxByRole(Role aRole, MailboxSession session)
throws MailboxException {
-        MailboxPath mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, session.getUser().getUserName(),
aRole.getDefaultMailbox());
+        MailboxPath mailboxPath = MailboxPath.forUser(session.getUser().getUserName(), aRole.getDefaultMailbox());
         try {
             return Stream.of(mailboxManager.getMailbox(mailboxPath, session));
         } catch (MailboxNotFoundException e) {

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/server/protocols/jmap/src/test/java/org/apache/james/jmap/DefaultMailboxesProvisioningFilterTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/DefaultMailboxesProvisioningFilterTest.java
b/server/protocols/jmap/src/test/java/org/apache/james/jmap/DefaultMailboxesProvisioningFilterTest.java
index e706d27..6700202 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/DefaultMailboxesProvisioningFilterTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/DefaultMailboxesProvisioningFilterTest.java
@@ -27,7 +27,6 @@ import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver;
 import org.apache.james.mailbox.inmemory.manager.InMemoryIntegrationResources;
 import org.apache.james.mailbox.mock.MockMailboxSession;
-import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.metrics.api.NoopMetricFactory;
 import org.apache.james.util.concurrency.ConcurrentTestRunner;
@@ -59,7 +58,7 @@ public class DefaultMailboxesProvisioningFilterTest {
         assertThat(mailboxManager.list(session))
             .containsOnlyElementsOf(DefaultMailboxes.DEFAULT_MAILBOXES
                 .stream()
-                .map(mailboxName -> new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME,
mailboxName))
+                .map(mailboxName -> MailboxPath.forUser(USERNAME, mailboxName))
                 .collect(Guavate.toImmutableList()));
     }
 
@@ -76,7 +75,7 @@ public class DefaultMailboxesProvisioningFilterTest {
         assertThat(mailboxManager.list(session))
             .containsOnlyElementsOf(DefaultMailboxes.DEFAULT_MAILBOXES
                 .stream()
-                .map(mailboxName -> new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME,
mailboxName))
+                .map(mailboxName -> MailboxPath.forUser(USERNAME, mailboxName))
                 .collect(Guavate.toImmutableList()));
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/GetMailboxesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/GetMailboxesMethodTest.java
b/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/GetMailboxesMethodTest.java
index 7c5d380..9f6c4ce 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/GetMailboxesMethodTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/GetMailboxesMethodTest.java
@@ -119,7 +119,7 @@ public class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldReturnMailboxesWhenAvailable() throws Exception {
-        MailboxPath mailboxPath = new MailboxPath("#private", USERNAME, "name");
+        MailboxPath mailboxPath = MailboxPath.forUser(USERNAME, "name");
         MailboxSession mailboxSession = mailboxManager.createSystemSession(USERNAME);
         mailboxManager.createMailbox(mailboxPath, mailboxSession);
         MessageManager messageManager = mailboxManager.getMailbox(mailboxPath, mailboxSession);
@@ -143,8 +143,8 @@ public class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldReturnOnlyMailboxesOfCurrentUserWhenAvailable() throws
Exception {
-        MailboxPath mailboxPathToReturn = new MailboxPath("#private", USERNAME, "mailboxToReturn");
-        MailboxPath mailboxPathtoSkip = new MailboxPath("#private", USERNAME2, "mailboxToSkip");
+        MailboxPath mailboxPathToReturn = MailboxPath.forUser(USERNAME, "mailboxToReturn");
+        MailboxPath mailboxPathtoSkip = MailboxPath.forUser(USERNAME2, "mailboxToSkip");
         MailboxSession userSession = mailboxManager.createSystemSession(USERNAME);
         MailboxSession user2Session = mailboxManager.createSystemSession(USERNAME2);
         mailboxManager.createMailbox(mailboxPathToReturn, userSession);
@@ -168,7 +168,7 @@ public class GetMailboxesMethodTest {
     @Test
     public void getMailboxesShouldReturnInboxWithSortOrder10() throws Exception {
         MailboxSession mailboxSession = mailboxManager.createSystemSession(USERNAME);
-        MailboxPath mailboxPath = new MailboxPath("#private", USERNAME, "INBOX");
+        MailboxPath mailboxPath = MailboxPath.forUser(USERNAME, "INBOX");
         mailboxManager.createMailbox(mailboxPath, mailboxSession);
 
         GetMailboxesRequest getMailboxesRequest = GetMailboxesRequest.builder()
@@ -189,7 +189,7 @@ public class GetMailboxesMethodTest {
     @Test
     public void getMailboxesShouldReturnSortOrder1000OnUnknownFolder() throws Exception {
         MailboxSession mailboxSession = mailboxManager.createSystemSession(USERNAME);
-        MailboxPath mailboxPath = new MailboxPath("#private", USERNAME, "unknown");
+        MailboxPath mailboxPath = MailboxPath.forUser(USERNAME, "unknown");
         mailboxManager.createMailbox(mailboxPath, mailboxSession);
 
         GetMailboxesRequest getMailboxesRequest = GetMailboxesRequest.builder()
@@ -210,7 +210,7 @@ public class GetMailboxesMethodTest {
     @Test
     public void getMailboxesShouldReturnInboxWithSortOrder10OnDifferenceCase() throws Exception
{
         MailboxSession mailboxSession = mailboxManager.createSystemSession(USERNAME);
-        MailboxPath mailboxPath = new MailboxPath("#private", USERNAME, "InBoX");
+        MailboxPath mailboxPath = MailboxPath.forUser(USERNAME, "InBoX");
         mailboxManager.createMailbox(mailboxPath, mailboxSession);
 
         GetMailboxesRequest getMailboxesRequest = GetMailboxesRequest.builder()
@@ -231,14 +231,14 @@ public class GetMailboxesMethodTest {
     @Test
     public void getMailboxesShouldReturnMailboxesWithSortOrder() throws Exception {
         MailboxSession mailboxSession = mailboxManager.createSystemSession(USERNAME);
-        mailboxManager.createMailbox(new MailboxPath("#private", USERNAME, "INBOX"), mailboxSession);
-        mailboxManager.createMailbox(new MailboxPath("#private", USERNAME, "ARCHIVE"), mailboxSession);
-        mailboxManager.createMailbox(new MailboxPath("#private", USERNAME, "DRAFTS"), mailboxSession);
-        mailboxManager.createMailbox(new MailboxPath("#private", USERNAME, "OUTBOX"), mailboxSession);
-        mailboxManager.createMailbox(new MailboxPath("#private", USERNAME, "SENT"), mailboxSession);
-        mailboxManager.createMailbox(new MailboxPath("#private", USERNAME, "TRASH"), mailboxSession);
-        mailboxManager.createMailbox(new MailboxPath("#private", USERNAME, "SPAM"), mailboxSession);
-        mailboxManager.createMailbox(new MailboxPath("#private", USERNAME, "TEMPLATES"),
mailboxSession);
+        mailboxManager.createMailbox(MailboxPath.forUser(USERNAME, "INBOX"), mailboxSession);
+        mailboxManager.createMailbox(MailboxPath.forUser(USERNAME, "ARCHIVE"), mailboxSession);
+        mailboxManager.createMailbox(MailboxPath.forUser(USERNAME, "DRAFTS"), mailboxSession);
+        mailboxManager.createMailbox(MailboxPath.forUser(USERNAME, "OUTBOX"), mailboxSession);
+        mailboxManager.createMailbox(MailboxPath.forUser(USERNAME, "SENT"), mailboxSession);
+        mailboxManager.createMailbox(MailboxPath.forUser(USERNAME, "TRASH"), mailboxSession);
+        mailboxManager.createMailbox(MailboxPath.forUser(USERNAME, "SPAM"), mailboxSession);
+        mailboxManager.createMailbox(MailboxPath.forUser(USERNAME, "TEMPLATES"), mailboxSession);
 
         GetMailboxesRequest getMailboxesRequest = GetMailboxesRequest.builder()
                 .build();
@@ -265,7 +265,7 @@ public class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldReturnEmptyMailboxByDefault() throws MailboxException {
-        MailboxPath mailboxPath = new MailboxPath("#private", USERNAME, "name");
+        MailboxPath mailboxPath = MailboxPath.forUser(USERNAME, "name");
         MailboxSession mailboxSession = mailboxManager.createSystemSession(USERNAME);
         mailboxManager.createMailbox(mailboxPath, mailboxSession);
 
@@ -286,7 +286,7 @@ public class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldReturnCorrectTotalMessagesCount() throws MailboxException
{
-        MailboxPath mailboxPath = new MailboxPath("#private", USERNAME, "name");
+        MailboxPath mailboxPath = MailboxPath.forUser(USERNAME, "name");
         MailboxSession mailboxSession = mailboxManager.createSystemSession(USERNAME);
         mailboxManager.createMailbox(mailboxPath, mailboxSession);
         MessageManager messageManager = mailboxManager.getMailbox(mailboxPath, mailboxSession);
@@ -310,7 +310,7 @@ public class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldReturnCorrectUnreadMessagesCount() throws MailboxException
{
-        MailboxPath mailboxPath = new MailboxPath("#private", USERNAME, "name");
+        MailboxPath mailboxPath = MailboxPath.forUser(USERNAME, "name");
         MailboxSession mailboxSession = mailboxManager.createSystemSession(USERNAME);
         mailboxManager.createMailbox(mailboxPath, mailboxSession);
         MessageManager messageManager = mailboxManager.getMailbox(mailboxPath, mailboxSession);
@@ -338,15 +338,15 @@ public class GetMailboxesMethodTest {
     @Test
     public void getMailboxesShouldReturnMailboxesWithRoles() throws Exception {
         MailboxSession mailboxSession = mailboxManager.createSystemSession(USERNAME);
-        mailboxManager.createMailbox(new MailboxPath("#private", USERNAME, "INBOX"), mailboxSession);
-        mailboxManager.createMailbox(new MailboxPath("#private", USERNAME, "ARCHIVE"), mailboxSession);
-        mailboxManager.createMailbox(new MailboxPath("#private", USERNAME, "DRAFTS"), mailboxSession);
-        mailboxManager.createMailbox(new MailboxPath("#private", USERNAME, "OUTBOX"), mailboxSession);
-        mailboxManager.createMailbox(new MailboxPath("#private", USERNAME, "SENT"), mailboxSession);
-        mailboxManager.createMailbox(new MailboxPath("#private", USERNAME, "TRASH"), mailboxSession);
-        mailboxManager.createMailbox(new MailboxPath("#private", USERNAME, "SPAM"), mailboxSession);
-        mailboxManager.createMailbox(new MailboxPath("#private", USERNAME, "TEMPLATES"),
mailboxSession);
-        mailboxManager.createMailbox(new MailboxPath("#private", USERNAME, "WITHOUT ROLE"),
mailboxSession);
+        mailboxManager.createMailbox(MailboxPath.forUser(USERNAME, "INBOX"), mailboxSession);
+        mailboxManager.createMailbox(MailboxPath.forUser(USERNAME, "ARCHIVE"), mailboxSession);
+        mailboxManager.createMailbox(MailboxPath.forUser(USERNAME, "DRAFTS"), mailboxSession);
+        mailboxManager.createMailbox(MailboxPath.forUser(USERNAME, "OUTBOX"), mailboxSession);
+        mailboxManager.createMailbox(MailboxPath.forUser(USERNAME, "SENT"), mailboxSession);
+        mailboxManager.createMailbox(MailboxPath.forUser(USERNAME, "TRASH"), mailboxSession);
+        mailboxManager.createMailbox(MailboxPath.forUser(USERNAME, "SPAM"), mailboxSession);
+        mailboxManager.createMailbox(MailboxPath.forUser(USERNAME, "TEMPLATES"), mailboxSession);
+        mailboxManager.createMailbox(MailboxPath.forUser(USERNAME, "WITHOUT ROLE"), mailboxSession);
         
         GetMailboxesRequest getMailboxesRequest = GetMailboxesRequest.builder()
                 .build();

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/SetMessagesCreationProcessorTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/SetMessagesCreationProcessorTest.java
b/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/SetMessagesCreationProcessorTest.java
index 8f15c63..c1b9f00 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/SetMessagesCreationProcessorTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/SetMessagesCreationProcessorTest.java
@@ -89,7 +89,6 @@ public class SetMessagesCreationProcessorTest {
     private static final InMemoryId OUTBOX_ID = InMemoryId.of(12345);
     private static final String DRAFTS = "drafts";
     private static final InMemoryId DRAFTS_ID = InMemoryId.of(12);
-    private static final String NAMESPACE = "#private";
 
     private final CreationMessage.Builder creationMessageBuilder = CreationMessage.builder()
             .from(DraftEmailer.builder().name("alice").email("alice@example.com").build())
@@ -142,14 +141,14 @@ public class SetMessagesCreationProcessorTest {
         
         outbox = mock(MessageManager.class);
         when(outbox.getId()).thenReturn(OUTBOX_ID);
-        when(outbox.getMailboxPath()).thenReturn(new MailboxPath(NAMESPACE, USER, OUTBOX));
+        when(outbox.getMailboxPath()).thenReturn(MailboxPath.forUser(USER, OUTBOX));
         
         when(outbox.appendMessage(any(InputStream.class), any(Date.class), any(MailboxSession.class),
any(Boolean.class), any(Flags.class)))
             .thenReturn(new ComposedMessageId(OUTBOX_ID, TestMessageId.of(23), MessageUid.of(1)));
 
         drafts = mock(MessageManager.class);
         when(drafts.getId()).thenReturn(DRAFTS_ID);
-        when(drafts.getMailboxPath()).thenReturn(new MailboxPath(NAMESPACE, USER, DRAFTS));
+        when(drafts.getMailboxPath()).thenReturn(MailboxPath.forUser(USER, DRAFTS));
         optionalOutbox = Optional.of(outbox);
         optionalDrafts = Optional.of(drafts);
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MailboxFactoryTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MailboxFactoryTest.java
b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MailboxFactoryTest.java
index e363522..ba53de7 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MailboxFactoryTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MailboxFactoryTest.java
@@ -65,7 +65,7 @@ public class MailboxFactoryTest {
 
     @Test
     public void mailboxFromMailboxIdShouldReturnPresentWhenExists() throws Exception {
-        MailboxPath mailboxPath = new MailboxPath("#private", user, "myBox");
+        MailboxPath mailboxPath = MailboxPath.forUser(user, "myBox");
         mailboxManager.createMailbox(mailboxPath, mailboxSession);
         MailboxId mailboxId = mailboxManager.getMailbox(mailboxPath, mailboxSession).getId();
 
@@ -81,7 +81,7 @@ public class MailboxFactoryTest {
     @Test
     public void getNameShouldReturnMailboxNameWhenRootMailbox() throws Exception {
         String expected = "mailbox";
-        MailboxPath mailboxPath = new MailboxPath("#private", user, expected);
+        MailboxPath mailboxPath = MailboxPath.forUser(user, expected);
 
         String name = sut.getName(mailboxPath, mailboxSession);
         assertThat(name).isEqualTo(expected);
@@ -90,7 +90,7 @@ public class MailboxFactoryTest {
     @Test
     public void getNameShouldReturnMailboxNameWhenChildMailbox() throws Exception {
         String expected = "mailbox";
-        MailboxPath mailboxPath = new MailboxPath("#private", user, "inbox." + expected);
+        MailboxPath mailboxPath = MailboxPath.forUser(user, "inbox." + expected);
 
         String name = sut.getName(mailboxPath, mailboxSession);
         assertThat(name).isEqualTo(expected);
@@ -99,7 +99,7 @@ public class MailboxFactoryTest {
     @Test
     public void getNameShouldReturnMailboxNameWhenChildOfChildMailbox() throws Exception
{
         String expected = "mailbox";
-        MailboxPath mailboxPath = new MailboxPath("#private", user, "inbox.children." + expected);
+        MailboxPath mailboxPath = MailboxPath.forUser(user, "inbox.children." + expected);
 
         String name = sut.getName(mailboxPath, mailboxSession);
         assertThat(name).isEqualTo(expected);
@@ -107,7 +107,7 @@ public class MailboxFactoryTest {
 
     @Test
     public void getParentIdFromMailboxPathShouldReturNullWhenRootMailbox() throws Exception
{
-        MailboxPath mailboxPath = new MailboxPath("#private", user, "mailbox");
+        MailboxPath mailboxPath = MailboxPath.forUser(user, "mailbox");
         mailboxManager.createMailbox(mailboxPath, mailboxSession);
 
         Optional<MailboxId> id = sut.getParentIdFromMailboxPath(mailboxPath, Optional.empty(),
mailboxSession);
@@ -116,11 +116,11 @@ public class MailboxFactoryTest {
 
     @Test
     public void getParentIdFromMailboxPathShouldReturnParentIdWhenChildMailbox() throws Exception
{
-        MailboxPath parentMailboxPath = new MailboxPath("#private", user, "inbox");
+        MailboxPath parentMailboxPath = MailboxPath.forUser(user, "inbox");
         mailboxManager.createMailbox(parentMailboxPath, mailboxSession);
         MailboxId parentId = mailboxManager.getMailbox(parentMailboxPath, mailboxSession).getId();
 
-        MailboxPath mailboxPath = new MailboxPath("#private", user, "inbox.mailbox");
+        MailboxPath mailboxPath = MailboxPath.forUser(user, "inbox.mailbox");
         mailboxManager.createMailbox(mailboxPath, mailboxSession);
 
         Optional<MailboxId> id = sut.getParentIdFromMailboxPath(mailboxPath, Optional.empty(),
mailboxSession);
@@ -129,10 +129,10 @@ public class MailboxFactoryTest {
 
     @Test
     public void getParentIdFromMailboxPathShouldReturnParentIdWhenChildOfChildMailbox() throws
Exception {
-        MailboxPath mailboxPath = new MailboxPath("#private", user, "inbox.children.mailbox");
-        mailboxManager.createMailbox(new MailboxPath("#private", user, "inbox"), mailboxSession);
+        MailboxPath mailboxPath = MailboxPath.forUser(user, "inbox.children.mailbox");
+        mailboxManager.createMailbox(MailboxPath.forUser(user, "inbox"), mailboxSession);
 
-        MailboxPath parentMailboxPath = new MailboxPath("#private", user, "inbox.children");
+        MailboxPath parentMailboxPath = MailboxPath.forUser(user, "inbox.children");
         mailboxManager.createMailbox(parentMailboxPath, mailboxSession);
         MailboxId parentId = mailboxManager.getMailbox(parentMailboxPath, mailboxSession).getId();
 
@@ -144,10 +144,10 @@ public class MailboxFactoryTest {
 
     @Test
     public void getParentIdFromMailboxPathShouldWorkWhenUserMailboxesProvided() throws Exception
{
-        MailboxPath mailboxPath = new MailboxPath("#private", user, "inbox.children.mailbox");
-        mailboxManager.createMailbox(new MailboxPath("#private", user, "inbox"), mailboxSession);
+        MailboxPath mailboxPath = MailboxPath.forUser(user, "inbox.children.mailbox");
+        mailboxManager.createMailbox(MailboxPath.forUser(user, "inbox"), mailboxSession);
 
-        MailboxPath parentMailboxPath = new MailboxPath("#private", user, "inbox.children");
+        MailboxPath parentMailboxPath = MailboxPath.forUser(user, "inbox.children");
         mailboxManager.createMailbox(parentMailboxPath, mailboxSession);
         MailboxId parentId = mailboxManager.getMailbox(parentMailboxPath, mailboxSession).getId();
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/server/protocols/jmap/src/test/java/org/apache/james/jmap/send/PostDequeueDecoratorTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/send/PostDequeueDecoratorTest.java
b/server/protocols/jmap/src/test/java/org/apache/james/jmap/send/PostDequeueDecoratorTest.java
index 53f14d7..ffaad17 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/send/PostDequeueDecoratorTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/send/PostDequeueDecoratorTest.java
@@ -46,7 +46,6 @@ import org.apache.james.mailbox.inmemory.InMemoryMessageId;
 import org.apache.james.mailbox.inmemory.manager.InMemoryIntegrationResources;
 import org.apache.james.mailbox.model.ComposedMessageId;
 import org.apache.james.mailbox.model.FetchGroupImpl;
-import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.model.MessageRange;
@@ -66,8 +65,8 @@ public class PostDequeueDecoratorTest {
     private static final String SENT = DefaultMailboxes.SENT;
     private static final String USERNAME = "username@domain.tld";
     private static final MessageUid UID = MessageUid.of(1);
-    private static final MailboxPath OUTBOX_MAILBOX_PATH = new MailboxPath(MailboxConstants.USER_NAMESPACE,
USERNAME, OUTBOX);
-    private static final MailboxPath SENT_MAILBOX_PATH = new MailboxPath(MailboxConstants.USER_NAMESPACE,
USERNAME, SENT);
+    private static final MailboxPath OUTBOX_MAILBOX_PATH = MailboxPath.forUser(USERNAME,
OUTBOX);
+    private static final MailboxPath SENT_MAILBOX_PATH = MailboxPath.forUser(USERNAME, SENT);
     
     private MailboxManager mailboxManager;
     private MailQueueItem mockedMailQueueItem;

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/server/protocols/jmap/src/test/java/org/apache/james/jmap/utils/MailboxUtilsTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/utils/MailboxUtilsTest.java
b/server/protocols/jmap/src/test/java/org/apache/james/jmap/utils/MailboxUtilsTest.java
index 8de3308..1d162d1 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/utils/MailboxUtilsTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/utils/MailboxUtilsTest.java
@@ -46,7 +46,7 @@ public class MailboxUtilsTest {
     }
     @Test
     public void hasChildrenShouldReturnFalseWhenNoChild() throws Exception {
-        MailboxPath mailboxPath = new MailboxPath("#private", user, "myBox");
+        MailboxPath mailboxPath = MailboxPath.forUser(user, "myBox");
         mailboxManager.createMailbox(mailboxPath, mailboxSession);
         MailboxId mailboxId = mailboxManager.getMailbox(mailboxPath, mailboxSession).getId();
 
@@ -55,11 +55,11 @@ public class MailboxUtilsTest {
 
     @Test
     public void hasChildrenShouldReturnTrueWhenHasAChild() throws Exception {
-        MailboxPath parentMailboxPath = new MailboxPath("#private", user, "inbox");
+        MailboxPath parentMailboxPath = MailboxPath.forUser(user, "inbox");
         mailboxManager.createMailbox(parentMailboxPath, mailboxSession);
         MailboxId parentId = mailboxManager.getMailbox(parentMailboxPath, mailboxSession).getId();
 
-        MailboxPath mailboxPath = new MailboxPath("#private", user, "inbox.myBox");
+        MailboxPath mailboxPath = MailboxPath.forUser(user, "inbox.myBox");
         mailboxManager.createMailbox(mailboxPath, mailboxSession);
 
         assertThat(sut.hasChildren(parentId, mailboxSession)).isTrue();

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
b/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
index e9b48df..5d7cd74 100644
--- a/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
+++ b/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
@@ -213,7 +213,7 @@ public class POP3ServerTest {
         assertEquals("Found unexpected messages", 0, list.length);
 
         pop3Client.disconnect();
-        MailboxPath mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, "foo",
"INBOX");
+        MailboxPath mailboxPath = MailboxPath.forUser("foo", "INBOX");
         MailboxSession session = mailboxManager.login("foo", "bar");
         if (!mailboxManager.mailboxExists(mailboxPath, session)) {
             mailboxManager.createMailbox(mailboxPath, session);
@@ -298,7 +298,7 @@ public class POP3ServerTest {
 
         usersRepository.addUser("foo2", "bar2");
 
-        MailboxPath mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, "foo2",
"INBOX");
+        MailboxPath mailboxPath = MailboxPath.forUser("foo2", "INBOX");
         MailboxSession session = mailboxManager.login("foo2", "bar2");
 
         if (!mailboxManager.mailboxExists(mailboxPath, session)) {
@@ -387,7 +387,7 @@ public class POP3ServerTest {
 
         usersRepository.addUser("foo2", "bar2");
 
-        MailboxPath mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, "foo2",
"INBOX");
+        MailboxPath mailboxPath = MailboxPath.forUser("foo2", "INBOX");
         MailboxSession session = mailboxManager.login("foo2", "bar2");
 
         if (!mailboxManager.mailboxExists(mailboxPath, session)) {
@@ -437,7 +437,7 @@ public class POP3ServerTest {
 
         usersRepository.addUser("foo2", "bar2");
 
-        MailboxPath mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, "foo2",
"INBOX");
+        MailboxPath mailboxPath = MailboxPath.forUser("foo2", "INBOX");
         MailboxSession session = mailboxManager.login("foo2", "bar2");
 
         if (!mailboxManager.mailboxExists(mailboxPath, session)) {

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserMailboxesRoutesTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserMailboxesRoutesTest.java
b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserMailboxesRoutesTest.java
index c62dcd6..8b9e3fd 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserMailboxesRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserMailboxesRoutesTest.java
@@ -608,7 +608,7 @@ public class UserMailboxesRoutesTest {
                 .thenReturn(
                         ImmutableList.of(
                                 new SimpleMailboxMetaData(
-                                        new MailboxPath("#private", USERNAME, MAILBOX_NAME),
mailboxId, '.')));
+                                        MailboxPath.forUser(USERNAME, MAILBOX_NAME), mailboxId,
'.')));
             doThrow(new RuntimeException()).when(mailboxManager).deleteMailbox(any(), any());
 
             when()
@@ -633,7 +633,7 @@ public class UserMailboxesRoutesTest {
             when(mailboxManager.search(any(MailboxQuery.class), any()))
                 .thenReturn(
                         ImmutableList.of(
-                                new SimpleMailboxMetaData(new MailboxPath("#private", USERNAME,
MAILBOX_NAME), mailboxId, '.')));
+                                new SimpleMailboxMetaData(MailboxPath.forUser(USERNAME, MAILBOX_NAME),
mailboxId, '.')));
             doThrow(new MailboxException()).when(mailboxManager).deleteMailbox(any(), any());
 
             when()
@@ -689,7 +689,7 @@ public class UserMailboxesRoutesTest {
             when(mailboxManager.search(any(MailboxQuery.class), any()))
                 .thenReturn(
                         ImmutableList.of(
-                                new SimpleMailboxMetaData(new MailboxPath("#private", USERNAME,
"any"), mailboxId, '.')));
+                                new SimpleMailboxMetaData(MailboxPath.forUser(USERNAME, "any"),
mailboxId, '.')));
             doThrow(new RuntimeException()).when(mailboxManager).deleteMailbox(any(), any());
 
             when()
@@ -703,7 +703,7 @@ public class UserMailboxesRoutesTest {
             MailboxId mailboxId = InMemoryId.of(12);
             when(mailboxManager.search(any(MailboxQuery.class), any()))
                 .thenReturn(
-                        ImmutableList.of(new SimpleMailboxMetaData(new MailboxPath("#private",
USERNAME, "any"), mailboxId, '.')));
+                        ImmutableList.of(new SimpleMailboxMetaData(MailboxPath.forUser(USERNAME,
"any"), mailboxId, '.')));
             doThrow(new MailboxNotFoundException("any")).when(mailboxManager).deleteMailbox(any(),
any());
 
             when()
@@ -717,7 +717,7 @@ public class UserMailboxesRoutesTest {
             MailboxId mailboxId = InMemoryId.of(12);
             when(mailboxManager.search(any(MailboxQuery.class), any()))
                 .thenReturn(
-                        ImmutableList.of(new SimpleMailboxMetaData(new MailboxPath("#private",
USERNAME, "any"), mailboxId, '.')));
+                        ImmutableList.of(new SimpleMailboxMetaData(MailboxPath.forUser(USERNAME,
"any"), mailboxId, '.')));
             doThrow(new MailboxException()).when(mailboxManager).deleteMailbox(any(), any());
 
             when()


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