You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by GitBox <gi...@apache.org> on 2022/03/08 03:37:36 UTC

[GitHub] [james-project] chibenwa opened a new pull request #910: JAMES-3715 Add TCP transport level tests for IMAP IDLE

chibenwa opened a new pull request #910:
URL: https://github.com/apache/james-project/pull/910


   In the face of Netty4 migration, pipeline modifications (which IDLE does)
   deserves to be seriously tested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [james-project] chibenwa commented on a change in pull request #910: JAMES-3715 Add TCP transport level tests for IMAP IDLE

Posted by GitBox <gi...@apache.org>.
chibenwa commented on a change in pull request #910:
URL: https://github.com/apache/james-project/pull/910#discussion_r822450023



##########
File path: server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
##########
@@ -970,4 +977,106 @@ void searchingASingleUTF8CriterionShouldComplete() throws Exception {
             store.close();
         }
     }
+
+    @Nested
+    class Idle {
+        IMAPServer imapServer;
+        private int port;
+        private MailboxSession mailboxSession;
+        private MessageManager inbox;
+
+        @BeforeEach
+        void beforeEach() throws Exception {
+            imapServer = createImapServer("imapServer.xml");
+            port = imapServer.getListenAddresses().get(0).getPort();
+            mailboxSession = memoryIntegrationResources.getMailboxManager().createSystemSession(USER);
+            memoryIntegrationResources.getMailboxManager()
+                .createMailbox(MailboxPath.inbox(USER), mailboxSession);
+            inbox = memoryIntegrationResources.getMailboxManager().getMailbox(MailboxPath.inbox(USER), mailboxSession);
+        }
+
+        @AfterEach
+        void tearDown() {
+            imapServer.destroy();
+        }
+
+        @Test
+        void idleShouldSendInitialContinuation() throws Exception {
+            SocketChannel server = SocketChannel.open();

Review comment:
       > This is more like a client than a server?
   
   Yes we are opening a TCP client connection to test the server.
   
   > BTW should we put this SocketChannel.open() into BeforeEach and close it in AfterEach?
   
   :+1: 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [james-project] quantranhong1999 commented on a change in pull request #910: JAMES-3715 Add TCP transport level tests for IMAP IDLE

Posted by GitBox <gi...@apache.org>.
quantranhong1999 commented on a change in pull request #910:
URL: https://github.com/apache/james-project/pull/910#discussion_r822437211



##########
File path: server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
##########
@@ -970,4 +977,106 @@ void searchingASingleUTF8CriterionShouldComplete() throws Exception {
             store.close();
         }
     }
+
+    @Nested
+    class Idle {
+        IMAPServer imapServer;
+        private int port;
+        private MailboxSession mailboxSession;
+        private MessageManager inbox;
+
+        @BeforeEach
+        void beforeEach() throws Exception {
+            imapServer = createImapServer("imapServer.xml");
+            port = imapServer.getListenAddresses().get(0).getPort();
+            mailboxSession = memoryIntegrationResources.getMailboxManager().createSystemSession(USER);
+            memoryIntegrationResources.getMailboxManager()
+                .createMailbox(MailboxPath.inbox(USER), mailboxSession);
+            inbox = memoryIntegrationResources.getMailboxManager().getMailbox(MailboxPath.inbox(USER), mailboxSession);
+        }
+
+        @AfterEach
+        void tearDown() {
+            imapServer.destroy();
+        }
+
+        @Test
+        void idleShouldSendInitialContinuation() throws Exception {
+            SocketChannel server = SocketChannel.open();

Review comment:
       This is more like a client than a server? BTW should we put this SocketChannel.open() into BeforeEach and close it in AfterEach?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [james-project] Arsnael commented on a change in pull request #910: JAMES-3715 Add TCP transport level tests for IMAP IDLE

Posted by GitBox <gi...@apache.org>.
Arsnael commented on a change in pull request #910:
URL: https://github.com/apache/james-project/pull/910#discussion_r825566745



##########
File path: server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
##########
@@ -995,134 +996,115 @@ void beforeEach() throws Exception {
             memoryIntegrationResources.getMailboxManager()
                 .createMailbox(MailboxPath.inbox(USER), mailboxSession);
             inbox = memoryIntegrationResources.getMailboxManager().getMailbox(MailboxPath.inbox(USER), mailboxSession);
+
+            clientConnection = SocketChannel.open();
+            clientConnection.connect(new InetSocketAddress(LOCALHOST_IP, port));
+            readBytes(clientConnection);
         }
 
         @AfterEach
-        void tearDown() {
+        void tearDown() throws Exception {
             imapServer.destroy();
+            clientConnection.close();

Review comment:
       Shouldn't we close the client connection before destroying the server?

##########
File path: server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
##########
@@ -1034,11 +1038,73 @@ void idleShouldBeInterruptible() throws Exception {
             readStringUntil(server, s -> s.contains("+ Idling"));
 
             server.write(ByteBuffer.wrap(("DONE\r\n").getBytes(StandardCharsets.UTF_8)));
-            assertThat(readStringUntil(server, s -> s.contains("a3 OK IDLE completed.")))
-                .isNotNull();
+
+            Awaitility.await().atMost(Duration.ofSeconds(2)).untilAsserted(() ->
+                assertThat(readStringUntil(server, s -> s.contains("a3 OK IDLE completed.")))
+                    .isNotNull());
+        }
+
+        @Test
+        void idleShouldBeInterruptibleWhenBatched() throws Exception {
+            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(("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 IDLE\r\nDONE\r\n").getBytes(StandardCharsets.UTF_8)));
+
+            Awaitility.await().atMost(Duration.ofSeconds(2)).untilAsserted(() ->
+                assertThat(readStringUntil(server, s -> s.contains("a3 OK IDLE completed.")))
+                    .isNotNull());
         }
 
         @Test
+        void idleShouldResponsesShouldBeOrdered() throws Exception {

Review comment:
       ```suggestion
           void idleResponsesShouldBeOrdered() throws Exception {
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [james-project] chibenwa merged pull request #910: JAMES-3715 Add TCP transport level tests for IMAP IDLE

Posted by GitBox <gi...@apache.org>.
chibenwa merged pull request #910:
URL: https://github.com/apache/james-project/pull/910


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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