You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ro...@apache.org on 2019/07/26 07:51:31 UTC

[james-project] 12/32: JAMES-2849 Revise JPA MPT test isolation strategy

This is an automated email from the ASF dual-hosted git repository.

rouazana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 83cb8755a28e682e2c526e1e4a1768a70a71203c
Author: Matthieu Baechler <ma...@apache.org>
AuthorDate: Tue Jul 23 17:49:26 2019 +0200

    JAMES-2849 Revise JPA MPT test isolation strategy
---
 .../org/apache/james/mailbox/jpa/JPAMailboxManager.java     | 12 ------------
 .../james/mpt/imapmailbox/jpa/host/JPAHostSystem.java       | 13 +++++--------
 2 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMailboxManager.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMailboxManager.java
index e17a316..b9076c2 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMailboxManager.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMailboxManager.java
@@ -68,16 +68,4 @@ public abstract class JPAMailboxManager extends StoreMailboxManager {
         return MAILBOX_CAPABILITIES;
     }
 
-    /**
-     * Delete all mailboxes 
-     * 
-     * @param mailboxSession
-     * @throws MailboxException
-     */
-    public void deleteEverything(MailboxSession mailboxSession) throws MailboxException {
-        final JPAMailboxMapper mapper = (JPAMailboxMapper) getMapperFactory().getMailboxMapper(mailboxSession);
-        mapper.execute(Mapper.toTransaction(mapper::deleteAllMemberships));
-        mapper.execute(Mapper.toTransaction(mapper::deleteAllMailboxes));
-    }
-
 }
diff --git a/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java b/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java
index 8f16a51..debbecd 100644
--- a/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java
+++ b/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java
@@ -139,14 +139,11 @@ public class JPAHostSystem extends JamesImapHostSystem {
     }
 
     @Override
-    public void afterTest() throws Exception {
-        if (mailboxManager != null) {
-            MailboxSession session = mailboxManager.createSystemSession("test");
-            mailboxManager.startProcessingRequest(session);
-            mailboxManager.deleteEverything(session);
-            mailboxManager.endProcessingRequest(session);
-            mailboxManager.logout(session, false);
-        }
+    public void afterTest() {
+        JPA_TEST_CLUSTER.clear(ImmutableList.<String>builder()
+            .addAll(JPAMailboxFixture.MAILBOX_TABLE_NAMES)
+            .addAll(JPAMailboxFixture.QUOTA_TABLES_NAMES)
+            .build());
     }
 
     @Override


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