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/11/14 02:09:35 UTC
[james-project] 18/32: Remove pseudo-support for shared mailboxes
(mailboxes with null user)
This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 337606144f7aa832935bc0f78a846ae6e474cfd4
Author: Raphael Ouazana <ra...@linagora.com>
AuthorDate: Fri Nov 8 16:00:11 2019 +0100
Remove pseudo-support for shared mailboxes (mailboxes with null user)
---
.../apache/james/mailbox/model/MailboxPath.java | 3 +-
.../mailbox/model/search/MailboxQueryTest.java | 42 -----------
.../james/event/json/dtos/MailboxPathTest.java | 32 --------
.../james/mailbox/jpa/mail/JPAMailboxMapper.java | 20 ++---
.../store/mail/model/MailboxMapperTest.java | 87 ++--------------------
.../org/apache/james/imap/main/PathConverter.java | 8 +-
.../apache/james/imap/main/PathConverterTest.java | 46 +-----------
.../jmap/draft/model/mailbox/MailboxNamespace.java | 1 +
8 files changed, 17 insertions(+), 222 deletions(-)
diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/model/MailboxPath.java b/mailbox/api/src/main/java/org/apache/james/mailbox/model/MailboxPath.java
index 7c4b948..92cbde1 100644
--- a/mailbox/api/src/main/java/org/apache/james/mailbox/model/MailboxPath.java
+++ b/mailbox/api/src/main/java/org/apache/james/mailbox/model/MailboxPath.java
@@ -76,8 +76,7 @@ public class MailboxPath {
}
/**
- * Get the name of the user who owns the mailbox. This can be null e.g. for
- * shared mailboxes.
+ * Get the name of the user who owns the mailbox.
*/
public String getUser() {
return user;
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/MailboxQueryTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/MailboxQueryTest.java
index 82b121e..08c907f 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/MailboxQueryTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/MailboxQueryTest.java
@@ -130,18 +130,6 @@ public class MailboxQueryTest {
}
@Test
- public void belongsToNamespaceAndUserShouldReturnTrueWithIdenticalMailboxesWithNullUser() {
- MailboxPath base = new MailboxPath("namespace", null, "name");
-
- MailboxQuery mailboxQuery = MailboxQuery.builder()
- .userAndNamespaceFrom(base)
- .build();
-
- assertThat(mailboxQuery.belongsToRequestedNamespaceAndUser(mailboxPath))
- .isTrue();
- }
-
- @Test
public void belongsToNamespaceAndUserShouldReturnTrueWithIdenticalMailboxesWithNullNamespace() {
MailboxPath mailboxPath = new MailboxPath(null, "user", "name");
@@ -154,16 +142,6 @@ public class MailboxQueryTest {
}
@Test
- public void belongsToNamespaceAndUserShouldReturnTrueWithMailboxWithSameNamespaceAndUserWithNullUser() {
- MailboxQuery mailboxQuery = MailboxQuery.builder()
- .userAndNamespaceFrom(new MailboxPath("namespace", null, "name"))
- .build();
-
- assertThat(mailboxQuery.belongsToRequestedNamespaceAndUser(new MailboxPath("namespace", null, "name")))
- .isTrue();
- }
-
- @Test
public void belongsToNamespaceAndUserShouldReturnTrueWithMailboxWithSameNamespaceAndUser() {
MailboxQuery mailboxQuery = MailboxQuery.builder()
.userAndNamespaceFrom(new MailboxPath("namespace", CURRENT_USER, "name"))
@@ -194,16 +172,6 @@ public class MailboxQueryTest {
}
@Test
- public void belongsToNamespaceAndUserShouldReturnFalseWithOneOfTheUserNull() {
- MailboxQuery mailboxQuery = MailboxQuery.builder()
- .userAndNamespaceFrom(new MailboxPath("namespace", CURRENT_USER, "name"))
- .build();
-
- assertThat(mailboxQuery.belongsToRequestedNamespaceAndUser(new MailboxPath("namespace", null, "name")))
- .isFalse();
- }
-
- @Test
public void belongsToNamespaceAndUserShouldReturnFalseWhenDifferentUser() {
MailboxQuery mailboxQuery = MailboxQuery.builder()
.userAndNamespaceFrom(new MailboxPath("namespace", CURRENT_USER, "name"))
@@ -212,14 +180,4 @@ public class MailboxQueryTest {
assertThat(mailboxQuery.belongsToRequestedNamespaceAndUser(new MailboxPath("namespace", "other", "name")))
.isFalse();
}
-
- @Test
- public void belongsToNamespaceAndUserShouldReturnFalseIfNamespaceAreDifferentWithNullUser() {
- MailboxQuery mailboxQuery = MailboxQuery.builder()
- .userAndNamespaceFrom(new MailboxPath("namespace", null, "name"))
- .build();
-
- assertThat(mailboxQuery.belongsToRequestedNamespaceAndUser(new MailboxPath("namespace2", null, "name")))
- .isFalse();
- }
}
diff --git a/mailbox/event/json/src/test/java/org/apache/james/event/json/dtos/MailboxPathTest.java b/mailbox/event/json/src/test/java/org/apache/james/event/json/dtos/MailboxPathTest.java
index a47e582..a35e664 100644
--- a/mailbox/event/json/src/test/java/org/apache/james/event/json/dtos/MailboxPathTest.java
+++ b/mailbox/event/json/src/test/java/org/apache/james/event/json/dtos/MailboxPathTest.java
@@ -47,17 +47,6 @@ class MailboxPathTest {
}
@Test
- void mailboxPathWithNullUserShouldBeWellSerialized() {
- assertThatJson(DTO_JSON_SERIALIZE.mailboxPathWrites().writes(DTOs.MailboxPath$.MODULE$.fromJava(
- new MailboxPath(MailboxConstants.USER_NAMESPACE, null, MAILBOX_NAME))).toString())
- .isEqualTo(
- "{" +
- " \"namespace\":\"#private\"," +
- " \"name\":\"mailboxName\"" +
- "}");
- }
-
- @Test
void mailboxPathWithEmptyNamespaceShouldBeWellSerialized() {
assertThatJson(DTO_JSON_SERIALIZE.mailboxPathWrites().writes(DTOs.MailboxPath$.MODULE$.fromJava(
new MailboxPath("", "user", MAILBOX_NAME))).toString())
@@ -81,27 +70,6 @@ class MailboxPathTest {
}
@Test
- void mailboxPathWithNullUserShouldBeWellDeSerialized() {
- assertThat(DTO_JSON_SERIALIZE.mailboxPathReads().reads(Json.parse("{" +
- " \"namespace\":\"#private\"," +
- " \"user\":null," +
- " \"name\":\"mailboxName\"" +
- "}")).get())
- .isEqualTo(DTOs.MailboxPath$.MODULE$.fromJava(
- new MailboxPath(MailboxConstants.USER_NAMESPACE, null, MAILBOX_NAME)));
- }
-
- @Test
- void mailboxPathWithNoUserShouldBeWellDeSerialized() {
- assertThat(DTO_JSON_SERIALIZE.mailboxPathReads().reads(Json.parse("{" +
- " \"namespace\":\"#private\"," +
- " \"name\":\"mailboxName\"" +
- "}")).get())
- .isEqualTo(DTOs.MailboxPath$.MODULE$.fromJava(
- new MailboxPath(MailboxConstants.USER_NAMESPACE, null, MAILBOX_NAME)));
- }
-
- @Test
void mailboxPathDeserializationShouldFailWhenNoNamespace() {
assertThat(DTO_JSON_SERIALIZE.mailboxPathReads().reads(Json.parse("{" +
" \"user\":\"user\"," +
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMailboxMapper.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMailboxMapper.java
index d342649..ca633e7 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMailboxMapper.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMailboxMapper.java
@@ -202,16 +202,10 @@ public class JPAMailboxMapper extends JPATransactionalMapper implements MailboxM
}
private TypedQuery<JPAMailbox> findMailboxWithPathLikeTypedQuery(MailboxPath path) {
- if (path.getUser() == null) {
- return getEntityManager().createNamedQuery("findMailboxWithNameLike", JPAMailbox.class)
- .setParameter("nameParam", path.getName())
- .setParameter("namespaceParam", path.getNamespace());
- } else {
- return getEntityManager().createNamedQuery("findMailboxWithNameLikeWithUser", JPAMailbox.class)
- .setParameter("nameParam", path.getName())
- .setParameter("namespaceParam", path.getNamespace())
- .setParameter("userParam", path.getUser());
- }
+ return getEntityManager().createNamedQuery("findMailboxWithNameLikeWithUser", JPAMailbox.class)
+ .setParameter("nameParam", path.getName())
+ .setParameter("namespaceParam", path.getNamespace())
+ .setParameter("userParam", path.getUser().asId());
}
public void deleteAllMemberships() throws MailboxException {
@@ -234,11 +228,7 @@ public class JPAMailboxMapper extends JPATransactionalMapper implements MailboxM
public boolean hasChildren(Mailbox mailbox, char delimiter) throws MailboxException, MailboxNotFoundException {
final String name = mailbox.getName() + delimiter + SQL_WILDCARD_CHAR;
final Long numberOfChildMailboxes;
- if (mailbox.getUser() == null) {
- numberOfChildMailboxes = (Long) getEntityManager().createNamedQuery("countMailboxesWithNameLike").setParameter("nameParam", name).setParameter("namespaceParam", mailbox.getNamespace()).getSingleResult();
- } else {
- numberOfChildMailboxes = (Long) getEntityManager().createNamedQuery("countMailboxesWithNameLikeWithUser").setParameter("nameParam", name).setParameter("namespaceParam", mailbox.getNamespace()).setParameter("userParam", mailbox.getUser()).getSingleResult();
- }
+ numberOfChildMailboxes = (Long) getEntityManager().createNamedQuery("countMailboxesWithNameLikeWithUser").setParameter("nameParam", name).setParameter("namespaceParam", mailbox.getNamespace()).setParameter("userParam", mailbox.getUser()).getSingleResult();
return numberOfChildMailboxes != null && numberOfChildMailboxes > 0;
}
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MailboxMapperTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MailboxMapperTest.java
index afca3fd..06a1909 100644
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MailboxMapperTest.java
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MailboxMapperTest.java
@@ -60,18 +60,6 @@ public abstract class MailboxMapperTest {
private Mailbox bobyMailbox;
private MailboxPath bobyMailboxPath;
private Mailbox bobInboxMailbox;
- private MailboxPath esnDevGroupInboxPath;
- private Mailbox esnDevGroupInboxMailbox;
- private MailboxPath esnDevGroupHublinPath;
- private Mailbox esnDevGroupHublinMailbox;
- private MailboxPath esnDevGroupJamesPath;
- private Mailbox esnDevGroupJamesMailbox;
- private MailboxPath obmTeamGroupInboxPath;
- private Mailbox obmTeamGroupInboxMailbox;
- private MailboxPath obmTeamGroupOPushPath;
- private Mailbox obmTeamGroupOPushMailbox;
- private MailboxPath obmTeamGroupRoundCubePath;
- private Mailbox obmTeamGroupRoundCubeMailbox;
private MailboxPath bobDifferentNamespacePath;
private Mailbox bobDifferentNamespaceMailbox;
@@ -111,20 +99,12 @@ public abstract class MailboxMapperTest {
}
@Test
- public void saveWithNullUserShouldPersistTheMailbox() throws MailboxException {
- mailboxMapper.save(esnDevGroupInboxMailbox);
- MailboxAssert.assertThat(mailboxMapper.findMailboxByPath(esnDevGroupInboxPath)).isEqualTo(esnDevGroupInboxMailbox);
- }
-
- @Test
public void listShouldRetrieveAllMailbox() throws MailboxException {
saveAll();
List<Mailbox> mailboxes = mailboxMapper.list();
assertMailboxes(mailboxes)
.containOnly(benwaInboxMailbox, benwaWorkMailbox, benwaWorkTodoMailbox, benwaPersoMailbox, benwaWorkDoneMailbox,
- esnDevGroupInboxMailbox, esnDevGroupHublinMailbox, esnDevGroupJamesMailbox,
- obmTeamGroupInboxMailbox, obmTeamGroupOPushMailbox, obmTeamGroupRoundCubeMailbox,
bobyMailbox, bobDifferentNamespaceMailbox, bobInboxMailbox);
}
@@ -141,18 +121,6 @@ public abstract class MailboxMapperTest {
}
@Test
- public void hasChildrenWithNullUserShouldReturnFalseWhenNoChildrenExists() throws MailboxException {
- saveAll();
- assertThat(mailboxMapper.hasChildren(esnDevGroupHublinMailbox, DELIMITER)).isFalse();
- }
-
- @Test
- public void hasChildrenWithNullUserShouldReturnTrueWhenChildrenExists() throws MailboxException {
- saveAll();
- assertThat(mailboxMapper.hasChildren(esnDevGroupInboxMailbox, DELIMITER)).isTrue();
- }
-
- @Test
public void hasChildrenShouldNotBeAcrossUsersAndNamespace() throws MailboxException {
saveAll();
assertThat(mailboxMapper.hasChildren(bobInboxMailbox, '.')).isFalse();
@@ -177,15 +145,6 @@ public abstract class MailboxMapperTest {
}
@Test
- public void deleteWithNullUserShouldEraseTheGivenMailbox() throws MailboxException {
- saveAll();
- mailboxMapper.delete(esnDevGroupJamesMailbox);
-
- assertThatThrownBy(() -> mailboxMapper.findMailboxByPath(esnDevGroupJamesPath))
- .isInstanceOf(MailboxNotFoundException.class);
- }
-
- @Test
public void findMailboxWithPathLikeWithChildRegexShouldRetrieveChildren() throws MailboxException {
saveAll();
MailboxPath regexPath = new MailboxPath(benwaWorkPath.getNamespace(), benwaWorkPath.getUser(), benwaWorkPath.getName() + WILDCARD);
@@ -195,36 +154,20 @@ public abstract class MailboxMapperTest {
}
@Test
- public void findMailboxWithPathLikeWithNullUserWithChildRegexShouldRetrieveChildren() throws MailboxException {
- saveAll();
- MailboxPath regexPath = new MailboxPath(obmTeamGroupInboxPath.getNamespace(), obmTeamGroupInboxPath.getUser(), obmTeamGroupInboxPath.getName() + WILDCARD);
-
- List<Mailbox> mailboxes = mailboxMapper.findMailboxWithPathLike(regexPath);
-
- assertMailboxes(mailboxes).containOnly(obmTeamGroupInboxMailbox, obmTeamGroupOPushMailbox, obmTeamGroupRoundCubeMailbox);
- }
-
- @Test
public void findMailboxWithPathLikeWithRegexShouldRetrieveCorrespondingMailbox() throws MailboxException {
saveAll();
- MailboxPath regexPath = new MailboxPath(benwaInboxPath.getNamespace(), benwaInboxPath.getUser(), WILDCARD + "X");
+ MailboxQuery.UserBound mailboxQuery = MailboxQuery.builder()
+ .userAndNamespaceFrom(benwaWorkPath)
+ .expression(new ExactName("INBOX"))
+ .build()
+ .asUserBound();
- List<Mailbox> mailboxes = mailboxMapper.findMailboxWithPathLike(regexPath);
+ List<Mailbox> mailboxes = mailboxMapper.findMailboxWithPathLike(mailboxQuery);
assertMailboxes(mailboxes).containOnly(benwaInboxMailbox);
}
@Test
- public void findMailboxWithPathLikeWithNullUserWithRegexShouldRetrieveCorrespondingMailbox() throws MailboxException {
- saveAll();
- MailboxPath regexPath = new MailboxPath(esnDevGroupInboxPath.getNamespace(), esnDevGroupInboxPath.getUser(), WILDCARD + "X");
-
- List<Mailbox> mailboxes = mailboxMapper.findMailboxWithPathLike(regexPath);
-
- assertMailboxes(mailboxes).containOnly(esnDevGroupInboxMailbox);
- }
-
- @Test
public void findMailboxWithPathLikeShouldEscapeMailboxName() throws MailboxException {
saveAll();
MailboxPath regexPath = new MailboxPath(benwaInboxPath.getNamespace(), benwaInboxPath.getUser(), "INB?X");
@@ -256,12 +199,6 @@ public abstract class MailboxMapperTest {
bobInboxPath = MailboxPath.forUser("bob", "INBOX");
bobyMailboxPath = MailboxPath.forUser("boby", "INBOX.that.is.a.trick");
bobDifferentNamespacePath = new MailboxPath("#private_bob", "bob", "INBOX.bob");
- esnDevGroupInboxPath = new MailboxPath("#community_ESN_DEV", null, "INBOX");
- esnDevGroupHublinPath = new MailboxPath("#community_ESN_DEV", null, "INBOX" + DELIMITER + "hublin");
- esnDevGroupJamesPath = new MailboxPath("#community_ESN_DEV", null, "INBOX" + DELIMITER + "james");
- obmTeamGroupInboxPath = new MailboxPath("#community_OBM_Core_Team", null, "INBOX");
- obmTeamGroupOPushPath = new MailboxPath("#community_OBM_Core_Team", null, "INBOX" + DELIMITER + "OPush");
- obmTeamGroupRoundCubePath = new MailboxPath("#community_OBM_Core_Team", null, "INBOX" + DELIMITER + "roundCube");
benwaInboxMailbox = createMailbox(benwaInboxPath);
benwaWorkMailbox = createMailbox(benwaWorkPath);
@@ -269,12 +206,6 @@ public abstract class MailboxMapperTest {
benwaPersoMailbox = createMailbox(benwaPersoPath);
benwaWorkDoneMailbox = createMailbox(benwaWorkDonePath);
bobInboxMailbox = createMailbox(bobInboxPath);
- esnDevGroupInboxMailbox = createMailbox(esnDevGroupInboxPath);
- esnDevGroupHublinMailbox = createMailbox(esnDevGroupHublinPath);
- esnDevGroupJamesMailbox = createMailbox(esnDevGroupJamesPath);
- obmTeamGroupInboxMailbox = createMailbox(obmTeamGroupInboxPath);
- obmTeamGroupOPushMailbox = createMailbox(obmTeamGroupOPushPath);
- obmTeamGroupRoundCubeMailbox = createMailbox(obmTeamGroupRoundCubePath);
bobyMailbox = createMailbox(bobyMailboxPath);
bobDifferentNamespaceMailbox = createMailbox(bobDifferentNamespacePath);
}
@@ -285,12 +216,6 @@ public abstract class MailboxMapperTest {
mailboxMapper.save(benwaWorkTodoMailbox);
mailboxMapper.save(benwaPersoMailbox);
mailboxMapper.save(benwaWorkDoneMailbox);
- mailboxMapper.save(esnDevGroupInboxMailbox);
- mailboxMapper.save(esnDevGroupHublinMailbox);
- mailboxMapper.save(esnDevGroupJamesMailbox);
- mailboxMapper.save(obmTeamGroupInboxMailbox);
- mailboxMapper.save(obmTeamGroupOPushMailbox);
- mailboxMapper.save(obmTeamGroupRoundCubeMailbox);
mailboxMapper.save(bobyMailbox);
mailboxMapper.save(bobDifferentNamespaceMailbox);
mailboxMapper.save(bobInboxMailbox);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/main/PathConverter.java b/protocols/imap/src/main/java/org/apache/james/imap/main/PathConverter.java
index d348fbc..e7d5ff6 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/main/PathConverter.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/main/PathConverter.java
@@ -48,7 +48,7 @@ public class PathConverter {
public MailboxPath buildFullPath(String mailboxName) {
if (Strings.isNullOrEmpty(mailboxName)) {
- return buildDefaultPath();
+ return buildRelativePath("");
}
if (isAbsolute(mailboxName)) {
return buildAbsolutePath(mailboxName);
@@ -57,10 +57,6 @@ public class PathConverter {
}
}
- private MailboxPath buildDefaultPath() {
- return new MailboxPath("", "", "");
- }
-
private boolean isAbsolute(String mailboxName) {
Preconditions.checkArgument(!Strings.isNullOrEmpty(mailboxName));
return mailboxName.charAt(0) == MailboxConstants.NAMESPACE_PREFIX_CHAR;
@@ -82,7 +78,7 @@ public class PathConverter {
if (namespace.equals(MailboxConstants.USER_NAMESPACE)) {
return ImapSessionUtils.getUserName(session);
}
- return null;
+ throw new DeniedAccessOnSharedMailboxException();
}
private MailboxPath buildMailboxPath(String namespace, String user, String mailboxName) {
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 893e59b..6395098 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
@@ -30,7 +30,6 @@ import org.apache.james.mailbox.MailboxSessionUtil;
import org.apache.james.mailbox.model.MailboxConstants;
import org.apache.james.mailbox.model.MailboxPath;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -56,13 +55,13 @@ public class PathConverterTest {
@Test
public void buildFullPathShouldAcceptNull() {
assertThat(pathConverter.buildFullPath(null))
- .isEqualTo(new MailboxPath("", "", ""));
+ .isEqualTo(new MailboxPath("", USERNAME, ""));
}
@Test
public void buildPathShouldAcceptEmpty() {
assertThat(pathConverter.buildFullPath(""))
- .isEqualTo(new MailboxPath("", "", ""));
+ .isEqualTo(new MailboxPath("", USERNAME, ""));
}
@Test
@@ -72,41 +71,18 @@ public class PathConverterTest {
.isEqualTo(MailboxPath.forUser(USERNAME, mailboxName));
}
- @Ignore("Shared mailbox is not supported yet")
- @Test
- public void buildFullPathShouldAcceptNamespacePrefix() {
- assertThat(pathConverter.buildFullPath("#"))
- .isEqualTo(new MailboxPath("#", null, ""));
- }
-
@Test
public void buildFullPathShouldAcceptUserNamespace() {
assertThat(pathConverter.buildFullPath(MailboxConstants.USER_NAMESPACE))
.isEqualTo(MailboxPath.forUser(USERNAME, ""));
}
- @Ignore("Shared mailbox is not supported yet")
- @Test
- public void buildFullPathShouldAcceptNamespaceAlone() {
- String namespace = "#any";
- assertThat(pathConverter.buildFullPath(namespace))
- .isEqualTo(new MailboxPath(namespace, null, ""));
- }
-
@Test
public void buildFullPathShouldAcceptUserNamespaceAndDelimiter() {
assertThat(pathConverter.buildFullPath(MailboxConstants.USER_NAMESPACE + PATH_DELIMITER))
.isEqualTo(MailboxPath.forUser(USERNAME, ""));
}
- @Ignore("Shared mailbox is not supported yet")
- @Test
- public void buildFullPathShouldAcceptNamespaceAndDelimiter() {
- String namespace = "#any";
- assertThat(pathConverter.buildFullPath(namespace + PATH_DELIMITER))
- .isEqualTo(new MailboxPath(namespace, null, ""));
- }
-
@Test
public void buildFullPathShouldAcceptFullAbsoluteUserPath() {
String mailboxName = "mailboxName";
@@ -114,15 +90,6 @@ public class PathConverterTest {
.isEqualTo(MailboxPath.forUser(USERNAME, mailboxName));
}
- @Ignore("Shared mailbox is not supported yet")
- @Test
- public void buildFullPathShouldAcceptFullAbsolutePath() {
- String namespace = "#any";
- String mailboxName = "mailboxName";
- assertThat(pathConverter.buildFullPath(namespace + PATH_DELIMITER + mailboxName))
- .isEqualTo(new MailboxPath(namespace, null, mailboxName));
- }
-
@Test
public void buildFullPathShouldAcceptRelativePathWithSubFolder() {
String mailboxName = "mailboxName" + PATH_DELIMITER + "subFolder";
@@ -137,15 +104,6 @@ public class PathConverterTest {
.isEqualTo(MailboxPath.forUser(USERNAME, mailboxName));
}
- @Ignore("Shared mailbox is not supported yet")
- @Test
- public void buildFullPathShouldAcceptAbsolutePathWithSubFolder() {
- String namespace = "#any";
- String mailboxName = "mailboxName.subFolder";
- assertThat(pathConverter.buildFullPath(namespace + PATH_DELIMITER + mailboxName))
- .isEqualTo(new MailboxPath(namespace, null, mailboxName));
- }
-
@Test
public void buildFullPathShouldDenyMailboxPathNotBelongingToTheUser() {
expectedException.expect(DeniedAccessOnSharedMailboxException.class);
diff --git a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/model/mailbox/MailboxNamespace.java b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/model/mailbox/MailboxNamespace.java
index a0447b3..1a730f1 100644
--- a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/model/mailbox/MailboxNamespace.java
+++ b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/model/mailbox/MailboxNamespace.java
@@ -42,6 +42,7 @@ public class MailboxNamespace {
}
public static MailboxNamespace delegated(String owner) {
+ Preconditions.checkArgument(owner != null);
Preconditions.checkArgument(!StringUtils.isBlank(owner));
return new MailboxNamespace(Type.Delegated, Optional.of(owner));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org