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 2021/02/17 01:46:46 UTC
[james-project] 08/13: JAMES-3500 Leverage PER_CLASS James server
test lifecycle where possible
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 4d7223c68e00c426846b663ba11e1107c889ddbf
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Feb 14 16:44:41 2021 +0700
JAMES-3500 Leverage PER_CLASS James server test lifecycle where possible
---
.../java/org/apache/james/CassandraCacheQueryTest.java | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/CassandraCacheQueryTest.java b/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/CassandraCacheQueryTest.java
index bd92057..a9cd178 100644
--- a/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/CassandraCacheQueryTest.java
+++ b/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/CassandraCacheQueryTest.java
@@ -47,7 +47,7 @@ import org.apache.james.utils.TestIMAPClient;
import org.apache.mailet.base.test.FakeMail;
import org.awaitility.Awaitility;
import org.awaitility.core.ConditionFactory;
-import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
@@ -97,7 +97,7 @@ class CassandraCacheQueryTest {
@RegisterExtension
static JamesServerExtension jamesServerExtension = WithCacheImmutableTest.baseExtensionBuilder()
- .lifeCycle(JamesServerExtension.Lifecycle.PER_TEST)
+ .lifeCycle(JamesServerExtension.Lifecycle.PER_CLASS)
.overrideServerModule(new TestingSessionModule())
.build();
@@ -113,11 +113,11 @@ class CassandraCacheQueryTest {
.and().pollDelay(ONE_HUNDRED_MILLISECONDS)
.await();
- private StatementRecorder statementRecorder;
+ private static StatementRecorder statementRecorder;
- @BeforeEach
- void beforeEach(GuiceJamesServer server) throws Exception {
- this.statementRecorder = new StatementRecorder();
+ @BeforeAll
+ static void beforeEach(GuiceJamesServer server) throws Exception {
+ statementRecorder = new StatementRecorder();
server.getProbe(DataProbeImpl.class).fluent()
.addDomain(DOMAIN)
.addUser(JAMES_USER, PASSWORD);
@@ -145,7 +145,7 @@ class CassandraCacheQueryTest {
.isNotEmpty();
}
- private void readAMail(GuiceJamesServer server) throws IOException {
+ private static void readAMail(GuiceJamesServer server) throws IOException {
try (TestIMAPClient reader = new TestIMAPClient()) {
int imapPort = server.getProbe(ImapGuiceProbe.class).getImapPort();
reader.connect(JAMES_SERVER_HOST, imapPort)
@@ -158,7 +158,7 @@ class CassandraCacheQueryTest {
}
}
- private void sendAMail(GuiceJamesServer server) throws IOException, MessagingException {
+ private static void sendAMail(GuiceJamesServer server) throws IOException, MessagingException {
Port smtpPort = server.getProbe(SmtpGuiceProbe.class).getSmtpPort();
try (SMTPMessageSender sender = new SMTPMessageSender(Domain.LOCALHOST.asString())) {
sender.connect(JAMES_SERVER_HOST, smtpPort);
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org