1 19 20 package org.apache.james.imapserver.handler.session; 21 22 import java.io.IOException ; 23 24 import javax.mail.MessagingException ; 25 import javax.mail.internet.MimeMessage ; 26 27 import org.apache.james.imapserver.ProtocolException; 28 import org.apache.james.imapserver.client.DeleteClientCommand; 29 import org.apache.james.imapserver.client.LoginCommand; 30 import org.apache.james.imapserver.client.LogoutClientCommand; 31 import org.apache.james.imapserver.store.MailboxException; 32 import org.apache.james.imapserver.util.MessageGenerator; 33 import org.apache.james.mailboxmanager.MailboxManagerException; 34 35 public class DeleteSessionTest extends AbstractSessionTest { 36 37 String [] folders = { USER_MAILBOX_ROOT + ".INBOX", 38 USER_MAILBOX_ROOT + ".test", USER_MAILBOX_ROOT + ".test1", 39 USER_MAILBOX_ROOT + ".test1.test1a", 40 USER_MAILBOX_ROOT + ".test1.test1b", 41 USER_MAILBOX_ROOT + ".test2.test2a", 42 USER_MAILBOX_ROOT + ".test2.test2b" }; 43 44 MimeMessage [] msgs = null; 45 46 public void setUp() throws MailboxException, MessagingException , 47 IOException , MailboxManagerException { 48 super.setUp(); 49 msgs = MessageGenerator.generateSimpleMessages(4); 50 createFolders(folders); 51 appendMessagesClosed(USER_MAILBOX_ROOT+".test1.test1a", msgs); 53 54 } 55 56 public void tearDown() throws Exception { 57 super.tearDown(); 58 for (int i = 0; i < folders.length; i++) { 59 assertFalse(folders[i] + " is still in use!", isOpen(folders[i])); 60 } 61 } 62 63 public void testDeleteExisting() throws ProtocolException, IOException , 64 MessagingException , MailboxManagerException { 65 verifyCommand(new LoginCommand(USER_NAME, USER_PASSWORD)); 66 assertTrue(folderExists(USER_MAILBOX_ROOT + ".test1.test1a")); 67 verifyCommand(new DeleteClientCommand("test1.test1a")); 68 assertFalse(folderExists(USER_MAILBOX_ROOT + ".test1.test1a")); 69 verifyCommand(new LogoutClientCommand()); 70 } 71 72 } 73 | Popular Tags |