KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > james > imapserver > handler > session > CreateSessionTest


1 /****************************************************************
2  * Licensed to the Apache Software Foundation (ASF) under one *
3  * or more contributor license agreements. See the NOTICE file *
4  * distributed with this work for additional information *
5  * regarding copyright ownership. The ASF licenses this file *
6  * to you under the Apache License, Version 2.0 (the *
7  * "License"); you may not use this file except in compliance *
8  * with the License. You may obtain a copy of the License at *
9  * *
10  * http://www.apache.org/licenses/LICENSE-2.0 *
11  * *
12  * Unless required by applicable law or agreed to in writing, *
13  * software distributed under the License is distributed on an *
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
15  * KIND, either express or implied. See the License for the *
16  * specific language governing permissions and limitations *
17  * under the License. *
18  ****************************************************************/

19
20 package org.apache.james.imapserver.handler.session;
21
22 import java.io.IOException JavaDoc;
23
24 import javax.mail.MessagingException JavaDoc;
25 import javax.mail.internet.MimeMessage JavaDoc;
26
27 import org.apache.james.imapserver.ProtocolException;
28 import org.apache.james.imapserver.client.CreateClientCommand;
29 import org.apache.james.imapserver.client.LoginCommand;
30 import org.apache.james.imapserver.client.LogoutClientCommand;
31 import org.apache.james.imapserver.client.SelectCommand;
32 import org.apache.james.imapserver.store.MailboxException;
33 import org.apache.james.mailboxmanager.MailboxManagerException;
34
35 public class CreateSessionTest extends AbstractSessionTest {
36     
37     String JavaDoc[] folders = {USER_MAILBOX_ROOT+".INBOX",USER_MAILBOX_ROOT+".test",USER_MAILBOX_ROOT+".test1",USER_MAILBOX_ROOT+".test1.test1a",USER_MAILBOX_ROOT+".test1.test1b",USER_MAILBOX_ROOT+".test2.test2a",USER_MAILBOX_ROOT+".test2.test2b"};
38     
39     public void setUp() throws MailboxException, MessagingException JavaDoc, IOException JavaDoc, MailboxManagerException {
40         super.setUp();
41         createFolders(folders);
42     }
43     
44     public void testCreateSelect() throws ProtocolException, IOException JavaDoc, MessagingException JavaDoc, MailboxManagerException {
45         verifyCommand(new LoginCommand(USER_NAME,USER_PASSWORD));
46         
47         verifyCommand(new CreateClientCommand("Drafts"));
48         assertTrue(folderExists(USER_MAILBOX_ROOT+".Drafts"));
49         
50         verifyCommand(new SelectCommand("Drafts", new MimeMessage JavaDoc[0],getUidValidity(USER_MAILBOX_ROOT+".Drafts")));
51         
52         verifyCommand(new LogoutClientCommand());
53     }
54
55 }
56
Popular Tags