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/05/12 01:41:15 UTC

[james-project] 01/05: JAMES-3737 IMAPServerTest: tests for non synchronized litterals

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 5f2271a1f74f1a27ad01fbe26de73e7e619cc3c7
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed May 11 10:43:29 2022 +0700

    JAMES-3737 IMAPServerTest: tests for non synchronized litterals
---
 .../james/imapserver/netty/IMAPServerTest.java     | 44 ++++++++++++++++++++++
 1 file changed, 44 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 0ac6057c5d..aea7bda099 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
@@ -338,6 +338,50 @@ class IMAPServerTest {
         }
     }
 
+    @Nested
+    class AppendNonSynchronizedLitterals {
+        IMAPServer imapServer;
+        private SocketChannel clientConnection;
+
+        @BeforeEach
+        void beforeEach() throws Exception {
+            imapServer = createImapServer("imapServerNoLimits.xml");
+            int port = imapServer.getListenAddresses().get(0).getPort();
+            memoryIntegrationResources.getMailboxManager()
+                .createMailbox(MailboxPath.inbox(USER), memoryIntegrationResources.getMailboxManager().createSystemSession(USER));
+            clientConnection = SocketChannel.open();
+            clientConnection.connect(new InetSocketAddress(LOCALHOST_IP, port));
+            readBytes(clientConnection);
+        }
+
+        @AfterEach
+        void tearDown() throws Exception {
+            clientConnection.close();
+            imapServer.destroy();
+        }
+
+        @Test
+        void appendShouldSucceedWhenNonSynchronized() throws Exception {
+            clientConnection.write(ByteBuffer.wrap(String.format("a0 LOGIN %s %s\r\n", USER.asString(), USER_PASS).getBytes(StandardCharsets.UTF_8)));
+            readBytes(clientConnection);
+
+            String msg = "Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)\r\n" +
+                "From: Fred Foobar <fo...@Blurdybloop.COM>\r\n" +
+                "Subject: afternoon meeting 2\r\n" +
+                "To: mooch@owatagu.siam.edu\r\n" +
+                "Message-Id: <B2...@Blurdybloop.COM>\r\n" +
+                "MIME-Version: 1.0\r\n" +
+                "Content-Type: TEXT/PLAIN; CHARSET=US-ASCII\r\n" +
+                "C:\r\n" +
+                "Hello Joe, could we change that to 4:00pm tomorrow?\r\n";
+            clientConnection.write(ByteBuffer.wrap(("A004 APPEND INBOX {" + msg.length() + "+}\r\n" +
+                msg + "\r\n").getBytes(StandardCharsets.UTF_8)));
+
+            assertThat(new String(readBytes(clientConnection), StandardCharsets.US_ASCII)).contains("APPEND completed.");
+
+        }
+    }
+
     @Nested
     class Compress {
         IMAPServer imapServer;


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