KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > james > remotemanager > UserManagementTest


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.remotemanager;
19
20 import org.apache.james.test.AbstractProtocolTest;
21
22 public class UserManagementTest
23         extends AbstractProtocolTest
24 {
25     private String JavaDoc _userName;
26     private String JavaDoc _password;
27
28     public UserManagementTest( String JavaDoc action, String JavaDoc userName )
29     {
30         this( action, userName, "password" );
31     }
32
33     public UserManagementTest( String JavaDoc action, String JavaDoc userName, String JavaDoc password )
34     {
35         super( action );
36         _port = 4555;
37         _userName = userName;
38         _password = password;
39     }
40
41     public void setUp() throws Exception JavaDoc
42     {
43         super.setUp();
44         addTestFile( "RemoteManagerLogin.test", _preElements );
45         addTestFile( "RemoteManagerLogout.test", _postElements );
46     }
47
48     public void addUser() throws Exception JavaDoc
49     {
50           addUser( _userName, _password );
51     }
52
53     protected void addUser( String JavaDoc userName, String JavaDoc password )
54             throws Exception JavaDoc
55     {
56         CL( "adduser " + userName + " " + password );
57         SL( "User " + userName + " added" );
58         executeTests();
59     }
60
61     /*protected void addExistingUser( String userName, String password )
62         throws Exception{
63         CL( "adduser " + userName + " " + password );
64         SL( "user " + userName + " already exist" );
65         executeTests();
66     }*/

67
68     public void deleteUser() throws Exception JavaDoc
69     {
70         deleteUser( _userName );
71     }
72
73     protected void deleteUser( String JavaDoc userName ) throws Exception JavaDoc
74     {
75         CL( "deluser " + userName );
76         SL( "User " + userName + " deleted" );
77         executeTests();
78     }
79 }
80
Popular Tags