KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > management > config > DomainConfigTest


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23 package com.sun.enterprise.management.config;
24
25 import java.util.Set JavaDoc;
26 import java.util.Map JavaDoc;
27 import java.util.Iterator JavaDoc;
28
29 import javax.management.ObjectName JavaDoc;
30
31 import com.sun.appserv.management.config.NamedConfigElement;
32 import com.sun.appserv.management.config.DomainConfig;
33
34 import com.sun.enterprise.management.AMXTestBase;
35 import com.sun.enterprise.management.Capabilities;
36 import com.sun.appserv.management.base.AMX;
37 import com.sun.appserv.management.config.*;
38
39 import com.sun.appserv.management.base.Util;
40
41
42 /**
43  */

44 public final class DomainConfigTest extends AMXTestBase
45 {
46         public
47     DomainConfigTest()
48     {
49     }
50     
51         public void
52     testGetDeployedItemProxies()
53     {
54         final DomainConfig mgr = getDomainConfig();
55         
56         final Set JavaDoc proxies = mgr.getContaineeSet();
57         assert( proxies.size() != 0 );
58         
59         final Iterator JavaDoc iter = proxies.iterator();
60         while ( iter.hasNext() )
61         {
62             final AMX proxy = Util.asAMX(iter.next());
63         }
64     }
65     
66         public void
67     testGetDeployedItemProxiesByName()
68     {
69         final DomainConfig mgr = getDomainConfig();
70         
71         final Map JavaDoc<String JavaDoc,Map JavaDoc<String JavaDoc,AMX>> typeMap = mgr.getMultiContaineeMap( null );
72         
73         for( final String JavaDoc j2eeType : typeMap.keySet() )
74         {
75             final Map JavaDoc<String JavaDoc,AMX> proxyMap = typeMap.get( j2eeType );
76             for( final String JavaDoc name : proxyMap.keySet() )
77             {
78                 final AMX amx = Util.asAMX(proxyMap.get( name ));
79                 
80                 final AMX proxy = mgr.getContainee( j2eeType, name);
81                 
82                 assert( Util.getObjectName( proxy ).equals( Util.getObjectName( amx ) ) );
83                 assert( proxy.getName().equals( name ) );
84             }
85         }
86     }
87     
88     
89         public void
90     testGetAttributes()
91     {
92         final DomainConfig mgr = getDomainConfig();
93         
94         mgr.getApplicationRoot();
95         mgr.getLocale();
96         mgr.getLogRoot();
97     }
98     
99         private <T extends AMX> void
100     checkMap( final Map JavaDoc<String JavaDoc,T> m )
101     {
102         assert( m != null );
103         assert( ! m.keySet().contains( AMX.NO_NAME ) );
104         assert( ! m.keySet().contains( AMX.NULL_NAME ) );
105     }
106     
107     
108         public void
109     testGetMaps()
110     {
111         final DomainConfig m = getDomainConfig();
112         
113         checkMap( m.getServerConfigMap() );
114         checkMap( m.getStandaloneServerConfigMap() );
115         checkMap( m.getClusteredServerConfigMap() );
116         checkMap( m.getLBConfigMap() );
117         checkMap( m.getLoadBalancerConfigMap() );
118         checkMap( m.getNodeAgentConfigMap() );
119         checkMap( m.getConfigConfigMap() );
120         checkMap( m.getClusterConfigMap() );
121                 
122         checkMap( m.getPersistenceManagerFactoryResourceConfigMap() );
123         checkMap( m.getJDBCResourceConfigMap() );
124         checkMap( m.getJDBCConnectionPoolConfigMap() );
125         checkMap( m.getConnectorResourceConfigMap() );
126         checkMap( m.getConnectorConnectionPoolConfigMap() );
127         checkMap( m.getAdminObjectResourceConfigMap() );
128         checkMap( m.getResourceAdapterConfigMap() );
129         checkMap( m.getMailResourceConfigMap() );
130         
131         checkMap( m.getJ2EEApplicationConfigMap() );
132         checkMap( m.getEJBModuleConfigMap( ) );
133         checkMap( m.getWebModuleConfigMap( ) );
134         checkMap( m.getRARModuleConfigMap() );
135         checkMap( m.getAppClientModuleConfigMap() );
136         checkMap( m.getLifecycleModuleConfigMap() );
137     }
138     
139     /*
140         KEEP, not quite ready to test this yet.
141         public void
142     testCreateStandaloneServerConfig()
143     {
144         final ConfigSetup setup = new ConfigSetup( getDomainRoot() );
145         
146         setup.removeTestServer();
147         
148         final StandaloneServerConfig server = setup.createTestServer();
149         setup.removeTestServer();
150     }
151     */

152     
153     
154         public void
155     testCreateClusterConfig()
156     {
157         // to be done
158
}
159 }
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
Popular Tags