james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject svn commit: r1147367 - in /james/mailbox/trunk/api/src/test/java/org/apache/james/mailbox: AbstractMailboxManagerTest.java MailboxManagerTest.java
Date Sat, 16 Jul 2011 07:14:00 GMT
Author: eric
Date: Sat Jul 16 07:14:00 2011
New Revision: 1147367

URL: http://svn.apache.org/viewvc?rev=1147367&view=rev
Log:
Merge AbstractMailboxManagerTest with MailboxManagerTest (MAILBOX-73)

Removed:
    james/mailbox/trunk/api/src/test/java/org/apache/james/mailbox/AbstractMailboxManagerTest.java
Modified:
    james/mailbox/trunk/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java

Modified: james/mailbox/trunk/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java?rev=1147367&r1=1147366&r2=1147367&view=diff
==============================================================================
--- james/mailbox/trunk/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
(original)
+++ james/mailbox/trunk/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
Sat Jul 16 07:14:00 2011
@@ -37,12 +37,57 @@ import org.slf4j.LoggerFactory;
  */
 public abstract class MailboxManagerTest {
     
+    private final static String USER1 = "USER1";
+
     /**
      * The mailboxManager that needs to get instanciated
      * by the mailbox implementations.
      */
     protected MailboxManager mailboxManager;
     
+    @Test
+    public void testBasicOperations() throws BadCredentialsException, MailboxException, UnsupportedEncodingException
{
+
+        setMailboxManager(new MockMailboxManager(getMailboxManager()).getMockMailboxManager());
+        
+        MailboxSession session = getMailboxManager().createSystemSession(USER1, LoggerFactory.getLogger("Mock"));
+        Assert.assertEquals(USER1, session.getUser().getUserName());
+        
+        getMailboxManager().startProcessingRequest(session);
+        
+        MailboxPath inbox = MailboxPath.inbox(session);
+        Assert.assertFalse(getMailboxManager().mailboxExists(inbox, session));
+        
+        getMailboxManager().createMailbox(inbox, session);
+        Assert.assertTrue(getMailboxManager().mailboxExists(inbox, session));
+        
+        try {
+            getMailboxManager().createMailbox(inbox, session);
+            Assert.fail();
+        } catch (MailboxException e) {
+            // mailbox already exists!
+        }
+        
+        MailboxPath inboxSubMailbox = new MailboxPath(inbox, "INBOX.Test");
+        Assert.assertFalse(getMailboxManager().mailboxExists(inboxSubMailbox, session));
+        
+        getMailboxManager().createMailbox(inboxSubMailbox, session);
+        Assert.assertTrue(getMailboxManager().mailboxExists(inboxSubMailbox, session));
+        
+        getMailboxManager().deleteMailbox(inbox, session);
+        Assert.assertFalse(getMailboxManager().mailboxExists(inbox, session));
+        Assert.assertTrue(getMailboxManager().mailboxExists(inboxSubMailbox, session));
+        
+        getMailboxManager().deleteMailbox(inboxSubMailbox, session);
+        Assert.assertFalse(getMailboxManager().mailboxExists(inboxSubMailbox, session));
+
+        getMailboxManager().logout(session, false);
+        getMailboxManager().endProcessingRequest(session);
+
+        Assert.assertFalse(session.isOpen());
+
+    }
+
     /**
      * Create some INBOXes and their sub mailboxes and assert list() method.
      * 



---------------------------------------------------------------------
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