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 rd...@apache.org on 2008/03/31 22:55:02 UTC
svn commit: r643145 - in
/james/server/trunk/experimental-seda-imap-function/src/test:
java/org/apache/james/test/functional/
resources/org/apache/james/test/functional/imap/scripts/
Author: rdonkin
Date: Mon Mar 31 13:54:52 2008
New Revision: 643145
URL: http://svn.apache.org/viewvc?rev=643145&view=rev
Log:
Test RENAME selected mailbox. Note that these tests will need amendment.
Added:
james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/RenameSelected.test
Modified:
james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/CreateScript.java
james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/ScriptBuilder.java
Modified: james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/CreateScript.java
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/CreateScript.java?rev=643145&r1=643144&r2=643145&view=diff
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/CreateScript.java (original)
+++ james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/CreateScript.java Mon Mar 31 13:54:52 2008
@@ -35,7 +35,37 @@
public static final void main(String[] args) throws Exception {
ScriptBuilder builder = ScriptBuilder.open("localhost", 143);
- renameHierarchy(builder);
+ renameSelected(builder);
+ }
+
+ public static void renameSelected(ScriptBuilder builder) throws Exception {
+ builder.login();
+ builder.create();
+ builder.select();
+ builder.append();
+ builder.setFile("rfc822-hello-world.mail");
+ builder.append();
+ builder.setFile("rfc822-sender.mail");
+ builder.append();
+ builder.setFile("rfc822.mail");
+ builder.append();
+ builder.setFile("rfc822-multiple-addresses.mail");
+ builder.append();
+ builder.select();
+ builder.getFetch().setFlagsFetch(true).bodyPeekHeaders(ScriptBuilder.Fetch.SELECT_HEADERS).setUid(true);
+ builder.fetchAllMessages();
+ builder.list();
+ builder.rename("anothermailbox");
+ builder.list();
+ builder.fetchAllMessages();
+ builder.store(builder.flags().add().flagged().range(1, 2));
+ builder.store(builder.flags().add().answered().range(1, 3));
+ builder.fetchAllMessages();
+ builder.select();
+ builder.setMailbox("anothermailbox");
+ builder.select();
+ builder.fetchAllMessages();
+ builder.quit();
}
public static void renameHierarchy(ScriptBuilder builder) throws Exception {
Modified: james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/ScriptBuilder.java
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/ScriptBuilder.java?rev=643145&r1=643144&r2=643145&view=diff
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/ScriptBuilder.java (original)
+++ james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/ScriptBuilder.java Mon Mar 31 13:54:52 2008
@@ -157,6 +157,10 @@
response();
}
+ public ScriptBuilder rename(String to) throws Exception {
+ return rename(getMailbox(), to);
+ }
+
public ScriptBuilder rename(String from, String to) throws Exception {
command("RENAME " + from + " " + to);
return this;
@@ -1072,7 +1076,9 @@
print(result);
} else {
inBuffer.compact();
- while (source.read(inBuffer) == 0);
+ int i = 0;
+ while ((i = source.read(inBuffer)) == 0);
+ if (i == -1) throw new RuntimeException("Unexpected EOF");
inBuffer.flip();
result = next();
}
@@ -1274,6 +1280,7 @@
line = StringUtils.replace(line, "OK Store completed", "OK STORE completed");
line = StringUtils.replace(line, "OK Rename completed", "OK RENAME completed");
line = StringUtils.replace(line, "OK Expunge completed", "OK EXPUNGE completed");
+ line = StringUtils.replace(line, "OK List completed", "OK LIST completed");
line = StringUtils.replace(line, "Select completed", "SELECT completed");
line = StringUtils.replace(line, "\\\\Seen \\\\Draft", "\\\\Draft \\\\Seen");
line = StringUtils.replace(line, "\\\\Flagged \\\\Deleted", "\\\\Deleted \\\\Flagged");
Added: james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/RenameSelected.test
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/RenameSelected.test?rev=643145&view=auto
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/RenameSelected.test (added)
+++ james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/RenameSelected.test Mon Mar 31 13:54:52 2008
@@ -0,0 +1,297 @@
+################################################################
+# 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. #
+################################################################
+C: A2 CREATE testmailbox
+S: A2 OK CREATE completed\.
+C: A3 SELECT testmailbox
+S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
+S: \* 0 EXISTS
+S: \* 0 RECENT
+S: \* OK \[UIDVALIDITY \d+\]
+S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)\]
+S: A3 OK \[READ-WRITE\] SELECT completed\.
+C: A4 APPEND testmailbox {185+}
+C: From: Timothy Tayler <ti...@example.org>
+C: To: Samual Smith <sa...@example.org>
+C: Date: Thu, 14 Feb 2008 12:00:00 +0000 (GMT)
+C: Subject: A Simple Email
+C:
+C: This is a very simple email.
+C:
+S: \* 1 EXISTS
+S: \* 1 RECENT
+S: A4 OK APPEND completed\.
+C: A5 APPEND testmailbox {185+}
+C: From: John Smith <jo...@example.org>
+C: To: Timothy Taylor <ti...@example.org>
+C: Subject: Hello
+C: Date: Sat, 23 Feb 2008 07:48:03 -0600
+C: Message-ID: <17...@machine.example.org>
+C:
+C: Hello, World!
+S: \* 2 EXISTS
+S: \* 2 RECENT
+S: A5 OK APPEND completed\.
+C: A6 APPEND testmailbox {227+}
+C: From: John Smith <jo...@example.org>
+C: Sender: Samual Smith <sa...@example.org>
+C: To: Timothy Taylor <ti...@example.org>
+C: Subject: Hello
+C: Date: Sat, 23 Feb 2008 07:48:03 -0600
+C: Message-ID: <17...@machine.example.org>
+C:
+C: Hello, World!
+S: \* 3 EXISTS
+S: \* 3 RECENT
+S: A6 OK APPEND completed\.
+C: A7 APPEND testmailbox {185+}
+C: From: Timothy Tayler <ti...@example.org>
+C: To: Samual Smith <sa...@example.org>
+C: Date: Thu, 14 Feb 2008 12:00:00 +0000 (GMT)
+C: Subject: A Simple Email
+C:
+C: This is a very simple email.
+C:
+S: \* 4 EXISTS
+S: \* 4 RECENT
+S: A7 OK APPEND completed\.
+C: A8 APPEND testmailbox {318+}
+C: From: "Brian G. Hutton" <br...@example.org>
+C: To: Timothy Taylor <ti...@example.org>, faith@example.org, Huh? <sa...@example.org>
+C: CC: <be...@example.org>, "David \"The Thin White Duke\" Bowie" <du...@example.org>
+C: Subject: Rhubarb
+C: Date: Sat, 23 Feb 2008 07:48:03 -0600
+C: Message-ID: <17...@machine.example.org>
+C:
+C: Rhubarb!
+S: \* 5 EXISTS
+S: \* 5 RECENT
+S: A8 OK APPEND completed\.
+C: A9 SELECT testmailbox
+S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
+S: \* 5 EXISTS
+S: \* 1 RECENT
+S: \* OK \[UNSEEN 1\](.)*
+S: \* OK \[UIDVALIDITY \d+\]
+S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)\]
+S: A9 OK \[READ-WRITE\] SELECT completed\.
+C: A10 FETCH 1:* (FLAGS UID BODY.PEEK[HEADER.FIELDS (DATE FROM TO ORIGINATOR X-LIST)])
+S: \* 1 FETCH \(FLAGS \(\) UID 1 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
+S: From: Timothy Tayler <timothy@example\.org>
+S: To: Samual Smith <samual@example\.org>
+S: Date: Thu, 14 Feb 2008 12:00:00 \+0000 \(GMT\)
+S:
+S: \)
+S: \* 2 FETCH \(FLAGS \(\) UID 2 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
+S: From: John Smith <john@example\.org>
+S: To: Timothy Taylor <tim@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: \* 3 FETCH \(FLAGS \(\) UID 3 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
+S: From: John Smith <john@example\.org>
+S: To: Timothy Taylor <tim@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: \* 4 FETCH \(FLAGS \(\) UID 4 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
+S: From: Timothy Tayler <timothy@example\.org>
+S: To: Samual Smith <samual@example\.org>
+S: Date: Thu, 14 Feb 2008 12:00:00 \+0000 \(GMT\)
+S:
+S: \)
+S: \* 5 FETCH \(FLAGS \(\\Recent\) UID 5 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{167\}
+S: From: "Brian G\. Hutton" <brian@example\.org>
+S: To: Timothy Taylor <tim@example\.org>, faith@example\.org, Huh\? <sam@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: A10 OK FETCH completed\.
+C: A11 LIST "" "*"
+S: \* LIST \(\\HasNoChildren\) "\." "anothermailbox"
+S: \* LIST \(\\HasNoChildren\) "\." "testmailbox"
+S: \* LIST \(\\HasNoChildren\) "\." "INBOX"
+S: \* LIST \(\\HasChildren\) "\." "alpha\.beta"
+S: \* LIST \(\\HasChildren\) "\." "alpha\.beta\.gamma\.delta"
+S: \* LIST \(\\HasNoChildren\) "\." "alpha\.beta\.gamma\.delta\.epsilon"
+S: A11 OK LIST completed\.
+C: A12 RENAME testmailbox anothermailbox
+S: A12 NO Mailbox exists\.
+C: A13 LIST "" "*"
+S: \* LIST \(\\HasNoChildren\) "\." "anothermailbox"
+S: \* LIST \(\\HasNoChildren\) "\." "testmailbox"
+S: \* LIST \(\\HasNoChildren\) "\." "INBOX"
+S: \* LIST \(\\HasChildren\) "\." "alpha\.beta"
+S: \* LIST \(\\HasChildren\) "\." "alpha\.beta\.gamma\.delta"
+S: \* LIST \(\\HasNoChildren\) "\." "alpha\.beta\.gamma\.delta\.epsilon"
+S: A13 OK LIST completed\.
+C: A14 FETCH 1:* (FLAGS UID BODY.PEEK[HEADER.FIELDS (DATE FROM TO ORIGINATOR X-LIST)])
+S: \* 1 FETCH \(FLAGS \(\) UID 1 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
+S: From: Timothy Tayler <timothy@example\.org>
+S: To: Samual Smith <samual@example\.org>
+S: Date: Thu, 14 Feb 2008 12:00:00 \+0000 \(GMT\)
+S:
+S: \)
+S: \* 2 FETCH \(FLAGS \(\) UID 2 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
+S: From: John Smith <john@example\.org>
+S: To: Timothy Taylor <tim@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: \* 3 FETCH \(FLAGS \(\) UID 3 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
+S: From: John Smith <john@example\.org>
+S: To: Timothy Taylor <tim@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: \* 4 FETCH \(FLAGS \(\) UID 4 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
+S: From: Timothy Tayler <timothy@example\.org>
+S: To: Samual Smith <samual@example\.org>
+S: Date: Thu, 14 Feb 2008 12:00:00 \+0000 \(GMT\)
+S:
+S: \)
+S: \* 5 FETCH \(FLAGS \(\\Recent\) UID 5 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{167\}
+S: From: "Brian G\. Hutton" <brian@example\.org>
+S: To: Timothy Taylor <tim@example\.org>, faith@example\.org, Huh\? <sam@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: A14 OK FETCH completed\.
+C: A15 STORE 1:2 +FLAGS (\FLAGGED)
+S: \* 1 FETCH \(FLAGS \(\\Flagged\)\)
+S: \* 2 FETCH \(FLAGS \(\\Flagged\)\)
+S: A15 OK STORE completed\.
+C: A16 STORE 1:3 +FLAGS (\ANSWERED)
+S: \* 1 FETCH \(FLAGS \(\\Answered \\Flagged\)\)
+S: \* 2 FETCH \(FLAGS \(\\Answered \\Flagged\)\)
+S: \* 3 FETCH \(FLAGS \(\\Answered\)\)
+S: A16 OK STORE completed\.
+C: A17 FETCH 1:* (FLAGS UID BODY.PEEK[HEADER.FIELDS (DATE FROM TO ORIGINATOR X-LIST)])
+S: \* 1 FETCH \(FLAGS \(\\Answered \\Flagged\) UID 1 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
+S: From: Timothy Tayler <timothy@example\.org>
+S: To: Samual Smith <samual@example\.org>
+S: Date: Thu, 14 Feb 2008 12:00:00 \+0000 \(GMT\)
+S:
+S: \)
+S: \* 2 FETCH \(FLAGS \(\\Answered \\Flagged\) UID 2 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
+S: From: John Smith <john@example\.org>
+S: To: Timothy Taylor <tim@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: \* 3 FETCH \(FLAGS \(\\Answered\) UID 3 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
+S: From: John Smith <john@example\.org>
+S: To: Timothy Taylor <tim@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: \* 4 FETCH \(FLAGS \(\) UID 4 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
+S: From: Timothy Tayler <timothy@example\.org>
+S: To: Samual Smith <samual@example\.org>
+S: Date: Thu, 14 Feb 2008 12:00:00 \+0000 \(GMT\)
+S:
+S: \)
+S: \* 5 FETCH \(FLAGS \(\\Recent\) UID 5 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{167\}
+S: From: "Brian G\. Hutton" <brian@example\.org>
+S: To: Timothy Taylor <tim@example\.org>, faith@example\.org, Huh\? <sam@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: A17 OK FETCH completed\.
+C: A18 SELECT testmailbox
+S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
+S: \* 5 EXISTS
+S: \* 0 RECENT
+S: \* OK \[UNSEEN 1\](.)*
+S: \* OK \[UIDVALIDITY \d+\]
+S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)\]
+S: A18 OK \[READ-WRITE\] SELECT completed\.
+C: A19 SELECT anothermailbox
+S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
+S: \* 10 EXISTS
+S: \* 0 RECENT
+S: \* OK \[UNSEEN 1\](.)*
+S: \* OK \[UIDVALIDITY \d+\]
+S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)\]
+S: A19 OK \[READ-WRITE\] SELECT completed\.
+C: A20 FETCH 1:* (FLAGS UID BODY.PEEK[HEADER.FIELDS (DATE FROM TO ORIGINATOR X-LIST)])
+S: \* 1 FETCH \(FLAGS \(\\Answered \\Flagged\) UID 1 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
+S: From: Timothy Tayler <timothy@example\.org>
+S: To: Samual Smith <samual@example\.org>
+S: Date: Thu, 14 Feb 2008 12:00:00 \+0000 \(GMT\)
+S:
+S: \)
+S: \* 2 FETCH \(FLAGS \(\\Answered \\Flagged\) UID 2 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
+S: From: John Smith <john@example\.org>
+S: To: Timothy Taylor <tim@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: \* 3 FETCH \(FLAGS \(\\Answered\) UID 3 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
+S: From: John Smith <john@example\.org>
+S: To: Timothy Taylor <tim@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: \* 4 FETCH \(FLAGS \(\) UID 4 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
+S: From: Timothy Tayler <timothy@example\.org>
+S: To: Samual Smith <samual@example\.org>
+S: Date: Thu, 14 Feb 2008 12:00:00 \+0000 \(GMT\)
+S:
+S: \)
+S: \* 5 FETCH \(FLAGS \(\) UID 5 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{167\}
+S: From: "Brian G\. Hutton" <brian@example\.org>
+S: To: Timothy Taylor <tim@example\.org>, faith@example\.org, Huh\? <sam@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: \* 6 FETCH \(FLAGS \(\) UID 6 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
+S: From: Timothy Tayler <timothy@example\.org>
+S: To: Samual Smith <samual@example\.org>
+S: Date: Thu, 14 Feb 2008 12:00:00 \+0000 \(GMT\)
+S:
+S: \)
+S: \* 7 FETCH \(FLAGS \(\) UID 7 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
+S: From: John Smith <john@example\.org>
+S: To: Timothy Taylor <tim@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: \* 8 FETCH \(FLAGS \(\) UID 8 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
+S: From: John Smith <john@example\.org>
+S: To: Timothy Taylor <tim@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: \* 9 FETCH \(FLAGS \(\) UID 9 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
+S: From: Timothy Tayler <timothy@example\.org>
+S: To: Samual Smith <samual@example\.org>
+S: Date: Thu, 14 Feb 2008 12:00:00 \+0000 \(GMT\)
+S:
+S: \)
+S: \* 10 FETCH \(FLAGS \(\) UID 10 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{167\}
+S: From: "Brian G\. Hutton" <brian@example\.org>
+S: To: Timothy Taylor <tim@example\.org>, faith@example\.org, Huh\? <sam@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: A20 OK FETCH completed\.
+C: A21 DELETE anothermailbox
+S: A21 OK DELETE completed\.
+C: A22 DELETE anothermailbox
+S: A23 OK DELETE completed\.
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org