JAMES-2183 IMAP Keywords consistency integration test

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

Branch: refs/heads/master
Commit: 6ff67ca3a579a27092dce8f6f93a8ff7b8db2d6b
Parents: c93ffe6
Author: benwa <btell...@linagora.com>
Authored: Fri Oct 13 09:56:07 2017 +0700
Committer: benwa <btell...@linagora.com>
Committed: Wed Oct 18 09:01:10 2017 +0700

----------------------------------------------------------------------
 ...assandraIMAPKeywordsInconsistenciesTest.java |  44 +++++++
 .../cucumber/GetMessageListMethodStepdefs.java  | 117 +++++++++++++++++++
 .../cucumber/GetMessagesMethodStepdefs.java     |   8 +-
 .../integration/cucumber/ImapStepdefs.java      |  12 +-
 .../cucumber/SetMessagesMethodStepdefs.java     |  38 +++++-
 .../cucumber/ImapKeywordsConsistency.feature    |  36 +++++-
 .../MemoryIMAPKeywordsInconsistenciesTest.java  |  32 +++++
 .../apache/james/utils/IMAPMessageReader.java   |   5 +
 8 files changed, 285 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/6ff67ca3/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraIMAPKeywordsInconsistenciesTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraIMAPKeywordsInconsistenciesTest.java
 
b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraIMAPKeywordsInconsistenciesTest.java
new file mode 100644
index 0000000..c5dde12
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraIMAPKeywordsInconsistenciesTest.java
@@ -0,0 +1,44 @@
+/****************************************************************
+ * 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/ImapKeywordsConsistency.feature",
+    glue={"org.apache.james.jmap.methods.integration", 
"org.apache.james.jmap.cassandra.cucumber"},
+    strict = true)
+public class CassandraIMAPKeywordsInconsistenciesTest {
+
+    @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/6ff67ca3/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessageListMethodStepdefs.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessageListMethodStepdefs.java
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessageListMethodStepdefs.java
new file mode 100644
index 0000000..c718803
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessageListMethodStepdefs.java
@@ -0,0 +1,117 @@
+/****************************************************************
+ * 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.methods.integration.cucumber;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.client.fluent.Request;
+import org.apache.james.mailbox.model.MailboxConstants;
+import org.apache.james.mailbox.model.MailboxId;
+import org.apache.james.mailbox.model.MessageId;
+import org.apache.james.modules.MailboxProbeImpl;
+
+import com.jayway.jsonpath.Configuration;
+import com.jayway.jsonpath.DocumentContext;
+import com.jayway.jsonpath.JsonPath;
+import com.jayway.jsonpath.Option;
+
+import cucumber.api.java.en.Then;
+import cucumber.api.java.en.When;
+import cucumber.runtime.java.guice.ScenarioScoped;
+
+@ScenarioScoped
+public class GetMessageListMethodStepdefs {
+
+    private static final String ARGUMENTS = "[0][1]";
+    private final MainStepdefs mainStepdefs;
+    private final UserStepdefs userStepdefs;
+    private final GetMessagesMethodStepdefs messagesMethodStepdefs;
+
+    private HttpResponse response;
+    private DocumentContext jsonPath;
+
+    @Inject
+    private GetMessageListMethodStepdefs(MainStepdefs mainStepdefs, 
UserStepdefs userStepdefs, GetMessagesMethodStepdefs messagesMethodStepdefs) {
+        this.mainStepdefs = mainStepdefs;
+        this.userStepdefs = userStepdefs;
+        this.messagesMethodStepdefs = messagesMethodStepdefs;
+    }
+
+    @When("^the user asks for message list in mailbox \"([^\"]*)\" with flag 
\"([^\"]*)\"$")
+    public void getMessageList(String mailbox, String flag) throws Exception {
+        MailboxId mailboxId = mainStepdefs.jmapServer
+            .getProbe(MailboxProbeImpl.class)
+            .getMailbox(MailboxConstants.USER_NAMESPACE, 
userStepdefs.lastConnectedUser, mailbox)
+            .getMailboxId();
+
+        post(String.format(
+                "[[\"getMessageList\", {\"filter\":{" +
+                "    \"inMailboxes\":[\"%s\"]," +
+                "    \"hasKeyword\":\"%s\"" +
+                "}}, \"#0\"]]",
+            mailboxId.serialize(),
+            flag));
+    }
+
+    @When("^the user asks for message list with flag \"([^\"]*)\"$")
+    public void getMessageList(String flag) throws Exception {
+        post(String.format(
+            "[[\"getMessageList\", {\"filter\":{" +
+                "    \"hasKeyword\":\"%s\"" +
+                "}}, \"#0\"]]",
+            flag));
+    }
+
+    @Then("^the message list is empty$")
+    public void assertEmpty() throws Exception {
+        assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200);
+        assertThat(jsonPath.<List<String>>read(ARGUMENTS + 
".messageIds")).isEmpty();
+    }
+
+    @Then("^the message list has size (\\d+)")
+    public void assertSize(int size) throws Exception {
+        assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200);
+        assertThat(jsonPath.<List<String>>read(ARGUMENTS + 
".messageIds")).hasSize(size);
+    }
+
+    @Then("^the message list contains \"([^\"]*)\"")
+    public void assertContains(String messsage) throws Exception {
+        MessageId messageId = messagesMethodStepdefs.getMessageId(messsage);
+        assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200);
+        assertThat(jsonPath.<List<String>>read(ARGUMENTS + 
".messageIds")).contains(messageId.serialize());
+    }
+
+    private void post(String requestBody) throws Exception {
+        response = 
Request.Post(mainStepdefs.baseUri().setPath("/jmap").build())
+            .addHeader("Authorization", 
userStepdefs.tokenByUser.get(userStepdefs.lastConnectedUser).serialize())
+            .addHeader("Accept", 
org.apache.http.entity.ContentType.APPLICATION_JSON.getMimeType())
+            .bodyString(requestBody, 
org.apache.http.entity.ContentType.APPLICATION_JSON)
+            .execute()
+            .returnResponse();
+        jsonPath = JsonPath.using(Configuration.defaultConfiguration()
+            .addOptions(Option.SUPPRESS_EXCEPTIONS))
+            .parse(response.getEntity().getContent());
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6ff67ca3/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 b477c2c..3c4d28f 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
@@ -108,6 +108,7 @@ public class GetMessagesMethodStepdefs {
 
         
mainStepdefs.jmapServer.getProbe(JmapGuiceProbe.class).setInMailboxes(id, 
userStepdefs.lastConnectedUser, mailboxId1, mailboxId2);
         messageIdsByName.put(messageName, id);
+        mainStepdefs.awaitMethod.run();
     }
 
     @Given("^the user has a message \"([^\"]*)\" in \"([^\"]*)\" mailbox with 
subject \"([^\"]*)\", content \"([^\"]*)\"$")
@@ -143,14 +144,19 @@ public class GetMessagesMethodStepdefs {
                     Date.from(dateTime.toInstant()), false, new Flags())
                 .getMessageId();
         messageIdsByName.put(messageName, id);
+        mainStepdefs.awaitMethod.run();
     }
 
     private MessageId appendMessage(String mailbox, ContentType contentType, 
String subject, String content, Optional<Map<String, String>> headers) throws 
Exception {
         ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
-        return 
mainStepdefs.mailboxProbe.appendMessage(userStepdefs.lastConnectedUser,
+        try {
+            return 
mainStepdefs.mailboxProbe.appendMessage(userStepdefs.lastConnectedUser,
                 MailboxPath.forUser(userStepdefs.lastConnectedUser, mailbox),
                 new ByteArrayInputStream(message(contentType, subject, 
content, headers).getBytes(Charsets.UTF_8)),
                 Date.from(dateTime.toInstant()), false, new 
Flags()).getMessageId();
+        } finally {
+            mainStepdefs.awaitMethod.run();
+        }
     }
 
     private String message(ContentType contentType, String subject, String 
content, Optional<Map<String,String>> headers) {

http://git-wip-us.apache.org/repos/asf/james-project/blob/6ff67ca3/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/ImapStepdefs.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/ImapStepdefs.java
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/ImapStepdefs.java
index 3eb3b0c..4f0f5f6 100644
--- 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/ImapStepdefs.java
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/ImapStepdefs.java
@@ -41,11 +41,13 @@ public class ImapStepdefs {
     private static final String LOCALHOST = "127.0.0.1";
 
     private final UserStepdefs userStepdefs;
+    private final MainStepdefs mainStepdefs;
     private final Map<String, IMAPMessageReader> imapConnections;
 
     @Inject
-    private ImapStepdefs(UserStepdefs userStepdefs) {
+    private ImapStepdefs(UserStepdefs userStepdefs, MainStepdefs mainStepdefs) 
{
         this.userStepdefs = userStepdefs;
+        this.mainStepdefs = mainStepdefs;
         this.imapConnections = Maps.newHashMap();
     }
 
@@ -93,6 +95,13 @@ public class ImapStepdefs {
         imapConnections.put(mailbox, imapMessageReader);
     }
 
+    @Then("^the user set flags via IMAP to \"([^\"]*)\" for all messages in 
mailbox \"([^\"]*)\"$")
+    public void setFlagsViaIMAPInMailbox(String flags, String mailbox) throws 
Throwable {
+        IMAPMessageReader imapMessageReader = imapConnections.get(mailbox);
+        imapMessageReader.setFlagsForAllMessagesInMailbox(flags);
+        mainStepdefs.awaitMethod.run();
+    }
+
     @Then("^the user has a IMAP RECENT and a notification about (\\d+) new 
messages on connection for mailbox \"([^\"]*)\"$")
     public void checkNotificationForNewMessageOnActiveConnection(int 
numberOfMessages, String mailbox) throws Throwable {
         IMAPMessageReader imapMessageReader = imapConnections.get(mailbox);
@@ -110,6 +119,7 @@ public class ImapStepdefs {
         imapMessageReader.connectAndSelect(login, password, srcMailbox);
         assertThat(imapMessageReader).isNotNull();
         imapMessageReader.copyFirstMessage(destMailbox);
+        mainStepdefs.awaitMethod.run();
     }
 
     @Then("^the user has IMAP EXPUNGE and a notification for (\\d+) message 
sequence number on connection for mailbox \"([^\"]*)\"$")

http://git-wip-us.apache.org/repos/asf/james-project/blob/6ff67ca3/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 3d9f7bb..364c39e 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,8 +19,12 @@
 
 package org.apache.james.jmap.methods.integration.cucumber;
 
+import java.util.List;
+import java.util.stream.Collectors;
+
 import javax.inject.Inject;
 
+import org.apache.http.entity.ContentType;
 import org.apache.http.client.fluent.Request;
 import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailbox.model.MailboxId;
@@ -66,9 +70,10 @@ public class SetMessagesMethodStepdefs {
             "]";
         Request.Post(mainStepdefs.baseUri().setPath("/jmap").build())
             .addHeader("Authorization", 
userStepdefs.tokenByUser.get(username).serialize())
-            .bodyString(requestBody, 
org.apache.http.entity.ContentType.APPLICATION_JSON)
+            .bodyString(requestBody, ContentType.APPLICATION_JSON)
             .execute()
             .discardContent();
+        mainStepdefs.awaitMethod.run();
     }
 
     @When("^the user copy \"([^\"]*)\" from mailbox \"([^\"]*)\" to mailbox 
\"([^\"]*)\"")
@@ -97,8 +102,37 @@ public class SetMessagesMethodStepdefs {
             "]";
         Request.Post(mainStepdefs.baseUri().setPath("/jmap").build())
             .addHeader("Authorization", 
userStepdefs.tokenByUser.get(username).serialize())
-            .bodyString(requestBody, 
org.apache.http.entity.ContentType.APPLICATION_JSON)
+            .bodyString(requestBody, ContentType.APPLICATION_JSON)
+            .execute()
+            .discardContent();
+        mainStepdefs.awaitMethod.run();
+    }
+
+    @When("^the user set flags on \"([^\"]*)\" to \"([^\"]*)\"")
+    public void setFlags(String message, List<String> keywords) throws 
Throwable {
+        String username = userStepdefs.lastConnectedUser;
+        MessageId messageId = getMessagesMethodStepdefs.getMessageId(message);
+        String keywordString = keywords
+            .stream()
+            .map(value -> "\"" + value + "\" : true")
+            .collect(Collectors.joining(","));
+
+        Request.Post(mainStepdefs.baseUri().setPath("/jmap").build())
+            .addHeader("Authorization", 
userStepdefs.tokenByUser.get(username).serialize())
+            .bodyString("[" +
+                "  [" +
+                "    \"setMessages\","+
+                "    {" +
+                "      \"update\": { \"" + messageId.serialize() + "\" : {" +
+                "        \"keywords\": {" + keywordString + "}" +
+                "      }}" +
+                "    }," +
+                "    \"#0\"" +
+                "  ]" +
+                "]",
+                ContentType.APPLICATION_JSON)
             .execute()
             .discardContent();
+        mainStepdefs.awaitMethod.run();
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/6ff67ca3/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 5a4ec8d..4650033 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
@@ -84,7 +84,7 @@ Feature: Impact of IMAP on JMAP keywords consistency
     When the user asks for message list in mailbox "source" with flag 
"$Flagged"
     Then the message list is empty
 
-  Scenario: SetMessages should succeed to solve Keywords conflict introduced 
via IMAP upon flags addition
+  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 the user copy "m1" from mailbox "source" to mailbox "mailbox"
     And the user has an open IMAP connection with mailbox "mailbox" selected
@@ -97,7 +97,19 @@ Feature: Impact of IMAP on JMAP keywords consistency
     And the message list has size 1
     And the message list contains "m1"
 
-  Scenario: SetMessages should ignore Keywords conflict introduced via IMAP 
upon flags deletion
+  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 the user copy "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 set flags on "m1" to "$Flagged"
+    Then the user ask for messages "m1"
+    And no error is returned
+    And the list should contain 1 message
+    And the id of the message is "m1"
+    And the keywords of the message is $Flagged
+
+  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 the user copy "m1" from mailbox "source" to mailbox "mailbox"
     And the user has an open IMAP connection with mailbox "mailbox" selected
@@ -106,4 +118,22 @@ Feature: Impact of IMAP on JMAP keywords consistency
     Then the user asks for message list in mailbox "mailbox" with flag 
"$Flagged"
     And the message list is empty
     And the user asks for message list in mailbox "source" with flag "$Flagged"
-    And the message list is empty
\ No newline at end of file
+    And the message list is empty
+    Then the user asks for message list in mailbox "mailbox" with flag 
"$Answered"
+    And the message list has size 1
+    And the message list contains "m1"
+    And the user asks for message list in mailbox "source" with flag 
"$Answered"
+    And the message list has size 1
+    And the message list contains "m1"
+
+  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 the user copy "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 set flags on "m1" to "$Answered"
+    Then the user ask for messages "m1"
+    And no error is returned
+    And the list should contain 1 message
+    And the id of the message is "m1"
+    And the keywords of the message is $Answered
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/6ff67ca3/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryIMAPKeywordsInconsistenciesTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryIMAPKeywordsInconsistenciesTest.java
 
b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryIMAPKeywordsInconsistenciesTest.java
new file mode 100644
index 0000000..30bbe9e
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryIMAPKeywordsInconsistenciesTest.java
@@ -0,0 +1,32 @@
+/****************************************************************
+ * 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/ImapKeywordsConsistency.feature",
+    glue={"org.apache.james.jmap.methods.integration", 
"org.apache.james.jmap.memory.cucumber"},
+    strict = true)
+public class MemoryIMAPKeywordsInconsistenciesTest {
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6ff67ca3/server/testing/src/main/java/org/apache/james/utils/IMAPMessageReader.java
----------------------------------------------------------------------
diff --git 
a/server/testing/src/main/java/org/apache/james/utils/IMAPMessageReader.java 
b/server/testing/src/main/java/org/apache/james/utils/IMAPMessageReader.java
index 8fb5d68..e2edb6f 100644
--- a/server/testing/src/main/java/org/apache/james/utils/IMAPMessageReader.java
+++ b/server/testing/src/main/java/org/apache/james/utils/IMAPMessageReader.java
@@ -95,6 +95,11 @@ public class IMAPMessageReader implements Closeable {
         return readFirstMessageInMailbox(user, password, "(RFC822.HEADER)", 
INBOX);
     }
 
+    public String setFlagsForAllMessagesInMailbox(String flag) throws 
IOException {
+        imapClient.store("1:*", "+FLAGS", flag);
+        return imapClient.getReplyString();
+    }
+
     private String readFirstMessageInMailbox(String user, String password, 
String parameters, String mailboxName) throws IOException {
         imapClient.login(user, password);
         imapClient.select(mailboxName);


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

Reply via email to