james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [4/6] james-project git commit: JAMES-2195 JMAP integration tests for messages updates
Date Thu, 26 Oct 2017 22:59:11 GMT
JAMES-2195 JMAP integration tests for messages updates


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

Branch: refs/heads/master
Commit: 6b49e6c065c001473cc05d84658c154a074b5d8f
Parents: e39e1f7
Author: benwa <btellier@linagora.com>
Authored: Thu Oct 19 16:09:39 2017 +0700
Committer: Antoine Duprat <aduprat@linagora.com>
Committed: Fri Oct 27 00:53:49 2017 +0200

----------------------------------------------------------------------
 .../CassandraSetMessagesMethodCucumberTest.java |  45 ++++++++
 .../cucumber/GetMessagesMethodStepdefs.java     |  32 ++++--
 .../cucumber/SetMessagesMethodStepdefs.java     |  97 +++++++++++++++--
 .../integration/cucumber/UserStepdefs.java      |   6 +-
 .../test/resources/cucumber/DownloadGet.feature |   1 -
 .../test/resources/cucumber/GetMessages.feature |   1 -
 .../cucumber/ImapKeywordsConsistency.feature    |  27 +++--
 ...essagesMailboxesUpdatesCompatibility.feature |  10 +-
 ...ywordsConsistencyOnDelegationMailbox.feature |  18 ++--
 .../test/resources/cucumber/SetMessages.feature | 104 +++++++++++++++++++
 .../MemorySetMessagesMethodCucumberTest.java    |  33 ++++++
 11 files changed, 325 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/6b49e6c0/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraSetMessagesMethodCucumberTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraSetMessagesMethodCucumberTest.java
b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraSetMessagesMethodCucumberTest.java
new file mode 100644
index 0000000..eb81d00
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraSetMessagesMethodCucumberTest.java
@@ -0,0 +1,45 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.jmap.cassandra.cucumber;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+
+import cucumber.api.CucumberOptions;
+import cucumber.api.junit.Cucumber;
+
+@RunWith(Cucumber.class)
+@CucumberOptions(features="classpath:cucumber/SetMessages.feature",
+                glue={"org.apache.james.jmap.methods.integration", "org.apache.james.jmap.cassandra.cucumber"},
+                strict = true,
+                tags = {"~@Ignore"})
+public class CassandraSetMessagesMethodCucumberTest {
+
+    @BeforeClass
+    public static void init() {
+        CucumberCassandraSingleton.cassandraServer.start();
+    }
+
+    @AfterClass
+    public static void after() {
+        CucumberCassandraSingleton.cassandraServer.stop();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6b49e6c0/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
index 524b46c..8b62b85 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
@@ -53,7 +53,6 @@ import com.github.fge.lambdas.Throwing;
 import com.github.steveash.guavate.Guavate;
 import com.google.common.base.Charsets;
 import com.google.common.base.Joiner;
-import com.google.common.base.Preconditions;
 import com.google.common.base.Splitter;
 import com.google.common.collect.ImmutableList;
 
@@ -561,15 +560,14 @@ public class GetMessagesMethodStepdefs {
             .containsOnlyElementsOf(values);
     }
 
-    @Then("^the message is in \"([^\"]*)\" user mailboxes")
-    public void assertMailboxNamesOfTheFirstMessageWithUser(String mailboxIds) throws Exception
{
-        List<String> values = Splitter.on(",")
-            .splitToList(mailboxIds).stream()
-            .map(name -> Splitter.on(':').omitEmptyStrings().splitToList(name))
-            .peek(nameParts -> Preconditions.checkArgument(nameParts.size() == 2))
-            .map(Throwing.function(nameParts -> mainStepdefs.jmapServer
+    @Then("^\"([^\"]*)\" should see message \"([^\"]*)\" in mailboxes:$")
+    public void assertMailboxesOfMessage(String user, String messageId, DataTable userMailboxes)
throws Exception {
+        userStepdefs.execWithUser(user, () -> postWithAListOfIds(ImmutableList.of(messageId)));
+
+        List<String> values = userMailboxes.asMap(String.class, String.class).entrySet().stream()
+            .map(Throwing.function(userMailbox -> mainStepdefs.jmapServer
                 .getProbe(MailboxProbeImpl.class)
-                .getMailbox(MailboxConstants.USER_NAMESPACE, nameParts.get(0), nameParts.get(1))
+                .getMailbox(MailboxConstants.USER_NAMESPACE, userMailbox.getKey(), userMailbox.getValue())
                 .getMailboxId()
                 .serialize()))
             .distinct()
@@ -689,6 +687,22 @@ public class GetMessagesMethodStepdefs {
             .isNullOrEmpty();
     }
 
+    @Then("^\"([^\"]*)\" should see message \"([^\"]*)\" with keywords (.*)$")
+    public void assertKeywordsOfMessage(String user, String messageId, List<String>
keywords) throws Exception {
+        userStepdefs.execWithUser(user, () -> postWithAListOfIds(ImmutableList.of(messageId)));
+
+        assertThat(httpStepDefs.jsonPath.<Map<String, Boolean>>read(FIRST_MESSAGE
+ ".keywords").keySet())
+            .containsOnlyElementsOf(keywords);
+    }
+
+    @Then("^\"([^\"]*)\" should see message \"([^\"]*)\" without keywords$")
+    public void assertKeywordsEmpty(String user, String messageId) throws Exception {
+        userStepdefs.execWithUser(user, () -> postWithAListOfIds(ImmutableList.of(messageId)));
+
+        assertThat(httpStepDefs.jsonPath.<Map<String, Boolean>>read(FIRST_MESSAGE
+ ".keywords").keySet())
+            .isEmpty();
+    }
+
     private void assertAttachment(String attachment, DataTable attachmentProperties) {
         attachmentProperties.asList(TableRow.class)
             .forEach(entry -> assertThat(httpStepDefs.jsonPath.<Object>read(attachment
+ "." + entry.getKey())).isEqualTo(entry.getValue()));

http://git-wip-us.apache.org/repos/asf/james-project/blob/6b49e6c0/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMessagesMethodStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMessagesMethodStepdefs.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMessagesMethodStepdefs.java
index 7676d9a..e3cc8bd 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMessagesMethodStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMessagesMethodStepdefs.java
@@ -19,7 +19,10 @@
 
 package org.apache.james.jmap.methods.integration.cucumber;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 import javax.inject.Inject;
@@ -33,6 +36,8 @@ import org.apache.james.modules.MailboxProbeImpl;
 
 import com.google.common.collect.ImmutableList;
 
+import cucumber.api.java.en.Given;
+import cucumber.api.java.en.Then;
 import cucumber.api.java.en.When;
 import cucumber.runtime.java.guice.ScenarioScoped;
 
@@ -52,7 +57,12 @@ public class SetMessagesMethodStepdefs {
         this.getMessagesMethodStepdefs = getMessagesMethodStepdefs;
     }
 
-    @When("^the user move \"([^\"]*)\" to mailbox \"([^\"]*)\"")
+    @When("^\"([^\"]*)\" moves \"([^\"]*)\" to user mailbox \"([^\"]*)\"")
+    public void moveMessageToMailboxWithUser(String username, String message, String mailbox)
throws Throwable {
+        userStepdefs.execWithUser(username, () -> moveMessageToMailbox(message, mailbox));
+    }
+
+    @When("^the user moves \"([^\"]*)\" to user mailbox \"([^\"]*)\"")
     public void moveMessageToMailbox(String message, String mailbox) throws Throwable {
         MessageId messageId = getMessagesMethodStepdefs.getMessageId(message);
         MailboxId mailboxId = mainStepdefs.jmapServer
@@ -74,18 +84,52 @@ public class SetMessagesMethodStepdefs {
         mainStepdefs.awaitMethod.run();
     }
 
-    @When("^\"([^\"]*)\" copy \"([^\"]*)\" from mailbox \"([^\"]*)\" to mailbox \"([^\"]*)\"")
-    public void copyMessageToMailbox(String userName, String message, String sourceMailbox,
String destinationMailbox) throws Throwable {
+    @When("^\"([^\"]*)\" copies \"([^\"]*)\" from mailbox \"([^\"]*)\" to mailbox \"([^\"]*)\"")
+    public void copyMessageToMailbox(String username, String message, String sourceMailbox,
String destinationMailbox) throws Throwable {
+        userStepdefs.execWithUser(username, () -> copyMessageToMailbox(message, sourceMailbox,
destinationMailbox));
+    }
+
+    @When("^the user copies \"([^\"]*)\" from mailbox \"([^\"]*)\" to mailbox \"([^\"]*)\"")
+    public void copyMessageToMailbox(String message, String sourceMailbox, String destinationMailbox)
throws Throwable {
         MessageId messageId = getMessagesMethodStepdefs.getMessageId(message);
         MailboxId sourceMailboxId = mainStepdefs.jmapServer
             .getProbe(MailboxProbeImpl.class)
-            .getMailbox(MailboxConstants.USER_NAMESPACE, userName, sourceMailbox)
+            .getMailbox(MailboxConstants.USER_NAMESPACE, userStepdefs.getConnectedUser(),
sourceMailbox)
             .getMailboxId();
         MailboxId destinationMailboxId = mainStepdefs.jmapServer
             .getProbe(MailboxProbeImpl.class)
-            .getMailbox(MailboxConstants.USER_NAMESPACE, userName, destinationMailbox)
+            .getMailbox(MailboxConstants.USER_NAMESPACE, userStepdefs.getConnectedUser(),
destinationMailbox)
             .getMailboxId();
 
+        httpStepDefs.post("[" +
+            "  [" +
+            "    \"setMessages\","+
+            "    {" +
+            "      \"update\": { \"" + messageId.serialize() + "\" : {" +
+            "        \"mailboxIds\": [\"" + destinationMailboxId.serialize() + "\",\"" +
sourceMailboxId.serialize() + "\"]" +
+            "      }}" +
+            "    }," +
+            "    \"#0\"" +
+            "  ]" +
+            "]");
+        mainStepdefs.awaitMethod.run();
+    }
+
+    @When("^\"([^\"]*)\" copies \"([^\"]*)\" from mailbox \"([^\"]*)\" of user \"([^\"]*)\"
to mailbox \"([^\"]*)\" of user \"([^\"]*)\"")
+    public void copyMessageToMailbox(String username, String message, String sourceMailbox,
String sourceUser, String destinationMailbox, String destinationUser) throws Throwable {
+        userStepdefs.execWithUser(username, () -> copyMessageToMailbox(message, sourceMailbox,
sourceUser, destinationMailbox, destinationUser));
+    }
+
+    private void copyMessageToMailbox(String message, String sourceMailbox, String sourceUser,
String destinationMailbox, String destinationUser) throws Throwable {
+        MessageId messageId = getMessagesMethodStepdefs.getMessageId(message);
+        MailboxId sourceMailboxId = mainStepdefs.jmapServer
+            .getProbe(MailboxProbeImpl.class)
+            .getMailbox(MailboxConstants.USER_NAMESPACE, sourceUser, sourceMailbox)
+            .getMailboxId();
+        MailboxId destinationMailboxId = mainStepdefs.jmapServer
+            .getProbe(MailboxProbeImpl.class)
+            .getMailbox(MailboxConstants.USER_NAMESPACE, destinationUser, destinationMailbox)
+            .getMailboxId();
 
         httpStepDefs.post("[" +
             "  [" +
@@ -101,8 +145,39 @@ public class SetMessagesMethodStepdefs {
         mainStepdefs.awaitMethod.run();
     }
 
-    @When("^the user set flags on \"([^\"]*)\" to \"([^\"]*)\"")
-    public void setFlags(String message, List<String> keywords) throws Throwable {
+    @Given("^\"([^\"]*)\" moves \"([^\"]*)\" to mailbox \"([^\"]*)\" of user \"([^\"]*)\"")
+    public void moveMessageToMailbox(String username, String message, String destinationMailbox,
String destinationUser) throws Throwable {
+        userStepdefs.execWithUser(username, () -> moveMessageToMailbox(message, destinationMailbox,
destinationUser));
+    }
+
+    private void moveMessageToMailbox(String message, String destinationMailbox, String destinationUser)
throws Throwable {
+        MessageId messageId = getMessagesMethodStepdefs.getMessageId(message);
+        MailboxId destinationMailboxId = mainStepdefs.jmapServer
+            .getProbe(MailboxProbeImpl.class)
+            .getMailbox(MailboxConstants.USER_NAMESPACE, destinationUser, destinationMailbox)
+            .getMailboxId();
+
+        httpStepDefs.post("[" +
+            "  [" +
+            "    \"setMessages\","+
+            "    {" +
+            "      \"update\": { \"" + messageId.serialize() + "\" : {" +
+            "        \"mailboxIds\": [\"" + destinationMailboxId.serialize() + "\"]" +
+            "      }}" +
+            "    }," +
+            "    \"#0\"" +
+            "  ]" +
+            "]");
+        mainStepdefs.awaitMethod.run();
+    }
+
+    @When("^\"([^\"]*)\" sets flags \"([^\"]*)\" on message \"([^\"]*)\"")
+    public void setFlags(String username, List<String> keywords, String message) throws
Throwable {
+        userStepdefs.execWithUser(username, () -> setFlags(keywords, message));
+    }
+
+    @When("^the user sets flags \"([^\"]*)\" on message \"([^\"]*)\"")
+    public void setFlags(List<String> keywords, String message) throws Throwable {
         MessageId messageId = getMessagesMethodStepdefs.getMessageId(message);
         String keywordString = keywords
             .stream()
@@ -136,4 +211,12 @@ public class SetMessagesMethodStepdefs {
         mainStepdefs.messageIdProbe.updateNewFlags(username, newFlags, messageId, ImmutableList.of(mailboxId));
         mainStepdefs.awaitMethod.run();
     }
+
+    @Then("^message \"([^\"]*)\" is not updated$")
+    public void assertIdOfTheFirstMessage(String messageName) throws Exception {
+        MessageId id = getMessagesMethodStepdefs.getMessageId(messageName);
+        assertThat(httpStepDefs.jsonPath.<Map<String, String>>read("[0][1].notUpdated"))
+            .containsOnlyKeys(id.serialize());
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/6b49e6c0/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/UserStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/UserStepdefs.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/UserStepdefs.java
index fa26e2f..1c23178 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/UserStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/UserStepdefs.java
@@ -59,7 +59,7 @@ public class UserStepdefs {
         this.lastConnectedUser = Optional.empty();
     }
 
-    public void execWithUser(String user, ThrowingRunnable sideEffect) throws Throwable {
+    public void execWithUser(String user, ThrowingRunnable sideEffect) throws Exception {
         Optional<String> previousConnectedUser = lastConnectedUser;
         connectUser(user);
         try {
@@ -106,13 +106,13 @@ public class UserStepdefs {
     }
 
     @Given("^a connected user \"([^\"]*)\"$")
-    public void createConnectedUser(String username) throws Throwable {
+    public void createConnectedUser(String username) throws Exception {
         createUser(username);
         connectUser(username);
     }
 
     @Given("^\"([^\"]*)\" is connected$")
-    public void connectUser(String username) throws Throwable {
+    public void connectUser(String username) throws Exception {
         AccessToken accessToken = authenticate(username);
         tokenByUser.put(username, accessToken);
         lastConnectedUser = Optional.of(username);

http://git-wip-us.apache.org/repos/asf/james-project/blob/6b49e6c0/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/DownloadGet.feature
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/DownloadGet.feature
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/DownloadGet.feature
index 9a69fa7..f739d65 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/DownloadGet.feature
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/DownloadGet.feature
@@ -16,7 +16,6 @@
 # specific language governing permissions and limitations      *
 # under the License.                                           *
 # **************************************************************/
-
 Feature: Download GET
   As a James user
   I want to retrieve my blobs (attachments and messages)

http://git-wip-us.apache.org/repos/asf/james-project/blob/6b49e6c0/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
index 82d6459..07bcf8a 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
@@ -16,7 +16,6 @@
 # specific language governing permissions and limitations      *
 # under the License.                                           *
 # **************************************************************/
-
 Feature: GetMessages method
   As a James user
   I want to be able to retrieve my messages

http://git-wip-us.apache.org/repos/asf/james-project/blob/6b49e6c0/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/ImapKeywordsConsistency.feature
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/ImapKeywordsConsistency.feature
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/ImapKeywordsConsistency.feature
index 188ec86..2cf97cb 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/ImapKeywordsConsistency.feature
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/ImapKeywordsConsistency.feature
@@ -16,7 +16,6 @@
 # specific language governing permissions and limitations      *
 # under the License.                                           *
 # **************************************************************/
-
 Feature: Impact of IMAP on JMAP keywords consistency
 
   Background:
@@ -28,7 +27,7 @@ Feature: Impact of IMAP on JMAP keywords consistency
 
   Scenario Outline: GetMessages should union keywords when an inconsistency was created via
IMAP
     Given the user has a message "m1" in "source" mailbox with subject "My awesome subject",
content "This is the content"
-    And "username@domain.tld" copy "m1" from mailbox "source" to mailbox "mailbox"
+    And "username@domain.tld" copies "m1" from mailbox "source" to mailbox "mailbox"
     And the user has an open IMAP connection with mailbox "<mailbox>" selected
     And the user set flags via IMAP to "(\Flagged)" for all messages in mailbox "<mailbox>"
     When the user ask for messages "m1"
@@ -44,7 +43,7 @@ Feature: Impact of IMAP on JMAP keywords consistency
 
   Scenario Outline: GetMessages should intersect Draft when an inconsistency was created
via IMAP
     Given the user has a message "m1" in "source" mailbox with subject "My awesome subject",
content "This is the content"
-    And "username@domain.tld" copy "m1" from mailbox "source" to mailbox "mailbox"
+    And "username@domain.tld" copies "m1" from mailbox "source" to mailbox "mailbox"
     And the user has an open IMAP connection with mailbox "<mailbox>" selected
     And the user set flags via IMAP to "(\Draft)" for all messages in mailbox "<mailbox>"
     When the user ask for messages "m1"
@@ -60,7 +59,7 @@ Feature: Impact of IMAP on JMAP keywords consistency
 
   Scenario: GetMessageList should return matching messageId when matching in at least 1 mailbox
     Given the user has a message "m1" in "source" mailbox with subject "My awesome subject",
content "This is the content"
-    And "username@domain.tld" copy "m1" from mailbox "source" to mailbox "mailbox"
+    And "username@domain.tld" copies "m1" from mailbox "source" to mailbox "mailbox"
     And the user has an open IMAP connection with mailbox "mailbox" selected
     And the user set flags via IMAP to "(\Flagged)" for all messages in mailbox "mailbox"
     When the user asks for message list with flag "$Flagged"
@@ -69,7 +68,7 @@ Feature: Impact of IMAP on JMAP keywords consistency
 
   Scenario: GetMessageList in specific mailbox should return messageId when matching
     Given the user has a message "m1" in "source" mailbox with subject "My awesome subject",
content "This is the content"
-    And "username@domain.tld" copy "m1" from mailbox "source" to mailbox "mailbox"
+    And "username@domain.tld" copies "m1" from mailbox "source" to mailbox "mailbox"
     And the user has an open IMAP connection with mailbox "mailbox" selected
     And the user set flags via IMAP to "(\Flagged)" for all messages in mailbox "mailbox"
     When "username@domain.tld" asks for message list in mailbox "mailbox" with flag "$Flagged"
@@ -78,7 +77,7 @@ Feature: Impact of IMAP on JMAP keywords consistency
 
   Scenario: GetMessageList in specific mailbox should skip messageId when not matching
     Given the user has a message "m1" in "source" mailbox with subject "My awesome subject",
content "This is the content"
-    And "username@domain.tld" copy "m1" from mailbox "source" to mailbox "mailbox"
+    And "username@domain.tld" copies "m1" from mailbox "source" to mailbox "mailbox"
     And the user has an open IMAP connection with mailbox "mailbox" selected
     And the user set flags via IMAP to "(\Flagged)" for all messages in mailbox "mailbox"
     When "username@domain.tld" asks for message list in mailbox "source" with flag "$Flagged"
@@ -86,10 +85,10 @@ Feature: Impact of IMAP on JMAP keywords consistency
 
   Scenario: SetMessages should succeed to solve Keywords conflict introduced via IMAP upon
flags addition (GetMessageList)
     Given the user has a message "m1" in "source" mailbox with subject "My awesome subject",
content "This is the content"
-    And "username@domain.tld" copy "m1" from mailbox "source" to mailbox "mailbox"
+    And "username@domain.tld" copies "m1" from mailbox "source" to mailbox "mailbox"
     And the user has an open IMAP connection with mailbox "mailbox" selected
     And the user set flags via IMAP to "(\Flagged)" for all messages in mailbox "mailbox"
-    When "username@domain.tld" set flags on "m1" to "$Flagged"
+    When "username@domain.tld" sets flags "$Flagged" on message "m1"
     Then "username@domain.tld" asks for message list in mailbox "mailbox" with flag "$Flagged"
     And the message list has size 1
     And the message list contains "m1"
@@ -99,10 +98,10 @@ Feature: Impact of IMAP on JMAP keywords consistency
 
   Scenario: SetMessages should succeed to solve Keywords conflict introduced via IMAP upon
flags addition with GetMessages
     Given the user has a message "m1" in "source" mailbox with subject "My awesome subject",
content "This is the content"
-    And "username@domain.tld" copy "m1" from mailbox "source" to mailbox "mailbox"
+    And "username@domain.tld" copies "m1" from mailbox "source" to mailbox "mailbox"
     And the user has an open IMAP connection with mailbox "mailbox" selected
     And the user set flags via IMAP to "(\Flagged)" for all messages in mailbox "mailbox"
-    When "username@domain.tld" set flags on "m1" to "$Flagged"
+    When "username@domain.tld" sets flags "$Flagged" on message "m1"
     Then the user ask for messages "m1"
     And no error is returned
     And the list should contain 1 message
@@ -111,10 +110,10 @@ Feature: Impact of IMAP on JMAP keywords consistency
 
   Scenario: SetMessages should ignore Keywords conflict introduced via IMAP upon flags deletion
with GetMessageList
     Given the user has a message "m1" in "source" mailbox with subject "My awesome subject",
content "This is the content"
-    And "username@domain.tld" copy "m1" from mailbox "source" to mailbox "mailbox"
+    And "username@domain.tld" copies "m1" from mailbox "source" to mailbox "mailbox"
     And the user has an open IMAP connection with mailbox "mailbox" selected
     And the user set flags via IMAP to "(\Flagged)" for all messages in mailbox "mailbox"
-    When "username@domain.tld" set flags on "m1" to "$Answered"
+    When "username@domain.tld" sets flags "$Answered" on message "m1"
     Then "username@domain.tld" asks for message list in mailbox "mailbox" with flag "$Flagged"
     And the message list is empty
     And "username@domain.tld" asks for message list in mailbox "source" with flag "$Flagged"
@@ -128,10 +127,10 @@ Feature: Impact of IMAP on JMAP keywords consistency
 
   Scenario: SetMessages should ignore Keywords conflict introduced via IMAP upon flags deletion
with GetMessages
     Given the user has a message "m1" in "source" mailbox with subject "My awesome subject",
content "This is the content"
-    And "username@domain.tld" copy "m1" from mailbox "source" to mailbox "mailbox"
+    And "username@domain.tld" copies "m1" from mailbox "source" to mailbox "mailbox"
     And the user has an open IMAP connection with mailbox "mailbox" selected
     And the user set flags via IMAP to "(\Flagged)" for all messages in mailbox "mailbox"
-    When "username@domain.tld" set flags on "m1" to "$Answered"
+    When "username@domain.tld" sets flags "$Answered" on message "m1"
     Then the user ask for messages "m1"
     And no error is returned
     And the list should contain 1 message

http://git-wip-us.apache.org/repos/asf/james-project/blob/6b49e6c0/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/ImapSetMessagesMailboxesUpdatesCompatibility.feature
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/ImapSetMessagesMailboxesUpdatesCompatibility.feature
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/ImapSetMessagesMailboxesUpdatesCompatibility.feature
index bc70272..b1baed8 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/ImapSetMessagesMailboxesUpdatesCompatibility.feature
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/ImapSetMessagesMailboxesUpdatesCompatibility.feature
@@ -30,25 +30,25 @@ Feature: IMAP compatibility of JMAP setMessages method used to update
mailboxes
 
   Scenario: A message moved by JMAP is seen as moved by IMAP
     Given the user has a message "m1" in "source" mailbox with subject "My awesome subject",
content "This is the content"
-    When the user move "m1" to mailbox "mailbox"
+    When the user moves "m1" to user mailbox "mailbox"
     Then the user has a IMAP message in mailbox "mailbox"
     And the user does not have a IMAP message in mailbox "source"
 
   Scenario: A message copied by JMAP is seen as copied by IMAP
     Given the user has a message "m1" in "source" mailbox with subject "My awesome subject",
content "This is the content"
-    When "username@domain.tld" copy "m1" from mailbox "source" to mailbox "mailbox"
+    When "username@domain.tld" copies "m1" from mailbox "source" to mailbox "mailbox"
     Then the user has a IMAP message in mailbox "mailbox"
     And the user has a IMAP message in mailbox "source"
 
   Scenario: If a message is moved by JMAP, IMAP client will be notified when selecting mailbox
     Given the user has a message "m1" in "source" mailbox with subject "My awesome subject",
content "This is the content"
-    When the user move "m1" to mailbox "mailbox"
+    When the user moves "m1" to user mailbox "mailbox"
     Then the user has a IMAP notification about 1 new message when selecting mailbox "mailbox"
 
   Scenario: If a message is moved by JMAP, IMAP client that have selected the destination
mailbox will be notified
     Given the user has a message "m1" in "source" mailbox with subject "My awesome subject",
content "This is the content"
     Given the user has an open IMAP connection with mailbox "mailbox" selected
-    When the user move "m1" to mailbox "mailbox"
+    When the user moves "m1" to user mailbox "mailbox"
     Then mailbox "mailbox" contains 1 messages
     Then the user has a IMAP RECENT and a notification about 1 new messages on connection
for mailbox "mailbox"
 
@@ -63,5 +63,5 @@ Feature: IMAP compatibility of JMAP setMessages method used to update mailboxes
   Scenario: If a message is moved by JMAP, IMAP client that have selected the source mailbox
will not be notified
     Given the user has a message "m1" in "source" mailbox with subject "My awesome subject",
content "This is the content"
     Given the user has an open IMAP connection with mailbox "source" selected
-    When the user move "m1" to mailbox "mailbox"
+    When the user moves "m1" to user mailbox "mailbox"
     Then the user has IMAP EXPUNGE and a notification for 1 message sequence number on connection
for mailbox "source"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/6b49e6c0/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/KeywordsConsistencyOnDelegationMailbox.feature
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/KeywordsConsistencyOnDelegationMailbox.feature
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/KeywordsConsistencyOnDelegationMailbox.feature
index 44f34d6..de01c1c 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/KeywordsConsistencyOnDelegationMailbox.feature
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/KeywordsConsistencyOnDelegationMailbox.feature
@@ -26,20 +26,20 @@ Feature: Keywords consistency on delegation mailbox
     And "alice@domain.tld" has a mailbox "shared"
     And "alice@domain.tld" shares its mailbox "shared" with rights "lrw" with "bob@domain.tld"
     And "alice@domain.tld" has a message "m1" in "notShared" mailbox with subject "My awesome
subject", content "This is the content"
-    And "alice@domain.tld" copy "m1" from mailbox "notShared" to mailbox "shared"
+    And "alice@domain.tld" copies "m1" from mailbox "notShared" to mailbox "shared"
 
   Scenario: getMessageList filtered by flag should combine flag when delegation mailbox
-    Given "bob@domain.tld" set flags on "m1" to "$Flagged"
+    Given "bob@domain.tld" sets flags "$Flagged" on message "m1"
     When "alice@domain.tld" asks for message list in mailboxes "shared,notShared" with flag
"$Flagged"
     Then the message list contains "m1"
 
   Scenario: getMessageList filtered by flag should keep flag on non-shared mailbox
-    Given "bob@domain.tld" set flags on "m1" to "$Flagged"
+    Given "bob@domain.tld" sets flags "$Flagged" on message "m1"
     When "alice@domain.tld" asks for message list in mailboxes "notShared" with flag "$Flagged"
     Then the message list is empty
 
   Scenario: getMessageList filtered by flag should keep flag on delegation mailbox
-    Given "bob@domain.tld" set flags on "m1" to "$Flagged"
+    Given "bob@domain.tld" sets flags "$Flagged" on message "m1"
     When "alice@domain.tld" asks for message list in mailboxes "shared" with flag "$Flagged"
     Then the message list contains "m1"
 
@@ -71,15 +71,15 @@ Feature: Keywords consistency on delegation mailbox
     And the keywords of the message is $Flagged
 
   Scenario: message should update message status based on delegation mailbox
-    Given "alice@domain.tld" set flags on "m1" to "$Flagged,$Seen"
-    And "bob@domain.tld" set flags on "m1" to "$Seen"
+    Given "alice@domain.tld" sets flags "$Flagged,$Seen" on message "m1"
+    And "bob@domain.tld" sets flags "$Seen" on message "m1"
     When "alice@domain.tld" ask for messages "m1"
     Then no error is returned
     And the message has IMAP flag "\Flagged \Seen" in mailbox "notShared" for "alice@domain.tld"
     And the message has IMAP flag "\Seen" in mailbox "shared" for "alice@domain.tld"
 
   Scenario: message should keep origin message status when cut the sharing
-    Given "bob@domain.tld" set flags on "m1" to "$Flagged"
+    Given "bob@domain.tld" sets flags "$Flagged" on message "m1"
     And "alice@domain.tld" shares its mailbox "shared" with rights "" with "bob@domain.tld"
     When "alice@domain.tld" ask for messages "m1"
     Then no error is returned
@@ -95,7 +95,7 @@ Feature: Keywords consistency on delegation mailbox
     And the keywords of the message is $Flagged,$Seen
 
   Scenario: getMessage on mailbox should keep its flag as it is when owner
-    Given "alice@domain.tld" set flags on "m1" to "$Flagged"
+    Given "alice@domain.tld" sets flags "$Flagged" on message "m1"
     When "alice@domain.tld" ask for messages "m1"
     Then no error is returned
     And the message has IMAP flag "\Flagged" in mailbox "shared" for "alice@domain.tld"
@@ -128,7 +128,7 @@ Feature: Keywords consistency on delegation mailbox
     And the keywords of the message is $Flagged
 
   Scenario: message should combine flag if not Draft on all mailboxes
-    Given "alice@domain.tld" set flags on "m1" to "$Flagged"
+    Given "alice@domain.tld" sets flags "$Flagged" on message "m1"
     When "alice@domain.tld" ask for messages "m1"
     Then no error is returned
     And the keywords of the message is $Flagged

http://git-wip-us.apache.org/repos/asf/james-project/blob/6b49e6c0/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/SetMessages.feature
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/SetMessages.feature
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/SetMessages.feature
new file mode 100644
index 0000000..12c4ac4
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/SetMessages.feature
@@ -0,0 +1,104 @@
+#***************************************************************
+# Licensed to the Apache Software Foundation (ASF) under one   *
+# or more contributor license agreements.  See the NOTICE file *
+# distributed with this work for additional information        *
+# regarding copyright ownership.  The ASF licenses this file   *
+# to you under the Apache License, Version 2.0 (the            *
+# "License"); you may not use this file except in compliance   *
+# with the License.  You may obtain a copy of the License at   *
+#                                                              *
+#   http://www.apache.org/licenses/LICENSE-2.0                 *
+#                                                              *
+# Unless required by applicable law or agreed to in writing,   *
+# software distributed under the License is distributed on an  *
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+# KIND, either express or implied.  See the License for the    *
+# specific language governing permissions and limitations      *
+# under the License.                                           *
+# **************************************************************/
+Feature: SetMessages method on shared folders
+  As a James user
+  I want to be able to modify properties of a shared mail
+
+  Background:
+    Given a domain named "domain.tld"
+    And a user "alice@domain.tld"
+    And a user "bob@domain.tld"
+    And "bob@domain.tld" has a mailbox "shared"
+    And "alice@domain.tld" has a mailbox "INBOX"
+    And "bob@domain.tld" has a message "mBob" in "shared" mailbox with two attachments in
text
+    And "alice@domain.tld" has a message "mAlice" in "INBOX" mailbox with two attachments
in text
+
+# Set in mailboxes
+
+  Scenario: A delegated user can copy messages from shared mailbox when having "read" right
+    Given "bob@domain.tld" shares his mailbox "shared" with "alice@domain.tld" with "lr"
rights
+    And "alice@domain.tld" copies "mBob" from mailbox "shared" of user "bob@domain.tld" to
mailbox "INBOX" of user "alice@domain.tld"
+    Then "alice@domain.tld" should see message "mBob" in mailboxes:
+        |alice@domain.tld |INBOX  |
+        |bob@domain.tld   |shared |
+
+  Scenario: A delegated user can move messages out of shared mailbox when having "read" and
"delete" rights
+    Given "bob@domain.tld" shares his mailbox "shared" with "alice@domain.tld" with "lrte"
rights
+    And "alice@domain.tld" moves "mBob" to mailbox "INBOX" of user "alice@domain.tld"
+    Then "alice@domain.tld" should see message "mBob" in mailboxes:
+        |alice@domain.tld |INBOX  |
+
+  Scenario: A delegated user can add messages to a shared mailbox when having "insert" rights
+    Given "bob@domain.tld" shares his mailbox "shared" with "alice@domain.tld" with "lri"
rights
+    And "alice@domain.tld" copies "mAlice" from mailbox "INBOX" of user "alice@domain.tld"
to mailbox "shared" of user "bob@domain.tld"
+    Then "alice@domain.tld" should see message "mAlice" in mailboxes:
+        |alice@domain.tld |INBOX  |
+        |bob@domain.tld   |shared |
+
+  Scenario: A delegated user can add messages with keywords to a shared mailbox when having
"write" right
+    Given "bob@domain.tld" shares his mailbox "shared" with "alice@domain.tld" with "lriws"
rights
+    And "alice@domain.tld" sets flags "$Flagged" on message "mAlice"
+    And "alice@domain.tld" moves "mAlice" to mailbox "shared" of user "bob@domain.tld"
+    Then "alice@domain.tld" should see message "mAlice" with keywords $Flagged
+
+  @Ignore
+  Scenario: A delegated user can add sanitized messages to a shared mailbox when missing
"write" right
+    Given "bob@domain.tld" shares his mailbox "shared" with "alice@domain.tld" with "lri"
rights
+    And "alice@domain.tld" sets flags "$Flagged" on message "mAlice"
+    And "alice@domain.tld" moves "mAlice" to mailbox "shared" of user "bob@domain.tld"
+    Then "alice@domain.tld" should see message "mAlice" without keywords
+
+  Scenario: A delegated user can not copy messages from shared mailbox when missing "read"
right
+    Given "bob@domain.tld" shares his mailbox "shared" with "alice@domain.tld" with "litewsa"
rights
+    When "alice@domain.tld" copies "mBob" from mailbox "shared" of user "bob@domain.tld"
to mailbox "INBOX" of user "alice@domain.tld"
+    Then message "mBob" is not updated
+
+  Scenario: A delegated user can not copy messages to shared mailbox when missing "insert"
right
+    Given "bob@domain.tld" shares his mailbox "shared" with "alice@domain.tld" with "lrtewsa"
rights
+    When "alice@domain.tld" copies "mAlice" from mailbox "INBOX" of user "alice@domain.tld"
to mailbox "shared" of user "bob@domain.tld"
+    Then message "mAlice" is not updated
+
+  Scenario: A delegated user can not move messages out of shared mailbox when missing "delete"
right
+    Given "bob@domain.tld" shares his mailbox "shared" with "alice@domain.tld" with "lriwsa"
rights
+    When "alice@domain.tld" moves "mBob" to mailbox "INBOX" of user "alice@domain.tld"
+    Then message "mBob" is not updated
+
+# Flags update
+
+  Scenario: A delegated user add keywords on a delegated message when having "write" right
+    Given "bob@domain.tld" shares his mailbox "shared" with "alice@domain.tld" with "lrw"
rights
+    When "alice@domain.tld" sets flags "$Flagged" on message "mBob"
+    Then "alice@domain.tld" should see message "mBob" with keywords $Flagged
+
+  Scenario: A delegated user can not add keywords on a delegated message when missing "write"
right
+    Given "bob@domain.tld" shares his mailbox "shared" with "alice@domain.tld" with "latires"
rights
+    When "alice@domain.tld" sets flags "$Flagged" on message "mBob"
+    Then message "mBob" is not updated
+
+  Scenario: A delegated user remove keywords on a delegated message when having "write" right
+    Given "bob@domain.tld" shares his mailbox "shared" with "alice@domain.tld" with "lrw"
rights
+    And "bob@domain.tld" sets flags "$Flagged" on message "mBob"
+    When "alice@domain.tld" sets flags "" on message "mBob"
+    Then "alice@domain.tld" should see message "mBob" without keywords
+
+  Scenario: A delegated user can not remove keywords on a delegated message when missing
"write" right
+    Given "bob@domain.tld" shares his mailbox "shared" with "alice@domain.tld" with "latires"
rights
+    And "bob@domain.tld" sets flags "$Flagged" on message "mBob"
+    When "alice@domain.tld" sets flags "" on message "mBob"
+    Then message "mBob" is not updated
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/6b49e6c0/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemorySetMessagesMethodCucumberTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemorySetMessagesMethodCucumberTest.java
b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemorySetMessagesMethodCucumberTest.java
new file mode 100644
index 0000000..197c1d7
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemorySetMessagesMethodCucumberTest.java
@@ -0,0 +1,33 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.jmap.memory.cucumber;
+
+import org.junit.runner.RunWith;
+
+import cucumber.api.CucumberOptions;
+import cucumber.api.junit.Cucumber;
+
+@RunWith(Cucumber.class)
+@CucumberOptions(features="classpath:cucumber/SetMessages.feature",
+                glue={"org.apache.james.jmap.methods.integration", "org.apache.james.jmap.memory.cucumber"},
+                strict = true,
+                tags = {"~@Ignore"})
+public class MemorySetMessagesMethodCucumberTest {
+}


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


Mime
View raw message