KickJava   Java API By Example, From Geeks To Geeks.

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


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 NON_AUTHENTICATED state.
27  * A welcome message precedes the execution of the test elements.
28  */

29 public class TestCommandsInNonAuthenticatedState
30         extends SimpleFileProtocolTest
31 {
32     public TestCommandsInNonAuthenticatedState( String JavaDoc name )
33     {
34         super( name );
35     }
36
37     /**
38      * Adds a welcome message to the {@link #preElements}.
39      * @throws Exception
40      */

41     public void setUp() throws Exception JavaDoc
42     {
43         super.setUp();
44         addTestFile( "Welcome.test", preElements );
45     }
46
47     /**
48      * Sets up tests valid in the non-authenticated state.
49      */

50     public static Test suite() throws Exception JavaDoc
51     {
52         TestSuite suite = new TestSuite();
53         // Not valid in this state
54
suite.addTest( new TestCommandsInNonAuthenticatedState( "ValidAuthenticated" ) );
55         suite.addTest( new TestCommandsInNonAuthenticatedState( "ValidSelected" ) );
56
57         // Valid in all states
58
suite.addTest( new TestCommandsInNonAuthenticatedState( "Capability" ) );
59         suite.addTest( new TestCommandsInNonAuthenticatedState( "Noop" ) );
60         suite.addTest( new TestCommandsInNonAuthenticatedState( "Logout" ) );
61
62         // Valid only in non-authenticated state.
63
suite.addTest( new TestCommandsInNonAuthenticatedState( "Authenticate" ) );
64         suite.addTest( new TestCommandsInNonAuthenticatedState( "Login" ) );
65
66         return suite;
67     }
68
69 }
70
Popular Tags