KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > james > imapserver > TestCommandsInAuthenticatedState


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

17
18 package org.apache.james.imapserver;
19
20 import org.apache.james.test.SimpleFileProtocolTest;
21
22 import junit.framework.Test;
23 import junit.framework.TestSuite;
24
25 /**
26  * Runs tests for commands valid in the AUTHENTICATED state. A login session precedes
27  * the execution of the test elements.
28  */

29 public class TestCommandsInAuthenticatedState
30         extends SimpleFileProtocolTest implements ImapTest
31 {
32     public TestCommandsInAuthenticatedState( String JavaDoc name )
33     {
34         super( name );
35     }
36
37     /**
38      * Sets up {@link #preElements} with a welcome message and login request/response.
39      * @throws Exception
40      */

41     public void setUp() throws Exception JavaDoc
42     {
43         super.setUp();
44         addTestFile( "Welcome.test", preElements );
45         addLogin( USER, PASSWORD );
46     }
47
48     protected void addLogin( String JavaDoc username, String JavaDoc password )
49     {
50         preElements.CL( "a001 LOGIN " + username + " " + password );
51         preElements.SL( "a001 OK LOGIN completed", "TestCommandsInAuthenticatedState.java:33" );
52     }
53
54     /**
55      * Provides all tests which should be run in the authenicated state. Each test name
56      * corresponds to a protocol session file.
57      */

58     public static Test suite() throws Exception JavaDoc
59     {
60         TestSuite suite = new TestSuite();
61         // Not valid in this state
62
suite.addTest( new TestCommandsInAuthenticatedState( "ValidSelected" ) );
63         suite.addTest( new TestCommandsInAuthenticatedState( "ValidNonAuthenticated" ) );
64
65         // Valid in all states
66
suite.addTest( new TestCommandsInAuthenticatedState( "Capability" ) );
67         suite.addTest( new TestCommandsInAuthenticatedState( "Noop" ) );
68         suite.addTest( new TestCommandsInAuthenticatedState( "Logout" ) );
69
70         // Valid in authenticated state
71
suite.addTest( new TestCommandsInAuthenticatedState( "ExamineInbox" ) );
72         suite.addTest( new TestCommandsInAuthenticatedState( "SelectInbox" ) );
73         suite.addTest( new TestCommandsInAuthenticatedState( "Create" ) );
74         suite.addTest( new TestCommandsInAuthenticatedState( "ExamineEmpty" ) );
75         suite.addTest( new TestCommandsInAuthenticatedState( "SelectEmpty" ) );
76         suite.addTest( new TestCommandsInAuthenticatedState( "ListNamespace" ) );
77         suite.addTest( new TestCommandsInAuthenticatedState( "ListMailboxes" ) );
78         suite.addTest( new TestCommandsInAuthenticatedState( "Status" ) );
79         suite.addTest( new TestCommandsInAuthenticatedState( "Subscribe" ) );
80         suite.addTest( new TestCommandsInAuthenticatedState( "Delete" ) );
81         suite.addTest( new TestCommandsInAuthenticatedState( "Append" ) );
82
83         return suite;
84     }
85
86 }
87
Popular Tags