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 ma...@apache.org on 2016/05/03 10:16:00 UTC

james-project git commit: JAMES-1726 Update can introduce duplicate

Repository: james-project
Updated Branches:
  refs/heads/master 0395ee41b -> 16689d35e


JAMES-1726 Update can introduce duplicate


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

Branch: refs/heads/master
Commit: 16689d35e10349fc48f01861261be3a363b605bf
Parents: 0395ee4
Author: Laura Royet <lr...@linagora.com>
Authored: Tue Apr 26 15:59:33 2016 +0200
Committer: Matthieu Baechler <ma...@linagora.com>
Committed: Tue May 3 10:13:57 2016 +0200

----------------------------------------------------------------------
 .../integration/SetMailboxesMethodTest.java     | 43 ++++++++++++++++++++
 1 file changed, 43 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/16689d35/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMailboxesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMailboxesMethodTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMailboxesMethodTest.java
index ede31d0..2ef33ca 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMailboxesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMailboxesMethodTest.java
@@ -1512,4 +1512,47 @@ public abstract class SetMailboxesMethodTest {
                     hasEntry(equalTo("type"), equalTo("invalidArguments")),
                     hasEntry(equalTo("description"), equalTo("The mailbox 'outbox' is a system mailbox.")))));
     }
+
+    @Test
+    public void setMailboxesShouldReturnNotUpdatedErrorWhenMovingMailboxTriggersNameConflict() {
+
+        jmapServer.serverProbe().createMailbox("#private", username, "A");
+        Mailbox<?> mailboxRootA = jmapServer.serverProbe().getMailbox("#private", username, "A");
+        String mailboxRootAId = mailboxRootA.getMailboxId().serialize();
+
+        jmapServer.serverProbe().createMailbox("#private", username, "A.B");
+        jmapServer.serverProbe().createMailbox("#private", username, "A.C");
+
+        jmapServer.serverProbe().createMailbox("#private", username, "A.B.C");
+        Mailbox<?> mailboxChildToMoveC = jmapServer.serverProbe().getMailbox("#private", username, "A.B.C");
+        String mailboxChildToMoveCId = mailboxChildToMoveC.getMailboxId().serialize();
+
+        String requestBody =
+              "[" +
+                  "  [ \"setMailboxes\"," +
+                  "    {" +
+                  "      \"update\": {" +
+                  "        \"" + mailboxChildToMoveCId + "\" : {" +
+                  "          \"parentId\" : \"" + mailboxRootAId + "\"" +
+                  "        }" +
+                  "      }" +
+                  "    }," +
+                  "    \"#0\"" +
+                  "  ]" +
+                  "]";
+
+      given()
+          .accept(ContentType.JSON)
+          .contentType(ContentType.JSON)
+          .header("Authorization", this.accessToken.serialize())
+          .body(requestBody)
+      .when()
+          .post("/jmap")
+      .then()
+          .statusCode(200)
+          .body(NAME, equalTo("mailboxesSet"))
+          .body(ARGUMENTS + ".notUpdated", hasEntry(equalTo(mailboxChildToMoveCId), Matchers.allOf(
+                  hasEntry(equalTo("type"), equalTo("invalidArguments")),
+                  hasEntry(equalTo("description"), equalTo("Cannot rename a mailbox to an already existing mailbox.")))));
+    }
 }


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