james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject james-project git commit: JAMES-1996 Add IMAPMessageReader.readFirstMessageHeadersInMailbox method
Date Thu, 13 Apr 2017 03:22:33 GMT
Repository: james-project
Updated Branches:
  refs/heads/master d3b455bbd -> f575b56df


JAMES-1996 Add IMAPMessageReader.readFirstMessageHeadersInMailbox method


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

Branch: refs/heads/master
Commit: f575b56df99c8e093965a3de42718b7430cc4ece
Parents: d3b455b
Author: Antoine Duprat <aduprat@linagora.com>
Authored: Wed Apr 12 16:25:30 2017 +0200
Committer: Antoine Duprat <aduprat@linagora.com>
Committed: Wed Apr 12 16:25:30 2017 +0200

----------------------------------------------------------------------
 .../org/apache/james/utils/IMAPMessageReader.java | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/f575b56d/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 2a7d79a..fc05bde 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
@@ -29,6 +29,8 @@ import com.google.common.base.Splitter;
 
 public class IMAPMessageReader implements Closeable {
 
+    private static final String INBOX = "INBOX";
+
     private final IMAPClient imapClient;
 
     public IMAPMessageReader(String host, int port) throws IOException {
@@ -42,7 +44,7 @@ public class IMAPMessageReader implements Closeable {
     }
 
     public boolean userReceivedMessage(String user, String password) throws IOException {
-        return userReceivedMessageInMailbox(user, password, "INBOX");
+        return userReceivedMessageInMailbox(user, password, INBOX);
     }
 
     public boolean userReceivedMessageInMailbox(String user, String password, String mailbox)
throws IOException {
@@ -59,7 +61,7 @@ public class IMAPMessageReader implements Closeable {
     }
 
     public boolean userDoesNotReceiveMessage(String user, String password) throws IOException
{
-        return userDoesNotReceiveMessageInMailbox(user, password, "INBOX");
+        return userDoesNotReceiveMessageInMailbox(user, password, INBOX);
     }
 
     public boolean userDoesNotReceiveMessageInMailbox(String user, String password, String
mailboxName) throws IOException {
@@ -71,16 +73,20 @@ public class IMAPMessageReader implements Closeable {
 
     public String readFirstMessageInInbox(String user, String password) throws IOException
{
 
-        return readFirstMessageInInbox(user, password, "(BODY[])");
+        return readFirstMessageInMailbox(user, password, "(BODY[])", INBOX);
+    }
+
+    public String readFirstMessageHeadersInMailbox(String user, String password, String mailboxName)
throws IOException {
+        return readFirstMessageInMailbox(user, password, "(RFC822.HEADER)", mailboxName);
     }
 
     public String readFirstMessageHeadersInInbox(String user, String password) throws IOException
{
-        return readFirstMessageInInbox(user, password, "(RFC822.HEADER)");
+        return readFirstMessageInMailbox(user, password, "(RFC822.HEADER)", INBOX);
     }
 
-    private String readFirstMessageInInbox(String user, String password, String parameters)
throws IOException {
+    private String readFirstMessageInMailbox(String user, String password, String parameters,
String mailboxName) throws IOException {
         imapClient.login(user, password);
-        imapClient.select("INBOX");
+        imapClient.select(mailboxName);
         imapClient.fetch("1:1", parameters);
         return imapClient.getReplyString();
     }


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