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 ad...@apache.org on 2017/11/16 13:20:32 UTC

[5/8] james-project git commit: JAMES-2219 Integration test about renaming a shared mailbox

JAMES-2219 Integration test about renaming a shared mailbox


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

Branch: refs/heads/master
Commit: 48979015080c1215089ac461ecec061bcbdcb156
Parents: 29510c2
Author: Antoine Duprat <ad...@linagora.com>
Authored: Wed Nov 15 15:32:43 2017 +0100
Committer: Antoine Duprat <ad...@linagora.com>
Committed: Thu Nov 16 14:19:16 2017 +0100

----------------------------------------------------------------------
 .../mailbox/store/StoreMailboxManager.java      |  9 +++
 .../cucumber/GetMailboxesMethodStepdefs.java    |  2 +-
 .../cucumber/SetMailboxesMethodStepdefs.java    | 29 ++++++-
 .../resources/cucumber/GetMailboxes.feature     | 82 ++++++++++++--------
 4 files changed, 87 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/48979015/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
index e76ea91..6a72340 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
@@ -37,6 +37,7 @@ import org.apache.james.mailbox.MailboxPathLocker;
 import org.apache.james.mailbox.MailboxPathLocker.LockAwareExecution;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MailboxSession.SessionType;
+import org.apache.james.mailbox.MailboxSession.User;
 import org.apache.james.mailbox.MailboxSessionIdGenerator;
 import org.apache.james.mailbox.MessageManager;
 import org.apache.james.mailbox.StandardMailboxMetaDataComparator;
@@ -548,10 +549,18 @@ public class StoreMailboxManager implements MailboxManager {
             throw new MailboxExistsException(to.toString());
         }
 
+        assertIsOwner(session.getUser(), from);
         MailboxMapper mapper = mailboxSessionMapperFactory.getMailboxMapper(session);
         mapper.execute(Mapper.toTransaction(() -> doRenameMailbox(from, to, session, mapper)));
     }
 
+    private void assertIsOwner(User user, MailboxPath mailboxPath) throws MailboxNotFoundException {
+        if (!user.isSameUser(mailboxPath.getUser())) {
+            LOGGER.info("Mailbox " + mailboxPath.asString() + " does not belong to " + user.getUserName());
+            throw new MailboxNotFoundException(mailboxPath.asString());
+        }
+    }
+
     private void doRenameMailbox(MailboxPath from, MailboxPath to, MailboxSession session, MailboxMapper mapper) throws MailboxException {
         // TODO put this into a serilizable transaction
         Mailbox mailbox = Optional.ofNullable(mapper.findMailboxByPath(from))

http://git-wip-us.apache.org/repos/asf/james-project/blob/48979015/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMailboxesMethodStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMailboxesMethodStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMailboxesMethodStepdefs.java
index 85e9af3..73272cf 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMailboxesMethodStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMailboxesMethodStepdefs.java
@@ -46,7 +46,7 @@ public class GetMailboxesMethodStepdefs {
         this.httpClient = httpClient;
     }
 
-    @When("^\"([^\"]*)\" ask for mailboxes$")
+    @When("^\"([^\"]*)\" lists mailboxes$")
     public void getMailboxes(String user) throws Throwable {
         userStepdefs.execWithUser(user, 
                 () -> httpClient.post("[[\"getMailboxes\", {}, \"#0\"]]"));

http://git-wip-us.apache.org/repos/asf/james-project/blob/48979015/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 3705db7..59c1fbd 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
@@ -130,9 +130,20 @@ public class SetMailboxesMethodStepdefs {
         shareMailboxWithRight(owner, mailboxName, rights, shareTo);
     }
 
-    @When("^renaming mailbox \"([^\"]*)\" to \"([^\"]*)\"")
-    public void renamingMailbox(String actualMailboxName, String newMailboxName) throws Throwable {
-        Mailbox mailbox = mainStepdefs.mailboxProbe.getMailbox("#private", userStepdefs.getConnectedUser(), actualMailboxName);
+    @When("^\"([^\"]*)\" renames the mailbox, owned by \"([^\"]*)\", \"([^\"]*)\" to \"([^\"]*)\"$")
+    public void renamingMailbox(String user, String mailboxOwner, String currentMailboxName, String newMailboxName) throws Throwable {
+        Mailbox mailbox = mainStepdefs.mailboxProbe.getMailbox("#private", mailboxOwner, currentMailboxName);
+        userStepdefs.connectUser(user);
+        renamingMailbox(mailbox, newMailboxName);
+    }
+
+    @When("^\"([^\"]*)\" renames (?:her|his) mailbox \"([^\"]*)\" to \"([^\"]*)\"$")
+    public void renamingMailbox(String user, String actualMailboxName, String newMailboxName) throws Throwable {
+        Mailbox mailbox = mainStepdefs.mailboxProbe.getMailbox("#private", user, actualMailboxName);
+        renamingMailbox(mailbox, newMailboxName);
+    }
+
+    private void renamingMailbox(Mailbox mailbox, String newMailboxName) throws Exception {
         String mailboxId = mailbox.getMailboxId().serialize();
         String requestBody =
                 "[" +
@@ -150,6 +161,11 @@ public class SetMailboxesMethodStepdefs {
         httpClient.post(requestBody);
     }
 
+    @When("^renaming mailbox \"([^\"]*)\" to \"([^\"]*)\"")
+    public void renamingMailbox(String actualMailboxName, String newMailboxName) throws Throwable {
+        renamingMailbox(userStepdefs.getConnectedUser(), actualMailboxName, newMailboxName);
+    }
+
     @When("^moving mailbox \"([^\"]*)\" to \"([^\"]*)\"$")
     public void movingMailbox(String actualMailboxPath, String newParentMailboxPath) throws Throwable {
         String username = userStepdefs.getConnectedUser();
@@ -206,4 +222,11 @@ public class SetMailboxesMethodStepdefs {
         assertThat(parameters).contains(Maps.immutableEntry("type", type),
                 Maps.immutableEntry("description", message));
     }
+
+    @Then("^mailbox \"([^\"]*)\" owned by \"([^\"]*)\" is not updated")
+    public void assertNotUpdated(String mailboxName, String owner) throws Exception {
+        Mailbox mailbox = mainStepdefs.mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, owner, mailboxName);
+        assertThat(httpClient.jsonPath.<Map<String, String>>read("[0][1].notUpdated"))
+            .containsOnlyKeys(mailbox.getMailboxId().serialize());
+    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/48979015/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMailboxes.feature
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMailboxes.feature b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMailboxes.feature
index 28f0011..34278c3 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMailboxes.feature
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMailboxes.feature
@@ -32,63 +32,63 @@ Feature: GetMailboxes method
   Scenario: Sharer can read the total and unread counts on a shared folder
     Given "alice@domain.tld" has a message "m1" in "shared" mailbox
     And "alice@domain.tld" has a message "m2" in "shared" mailbox with subject "my test subject 2", content "testmail 2"
-    When "alice@domain.tld" ask for mailboxes
+    When "alice@domain.tld" lists mailboxes
     Then the mailbox "shared" has 2 messages
     And the mailbox "shared" has 2 unseen messages
 
   Scenario: Sharee can read the total and unread counts on a shared folder
     Given "alice@domain.tld" has a message "m1" in "shared" mailbox
     And "alice@domain.tld" has a message "m2" in "shared" mailbox with subject "my test subject 2", content "testmail 2"
-    When "bob@domain.tld" ask for mailboxes
+    When "bob@domain.tld" lists mailboxes
     Then the mailbox "shared" has 2 messages
     And the mailbox "shared" has 2 unseen messages
 
   Scenario: Copy message should update the total and the unread counts when asked by sharer
     Given "alice@domain.tld" has a message "m1" in "INBOX" mailbox
     And "alice@domain.tld" copies "m1" from mailbox "INBOX" to mailbox "shared"
-    When "alice@domain.tld" ask for mailboxes
+    When "alice@domain.tld" lists mailboxes
     Then the mailbox "shared" has 1 message
     And the mailbox "shared" has 1 unseen message
 
   Scenario: Copy message should update the total and the unread counts when asked by sharer / sharee view
     Given "alice@domain.tld" has a message "m1" in "INBOX" mailbox
     And "alice@domain.tld" copies "m1" from mailbox "INBOX" to mailbox "shared"
-    When "bob@domain.tld" ask for mailboxes
+    When "bob@domain.tld" lists mailboxes
     Then the mailbox "shared" has 1 message
     And the mailbox "shared" has 1 unseen message
 
   Scenario: Copy message should update the total and the unread counts when asked by sharee
     Given "bob@domain.tld" has a message "m1" in "bobMailbox" mailbox
     And "bob@domain.tld" copies "m1" from mailbox "bobMailbox" of user "bob@domain.tld" to mailbox "shared" of user "alice@domain.tld"
-    When "alice@domain.tld" ask for mailboxes
+    When "alice@domain.tld" lists mailboxes
     Then the mailbox "shared" has 1 message
     And the mailbox "shared" has 1 unseen message
 
   Scenario: Copy message should update the total and the unread counts when asked by sharee / sharee view
     Given "bob@domain.tld" has a message "m1" in "bobMailbox" mailbox
     And "bob@domain.tld" copies "m1" from mailbox "bobMailbox" of user "bob@domain.tld" to mailbox "shared" of user "alice@domain.tld"
-    When "bob@domain.tld" ask for mailboxes
+    When "bob@domain.tld" lists mailboxes
     Then the mailbox "shared" has 1 message
     And the mailbox "shared" has 1 unseen message
 
   Scenario: Move message should update the total and the unread counts when asked by sharer
     Given "alice@domain.tld" has a message "m1" in "INBOX" mailbox
     And "alice@domain.tld" moves "m1" to mailbox "shared" of user "alice@domain.tld"
-    When "alice@domain.tld" ask for mailboxes
+    When "alice@domain.tld" lists mailboxes
     Then the mailbox "shared" has 1 message
     And the mailbox "shared" has 1 unseen message
 
   Scenario: Move message should update the total and the unread counts of origin mailbox when asked by sharer
     Given "alice@domain.tld" has a message "m1" in "INBOX" mailbox
     And "alice@domain.tld" moves "m1" to mailbox "shared" of user "alice@domain.tld"
-    When "alice@domain.tld" ask for mailboxes
+    When "alice@domain.tld" lists mailboxes
     Then the mailbox "INBOX" has 0 messages
     And the mailbox "INBOX" has 0 unseen messages
 
   Scenario: Move message should update the total and the unread counts when asked by sharer / sharee view
     Given "alice@domain.tld" has a message "m1" in "INBOX" mailbox
     And "alice@domain.tld" moves "m1" to mailbox "shared" of user "alice@domain.tld"
-    When "bob@domain.tld" ask for mailboxes
+    When "bob@domain.tld" lists mailboxes
     Then the mailbox "shared" has 1 message
     And the mailbox "shared" has 1 unseen message
 
@@ -97,14 +97,14 @@ Feature: GetMailboxes method
     And "alice@domain.tld" has a message "m1" in "sharedBis" mailbox
     And "alice@domain.tld" shares her mailbox "sharedBis" with "bob@domain.tld" with "aeilrwt" rights
     And "alice@domain.tld" moves "m1" to mailbox "shared" of user "alice@domain.tld"
-    When "bob@domain.tld" ask for mailboxes
+    When "bob@domain.tld" lists mailboxes
     Then the mailbox "sharedBis" has 0 messages
     And the mailbox "sharedBis" has 0 unseen messages
 
   Scenario: Move message should update the total and the unread counts when asked by sharee
     Given "bob@domain.tld" has a message "m1" in "bobMailbox" mailbox
     And "bob@domain.tld" moves "m1" to mailbox "shared" of user "alice@domain.tld"
-    When "alice@domain.tld" ask for mailboxes
+    When "alice@domain.tld" lists mailboxes
     Then the mailbox "shared" has 1 message
     And the mailbox "shared" has 1 unseen message
 
@@ -113,21 +113,21 @@ Feature: GetMailboxes method
     And "bob@domain.tld" has a message "m1" in "sharedBis" mailbox
     And "bob@domain.tld" shares her mailbox "sharedBis" with "alice@domain.tld" with "aeilrwt" rights
     And "bob@domain.tld" moves "m1" to mailbox "shared" of user "alice@domain.tld"
-    When "alice@domain.tld" ask for mailboxes
+    When "alice@domain.tld" lists mailboxes
     Then the mailbox "sharedBis" has 0 messages
     And the mailbox "sharedBis" has 0 unseen messages
 
   Scenario: Move message should update the total and the unread counts when asked by sharee / sharee view
     Given "bob@domain.tld" has a message "m1" in "bobMailbox" mailbox
     And "bob@domain.tld" moves "m1" to mailbox "shared" of user "alice@domain.tld"
-    When "bob@domain.tld" ask for mailboxes
+    When "bob@domain.tld" lists mailboxes
     Then the mailbox "shared" has 1 message
     And the mailbox "shared" has 1 unseen message
 
   Scenario: Move message should update the total and the unread counts of origin mailbox when asked by sharee / sharee view
     Given "bob@domain.tld" has a message "m1" in "bobMailbox" mailbox
     And "bob@domain.tld" moves "m1" to mailbox "shared" of user "alice@domain.tld"
-    When "bob@domain.tld" ask for mailboxes
+    When "bob@domain.tld" lists mailboxes
     Then the mailbox "bobMailbox" has 0 messages
     And the mailbox "bobMailbox" has 0 unseen messages
 
@@ -136,7 +136,7 @@ Feature: GetMailboxes method
     And "alice@domain.tld" shares her mailbox "shared2" with "bob@domain.tld" with "lr" rights
     And "bob@domain.tld" has a message "m1" in "bobMailbox" mailbox
     And "bob@domain.tld" moves "m1" to mailbox "shared2" of user "alice@domain.tld"
-    When "alice@domain.tld" ask for mailboxes
+    When "alice@domain.tld" lists mailboxes
     Then the mailbox "shared" has 0 messages
     And the mailbox "shared" has 0 unseen messages
 
@@ -145,28 +145,28 @@ Feature: GetMailboxes method
     And "alice@domain.tld" shares her mailbox "shared2" with "bob@domain.tld" with "lr" rights
     And "bob@domain.tld" has a message "m1" in "bobMailbox" mailbox
     And "bob@domain.tld" moves "m1" to mailbox "shared2" of user "alice@domain.tld"
-    When "bob@domain.tld" ask for mailboxes
+    When "bob@domain.tld" lists mailboxes
     Then the mailbox "shared" has 0 messages
     And the mailbox "shared" has 0 unseen messages
 
   Scenario: Move message should update the total and the unread counts when asked by sharee and seen message
     Given "bob@domain.tld" has a message "m1" in the "bobMailbox" mailbox with flags "$Seen"
     And "bob@domain.tld" moves "m1" to mailbox "shared" of user "alice@domain.tld"
-    When "alice@domain.tld" ask for mailboxes
+    When "alice@domain.tld" lists mailboxes
     Then the mailbox "shared" has 1 message
     And the mailbox "shared" has 0 unseen message
 
   Scenario: Move message should update the total and the unread counts when asked by sharee / sharee view and seen message
     Given "bob@domain.tld" has a message "m1" in the "bobMailbox" mailbox with flags "$Seen"
     And "bob@domain.tld" moves "m1" to mailbox "shared" of user "alice@domain.tld"
-    When "bob@domain.tld" ask for mailboxes
+    When "bob@domain.tld" lists mailboxes
     Then the mailbox "shared" has 1 message
     And the mailbox "shared" has 0 unseen message
 
   Scenario: Move message should update the total and the unread counts of origin mailbox when asked by sharer and seen message
     Given "alice@domain.tld" has a message "m1" in the "INBOX" mailbox with flags "$Seen"
     And "alice@domain.tld" moves "m1" to mailbox "shared" of user "alice@domain.tld"
-    When "alice@domain.tld" ask for mailboxes
+    When "alice@domain.tld" lists mailboxes
     Then the mailbox "INBOX" has 0 messages
     And the mailbox "INBOX" has 0 unseen messages
 
@@ -175,7 +175,7 @@ Feature: GetMailboxes method
     And "alice@domain.tld" shares her mailbox "shared2" with "bob@domain.tld" with "lri" rights
     And "bob@domain.tld" has a message "m1" in the "bobMailbox" mailbox with flags "$Seen"
     And "bob@domain.tld" moves "m1" to mailbox "shared2" of user "alice@domain.tld"
-    When "alice@domain.tld" ask for mailboxes
+    When "alice@domain.tld" lists mailboxes
     Then the mailbox "shared" has 0 messages
     And the mailbox "shared" has 0 unseen messages
 
@@ -184,35 +184,35 @@ Feature: GetMailboxes method
     And "alice@domain.tld" shares her mailbox "shared2" with "bob@domain.tld" with "lri" rights
     And "bob@domain.tld" has a message "m1" in the "bobMailbox" mailbox with flags "$Seen"
     And "bob@domain.tld" moves "m1" to mailbox "shared2" of user "alice@domain.tld"
-    When "bob@domain.tld" ask for mailboxes
+    When "bob@domain.tld" lists mailboxes
     Then the mailbox "shared" has 0 messages
     And the mailbox "shared" has 0 unseen messages
 
   Scenario: Set flags by sharer should update unseen count when read by sharer
     Given "alice@domain.tld" has a message "m1" in "shared" mailbox
     When "alice@domain.tld" sets flags "$Seen" on message "m1"
-    When "alice@domain.tld" ask for mailboxes
+    When "alice@domain.tld" lists mailboxes
     Then the mailbox "shared" has 1 message
     And the mailbox "shared" has 0 unseen messages
 
   Scenario: Set flags by sharer should update unseen count when read by sharee
     Given "alice@domain.tld" has a message "m1" in "shared" mailbox
     When "alice@domain.tld" sets flags "$Seen" on message "m1"
-    When "bob@domain.tld" ask for mailboxes
+    When "bob@domain.tld" lists mailboxes
     Then the mailbox "shared" has 1 message
     And the mailbox "shared" has 0 unseen messages
 
   Scenario: Set flags by sharee should update unseen count when read by sharer
     Given "alice@domain.tld" has a message "m1" in "shared" mailbox
     When "bob@domain.tld" sets flags "$Seen" on message "m1"
-    When "alice@domain.tld" ask for mailboxes
+    When "alice@domain.tld" lists mailboxes
     Then the mailbox "shared" has 1 message
     And the mailbox "shared" has 0 unseen messages
 
   Scenario: Set flags by sharee should update unseen count when read by sharee
     Given "alice@domain.tld" has a message "m1" in "shared" mailbox
     When "bob@domain.tld" sets flags "$Seen" on message "m1"
-    When "bob@domain.tld" ask for mailboxes
+    When "bob@domain.tld" lists mailboxes
     Then the mailbox "shared" has 1 message
     And the mailbox "shared" has 0 unseen messages
 
@@ -221,7 +221,7 @@ Feature: GetMailboxes method
     And "alice@domain.tld" shares her mailbox "shared2" with "bob@domain.tld" with "lri" rights
     And "alice@domain.tld" has a message "m1" in "shared2" mailbox
     When "bob@domain.tld" sets flags "$Seen" on message "m1"
-    When "alice@domain.tld" ask for mailboxes
+    When "alice@domain.tld" lists mailboxes
     Then the mailbox "shared2" has 1 message
     And the mailbox "shared2" has 1 unseen message
 
@@ -230,7 +230,7 @@ Feature: GetMailboxes method
     And "alice@domain.tld" shares her mailbox "shared2" with "bob@domain.tld" with "lri" rights
     And "alice@domain.tld" has a message "m1" in "shared2" mailbox
     When "bob@domain.tld" sets flags "$Seen" on message "m1"
-    When "bob@domain.tld" ask for mailboxes
+    When "bob@domain.tld" lists mailboxes
     Then the mailbox "shared2" has 1 message
     And the mailbox "shared2" has 1 unseen message
 
@@ -238,7 +238,7 @@ Feature: GetMailboxes method
     Given "alice@domain.tld" has a mailbox "shared2"
     And "alice@domain.tld" shares her mailbox "shared2" with "bob@domain.tld" with "l" rights
     And "alice@domain.tld" has a message "m1" in "shared2" mailbox
-    When "bob@domain.tld" ask for mailboxes
+    When "bob@domain.tld" lists mailboxes
     Then the mailbox "shared2" has 0 messages
     And the mailbox "shared2" has 0 unseen messages
 
@@ -246,7 +246,7 @@ Feature: GetMailboxes method
     Given "alice@domain.tld" has a mailbox "mailbox1"
     And "alice@domain.tld" has a mailbox "mailbox1.shared"
     And "alice@domain.tld" shares her mailbox "mailbox1.shared" with "bob@domain.tld" with "aeirwt" rights
-    When "bob@domain.tld" ask for mailboxes
+    When "bob@domain.tld" lists mailboxes
     Then the mailboxes should contain "shared" in "Delegated" namespace
     And the mailboxes should not contain "mailbox1"
 
@@ -254,6 +254,26 @@ Feature: GetMailboxes method
     Given "alice@domain.tld" has a mailbox "mailbox1"
     And "alice@domain.tld" has a mailbox "mailbox1.shared"
     And "alice@domain.tld" shares her mailbox "mailbox1.shared" with "bob@domain.tld" with "l" rights
-    When "bob@domain.tld" ask for mailboxes
+    When "bob@domain.tld" lists mailboxes
     Then the mailboxes should contain "shared" in "Delegated" namespace
-    And the mailboxes should contain "mailbox1" in "Delegated" namespace
\ No newline at end of file
+    And the mailboxes should contain "mailbox1" in "Delegated" namespace
+
+  Scenario: A sharee should be able to access a shared mailbox after it has been renamed by the owner
+    Given "alice@domain.tld" renames her mailbox "shared" to "mySharedMailbox"
+    When "bob@domain.tld" lists mailboxes
+    Then the mailboxes should contain "mySharedMailbox" in "Delegated" namespace
+
+  Scenario: A sharee should not be able to rename a shared mailbox
+    Given "bob@domain.tld" renames the mailbox, owned by "alice@domain.tld", "shared" to "mySharedMailbox"
+    When "alice@domain.tld" lists mailboxes
+    Then the mailboxes should contain "shared" in "Personal" namespace
+
+  Scenario: A user should not be able to rename an other user mailbox
+    Given "alice@domain.tld" has a mailbox "mySecrets"
+    And "bob@domain.tld" renames the mailbox, owned by "alice@domain.tld", "mySecrets" to "revealMySecrets"
+    When "alice@domain.tld" lists mailboxes
+    Then the mailboxes should contain "mySecrets" in "Personal" namespace
+
+  Scenario: A sharee should receive a not updated response when trying to rename a shared mailbox
+    Given "bob@domain.tld" renames the mailbox, owned by "alice@domain.tld", "shared" to "mySharedMailbox"
+    Then mailbox "shared" owned by "alice@domain.tld" is not updated


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org