You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2022/03/22 02:03:39 UTC

[james-project] 10/25: JAMES-3722 Test IMAP CLOSE in regard of QRESYNC

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 63f93c47ffff2476b4e25854c88d4f9e09f5bc02
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Tue Mar 8 08:49:57 2022 +0700

    JAMES-3722 Test IMAP CLOSE in regard of QRESYNC
---
 .../james/imapserver/netty/IMAPServerTest.java     | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java b/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
index fb2d92b..e4979ea 100644
--- a/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
+++ b/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
@@ -1752,5 +1752,28 @@ class IMAPServerTest {
                 .filteredOn(s -> s.contains("* OK [CLOSED]"))
                 .hasSize(1);
         }
+
+        @Test
+        void closeShouldNotReturnHighestModseqWhenUsingQResync() throws Exception {
+            // See https://www.rfc-editor.org/errata_search.php?rfc=5162
+            memoryIntegrationResources.getMailboxManager()
+                .createMailbox(MailboxPath.forUser(USER, "other"), mailboxSession);
+            SocketChannel server = SocketChannel.open();
+            server.connect(new InetSocketAddress(LOCALHOST_IP, port));
+            readBytes(server);
+
+            server.write(ByteBuffer.wrap(String.format("a0 LOGIN %s %s\r\n", USER.asString(), USER_PASS).getBytes(StandardCharsets.UTF_8)));
+            readBytes(server);
+            server.write(ByteBuffer.wrap(("a1 ENABLE QRESYNC\r\n").getBytes(StandardCharsets.UTF_8)));
+            readStringUntil(server, s -> s.contains("a1 OK ENABLE completed."));
+
+            server.write(ByteBuffer.wrap(("a2 SELECT INBOX\r\n").getBytes(StandardCharsets.UTF_8)));
+            readStringUntil(server, s -> s.contains("a2 OK [READ-WRITE] SELECT completed."));
+
+            server.write(ByteBuffer.wrap(("a3 CLOSE\r\n").getBytes(StandardCharsets.UTF_8)));
+
+            assertThat(readStringUntil(server, s -> s.contains("a3 OK CLOSE completed.")))
+                .isNotNull();
+        }
     }
 }

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