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 <[email protected]> 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 <[email protected]>\r\n" + + "Subject: afternoon meeting 2\r\n" + + "To: [email protected]\r\n" + + "Message-Id: <[email protected]>\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: [email protected] For additional commands, e-mail: [email protected]
