JAMES-2249 jmap cucumber: remove useless parameter in Stepdefs

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

Branch: refs/heads/master
Commit: 40c004312943fea4222875e1e7c40766f855b7b3
Parents: 34d523e
Author: Luc DUZAN <ldu...@linagora.com>
Authored: Mon Dec 11 15:32:21 2017 +0100
Committer: Antoine Duprat <adup...@linagora.com>
Committed: Tue Dec 12 15:12:36 2017 +0100

----------------------------------------------------------------------
 .../integration/cucumber/DownloadStepdefs.java  | 24 ++++++++---------
 .../cucumber/GetMessagesMethodStepdefs.java     | 10 +++----
 .../cucumber/SetMessagesMethodStepdefs.java     | 28 +++++++++++---------
 3 files changed, 32 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/40c00431/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
index 79f793c..6d852f2 100644
--- 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
@@ -246,8 +246,8 @@ public class DownloadStepdefs {
                     blobId));
     }
 
-    @When("^\"([^\"]*)\" downloads \"([^\"]*)\" with a valid authentication 
token but a bad blobId$")
-    public void downloadsWithValidToken(String username, String attachmentId) 
throws Throwable {
+    @When("^\"([^\"]*)\" downloads \"(?:[^\"]*)\" with a valid authentication 
token but a bad blobId$")
+    public void downloadsWithValidToken(String username) throws Throwable {
         userStepdefs.execWithUser(username, () -> {
             URIBuilder uriBuilder = 
mainStepdefs.baseUri().setPath("/download/badblobId");
             response = Request.Get(uriBuilder.build())
@@ -258,16 +258,16 @@ public class DownloadStepdefs {
         });
     }
 
-    @When("^\"([^\"]*)\" downloads \"([^\"]*)\" without any authentication 
token$")
-    public void getDownloadWithoutToken(String username, String attachmentId) 
throws Exception {
+    @When("^\"(?:[^\"]*)\" downloads \"([^\"]*)\" without any authentication 
token$")
+    public void getDownloadWithoutToken(String attachmentId) throws Exception {
         String blobId = blobIdByAttachmentId.get(attachmentId);
         response = Request.Get(mainStepdefs.baseUri().setPath("/download/" + 
blobId).build())
             .execute()
             .returnResponse();
     }
 
-    @When("^\"([^\"]*)\" downloads \"([^\"]*)\" with an empty authentication 
token$")
-    public void getDownloadWithEmptyToken(String username, String 
attachmentId) throws Exception {
+    @When("^\"(?:[^\"]*)\" downloads \"([^\"]*)\" with an empty authentication 
token$")
+    public void getDownloadWithEmptyToken(String attachmentId) throws 
Exception {
         String blobId = blobIdByAttachmentId.get(attachmentId);
         response = Request.Get(
                 mainStepdefs.baseUri()
@@ -278,8 +278,8 @@ public class DownloadStepdefs {
                 .returnResponse();
     }
 
-    @When("^\"([^\"]*)\" downloads \"([^\"]*)\" with a bad authentication 
token$")
-    public void getDownloadWithBadToken(String username, String attachmentId) 
throws Exception {
+    @When("^\"(?:[^\"]*)\" downloads \"([^\"]*)\" with a bad authentication 
token$")
+    public void getDownloadWithBadToken(String attachmentId) throws Exception {
         String blobId = blobIdByAttachmentId.get(attachmentId);
         response = Request.Get(
                 mainStepdefs.baseUri()
@@ -290,8 +290,8 @@ public class DownloadStepdefs {
                 .returnResponse();
     }
 
-    @When("^\"([^\"]*)\" downloads \"([^\"]*)\" with an invalid authentication 
token$")
-    public void getDownloadWithUnknownToken(String username, String 
attachmentId) throws Exception {
+    @When("^\"(?:[^\"]*)\" downloads \"([^\"]*)\" with an invalid 
authentication token$")
+    public void getDownloadWithUnknownToken(String attachmentId) throws 
Exception {
         String blobId = blobIdByAttachmentId.get(attachmentId);
         response = Request.Get(
                 mainStepdefs.baseUri()
@@ -347,8 +347,8 @@ public class DownloadStepdefs {
                 .returnResponse();
     }
 
-    @When("^\"([^\"]*)\" downloads \"([^\"]*)\" with an expired token$")
-    public void getDownloadWithExpiredToken(String username, String 
attachmentId) throws Exception {
+    @When("^\"(?:[^\"]*)\" downloads \"([^\"]*)\" with an expired token$")
+    public void getDownloadWithExpiredToken(String attachmentId) throws 
Exception {
         String blobId = blobIdByAttachmentId.get(attachmentId);
         response = Request.Get(mainStepdefs.baseUri().setPath("/download/" + 
blobId)
                 .addParameter("access_token", EXPIRED_ATTACHMENT_TOKEN)

http://git-wip-us.apache.org/repos/asf/james-project/blob/40c00431/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 05db2de..0f6c561 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
@@ -320,13 +320,13 @@ public class GetMessagesMethodStepdefs {
         appendMessage(messageName, mailbox, 
"eml/htmlBodyWithManyEmptyTags.eml");
     }
 
-    @Given("^\"([^\"]*)\" has a message \"([^\"]*)\" in the \"([^\"]*)\" 
mailbox with multiple same inlined attachments \"([^\"]*)\"$")
-    public void appendMessageWithSameInlinedAttachmentsToMailbox(String 
username, String messageName, String mailbox, String attachmentId) throws 
Throwable {
-        userStepdefs.execWithUser(username, () -> 
appendMessageWithSameInlinedAttachmentsToMailbox(messageName, mailbox, 
attachmentId));
+    @Given("^\"([^\"]*)\" has a message \"([^\"]*)\" in the \"([^\"]*)\" 
mailbox with multiple same inlined attachments \"(?:[^\"]*)\"$")
+    public void appendMessageWithSameInlinedAttachmentsToMailbox(String 
username, String messageName, String mailbox) throws Throwable {
+        userStepdefs.execWithUser(username, () -> 
appendMessageWithSameInlinedAttachmentsToMailbox(messageName, mailbox));
     }
 
-    @Given("^the user has a message \"([^\"]*)\" in the \"([^\"]*)\" mailbox 
with multiple same inlined attachments \"([^\"]*)\"$")
-    public void appendMessageWithSameInlinedAttachmentsToMailbox(String 
messageName, String mailbox, String attachmentId) throws Exception {
+    @Given("^the user has a message \"([^\"]*)\" in the \"([^\"]*)\" mailbox 
with multiple same inlined attachments \"(?:[^\"]*)\"$")
+    public void appendMessageWithSameInlinedAttachmentsToMailbox(String 
messageName, String mailbox) throws Exception {
         appendMessage(messageName, mailbox, "eml/sameInlinedImages.eml");
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/40c00431/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 94fb073..e2d276c 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
@@ -184,20 +184,22 @@ public class SetMessagesMethodStepdefs {
 
     @When("^\"([^\"]*)\" marks the message \"([^\"]*)\" as flagged$")
     public void flag(String username, String message) throws Throwable {
-        MessageId messageId = messageIdStepdefs.getMessageId(message);
+        userStepdefs.execWithUser(username, () -> {
+            MessageId messageId = messageIdStepdefs.getMessageId(message);
 
-        httpClient.post("[" +
-            "  [" +
-            "    \"setMessages\","+
-            "    {" +
-            "      \"update\": { \"" + messageId.serialize() + "\" : {" +
-            "        \"isFlagged\": true" +
-            "      }}" +
-            "    }," +
-            "    \"#0\"" +
-            "  ]" +
-            "]");
-        mainStepdefs.awaitMethod.run();
+            httpClient.post("[" +
+                "  [" +
+                "    \"setMessages\","+
+                "    {" +
+                "      \"update\": { \"" + messageId.serialize() + "\" : {" +
+                "        \"isFlagged\": true" +
+                "      }}" +
+                "    }," +
+                "    \"#0\"" +
+                "  ]" +
+                "]");
+            mainStepdefs.awaitMethod.run();
+        });
     }
 
     @When("^\"([^\"]*)\" destroys message \"([^\"]*)\"$")


---------------------------------------------------------------------
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