KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > fortress > impl > role > test > ServiceMetaManagerTestCase


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

17
18 package org.apache.avalon.fortress.impl.role.test;
19
20 import org.apache.avalon.fortress.impl.handler.FactoryComponentHandler;
21 import org.apache.avalon.fortress.impl.handler.PerThreadComponentHandler;
22 import org.apache.avalon.fortress.impl.handler.PoolableComponentHandler;
23 import org.apache.avalon.fortress.impl.handler.ThreadSafeComponentHandler;
24 import org.apache.avalon.fortress.impl.role.ServiceMetaManager;
25 import org.apache.avalon.fortress.test.data.*;
26 import org.apache.avalon.framework.container.ContainerUtil;
27 import org.apache.avalon.framework.logger.NullLogger;
28
29 /**
30  * ServiceMetaManagerTestCase does XYZ
31  *
32  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
33  * @version CVS $ Revision: 1.1 $
34  */

35 public class ServiceMetaManagerTestCase extends AbstractMetaInfoManagerTestCase
36 {
37     public ServiceMetaManagerTestCase( String JavaDoc name )
38     {
39         super( name );
40     }
41
42     public void setUp() throws Exception JavaDoc
43     {
44         m_manager = new ServiceMetaManager();
45         ContainerUtil.enableLogging( m_manager, new NullLogger() );
46         ContainerUtil.initialize( m_manager );
47     }
48
49     public void testTestRoles() throws Exception JavaDoc
50     {
51         String JavaDoc[] roles = new String JavaDoc[]{Role1.class.getName()};
52         checkRole( "component1", roles, Component1.class.getName(), ThreadSafeComponentHandler.class.getName() );
53
54         roles[0] = Role2.class.getName();
55         checkRole( "component2", roles, Component2.class.getName(), PoolableComponentHandler.class.getName() );
56
57         roles[0] = Role4.class.getName();
58         checkRole( "component4", roles, Component4.class.getName(), FactoryComponentHandler.class.getName() );
59
60         roles = new String JavaDoc[]
61         {
62             Role3.class.getName(),
63             BaseRole.class.getName()
64         };
65
66         checkRole( "component3", roles, Component3.class.getName(), PerThreadComponentHandler.class.getName() );
67     }
68 }
69
Popular Tags