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 2026/06/04 12:35:23 UTC
(james-project) 08/31: [REFACTORING] Split IMAPServerCompressWithSSLTest
This is an automated email from the ASF dual-hosted git repository.
chibenwa pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit b491d852ddc4fc543fcda803b104bad6fb00788c
Author: Quan Tran <hq...@linagora.com>
AuthorDate: Thu Jun 4 14:18:58 2026 +0700
[REFACTORING] Split IMAPServerCompressWithSSLTest
---
.../netty/IMAPServerCompressWithSSLTest.java | 85 ++++++++++++++++++++++
.../james/imapserver/netty/IMAPServerTest.java | 49 -------------
2 files changed, 85 insertions(+), 49 deletions(-)
diff --git a/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerCompressWithSSLTest.java b/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerCompressWithSSLTest.java
new file mode 100644
index 0000000000..7aee59ec12
--- /dev/null
+++ b/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerCompressWithSSLTest.java
@@ -0,0 +1,85 @@
+/****************************************************************
+ * 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. *
+ ****************************************************************/
+
+package org.apache.james.imapserver.netty;
+
+import static jakarta.mail.Folder.READ_WRITE;
+
+import java.util.Properties;
+
+import jakarta.mail.FetchProfile;
+import jakarta.mail.Session;
+import jakarta.mail.Store;
+
+import org.apache.james.mailbox.MailboxSession;
+import org.apache.james.mailbox.MessageManager;
+import org.apache.james.mailbox.inmemory.InMemoryMailboxManager;
+import org.apache.james.mailbox.model.MailboxPath;
+import org.eclipse.angus.mail.imap.IMAPFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+
+@SuppressWarnings("checkstyle:membername")
+class IMAPServerCompressWithSSLTest extends AbstractIMAPServerTest {
+ IMAPServer imapServer;
+ private int port;
+
+ @BeforeEach
+ void beforeEach() throws Exception {
+ imapServer = createImapServer("imapServerSSLCompress.xml");
+ port = imapServer.getListenAddresses().get(0).getPort();
+ }
+
+ @AfterEach
+ void tearDown() {
+ imapServer.destroy();
+ }
+
+ @Test
+ void shouldNotThrowWhenCompressionEnabled() throws Exception {
+ InMemoryMailboxManager mailboxManager = memoryIntegrationResources.getMailboxManager();
+ MailboxSession mailboxSession = mailboxManager.createSystemSession(USER);
+ mailboxManager.createMailbox(
+ MailboxPath.inbox(USER),
+ mailboxSession);
+ mailboxManager.getMailbox(MailboxPath.inbox(USER), mailboxSession)
+ .appendMessage(MessageManager.AppendCommand.builder().build("header: value\r\n\r\nbody"), mailboxSession);
+
+ Properties props = new Properties();
+ props.put("mail.imaps.user", USER.asString());
+ props.put("mail.imaps.host", "127.0.0.1");
+ props.put("mail.imaps.auth.mechanisms", "LOGIN");
+ props.put("mail.imaps.compress.enable", true);
+ props.put("mail.imaps.ssl.enable", "true");
+ props.put("mail.imaps.ssl.trust", "*");
+ props.put("mail.imaps.ssl.checkserveridentity", "false");
+ final Session session = Session.getInstance(props);
+ final Store store = session.getStore("imaps");
+ store.connect("127.0.0.1", port, USER.asString(), USER_PASS);
+ final FetchProfile fetchProfile = new FetchProfile();
+ fetchProfile.add(FetchProfile.Item.ENVELOPE);
+ final IMAPFolder inbox = (IMAPFolder) store.getFolder("INBOX");
+ inbox.open(READ_WRITE);
+
+ inbox.getMessageByUID(1);
+ }
+
+}
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 6430df0c8f..5d0d14d522 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
@@ -20,7 +20,6 @@
package org.apache.james.imapserver.netty;
import static jakarta.mail.Flags.Flag.ANSWERED;
-import static jakarta.mail.Folder.READ_WRITE;
import static org.apache.james.jmap.JMAPTestingConstants.LOCALHOST_IP;
import static org.apache.james.jwt.OidcTokenFixture.INTROSPECTION_RESPONSE;
import static org.apache.james.mailbox.MessageManager.FlagsUpdateMode.REPLACE;
@@ -58,7 +57,6 @@ import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
-import jakarta.mail.FetchProfile;
import jakarta.mail.Flags;
import jakarta.mail.Folder;
import jakarta.mail.Message;
@@ -111,7 +109,6 @@ import org.apache.james.util.concurrency.ConcurrentTestRunner;
import org.apache.james.utils.TestIMAPClient;
import org.assertj.core.api.SoftAssertions;
import org.awaitility.Awaitility;
-import org.eclipse.angus.mail.imap.IMAPFolder;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
@@ -238,52 +235,6 @@ class IMAPServerTest {
- @Nested
- class CompressWithSSL {
- IMAPServer imapServer;
- private int port;
-
- @BeforeEach
- void beforeEach() throws Exception {
- imapServer = createImapServer("imapServerSSLCompress.xml");
- port = imapServer.getListenAddresses().get(0).getPort();
- }
-
- @AfterEach
- void tearDown() {
- imapServer.destroy();
- }
-
- @Test
- void shouldNotThrowWhenCompressionEnabled() throws Exception {
- InMemoryMailboxManager mailboxManager = memoryIntegrationResources.getMailboxManager();
- MailboxSession mailboxSession = mailboxManager.createSystemSession(USER);
- mailboxManager.createMailbox(
- MailboxPath.inbox(USER),
- mailboxSession);
- mailboxManager.getMailbox(MailboxPath.inbox(USER), mailboxSession)
- .appendMessage(MessageManager.AppendCommand.builder().build("header: value\r\n\r\nbody"), mailboxSession);
-
- Properties props = new Properties();
- props.put("mail.imaps.user", USER.asString());
- props.put("mail.imaps.host", "127.0.0.1");
- props.put("mail.imaps.auth.mechanisms", "LOGIN");
- props.put("mail.imaps.compress.enable", true);
- props.put("mail.imaps.ssl.enable", "true");
- props.put("mail.imaps.ssl.trust", "*");
- props.put("mail.imaps.ssl.checkserveridentity", "false");
- final Session session = Session.getInstance(props);
- final Store store = session.getStore("imaps");
- store.connect("127.0.0.1", port, USER.asString(), USER_PASS);
- final FetchProfile fetchProfile = new FetchProfile();
- fetchProfile.add(FetchProfile.Item.ENVELOPE);
- final IMAPFolder inbox = (IMAPFolder) store.getFolder("INBOX");
- inbox.open(READ_WRITE);
-
- inbox.getMessageByUID(1);
- }
-
- }
public static class BlindTrustManager implements X509TrustManager {
public X509Certificate[] getAcceptedIssuers() {
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org