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 bt...@apache.org on 2017/02/22 02:01:38 UTC

james-project git commit: PROTOCOLS-116 Add MPT test for UID<-> MSN handling by IMAP

Repository: james-project
Updated Branches:
  refs/heads/master 6b5d52789 -> c1379a10a


PROTOCOLS-116 Add MPT test for UID<-> MSN handling by IMAP


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

Branch: refs/heads/master
Commit: c1379a10a019f3ea598d18ab9281ee674098ace6
Parents: 6b5d527
Author: Benoit Tellier <bt...@linagora.com>
Authored: Fri Feb 17 12:03:51 2017 +0700
Committer: benwa <bt...@linagora.com>
Committed: Wed Feb 22 09:00:36 2017 +0700

----------------------------------------------------------------------
 .../imapmailbox/suite/ConcurrentSessions.java   |  10 ++
 .../ConcurrentAppendUIDToMSNMapping.test        | 136 +++++++++++++++
 .../ConcurrentExpungeUIDToMSNMapping.test       | 172 +++++++++++++++++++
 3 files changed, 318 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/c1379a10/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ConcurrentSessions.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ConcurrentSessions.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ConcurrentSessions.java
index aebc136..4a55ed1 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ConcurrentSessions.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ConcurrentSessions.java
@@ -140,4 +140,14 @@ public class ConcurrentSessions extends BaseAuthenticatedState {
     public void testConcurrentRenameSelectedITALY() throws Exception {
         scriptTest("ConcurrentRenameSelected", Locale.ITALY);
     }
+
+    @Test
+    public void expungeShouldNotBreakUIDToMSNMapping() throws Exception {
+        scriptTest("ConcurrentExpungeUIDToMSNMapping", Locale.US);
+    }
+
+    @Test
+    public void appendShouldNotBreakUIDToMSNMapping() throws Exception {
+        scriptTest("ConcurrentAppendUIDToMSNMapping", Locale.US);
+    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/c1379a10/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/ConcurrentAppendUIDToMSNMapping.test
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/ConcurrentAppendUIDToMSNMapping.test b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/ConcurrentAppendUIDToMSNMapping.test
new file mode 100644
index 0000000..bed1e78
--- /dev/null
+++ b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/ConcurrentAppendUIDToMSNMapping.test
@@ -0,0 +1,136 @@
+################################################################
+# 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.                                           #
+################################################################
+
+#####
+##### Test : verify append do not break MSN <-> UID mapping
+#####
+
+### PROVISIONING
+SESSION: 1
+C: 1a CREATE expungeresponse
+S: 1a OK CREATE completed.
+
+C: 1b APPEND expungeresponse (\Deleted) {254+}
+C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+C: From: Fred Foobar <fo...@Blurdybloop.COM>
+C: Subject: Test 01
+C: To: mooch@owatagu.siam.edu
+C: Message-Id: <B2...@Blurdybloop.COM>
+C: MIME-Version: 1.0
+C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+C:
+C: Test 01
+C:
+S: 1b OK (\[.+\] )?APPEND completed.
+
+C: 1c APPEND expungeresponse {254+}
+C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+C: From: Fred Foobar <fo...@Blurdybloop.COM>
+C: Subject: Test 02
+C: To: mooch@owatagu.siam.edu
+C: Message-Id: <B2...@Blurdybloop.COM>
+C: MIME-Version: 1.0
+C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+C:
+C: Test 02
+C:
+S: 1c OK (\[.+\] )?APPEND completed.
+
+C: 1d APPEND expungeresponse (\Deleted) {254+}
+C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+C: From: Fred Foobar <fo...@Blurdybloop.COM>
+C: Subject: Test 03
+C: To: mooch@owatagu.siam.edu
+C: Message-Id: <B2...@Blurdybloop.COM>
+C: MIME-Version: 1.0
+C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+C:
+C: Test 03
+C:
+S: 1d OK (\[.+\] )?APPEND completed.
+
+C: 1e APPEND expungeresponse {254+}
+C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+C: From: Fred Foobar <fo...@Blurdybloop.COM>
+C: Subject: Test 04
+C: To: mooch@owatagu.siam.edu
+C: Message-Id: <B2...@Blurdybloop.COM>
+C: MIME-Version: 1.0
+C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+C:
+C: Test 04
+C:
+S: 1e OK (\[.+\] )?APPEND completed.
+
+
+
+
+SESSION: 2
+C: 2a SELECT expungeresponse
+S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
+S: \* 4 EXISTS
+S: \* 4 RECENT
+S: \* OK \[UIDVALIDITY \d+\].*
+S: \* OK \[UNSEEN 1\].*
+S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\\Seen( \\\*)?\)\].*
+S: \* OK \[HIGHESTMODSEQ \d+\].*
+S: \* OK \[UIDNEXT 5\].*
+S: 2a OK \[READ-WRITE\] SELECT completed.
+
+# Do an append on mailbox
+# MSN 5 should be mapped to UID 5
+SESSION: 1
+
+C: 1g APPEND expungeresponse {254+}
+C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+C: From: Fred Foobar <fo...@Blurdybloop.COM>
+C: Subject: Test 05
+C: To: mooch@owatagu.siam.edu
+C: Message-Id: <B2...@Blurdybloop.COM>
+C: MIME-Version: 1.0
+C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+C:
+C: Test 05
+C:
+S: 1g OK (\[.+\] )?APPEND completed.
+
+# Make sure session 2 gets append responses
+SESSION: 2
+C: 2b NOOP
+S: \* 5 EXISTS
+S: \* 5 RECENT
+S: 2b OK NOOP completed.
+
+# Make sure mapping was updated
+
+C: 2c FETCH 5 (BODY[])
+S: \* 5 FETCH \(.*BODY\[\] \{254\}
+S: Date: Mon, 7 Feb 1994 21:52:25 -0800 \(PST\)
+S: From: Fred Foobar <fo...@Blurdybloop.COM>
+S: Subject: Test 05
+S: To: mooch@owatagu.siam.edu
+S: Message-Id: <B2...@Blurdybloop.COM>
+S: MIME-Version: 1.0
+S: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+S:
+S: Test 05
+S: \)
+S: 2c OK FETCH completed\.
+
+

http://git-wip-us.apache.org/repos/asf/james-project/blob/c1379a10/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/ConcurrentExpungeUIDToMSNMapping.test
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/ConcurrentExpungeUIDToMSNMapping.test b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/ConcurrentExpungeUIDToMSNMapping.test
new file mode 100644
index 0000000..967562c
--- /dev/null
+++ b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/ConcurrentExpungeUIDToMSNMapping.test
@@ -0,0 +1,172 @@
+################################################################
+# 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.                                           #
+################################################################
+
+#####
+##### Test : verify expunge do not break MSN <-> UID mapping
+#####
+
+### PROVISIONING
+SESSION: 1
+C: 1a CREATE expungeresponse
+S: 1a OK CREATE completed.
+
+C: 1b APPEND expungeresponse (\Deleted) {254+}
+C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+C: From: Fred Foobar <fo...@Blurdybloop.COM>
+C: Subject: Test 01
+C: To: mooch@owatagu.siam.edu
+C: Message-Id: <B2...@Blurdybloop.COM>
+C: MIME-Version: 1.0
+C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+C:
+C: Test 01
+C:
+S: 1b OK (\[.+\] )?APPEND completed.
+
+C: 1c APPEND expungeresponse {254+}
+C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+C: From: Fred Foobar <fo...@Blurdybloop.COM>
+C: Subject: Test 02
+C: To: mooch@owatagu.siam.edu
+C: Message-Id: <B2...@Blurdybloop.COM>
+C: MIME-Version: 1.0
+C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+C:
+C: Test 02
+C:
+S: 1c OK (\[.+\] )?APPEND completed.
+
+C: 1d APPEND expungeresponse (\Deleted) {254+}
+C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+C: From: Fred Foobar <fo...@Blurdybloop.COM>
+C: Subject: Test 03
+C: To: mooch@owatagu.siam.edu
+C: Message-Id: <B2...@Blurdybloop.COM>
+C: MIME-Version: 1.0
+C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+C:
+C: Test 03
+C:
+S: 1d OK (\[.+\] )?APPEND completed.
+
+C: 1e APPEND expungeresponse {254+}
+C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+C: From: Fred Foobar <fo...@Blurdybloop.COM>
+C: Subject: Test 04
+C: To: mooch@owatagu.siam.edu
+C: Message-Id: <B2...@Blurdybloop.COM>
+C: MIME-Version: 1.0
+C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+C:
+C: Test 04
+C:
+S: 1e OK (\[.+\] )?APPEND completed.
+
+C: 1f SELECT expungeresponse
+S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
+S: \* 4 EXISTS
+S: \* 4 RECENT
+S: \* OK \[UIDVALIDITY \d+\].*
+S: \* OK \[UNSEEN 1\].*
+S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\\Seen( \\\*)?\)\].*
+S: \* OK \[HIGHESTMODSEQ \d+\].*
+S: \* OK \[UIDNEXT 5\].*
+S: 1f OK \[READ-WRITE\] SELECT completed.
+
+
+
+
+SESSION: 2
+C: 2a SELECT expungeresponse
+S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
+S: \* 4 EXISTS
+S: \* 0 RECENT
+S: \* OK \[UIDVALIDITY \d+\].*
+S: \* OK \[UNSEEN 1\].*
+S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\\Seen( \\\*)?\)\].*
+S: \* OK \[HIGHESTMODSEQ \d+\].*
+S: \* OK \[UIDNEXT 5\].*
+S: 2a OK \[READ-WRITE\] SELECT completed.
+
+# Do an expunge with session 1
+# MSN 1 and 3 will be deleted
+# after that MSN 1 should point initial message 3 and MSN 2 initial message 4
+SESSION: 1
+
+# MSN 1 points to initial message 1
+C: 1g FETCH 1 (BODY[])
+S: \* 1 FETCH \(.*\) BODY\[\] \{254\}
+S: Date: Mon, 7 Feb 1994 21:52:25 -0800 \(PST\)
+S: From: Fred Foobar <fo...@Blurdybloop.COM>
+S: Subject: Test 01
+S: To: mooch@owatagu.siam.edu
+S: Message-Id: <B2...@Blurdybloop.COM>
+S: MIME-Version: 1.0
+S: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+S:
+S: Test 01
+S: \)
+S: 1g OK FETCH completed\.
+
+C: 1h EXPUNGE
+S: \* 1 EXPUNGE
+S: \* 2 EXPUNGE
+S: \* 2 RECENT
+S: 1h OK EXPUNGE completed.
+
+# MSN 1 now points to initial message 2
+C: 1i FETCH 1 (BODY[])
+S: \* 1 FETCH \(FLAGS \(.*\) BODY\[\] \{254\}
+S: Date: Mon, 7 Feb 1994 21:52:25 -0800 \(PST\)
+S: From: Fred Foobar <fo...@Blurdybloop.COM>
+S: Subject: Test 02
+S: To: mooch@owatagu.siam.edu
+S: Message-Id: <B2...@Blurdybloop.COM>
+S: MIME-Version: 1.0
+S: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+S:
+S: Test 02
+S: \)
+S: 1i OK FETCH completed\.
+
+# Make sure session 2 gets expunge responses
+SESSION: 2
+C: 2b NOOP
+S: \* 1 EXPUNGE
+S: \* 2 EXPUNGE
+S: \* 1 FETCH \(FLAGS \(\\Seen\)\)
+S: 2b OK NOOP completed.
+
+# Make sure mapping was updated
+
+C: 2c FETCH 1 (BODY[])
+S: \* 1 FETCH \(.*BODY\[\] \{254\}
+S: Date: Mon, 7 Feb 1994 21:52:25 -0800 \(PST\)
+S: From: Fred Foobar <fo...@Blurdybloop.COM>
+S: Subject: Test 02
+S: To: mooch@owatagu.siam.edu
+S: Message-Id: <B2...@Blurdybloop.COM>
+S: MIME-Version: 1.0
+S: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+S:
+S: Test 02
+S: \)
+S: 2c OK FETCH completed\.
+
+


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