james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [09/22] james-project git commit: MAILBOX-350 Review MailboxManagerTest: Migrate to Junit 5
Date Wed, 21 Nov 2018 10:07:19 GMT
MAILBOX-350 Review MailboxManagerTest: Migrate to Junit 5


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/0d28c9df
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/0d28c9df
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/0d28c9df

Branch: refs/heads/master
Commit: 0d28c9df79b6e58fd06518ba9ecb6abcd7121110
Parents: 7c19e19
Author: Benoit Tellier <btellier@linagora.com>
Authored: Tue Nov 20 13:38:18 2018 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Wed Nov 21 16:40:36 2018 +0700

----------------------------------------------------------------------
 .../james/mailbox/MailboxManagerTest.java       |  76 ++++++------
 .../cassandra/CassandraMailboxManagerTest.java  |  42 ++-----
 mailbox/jpa/pom.xml                             |  21 +++-
 .../mailbox/jpa/JPAMailboxManagerTest.java      | 121 +++++++++----------
 mailbox/maildir/pom.xml                         |  25 +++-
 .../DomainUserMaildirMailboxManagerTest.java    |  21 ++--
 .../FullUserMaildirMailboxManagerTest.java      |  18 +--
 .../maildir/MaildirMailboxManagerProvider.java  |   7 +-
 mailbox/memory/pom.xml                          |  20 ++-
 .../inmemory/MemoryMailboxManagerTest.java      |   8 --
 10 files changed, 171 insertions(+), 188 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/0d28c9df/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
index 17bdc33..7be9d23 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
@@ -22,6 +22,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatCode;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.assertj.core.api.SoftAssertions.assertSoftly;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
 
 import java.nio.charset.StandardCharsets;
 import java.time.Duration;
@@ -51,8 +52,9 @@ import org.apache.james.mailbox.model.search.MailboxQuery;
 import org.apache.james.mailbox.util.EventCollector;
 import org.apache.james.mime4j.dom.Message;
 import org.apache.james.util.concurrency.ConcurrentTestRunner;
-import org.junit.Assume;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableList;
@@ -92,6 +94,7 @@ public abstract class MailboxManagerTest {
 
     protected abstract MailboxManager provideMailboxManager() throws MailboxException;
 
+    @BeforeEach
     public void setUp() throws Exception {
         this.mailboxManager = provideMailboxManager();
 
@@ -100,6 +103,7 @@ public abstract class MailboxManagerTest {
             .setBody("testmail", StandardCharsets.UTF_8);
     }
 
+    @AfterEach
     public void tearDown() throws Exception {
         mailboxManager.logout(session, false);
         mailboxManager.endProcessingRequest(session);
@@ -255,7 +259,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void searchShouldNotReturnResultsFromOtherNamespaces() throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Namespace));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Namespace));
         session = mailboxManager.createSystemSession(USER_1);
         mailboxManager.createMailbox(new MailboxPath("other_namespace", USER_1, "Other"),
session);
         mailboxManager.createMailbox(MailboxPath.inbox(session), session);
@@ -284,7 +288,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void updateAnnotationsShouldUpdateStoredAnnotation() throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
         session = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox = MailboxPath.inbox(session);
         mailboxManager.createMailbox(inbox, session);
@@ -297,7 +301,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void updateAnnotationsShouldDeleteAnnotationWithNilValue() throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
         session = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox = MailboxPath.inbox(session);
         mailboxManager.createMailbox(inbox, session);
@@ -310,7 +314,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void updateAnnotationsShouldThrowExceptionIfMailboxDoesNotExist() throws Exception
{
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
         session = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox = MailboxPath.inbox(session);
 
@@ -320,7 +324,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void getAnnotationsShouldReturnEmptyForNonStoredAnnotation() throws Exception
{
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
         session = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox = MailboxPath.inbox(session);
         mailboxManager.createMailbox(inbox, session);
@@ -330,7 +334,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void getAllAnnotationsShouldRetrieveStoredAnnotations() throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
         session = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox = MailboxPath.inbox(session);
         mailboxManager.createMailbox(inbox, session);
@@ -342,7 +346,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void getAllAnnotationsShouldThrowExceptionIfMailboxDoesNotExist() throws Exception
{
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
         session = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox = MailboxPath.inbox(session);
 
@@ -352,7 +356,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void getAnnotationsByKeysShouldRetrieveStoresAnnotationsByKeys() throws Exception
{
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
         session = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox = MailboxPath.inbox(session);
         mailboxManager.createMailbox(inbox, session);
@@ -365,7 +369,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void getAnnotationsByKeysShouldThrowExceptionIfMailboxDoesNotExist() throws Exception
{
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
         session = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox = MailboxPath.inbox(session);
 
@@ -375,7 +379,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void getAnnotationsByKeysWithOneDepthShouldRetriveAnnotationsWithOneDepth() throws
Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
         session = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox = MailboxPath.inbox(session);
         mailboxManager.createMailbox(inbox, session);
@@ -388,7 +392,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void getAnnotationsByKeysWithAllDepthShouldThrowExceptionWhenMailboxDoesNotExist()
throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
         session = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox = MailboxPath.inbox(session);
 
@@ -398,7 +402,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void getAnnotationsByKeysWithAllDepthShouldRetriveAnnotationsWithAllDepth() throws
Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
         session = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox = MailboxPath.inbox(session);
         mailboxManager.createMailbox(inbox, session);
@@ -411,7 +415,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void updateAnnotationsShouldThrowExceptionIfAnnotationDataIsOverLimitation() throws
Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
         session = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox = MailboxPath.inbox(session);
         mailboxManager.createMailbox(inbox, session);
@@ -422,7 +426,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void shouldUpdateAnnotationWhenRequestCreatesNewAndMailboxIsNotOverLimit() throws
Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
         session = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox = MailboxPath.inbox(session);
         mailboxManager.createMailbox(inbox, session);
@@ -437,7 +441,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void updateAnnotationsShouldThrowExceptionIfRequestCreateNewButMailboxIsOverLimit()
throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Annotation));
         session = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox = MailboxPath.inbox(session);
         mailboxManager.createMailbox(inbox, session);
@@ -454,7 +458,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void searchShouldNotDuplicateMailboxWhenReportedAsUserMailboxesAndUserHasRightOnMailboxes()
throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
         MailboxSession session1 = mailboxManager.createSystemSession(USER_1);
         MailboxPath inbox1 = MailboxPath.inbox(session1);
         mailboxManager.createMailbox(inbox1, session1);
@@ -477,7 +481,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void searchShouldIncludeDelegatedMailboxes() throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
         MailboxSession session1 = mailboxManager.createSystemSession(USER_1);
         MailboxSession session2 = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox1 = MailboxPath.inbox(session1);
@@ -500,7 +504,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void searchShouldCombinePrivateAndDelegatedMailboxes() throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
         MailboxSession session1 = mailboxManager.createSystemSession(USER_1);
         MailboxSession session2 = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox1 = MailboxPath.inbox(session1);
@@ -525,7 +529,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void searchShouldAllowUserFiltering() throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
         MailboxSession session1 = mailboxManager.createSystemSession(USER_1);
         MailboxSession session2 = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox1 = MailboxPath.inbox(session1);
@@ -551,7 +555,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void searchShouldAllowNamespaceFiltering() throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
         MailboxSession session1 = mailboxManager.createSystemSession(USER_1);
         MailboxSession session2 = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox1 = MailboxPath.inbox(session1);
@@ -584,7 +588,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void searchForMessageShouldReturnMessagesFromAllMyMailboxesIfNoMailboxesAreSpecified()
throws Exception {
-        Assume.assumeTrue(mailboxManager
+        assumeTrue(mailboxManager
             .getSupportedMessageCapabilities()
             .contains(MailboxManager.MessageCapabilities.UniqueID));
 
@@ -616,7 +620,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void searchForMessageShouldReturnMessagesFromMyDelegatedMailboxes() throws Exception
{
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
 
         session = mailboxManager.createSystemSession(USER_1);
         MailboxSession sessionFromDelegater = mailboxManager.createSystemSession(USER_2);
@@ -645,7 +649,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void searchForMessageShouldNotReturnMessagesFromMyDelegatedMailboxesICanNotRead()
throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
 
         session = mailboxManager.createSystemSession(USER_1);
         MailboxSession sessionFromDelegater = mailboxManager.createSystemSession(USER_2);
@@ -672,7 +676,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void searchForMessageShouldOnlySearchInMailboxICanRead() throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
 
         session = mailboxManager.createSystemSession(USER_1);
         MailboxSession sessionFromDelegater = mailboxManager.createSystemSession(USER_2);
@@ -692,7 +696,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void searchForMessageShouldIgnoreMailboxThatICanNotRead() throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
 
         session = mailboxManager.createSystemSession(USER_1);
         MailboxSession sessionFromDelegater = mailboxManager.createSystemSession(USER_2);
@@ -713,7 +717,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void searchForMessageShouldCorrectlyExcludeMailbox() throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
 
         session = mailboxManager.createSystemSession(USER_1);
         MailboxPath otherMailboxPath = MailboxPath.forUser(USER_1, "SHARED");
@@ -733,7 +737,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void searchForMessageShouldPriorizeExclusionFromInclusion() throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
 
         session = mailboxManager.createSystemSession(USER_1);
         MailboxPath otherMailboxPath = MailboxPath.forUser(USER_1, "SHARED");
@@ -754,7 +758,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void searchForMessageShouldOnlySearchInGivenMailbox() throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
 
         session = mailboxManager.createSystemSession(USER_1);
 
@@ -783,7 +787,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void searchShouldNotReturnNoMoreDelegatedMailboxes() throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
         MailboxSession session1 = mailboxManager.createSystemSession(USER_1);
         MailboxSession session2 = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox1 = MailboxPath.inbox(session1);
@@ -812,7 +816,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void getMailboxCountersShouldReturnDefaultValueWhenNoReadRight() throws Exception
{
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
         MailboxSession session1 = mailboxManager.createSystemSession(USER_1);
         MailboxSession session2 = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox1 = MailboxPath.inbox(session1);
@@ -838,7 +842,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void getMailboxCountersShouldReturnStoredValueWhenReadRight() throws Exception
{
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
         MailboxSession session1 = mailboxManager.createSystemSession(USER_1);
         MailboxSession session2 = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox1 = MailboxPath.inbox(session1);
@@ -868,7 +872,7 @@ public abstract class MailboxManagerTest {
     @Test
     @SuppressWarnings("unchecked")
     public void getMetaDataShouldReturnDefaultValueWhenNoReadRight() throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.ACL));
         MailboxSession session1 = mailboxManager.createSystemSession(USER_1);
         MailboxSession session2 = mailboxManager.createSystemSession(USER_2);
         MailboxPath inbox1 = MailboxPath.inbox(session1);
@@ -914,7 +918,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void addingMessageShouldFireQuotaUpdateEvent() throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Quota));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Quota));
         session = mailboxManager.createSystemSession(USER_1);
 
         EventCollector listener = new EventCollector();
@@ -933,7 +937,7 @@ public abstract class MailboxManagerTest {
 
     @Test
     public void deleteMailboxShouldFireMailboxDeletionEvent() throws Exception {
-        Assume.assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Quota));
+        assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Quota));
         session = mailboxManager.createSystemSession(USER_1);
 
         EventCollector listener = new EventCollector();

http://git-wip-us.apache.org/repos/asf/james-project/blob/0d28c9df/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerTest.java
b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerTest.java
index 8193bca..b44e40d 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerTest.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerTest.java
@@ -18,48 +18,20 @@
  ****************************************************************/
 package org.apache.james.mailbox.cassandra;
 
-import org.apache.james.backends.cassandra.CassandraCluster;
-import org.apache.james.backends.cassandra.DockerCassandraRule;
+import org.apache.james.backends.cassandra.CassandraClusterExtension;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxManagerTest;
 import org.apache.james.mailbox.cassandra.mail.MailboxAggregateModule;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 public class CassandraMailboxManagerTest extends MailboxManagerTest {
-
-    @ClassRule public static DockerCassandraRule cassandraServer = new DockerCassandraRule();
-    
-    private static CassandraCluster cassandra;
-
-    @BeforeClass
-    public static void setUpClass() {
-        cassandra = CassandraCluster.create(MailboxAggregateModule.MODULE_WITH_QUOTA, cassandraServer.getHost());
-    }
-
-    @Before
-    public void setup() throws Exception {
-        super.setUp();
-    }
+    @RegisterExtension
+    static CassandraClusterExtension cassandra = new CassandraClusterExtension(MailboxAggregateModule.MODULE_WITH_QUOTA);
 
     @Override
     protected MailboxManager provideMailboxManager() {
-        return CassandraMailboxManagerProvider.provideMailboxManager(cassandra.getConf(),
cassandra.getTypesProvider());
+        return CassandraMailboxManagerProvider.provideMailboxManager(
+            cassandra.getCassandraCluster().getConf(),
+            cassandra.getCassandraCluster().getTypesProvider());
     }
-
-    @Override
-    @After
-    public void tearDown() throws Exception {
-        super.tearDown();
-        cassandra.clearTables();
-    }
-
-    @AfterClass
-    public static void tearDownClass() {
-        cassandra.closeCluster();
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/0d28c9df/mailbox/jpa/pom.xml
----------------------------------------------------------------------
diff --git a/mailbox/jpa/pom.xml b/mailbox/jpa/pom.xml
index 8412119..35a8050 100644
--- a/mailbox/jpa/pom.xml
+++ b/mailbox/jpa/pom.xml
@@ -76,11 +76,6 @@
             <artifactId>javax.mail</artifactId>
         </dependency>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.derby</groupId>
             <artifactId>derby</artifactId>
             <scope>test</scope>
@@ -95,11 +90,25 @@
             <artifactId>jasypt</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.platform</groupId>
+            <artifactId>junit-platform-launcher</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.vintage</groupId>
+            <artifactId>junit-vintage-engine</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.mockito</groupId>
             <artifactId>mockito-core</artifactId>
             <scope>test</scope>
         </dependency>
-
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>

http://git-wip-us.apache.org/repos/asf/james-project/blob/0d28c9df/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPAMailboxManagerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPAMailboxManagerTest.java
b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPAMailboxManagerTest.java
index 5164cf7..e15c09c 100644
--- a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPAMailboxManagerTest.java
+++ b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPAMailboxManagerTest.java
@@ -1,65 +1,56 @@
-/****************************************************************
- * 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.mailbox.jpa;
-
-import java.util.Optional;
-
-import org.apache.james.backends.jpa.JpaTestCluster;
-import org.apache.james.mailbox.MailboxManager;
-import org.apache.james.mailbox.MailboxManagerTest;
-import org.apache.james.mailbox.exception.MailboxException;
-import org.apache.james.mailbox.jpa.openjpa.OpenJPAMailboxManager;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class JPAMailboxManagerTest extends MailboxManagerTest {
-
-    private static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.MAILBOX_PERSISTANCE_CLASSES);
-    private Optional<OpenJPAMailboxManager> openJPAMailboxManager = Optional.empty();
-
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-    }
-    
-    @Override
-    protected MailboxManager provideMailboxManager() {
-        if (!openJPAMailboxManager.isPresent()) {
-            openJPAMailboxManager = Optional.of(JpaMailboxManagerProvider.provideMailboxManager(JPA_TEST_CLUSTER));
-        }
-        return openJPAMailboxManager.get();
-    }
-
-    @Override
-    @After
-    public void tearDown() throws MailboxException {
-        JPA_TEST_CLUSTER.clear(JPAMailboxFixture.MAILBOX_TABLE_NAMES);
-    }
-
-    @Ignore("MAILBOX-343")
-    @Test
-    @Override
-    public void creatingConcurrentlyMailboxesWithSameParentShouldNotFail() {
-
-    }
-
-}
+/****************************************************************
+ * 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.mailbox.jpa;
+
+import java.util.Optional;
+
+import org.apache.james.backends.jpa.JpaTestCluster;
+import org.apache.james.mailbox.MailboxManager;
+import org.apache.james.mailbox.MailboxManagerTest;
+import org.apache.james.mailbox.jpa.openjpa.OpenJPAMailboxManager;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+public class JPAMailboxManagerTest extends MailboxManagerTest {
+
+    private static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.MAILBOX_PERSISTANCE_CLASSES);
+    private Optional<OpenJPAMailboxManager> openJPAMailboxManager = Optional.empty();
+    
+    @Override
+    protected MailboxManager provideMailboxManager() {
+        if (!openJPAMailboxManager.isPresent()) {
+            openJPAMailboxManager = Optional.of(JpaMailboxManagerProvider.provideMailboxManager(JPA_TEST_CLUSTER));
+        }
+        return openJPAMailboxManager.get();
+    }
+
+    @AfterEach
+    void tearDownJpa() {
+        JPA_TEST_CLUSTER.clear(JPAMailboxFixture.MAILBOX_TABLE_NAMES);
+    }
+
+    @Disabled("MAILBOX-343")
+    @Test
+    @Override
+    public void creatingConcurrentlyMailboxesWithSameParentShouldNotFail() {
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/0d28c9df/mailbox/maildir/pom.xml
----------------------------------------------------------------------
diff --git a/mailbox/maildir/pom.xml b/mailbox/maildir/pom.xml
index 4db348e..b2a6b61 100644
--- a/mailbox/maildir/pom.xml
+++ b/mailbox/maildir/pom.xml
@@ -61,6 +61,11 @@
             <artifactId>apache-mime4j-dom</artifactId>
         </dependency>
         <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-testing</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>ch.qos.logback</groupId>
             <artifactId>logback-classic</artifactId>
             <scope>test</scope>
@@ -74,11 +79,6 @@
             <artifactId>commons-io</artifactId>
         </dependency>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
         </dependency>
@@ -88,6 +88,21 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.platform</groupId>
+            <artifactId>junit-platform-launcher</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.vintage</groupId>
+            <artifactId>junit-vintage-engine</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.mockito</groupId>
             <artifactId>mockito-core</artifactId>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/james-project/blob/0d28c9df/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/DomainUserMaildirMailboxManagerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/DomainUserMaildirMailboxManagerTest.java
b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/DomainUserMaildirMailboxManagerTest.java
index eeb213a..508fc54 100644
--- a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/DomainUserMaildirMailboxManagerTest.java
+++ b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/DomainUserMaildirMailboxManagerTest.java
@@ -20,35 +20,28 @@ package org.apache.james.mailbox.maildir;
 
 import java.io.UnsupportedEncodingException;
 
+import org.apache.james.junit.TemporaryFolderExtension;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxManagerTest;
 import org.apache.james.mailbox.exception.MailboxException;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 public class DomainUserMaildirMailboxManagerTest extends MailboxManagerTest {
 
-    @Rule
-    public TemporaryFolder tmpFolder = new TemporaryFolder();
-
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-    }
+    @RegisterExtension
+    TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
     
     @Override
     protected MailboxManager provideMailboxManager() {
         try {
-            return MaildirMailboxManagerProvider.createMailboxManager("/%domain/%user", tmpFolder);
+            return MaildirMailboxManagerProvider.createMailboxManager("/%domain/%user", temporaryFolder.getTemporaryFolder().getTempDir());
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
     }
 
-    @Ignore("https://issues.apache.org/jira/browse/MAILBOX-292")
+    @Disabled("https://issues.apache.org/jira/browse/MAILBOX-292")
     @Override
     public void createMailboxShouldReturnRightId() throws MailboxException, UnsupportedEncodingException
{
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/0d28c9df/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerTest.java
b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerTest.java
index 0aa8384..b69f30f 100644
--- a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerTest.java
+++ b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerTest.java
@@ -20,29 +20,21 @@ package org.apache.james.mailbox.maildir;
 
 import java.io.UnsupportedEncodingException;
 
+import org.apache.james.junit.TemporaryFolderExtension;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxManagerTest;
 import org.apache.james.mailbox.exception.MailboxException;
-import org.junit.Before;
 import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 public class FullUserMaildirMailboxManagerTest extends MailboxManagerTest {
-
-    @Rule
-    public TemporaryFolder tmpFolder = new TemporaryFolder();
-
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-    }
+    @RegisterExtension
+    TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
     
     @Override
     protected MailboxManager provideMailboxManager() {
         try {
-            return MaildirMailboxManagerProvider.createMailboxManager("/%fulluser", tmpFolder);
+            return MaildirMailboxManagerProvider.createMailboxManager("/%fulluser", temporaryFolder.getTemporaryFolder().getTempDir());
         } catch (Exception e) {
             throw new RuntimeException(e);
         }

http://git-wip-us.apache.org/repos/asf/james-project/blob/0d28c9df/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java
----------------------------------------------------------------------
diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java
b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java
index 19e446b..8b632bd 100644
--- a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java
+++ b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java
@@ -19,6 +19,7 @@
 
 package org.apache.james.mailbox.maildir;
 
+import java.io.File;
 import java.io.IOException;
 
 import org.apache.james.mailbox.acl.GroupMembershipResolver;
@@ -40,7 +41,11 @@ import org.junit.rules.TemporaryFolder;
 
 public class MaildirMailboxManagerProvider {
     public static StoreMailboxManager createMailboxManager(String configuration, TemporaryFolder
temporaryFolder) throws MailboxException, IOException {
-        MaildirStore store = new MaildirStore(temporaryFolder.newFolder().getPath() + configuration,
new JVMMailboxPathLocker());
+        return createMailboxManager(configuration, temporaryFolder.newFolder());
+    }
+
+    public static StoreMailboxManager createMailboxManager(String configuration, File tempFile)
throws MailboxException {
+        MaildirStore store = new MaildirStore(tempFile.getPath() + configuration, new JVMMailboxPathLocker());
         MaildirMailboxSessionMapperFactory mf = new MaildirMailboxSessionMapperFactory(store);
 
         MailboxACLResolver aclResolver = new UnionMailboxACLResolver();

http://git-wip-us.apache.org/repos/asf/james-project/blob/0d28c9df/mailbox/memory/pom.xml
----------------------------------------------------------------------
diff --git a/mailbox/memory/pom.xml b/mailbox/memory/pom.xml
index c09ef24..eadc962 100644
--- a/mailbox/memory/pom.xml
+++ b/mailbox/memory/pom.xml
@@ -66,11 +66,6 @@
             <artifactId>javax.mail</artifactId>
         </dependency>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>nl.jqno.equalsverifier</groupId>
             <artifactId>equalsverifier</artifactId>
             <scope>test</scope>
@@ -86,6 +81,21 @@
             <version>1.11.3</version>
         </dependency>
         <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.platform</groupId>
+            <artifactId>junit-platform-launcher</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.vintage</groupId>
+            <artifactId>junit-vintage-engine</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.mockito</groupId>
             <artifactId>mockito-core</artifactId>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/james-project/blob/0d28c9df/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerTest.java
b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerTest.java
index cfdfb4a..1a5f78a 100644
--- a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerTest.java
+++ b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerTest.java
@@ -22,16 +22,8 @@ package org.apache.james.mailbox.inmemory;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxManagerTest;
 import org.apache.james.mailbox.exception.MailboxException;
-import org.junit.Before;
 
 public class MemoryMailboxManagerTest extends MailboxManagerTest {
-
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-    }
-    
     @Override
     protected MailboxManager provideMailboxManager() throws MailboxException {
         return MemoryMailboxManagerProvider.provideMailboxManager();


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


Mime
View raw message