package org.apache.james.imapserver.mock;

import org.apache.james.mailboxmanager.manager.MailboxManagerProvider;
import org.apache.james.mailboxmanager.torque.TorqueMailboxManagerProvider;

public class MailboxManagerProviderSingleton {
    
    
    private static TorqueMailboxManagerProvider torqueMailboxManagerProvider;

    public synchronized static MailboxManagerProvider getMailboxManagerProviderInstance() throws Exception {
        if (torqueMailboxManagerProvider==null) {
            torqueMailboxManagerProvider=new TorqueMailboxManagerProvider();
            torqueMailboxManagerProvider.configureDefaults();
            torqueMailboxManagerProvider.initialize();
        }
        return torqueMailboxManagerProvider;
        
    }

}

@@ -146,22 +146,20 @@
 manager.
-torque
+mock
 .TorqueM
@@ -179,16 +179,25 @@
 Provider
+Singleton
 ;%0A%0Apubli
@@ -247,92 +247,8 @@
    %0A
-    %0A    private static TorqueMailboxManagerProvider torqueMailboxManagerProvider;%0A%0A
     
@@ -360,311 +360,96 @@
     
-    if (torqueMailboxManagerProvider==null) %7B%0A            torqueMailboxManagerProvider=new TorqueMailboxManagerProvider();%0A            torqueMailboxManagerProvider.configureDefaults();%0A            torqueMailboxManagerProvider.initialize();%0A        %7D%0A        return torqueMailboxManagerProvider;%0A        
+%09return TorqueMailboxManagerProviderSingleton.getTorqueMailboxManagerProviderInstance();
 %0A   

fix for JAMES-658. mailboxmanager and imapserver tests have to use one singleton TorqueMailboxManagerProvider instance