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 d05b76bb688db8466c5c9b00752d10eeb044e598 Author: Quan Tran <[email protected]> AuthorDate: Thu Jun 4 14:50:00 2026 +0700 [REFACTORING] Split IMAPServerPlainAuthDisallowedSSLTest --- .../IMAPServerPlainAuthDisallowedSSLTest.java | 62 ++++++++++++++++++++++ .../james/imapserver/netty/IMAPServerTest.java | 33 ------------ 2 files changed, 62 insertions(+), 33 deletions(-) diff --git a/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerPlainAuthDisallowedSSLTest.java b/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerPlainAuthDisallowedSSLTest.java new file mode 100644 index 0000000000..51e7249e08 --- /dev/null +++ b/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerPlainAuthDisallowedSSLTest.java @@ -0,0 +1,62 @@ +/**************************************************************** + * 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 org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatCode; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + + +@SuppressWarnings("checkstyle:membername") +class IMAPServerPlainAuthDisallowedSSLTest extends AbstractIMAPServerTest { + IMAPServer imapServer; + private int port; + + @BeforeEach + void beforeEach() throws Exception { + imapServer = createImapServer("imapServerPlainAuthAllowed.xml"); + port = imapServer.getListenAddresses().get(0).getPort(); + } + + @AfterEach + void tearDown() { + imapServer.destroy(); + } + + @Test + void loginShouldSucceedOnUnEncryptedChannel() { + assertThatCode(() -> + testIMAPClient.connect("127.0.0.1", port) + .login(USER.asString(), USER_PASS)) + .doesNotThrowAnyException(); + } + + @Test + void capabilityShouldAdvertiseLoginOnUnEncryptedChannel() throws Exception { + testIMAPClient.connect("127.0.0.1", port); + + assertThat(testIMAPClient.capability()) + .doesNotContain("LOGINDISABLED") + .contains("AUTH=PLAIN"); + } +} 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 8926e4fc9b..5ba5df22b4 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 @@ -260,39 +260,6 @@ class IMAPServerTest { - @Nested - class PlainAuthDisallowedSSL { - IMAPServer imapServer; - private int port; - - @BeforeEach - void beforeEach() throws Exception { - imapServer = createImapServer("imapServerPlainAuthAllowed.xml"); - port = imapServer.getListenAddresses().get(0).getPort(); - } - - @AfterEach - void tearDown() { - imapServer.destroy(); - } - - @Test - void loginShouldSucceedOnUnEncryptedChannel() { - assertThatCode(() -> - testIMAPClient.connect("127.0.0.1", port) - .login(USER.asString(), USER_PASS)) - .doesNotThrowAnyException(); - } - - @Test - void capabilityShouldAdvertiseLoginOnUnEncryptedChannel() throws Exception { - testIMAPClient.connect("127.0.0.1", port); - - assertThat(testIMAPClient.capability()) - .doesNotContain("LOGINDISABLED") - .contains("AUTH=PLAIN"); - } - } @Nested class AuthenticationRequireSSL { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
