http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/CyrusHostSystem.java
----------------------------------------------------------------------
diff --git 
a/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/CyrusHostSystem.java
 
b/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/CyrusHostSystem.java
index 2c09ac8..452f135 100644
--- 
a/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/CyrusHostSystem.java
+++ 
b/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/CyrusHostSystem.java
@@ -21,7 +21,7 @@ package org.apache.james.mpt.imapmailbox.cyrus.host;
 import java.net.InetSocketAddress;
 import java.util.function.Supplier;
 
-import org.apache.james.mailbox.model.MailboxConstants;
+import org.apache.commons.lang.NotImplementedException;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mpt.api.ImapFeatures;
 import org.apache.james.mpt.api.ImapFeatures.Feature;
@@ -30,7 +30,6 @@ import org.apache.james.mpt.api.UserAdder;
 import org.apache.james.mpt.host.ExternalHostSystem;
 import org.apache.james.mpt.monitor.NullMonitor;
 import org.apache.james.mpt.protocol.ProtocolSession;
-import org.apache.commons.lang.NotImplementedException;
 
 import com.google.common.base.Joiner;
 import com.google.common.base.Strings;
@@ -69,7 +68,7 @@ public class CyrusHostSystem extends ExternalHostSystem 
implements Provider<Cont
     }
 
     private boolean createUserInbox(String user) {
-        createMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, user, 
""));
+        createMailbox(MailboxPath.forUser(user, ""));
         return true;
     }
     

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/protocols/imap/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
----------------------------------------------------------------------
diff --git 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
index ef3f87e..a4bf955 100644
--- 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
+++ 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
@@ -68,7 +68,7 @@ public class LSubProcessor extends 
AbstractSubscriptionProcessor<LsubRequest> {
         boolean isRelative = ((finalReferencename + mailboxName).charAt(0) != 
MailboxConstants.NAMESPACE_PREFIX_CHAR);
         MailboxPath basePath = null;
         if (isRelative) {
-            basePath = new MailboxPath(MailboxConstants.USER_NAMESPACE, 
mailboxSession.getUser().getUserName(), 
CharsetUtil.decodeModifiedUTF7(finalReferencename));
+            basePath = 
MailboxPath.forUser(mailboxSession.getUser().getUserName(), 
CharsetUtil.decodeModifiedUTF7(finalReferencename));
         } else {
             basePath = 
PathConverter.forSession(session).buildFullPath(CharsetUtil.decodeModifiedUTF7(finalReferencename));
         }

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
----------------------------------------------------------------------
diff --git 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
index 6f180e5..16a7280 100644
--- 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
+++ 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
@@ -166,7 +166,7 @@ public class ListProcessor extends 
AbstractMailboxProcessor<ListRequest> {
 
                 MailboxPath basePath = null;
                 if (isRelative) {
-                    basePath = new 
MailboxPath(MailboxConstants.USER_NAMESPACE, user, finalReferencename);
+                    basePath = MailboxPath.forUser(user, finalReferencename);
                 } else {
                     basePath = 
PathConverter.forSession(session).buildFullPath(finalReferencename);
                 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/protocols/imap/src/test/java/org/apache/james/imap/main/PathConverterTest.java
----------------------------------------------------------------------
diff --git 
a/protocols/imap/src/test/java/org/apache/james/imap/main/PathConverterTest.java
 
b/protocols/imap/src/test/java/org/apache/james/imap/main/PathConverterTest.java
index 11515d4..b395109 100644
--- 
a/protocols/imap/src/test/java/org/apache/james/imap/main/PathConverterTest.java
+++ 
b/protocols/imap/src/test/java/org/apache/james/imap/main/PathConverterTest.java
@@ -72,7 +72,7 @@ public class PathConverterTest {
     public void buildPathShouldAcceptRelativeMailboxName() {
         String mailboxName = "mailboxName";
         assertThat(pathConverter.buildFullPath(mailboxName))
-            .isEqualTo(new MailboxPath(MailboxConstants.USER_NAMESPACE, 
USERNAME, mailboxName));
+            .isEqualTo(MailboxPath.forUser(USERNAME, mailboxName));
     }
 
     @Ignore("Shared mailbox is not supported yet")
@@ -85,7 +85,7 @@ public class PathConverterTest {
     @Test
     public void buildFullPathShouldAcceptUserNamespace() {
         
assertThat(pathConverter.buildFullPath(MailboxConstants.USER_NAMESPACE))
-            .isEqualTo(new MailboxPath(MailboxConstants.USER_NAMESPACE, 
USERNAME, ""));
+            .isEqualTo(MailboxPath.forUser(USERNAME, ""));
     }
 
     @Ignore("Shared mailbox is not supported yet")
@@ -99,7 +99,7 @@ public class PathConverterTest {
     @Test
     public void buildFullPathShouldAcceptUserNamespaceAndDelimiter() {
         assertThat(pathConverter.buildFullPath(MailboxConstants.USER_NAMESPACE 
+ PATH_DELIMITER))
-            .isEqualTo(new MailboxPath(MailboxConstants.USER_NAMESPACE, 
USERNAME, ""));
+            .isEqualTo(MailboxPath.forUser(USERNAME, ""));
     }
 
     @Ignore("Shared mailbox is not supported yet")
@@ -114,7 +114,7 @@ public class PathConverterTest {
     public void buildFullPathShouldAcceptFullAbsoluteUserPath() {
         String mailboxName = "mailboxName";
         assertThat(pathConverter.buildFullPath(MailboxConstants.USER_NAMESPACE 
+ PATH_DELIMITER + mailboxName))
-            .isEqualTo(new MailboxPath(MailboxConstants.USER_NAMESPACE, 
USERNAME, mailboxName));
+            .isEqualTo(MailboxPath.forUser(USERNAME, mailboxName));
     }
 
     @Ignore("Shared mailbox is not supported yet")
@@ -130,14 +130,14 @@ public class PathConverterTest {
     public void buildFullPathShouldAcceptRelativePathWithSubFolder() {
         String mailboxName = "mailboxName" + PATH_DELIMITER + "subFolder";
         assertThat(pathConverter.buildFullPath(mailboxName))
-            .isEqualTo(new MailboxPath(MailboxConstants.USER_NAMESPACE, 
USERNAME, mailboxName));
+            .isEqualTo(MailboxPath.forUser(USERNAME, mailboxName));
     }
 
     @Test
     public void buildFullPathShouldAcceptAbsoluteUserPathWithSubFolder() {
         String mailboxName = "mailboxName.subFolder";
         assertThat(pathConverter.buildFullPath(MailboxConstants.USER_NAMESPACE 
+ PATH_DELIMITER + mailboxName))
-            .isEqualTo(new MailboxPath(MailboxConstants.USER_NAMESPACE, 
USERNAME, mailboxName));
+            .isEqualTo(MailboxPath.forUser(USERNAME, mailboxName));
     }
 
     @Ignore("Shared mailbox is not supported yet")

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/protocols/imap/src/test/java/org/apache/james/imap/processor/DeleteACLProcessorTest.java
----------------------------------------------------------------------
diff --git 
a/protocols/imap/src/test/java/org/apache/james/imap/processor/DeleteACLProcessorTest.java
 
b/protocols/imap/src/test/java/org/apache/james/imap/processor/DeleteACLProcessorTest.java
index 73f3bf3..52c28ee 100644
--- 
a/protocols/imap/src/test/java/org/apache/james/imap/processor/DeleteACLProcessorTest.java
+++ 
b/protocols/imap/src/test/java/org/apache/james/imap/processor/DeleteACLProcessorTest.java
@@ -38,7 +38,6 @@ import 
org.apache.james.mailbox.MessageManager.MetaData.FetchGroup;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.exception.MailboxNotFoundException;
 import org.apache.james.mailbox.model.MailboxACL;
-import org.apache.james.mailbox.model.MailboxACL.EditMode;
 import org.apache.james.mailbox.model.MailboxACL.EntryKey;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.metrics.api.NoopMetricFactory;
@@ -99,7 +98,7 @@ public class DeleteACLProcessorTest {
 
     @Before
     public void setUp() throws Exception {
-        path = new MailboxPath("#private", USER_1, MAILBOX_NAME);
+        path = MailboxPath.forUser(USER_1, MAILBOX_NAME);
         statusResponseFactory = new UnpooledStatusResponseFactory();
         mailboxManagerStub = mockery.mock(MailboxManager.class);
         subject = new DeleteACLProcessor(mockery.mock(ImapProcessor.class), 
mailboxManagerStub, statusResponseFactory, new NoopMetricFactory());

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/protocols/imap/src/test/java/org/apache/james/imap/processor/GetACLProcessorTest.java
----------------------------------------------------------------------
diff --git 
a/protocols/imap/src/test/java/org/apache/james/imap/processor/GetACLProcessorTest.java
 
b/protocols/imap/src/test/java/org/apache/james/imap/processor/GetACLProcessorTest.java
index bf75f0d..d7c3e5f 100644
--- 
a/protocols/imap/src/test/java/org/apache/james/imap/processor/GetACLProcessorTest.java
+++ 
b/protocols/imap/src/test/java/org/apache/james/imap/processor/GetACLProcessorTest.java
@@ -96,7 +96,7 @@ public class GetACLProcessorTest {
 
     @Before
     public void setUp() throws Exception {
-        path = new MailboxPath("#private", USER_1, MAILBOX_NAME);
+        path = MailboxPath.forUser(USER_1, MAILBOX_NAME);
         statusResponseFactory = new UnpooledStatusResponseFactory();
         mailboxManagerStub = mockery.mock(MailboxManager.class);
         subject = new GetACLProcessor(mockery.mock(ImapProcessor.class), 
mailboxManagerStub, statusResponseFactory, new NoopMetricFactory());

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/protocols/imap/src/test/java/org/apache/james/imap/processor/GetQuotaRootProcessorTest.java
----------------------------------------------------------------------
diff --git 
a/protocols/imap/src/test/java/org/apache/james/imap/processor/GetQuotaRootProcessorTest.java
 
b/protocols/imap/src/test/java/org/apache/james/imap/processor/GetQuotaRootProcessorTest.java
index ae7f260..f4057df 100644
--- 
a/protocols/imap/src/test/java/org/apache/james/imap/processor/GetQuotaRootProcessorTest.java
+++ 
b/protocols/imap/src/test/java/org/apache/james/imap/processor/GetQuotaRootProcessorTest.java
@@ -51,7 +51,7 @@ import org.junit.Test;
 public class GetQuotaRootProcessorTest {
 
     private static final QuotaRoot QUOTA_ROOT = 
QuotaRootImpl.quotaRoot("plop");
-    public static final MailboxPath MAILBOX_PATH = new MailboxPath("#private", 
"plop", "INBOX");
+    public static final MailboxPath MAILBOX_PATH = MailboxPath.forUser("plop", 
"INBOX");
     public static final Quota MESSAGE_QUOTA = QuotaImpl.quota(24, 1589);
     public static final Quota STORAGE_QUOTA = QuotaImpl.quota(240, 15890);
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/protocols/imap/src/test/java/org/apache/james/imap/processor/ListRightsProcessorTest.java
----------------------------------------------------------------------
diff --git 
a/protocols/imap/src/test/java/org/apache/james/imap/processor/ListRightsProcessorTest.java
 
b/protocols/imap/src/test/java/org/apache/james/imap/processor/ListRightsProcessorTest.java
index 0f914fc..f09b679 100644
--- 
a/protocols/imap/src/test/java/org/apache/james/imap/processor/ListRightsProcessorTest.java
+++ 
b/protocols/imap/src/test/java/org/apache/james/imap/processor/ListRightsProcessorTest.java
@@ -101,7 +101,7 @@ public class ListRightsProcessorTest {
 
     @Before
     public void setUp() throws Exception {
-        path = new MailboxPath("#private", USER_1, MAILBOX_NAME);
+        path = MailboxPath.forUser(USER_1, MAILBOX_NAME);
         statusResponseFactory = new UnpooledStatusResponseFactory();
         mailboxManagerStub = mockery.mock(MailboxManager.class);
         subject = new ListRightsProcessor(mockery.mock(ImapProcessor.class), 
mailboxManagerStub, statusResponseFactory, new NoopMetricFactory());

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/protocols/imap/src/test/java/org/apache/james/imap/processor/SetACLProcessorTest.java
----------------------------------------------------------------------
diff --git 
a/protocols/imap/src/test/java/org/apache/james/imap/processor/SetACLProcessorTest.java
 
b/protocols/imap/src/test/java/org/apache/james/imap/processor/SetACLProcessorTest.java
index b09a8ae..5c88a0d 100644
--- 
a/protocols/imap/src/test/java/org/apache/james/imap/processor/SetACLProcessorTest.java
+++ 
b/protocols/imap/src/test/java/org/apache/james/imap/processor/SetACLProcessorTest.java
@@ -103,7 +103,7 @@ public class SetACLProcessorTest {
 
     @Before
     public void setUp() throws Exception {
-        path = new MailboxPath("#private", USER_1, MAILBOX_NAME);
+        path = MailboxPath.forUser(USER_1, MAILBOX_NAME);
         statusResponseFactory = new UnpooledStatusResponseFactory();
         mailboxManagerStub = mockery.mock(MailboxManager.class);
         subject = new SetACLProcessor(mockery.mock(ImapProcessor.class), 
mailboxManagerStub, statusResponseFactory, new NoopMetricFactory());

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/protocols/imap/src/test/java/org/apache/james/imap/processor/base/SelectedMailboxImplTest.java
----------------------------------------------------------------------
diff --git 
a/protocols/imap/src/test/java/org/apache/james/imap/processor/base/SelectedMailboxImplTest.java
 
b/protocols/imap/src/test/java/org/apache/james/imap/processor/base/SelectedMailboxImplTest.java
index c8e0338..55298ef 100644
--- 
a/protocols/imap/src/test/java/org/apache/james/imap/processor/base/SelectedMailboxImplTest.java
+++ 
b/protocols/imap/src/test/java/org/apache/james/imap/processor/base/SelectedMailboxImplTest.java
@@ -79,7 +79,7 @@ public class SelectedMailboxImplTest {
     @Before
     public void setUp() throws Exception {
         executorService = Executors.newFixedThreadPool(1);
-        mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, 
"[email protected]", MailboxConstants.INBOX);
+        mailboxPath = MailboxPath.forUser("[email protected]", 
MailboxConstants.INBOX);
         mailboxManager = mock(MailboxManager.class);
         messageManager = mock(MessageManager.class);
         imapSession = mock(ImapSession.class);

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/server/container/cli-integration/src/test/java/org/apache/james/cli/ReindexCommandIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/server/container/cli-integration/src/test/java/org/apache/james/cli/ReindexCommandIntegrationTest.java
 
b/server/container/cli-integration/src/test/java/org/apache/james/cli/ReindexCommandIntegrationTest.java
index ac7bfd7..bccaa62 100644
--- 
a/server/container/cli-integration/src/test/java/org/apache/james/cli/ReindexCommandIntegrationTest.java
+++ 
b/server/container/cli-integration/src/test/java/org/apache/james/cli/ReindexCommandIntegrationTest.java
@@ -71,7 +71,7 @@ public class ReindexCommandIntegrationTest {
         String mailbox = "mailbox";
         ServerCmd.doMain(new String[] {"-h", "127.0.0.1", "-p", "9999", 
"reindexmailbox", MailboxConstants.USER_NAMESPACE, USER, mailbox});
 
-        verify(reIndexer).reIndex(new 
MailboxPath(MailboxConstants.USER_NAMESPACE, USER, mailbox));
+        verify(reIndexer).reIndex(MailboxPath.forUser(USER, mailbox));
     }
 
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxProbeImpl.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxProbeImpl.java
 
b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxProbeImpl.java
index 1bf0252..66e6be0 100644
--- 
a/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxProbeImpl.java
+++ 
b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxProbeImpl.java
@@ -36,7 +36,6 @@ import org.apache.james.mailbox.MessageManager;
 import org.apache.james.mailbox.SubscriptionManager;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.ComposedMessageId;
-import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.model.MailboxMetaData;
 import org.apache.james.mailbox.model.MailboxPath;
@@ -124,7 +123,7 @@ public class MailboxProbeImpl implements GuiceProbe, 
MailboxProbe {
 
     private List<MailboxMetaData> searchUserMailboxes(String username, 
MailboxSession session) throws MailboxException {
         return mailboxManager.search(
-            new MailboxQuery(new MailboxPath(MailboxConstants.USER_NAMESPACE, 
username, ""),
+            new MailboxQuery(MailboxPath.forUser(username, ""),
                 "*",
                 session.getPathDelimiter()),
             session);

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java
----------------------------------------------------------------------
diff --git 
a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java
 
b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java
index 8242c08..320bb79 100644
--- 
a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java
+++ 
b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java
@@ -36,7 +36,6 @@ import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageManager;
 import org.apache.james.mailbox.exception.MailboxException;
-import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.model.MailboxMetaData;
 import org.apache.james.mailbox.model.MailboxPath;
@@ -214,7 +213,7 @@ public class MailboxManagerManagement extends StandardMBean 
implements MailboxMa
 
     private List<MailboxMetaData> retrieveAllUserMailboxes(String username, 
MailboxSession session) throws MailboxException {
         return mailboxManager.search(
-            new MailboxQuery(new MailboxPath(MailboxConstants.USER_NAMESPACE, 
username, ""),
+            new MailboxQuery(MailboxPath.forUser(username, ""),
                 "*",
                 session.getPathDelimiter()),
             session);

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/server/container/mailbox-adapter/src/test/java/org/apache/james/adapter/mailbox/MailboxManagementTest.java
----------------------------------------------------------------------
diff --git 
a/server/container/mailbox-adapter/src/test/java/org/apache/james/adapter/mailbox/MailboxManagementTest.java
 
b/server/container/mailbox-adapter/src/test/java/org/apache/james/adapter/mailbox/MailboxManagementTest.java
index c5f2410..e5010a1 100644
--- 
a/server/container/mailbox-adapter/src/test/java/org/apache/james/adapter/mailbox/MailboxManagementTest.java
+++ 
b/server/container/mailbox-adapter/src/test/java/org/apache/james/adapter/mailbox/MailboxManagementTest.java
@@ -78,21 +78,21 @@ public class MailboxManagementTest {
 
     @Test
     public void deleteMailboxesShouldDeleteMailboxes() throws Exception {
-        inMemoryMapperFactory.createMailboxMapper(session).save(new 
SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "name"), 
UID_VALIDITY));
+        inMemoryMapperFactory.createMailboxMapper(session).save(new 
SimpleMailbox(MailboxPath.forUser(USER, "name"), UID_VALIDITY));
         mailboxManagerManagement.deleteMailboxes(USER);
         
assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).isEmpty();
     }
 
     @Test
     public void deleteMailboxesShouldDeleteInbox() throws Exception {
-        inMemoryMapperFactory.createMailboxMapper(session).save(new 
SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "INBOX"), 
UID_VALIDITY));
+        inMemoryMapperFactory.createMailboxMapper(session).save(new 
SimpleMailbox(MailboxPath.forUser(USER, "INBOX"), UID_VALIDITY));
         mailboxManagerManagement.deleteMailboxes(USER);
         
assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).isEmpty();
     }
 
     @Test
     public void deleteMailboxesShouldDeleteMailboxesChildren() throws 
Exception {
-        inMemoryMapperFactory.createMailboxMapper(session).save(new 
SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, 
"INBOX.test"), UID_VALIDITY));
+        inMemoryMapperFactory.createMailboxMapper(session).save(new 
SimpleMailbox(MailboxPath.forUser(USER, "INBOX.test"), UID_VALIDITY));
         mailboxManagerManagement.deleteMailboxes(USER);
         
assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).isEmpty();
     }
@@ -107,7 +107,7 @@ public class MailboxManagementTest {
 
     @Test
     public void deleteMailboxesShouldNotDeleteMailboxesBelongingToOtherUsers() 
throws Exception {
-        Mailbox mailbox = new SimpleMailbox(new 
MailboxPath(MailboxConstants.USER_NAMESPACE, "userbis", "name"), UID_VALIDITY);
+        Mailbox mailbox = new SimpleMailbox(MailboxPath.forUser("userbis", 
"name"), UID_VALIDITY);
         inMemoryMapperFactory.createMailboxMapper(session).save(mailbox);
         mailboxManagerManagement.deleteMailboxes(USER);
         
assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).containsExactly(mailbox);
@@ -115,7 +115,7 @@ public class MailboxManagementTest {
 
     @Test
     public void deleteMailboxesShouldDeleteMailboxesWithEmptyNames() throws 
Exception {
-        inMemoryMapperFactory.createMailboxMapper(session).save(new 
SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, ""), 
UID_VALIDITY));
+        inMemoryMapperFactory.createMailboxMapper(session).save(new 
SimpleMailbox(MailboxPath.forUser(USER, ""), UID_VALIDITY));
         mailboxManagerManagement.deleteMailboxes(USER);
         
assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).isEmpty();
     }
@@ -132,9 +132,9 @@ public class MailboxManagementTest {
 
     @Test
     public void deleteMailboxesShouldDeleteMultipleMailboxes() throws 
Exception {
-        inMemoryMapperFactory.createMailboxMapper(session).save(new 
SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "name"), 
UID_VALIDITY));
-        inMemoryMapperFactory.createMailboxMapper(session).save(new 
SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "INBOX"), 
UID_VALIDITY));
-        inMemoryMapperFactory.createMailboxMapper(session).save(new 
SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, 
"INBOX.test"), UID_VALIDITY));
+        inMemoryMapperFactory.createMailboxMapper(session).save(new 
SimpleMailbox(MailboxPath.forUser(USER, "name"), UID_VALIDITY));
+        inMemoryMapperFactory.createMailboxMapper(session).save(new 
SimpleMailbox(MailboxPath.forUser(USER, "INBOX"), UID_VALIDITY));
+        inMemoryMapperFactory.createMailboxMapper(session).save(new 
SimpleMailbox(MailboxPath.forUser(USER, "INBOX.test"), UID_VALIDITY));
         mailboxManagerManagement.deleteMailboxes(USER);
         
assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).isEmpty();
     }
@@ -143,12 +143,12 @@ public class MailboxManagementTest {
     public void createMailboxShouldCreateAMailbox() throws Exception {
         
mailboxManagerManagement.createMailbox(MailboxConstants.USER_NAMESPACE, USER, 
"name");
         
assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).hasSize(1);
-        
assertThat(inMemoryMapperFactory.createMailboxMapper(session).findMailboxByPath(new
 MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "name"))).isNotNull();
+        
assertThat(inMemoryMapperFactory.createMailboxMapper(session).findMailboxByPath(MailboxPath.forUser(USER,
 "name"))).isNotNull();
     }
 
     @Test
     public void createMailboxShouldNotThrowIfMailboxAlreadyExist() throws 
Exception {
-        MailboxPath path = new MailboxPath(MailboxConstants.USER_NAMESPACE, 
USER, "name");
+        MailboxPath path = MailboxPath.forUser(USER, "name");
         Mailbox mailbox = new SimpleMailbox(path, UID_VALIDITY);
         inMemoryMapperFactory.createMailboxMapper(session).save(mailbox);
         
mailboxManagerManagement.createMailbox(MailboxConstants.USER_NAMESPACE, USER, 
"name");
@@ -188,11 +188,11 @@ public class MailboxManagementTest {
     @Test
     public void listMailboxesShouldReturnUserMailboxes() throws Exception {
         Mailbox mailbox1 = new SimpleMailbox(new MailboxPath("#top", USER, 
"name1"), UID_VALIDITY);
-        Mailbox mailbox2 = new SimpleMailbox(new 
MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "name2"), UID_VALIDITY);
-        Mailbox mailbox3 = new SimpleMailbox(new 
MailboxPath(MailboxConstants.USER_NAMESPACE, "other_user", "name3"), 
UID_VALIDITY);
-        Mailbox mailbox4 = new SimpleMailbox(new 
MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "name4"), UID_VALIDITY);
-        Mailbox mailbox5 = new SimpleMailbox(new 
MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "INBOX"), UID_VALIDITY);
-        Mailbox mailbox6 = new SimpleMailbox(new 
MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "INBOX.toto"), UID_VALIDITY);
+        Mailbox mailbox2 = new SimpleMailbox(MailboxPath.forUser(USER, 
"name2"), UID_VALIDITY);
+        Mailbox mailbox3 = new SimpleMailbox(MailboxPath.forUser("other_user", 
"name3"), UID_VALIDITY);
+        Mailbox mailbox4 = new SimpleMailbox(MailboxPath.forUser(USER, 
"name4"), UID_VALIDITY);
+        Mailbox mailbox5 = new SimpleMailbox(MailboxPath.forUser(USER, 
"INBOX"), UID_VALIDITY);
+        Mailbox mailbox6 = new SimpleMailbox(MailboxPath.forUser(USER, 
"INBOX.toto"), UID_VALIDITY);
         inMemoryMapperFactory.createMailboxMapper(session).save(mailbox1);
         inMemoryMapperFactory.createMailboxMapper(session).save(mailbox2);
         inMemoryMapperFactory.createMailboxMapper(session).save(mailbox3);
@@ -214,7 +214,7 @@ public class MailboxManagementTest {
 
     @Test
     public void deleteMailboxShouldDeleteGivenMailbox() throws Exception {
-        inMemoryMapperFactory.createMailboxMapper(session).save(new 
SimpleMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "name"), 
UID_VALIDITY));
+        inMemoryMapperFactory.createMailboxMapper(session).save(new 
SimpleMailbox(MailboxPath.forUser(USER, "name"), UID_VALIDITY));
         
mailboxManagerManagement.deleteMailbox(MailboxConstants.USER_NAMESPACE, USER, 
"name");
         
assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).isEmpty();
     }
@@ -229,7 +229,7 @@ public class MailboxManagementTest {
 
     @Test
     public void deleteMailboxShouldNotDeleteGivenMailboxIfWrongUser() throws 
Exception {
-        Mailbox mailbox = new SimpleMailbox(new 
MailboxPath(MailboxConstants.USER_NAMESPACE, "userbis", "name"), UID_VALIDITY);
+        Mailbox mailbox = new SimpleMailbox(MailboxPath.forUser("userbis", 
"name"), UID_VALIDITY);
         inMemoryMapperFactory.createMailboxMapper(session).save(mailbox);
         
mailboxManagerManagement.deleteMailbox(MailboxConstants.USER_NAMESPACE, USER, 
"name");
         
assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).containsOnly(mailbox);
@@ -237,7 +237,7 @@ public class MailboxManagementTest {
 
     @Test
     public void deleteMailboxShouldNotDeleteGivenMailboxIfWrongName() throws 
Exception {
-        Mailbox mailbox = new SimpleMailbox(new 
MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "wrong_name"), UID_VALIDITY);
+        Mailbox mailbox = new SimpleMailbox(MailboxPath.forUser(USER, 
"wrong_name"), UID_VALIDITY);
         inMemoryMapperFactory.createMailboxMapper(session).save(mailbox);
         
mailboxManagerManagement.deleteMailbox(MailboxConstants.USER_NAMESPACE, USER, 
"name");
         
assertThat(inMemoryMapperFactory.createMailboxMapper(session).list()).containsOnly(mailbox);
@@ -245,7 +245,7 @@ public class MailboxManagementTest {
 
     @Test
     public void importEmlFileToMailboxShouldImportEmlFileToGivenMailbox() 
throws Exception {
-        Mailbox mailbox = new SimpleMailbox(new 
MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "name"),
+        Mailbox mailbox = new SimpleMailbox(MailboxPath.forUser(USER, "name"),
                 UID_VALIDITY);
         inMemoryMapperFactory.createMailboxMapper(session).save(mailbox);
         String emlpath = 
ClassLoader.getSystemResource("eml/frnog.eml").getFile();
@@ -262,7 +262,7 @@ public class MailboxManagementTest {
 
     @Test
     public void 
importEmlFileToMailboxShouldNotImportEmlFileWithWrongPathToGivenMailbox() 
throws Exception {
-        Mailbox mailbox = new SimpleMailbox(new 
MailboxPath(MailboxConstants.USER_NAMESPACE, USER, "name"),
+        Mailbox mailbox = new SimpleMailbox(MailboxPath.forUser(USER, "name"),
                 UID_VALIDITY);
         inMemoryMapperFactory.createMailboxMapper(session).save(mailbox);
         String emlpath = 
ClassLoader.getSystemResource("eml/frnog.eml").getFile();

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/LocalDeliveryTest.java
----------------------------------------------------------------------
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/LocalDeliveryTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/LocalDeliveryTest.java
index c5c19d2..8b59316 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/LocalDeliveryTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/LocalDeliveryTest.java
@@ -34,6 +34,7 @@ import javax.mail.Flags;
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeBodyPart;
 
+import org.apache.james.core.MailAddress;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageManager;
@@ -44,7 +45,6 @@ import org.apache.james.metrics.api.MetricFactory;
 import org.apache.james.transport.mailets.LocalDelivery;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.mailet.Mail;
-import org.apache.james.core.MailAddress;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMailetConfig;
@@ -93,7 +93,7 @@ public class LocalDeliveryTest {
     public void 
mailShouldBeWellDeliveredByDefaultToUserWhenVirtualHostingIsTurnedOn() throws 
Exception {
         // Given
         String username = "[email protected]";
-        MailboxPath inbox = new MailboxPath("#private", username, "INBOX");
+        MailboxPath inbox = MailboxPath.forUser(username, "INBOX");
         MessageManager messageManager = mock(MessageManager.class);
 
         when(usersRepository.supportVirtualHosting()).thenReturn(true);
@@ -114,7 +114,7 @@ public class LocalDeliveryTest {
     public void 
mailShouldBeWellDeliveredByDefaultToUserWhenVirtualHostingIsTurnedOff() throws 
Exception {
         // Given
         String username = "receiver";
-        MailboxPath inbox = new MailboxPath("#private", username, "INBOX");
+        MailboxPath inbox = MailboxPath.forUser(username, "INBOX");
         MessageManager messageManager = mock(MessageManager.class);
         when(usersRepository.supportVirtualHosting()).thenReturn(false);
         when(usersRepository.getUser(new 
MailAddress("receiver@localhost"))).thenReturn(username);

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/MailboxAppenderTest.java
----------------------------------------------------------------------
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/MailboxAppenderTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/MailboxAppenderTest.java
index d85e826..1c26351 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/MailboxAppenderTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/MailboxAppenderTest.java
@@ -80,7 +80,7 @@ public class MailboxAppenderTest {
     public void appendShouldAddMessageToDesiredMailbox() throws Exception {
         testee.append(mimeMessage, USER, FOLDER);
 
-        MessageResultIterator messages = mailboxManager.getMailbox(new 
MailboxPath("#private", USER, FOLDER), session)
+        MessageResultIterator messages = 
mailboxManager.getMailbox(MailboxPath.forUser(USER, FOLDER), session)
             .getMessages(MessageRange.all(), new 
FetchGroupImpl(MessageResult.FetchGroup.FULL_CONTENT), session);
 
         assertThat(messages).hasSize(1);
@@ -88,7 +88,7 @@ public class MailboxAppenderTest {
 
     @Test
     public void appendShouldAddMessageToDesiredMailboxWhenMailboxExists() 
throws Exception {
-        MailboxPath mailboxPath = new MailboxPath("#private", USER, FOLDER);
+        MailboxPath mailboxPath = MailboxPath.forUser(USER, FOLDER);
         mailboxManager.createMailbox(mailboxPath, session);
 
         testee.append(mimeMessage, USER, FOLDER);
@@ -110,7 +110,7 @@ public class MailboxAppenderTest {
     public void appendShouldRemovePathSeparatorAsFirstChar() throws Exception {
         testee.append(mimeMessage, USER, "." + FOLDER);
 
-        MessageResultIterator messages = mailboxManager.getMailbox(new 
MailboxPath("#private", USER, FOLDER), session)
+        MessageResultIterator messages = 
mailboxManager.getMailbox(MailboxPath.forUser(USER, FOLDER), session)
             .getMessages(MessageRange.all(), new 
FetchGroupImpl(MessageResult.FetchGroup.FULL_CONTENT), session);
 
         assertThat(messages).hasSize(1);
@@ -120,7 +120,7 @@ public class MailboxAppenderTest {
     public void appendShouldReplaceSlashBySeparator() throws Exception {
         testee.append(mimeMessage, USER, FOLDER + "/any");
 
-        MessageResultIterator messages = mailboxManager.getMailbox(new 
MailboxPath("#private", USER, FOLDER + ".any"), session)
+        MessageResultIterator messages = 
mailboxManager.getMailbox(MailboxPath.forUser(USER, FOLDER + ".any"), session)
             .getMessages(MessageRange.all(), new 
FetchGroupImpl(MessageResult.FetchGroup.FULL_CONTENT), session);
 
         assertThat(messages).hasSize(1);

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
index 7cb7c23..1d8736d 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
@@ -28,13 +28,13 @@ import java.io.IOException;
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeBodyPart;
 
+import org.apache.james.core.MailAddress;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.sieverepository.api.exception.ScriptNotFoundException;
 import org.apache.james.transport.mailets.Sieve;
 import org.apache.james.transport.mailets.jsieve.ResourceLocator;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.mailet.Mail;
-import org.apache.james.core.MailAddress;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMailetConfig;
@@ -57,9 +57,9 @@ public class SieveIntegrationTest {
     public static final DateTime DATE_DEFAULT = 
formatter.parseDateTime("2016-01-14 00:00:00");
     public static final DateTime DATE_NEW = 
formatter.parseDateTime("2016-01-18 00:00:00");
     public static final DateTime DATE_OLD = 
formatter.parseDateTime("2011-01-18 00:00:00");
-    public static final MailboxPath NOT_SELECTED_MAILBOX = new 
MailboxPath("#private", LOCAL_PART, "INBOX.not.selected");
-    public static final MailboxPath SELECTED_MAILBOX = new 
MailboxPath("#private", LOCAL_PART, "INBOX.select");
-    public static final MailboxPath INBOX = new MailboxPath("#private", 
LOCAL_PART, "INBOX");
+    public static final MailboxPath NOT_SELECTED_MAILBOX = 
MailboxPath.forUser(LOCAL_PART, "INBOX.not.selected");
+    public static final MailboxPath SELECTED_MAILBOX = 
MailboxPath.forUser(LOCAL_PART, "INBOX.select");
+    public static final MailboxPath INBOX = MailboxPath.forUser(LOCAL_PART, 
"INBOX");
 
     private Sieve testee;
     private UsersRepository usersRepository;

http://git-wip-us.apache.org/repos/asf/james-project/blob/f15ff20b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/ToRecipientFolderTest.java
----------------------------------------------------------------------
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/ToRecipientFolderTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/ToRecipientFolderTest.java
index 760909c..6222bdf 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/ToRecipientFolderTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/ToRecipientFolderTest.java
@@ -35,6 +35,7 @@ import javax.mail.Flags;
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeBodyPart;
 
+import org.apache.james.core.MailAddress;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageManager;
@@ -45,7 +46,6 @@ import org.apache.james.metrics.api.MetricFactory;
 import org.apache.james.transport.mailets.ToRecipientFolder;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.mailet.Mail;
-import org.apache.james.core.MailAddress;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMailetConfig;
@@ -61,9 +61,9 @@ public class ToRecipientFolderTest {
 
     public static final String USER_LOCAL_PART = "receiver";
     public static final String USER = USER_LOCAL_PART + "@domain.com";
-    public static final MailboxPath INBOX = new MailboxPath("#private", USER, 
"INBOX");
-    public static final MailboxPath JUNK = new MailboxPath("#private", 
USER_LOCAL_PART, "Junk");
-    public static final MailboxPath JUNK_VIRTUAL_HOSTING = new 
MailboxPath("#private", USER, "Junk");
+    public static final MailboxPath INBOX = MailboxPath.forUser(USER, "INBOX");
+    public static final MailboxPath JUNK = 
MailboxPath.forUser(USER_LOCAL_PART, "Junk");
+    public static final MailboxPath JUNK_VIRTUAL_HOSTING = 
MailboxPath.forUser(USER, "Junk");
     public static final String MAILET_NAME = "RecipientFolderTest";
 
     private MessageManager messageManager;

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/GetMailboxesMethodTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMailboxesMethodTest.java
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMailboxesMethodTest.java
index 82a6f01..547c644 100644
--- 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMailboxesMethodTest.java
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMailboxesMethodTest.java
@@ -365,7 +365,7 @@ public abstract class GetMailboxesMethodTest {
     public void getMailboxesShouldReturnMailboxesWhenAvailable() throws 
Exception {
         mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice, 
"name");
 
-        mailboxProbe.appendMessage(alice, new 
MailboxPath(MailboxConstants.USER_NAMESPACE, alice, "name"),
+        mailboxProbe.appendMessage(alice, MailboxPath.forUser(alice, "name"),
                 new ByteArrayInputStream("Subject: 
test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
 
         given()
@@ -383,7 +383,7 @@ public abstract class GetMailboxesMethodTest {
     public void getMailboxesShouldReturnMailboxPropertiesWhenAvailable() 
throws Exception {
         String myMailboxId = 
mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice, 
"name").serialize();
 
-        mailboxProbe.appendMessage(alice, new 
MailboxPath(MailboxConstants.USER_NAMESPACE, alice, "name"),
+        mailboxProbe.appendMessage(alice, MailboxPath.forUser(alice, "name"),
                 new ByteArrayInputStream("Subject: 
test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
 
         given()


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to