KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lenya > ac > impl > AccreditableManagerTest


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

16 package org.apache.lenya.ac.impl;
17
18 import junit.textui.TestRunner;
19
20 import org.apache.avalon.framework.component.ComponentSelector;
21 import org.apache.lenya.ac.AccessControlException;
22 import org.apache.lenya.ac.AccreditableManager;
23 import org.apache.lenya.cms.ExcaliburTest;
24 import org.apache.lenya.cms.PublicationHelper;
25
26 public class AccreditableManagerTest extends ExcaliburTest {
27
28     /**
29      * @param test The test to execute.
30      */

31     public AccreditableManagerTest(String JavaDoc test) {
32         super(test);
33     }
34
35     /**
36      * The main program.
37      * The parameters are set from the command line arguments.
38      *
39      * @param args The command line arguments.
40      */

41     public static void main(String JavaDoc[] args) {
42         args = PublicationHelper.extractPublicationArguments(args);
43         TestRunner.run(AccreditableManagerTest.class);
44     }
45     
46     private AccreditableManager accreditableManager;
47     private ComponentSelector selector;
48     
49     protected static final String JavaDoc HINT = "file";
50
51     /**
52      * The JUnit setup method. Lookup the resolver role.
53      *
54      * @exception Exception Description of Exception
55      * @since
56      */

57     public void setUp() throws Exception JavaDoc {
58         super.setUp();
59
60         String JavaDoc role = AccreditableManager.ROLE + "Selector";
61         selector = (ComponentSelector) manager.lookup(role);
62         
63         accreditableManager = (AccreditableManager) selector.select(HINT);
64         assertNotNull("AccreditableManager is null", accreditableManager);
65     }
66
67     /**
68      * The test.
69      * @throws AccessControlException when something went wrong.
70      */

71     public void testAccreditableManager() throws AccessControlException {
72         assertNotNull(accreditableManager.getUserManager());
73         assertNotNull(accreditableManager.getGroupManager());
74         assertNotNull(accreditableManager.getRoleManager());
75         
76     }
77
78 }
79
Popular Tags