KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > management > ext > wsmgmt > WebServiceConfigTest


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  
24 /*
25  * $Header: /cvs/glassfish/admin/mbeanapi-impl/tests/com/sun/enterprise/management/ext/wsmgmt/WebServiceConfigTest.java,v 1.6 2006/03/09 20:30:57 llc Exp $
26  * $Revision: 1.6 $
27  * $Date: 2006/03/09 20:30:57 $
28  */

29 package com.sun.enterprise.management.ext.wsmgmt;
30
31 import java.util.Set JavaDoc;
32 import java.util.Iterator JavaDoc;
33 import java.io.IOException JavaDoc;
34 import java.util.Map JavaDoc;
35 import java.util.List JavaDoc;
36 import java.util.HashMap JavaDoc;
37
38
39 import javax.management.ObjectName JavaDoc;
40 import javax.management.AttributeList JavaDoc;
41 import javax.management.MBeanServerConnection JavaDoc;
42 import javax.management.NotCompliantMBeanException JavaDoc;
43
44 import com.sun.appserv.management.j2ee.J2EEDomain;
45
46
47 import com.sun.appserv.management.util.jmx.MBeanServerConnectionConnectionSource;
48
49 import com.sun.enterprise.management.support.AMXNonConfigImplBase;
50 import com.sun.enterprise.management.support.QueryMgrImpl;
51 import com.sun.appserv.management.ext.wsmgmt.WebServiceMgr;
52 import com.sun.appserv.management.util.misc.ExceptionUtil;
53
54 import com.sun.appserv.management.config.WebServiceEndpointConfig;
55 import com.sun.appserv.management.config.TransformationRuleConfig;
56 import com.sun.appserv.management.base.XTypes;
57 import com.sun.appserv.management.base.Util;
58
59 import com.sun.enterprise.management.AMXTestBase;
60 import com.sun.enterprise.management.Capabilities;
61
62 /**
63  */

64 public final class WebServiceConfigTest extends AMXTestBase
65 {
66
67     public WebServiceConfigTest() throws IOException JavaDoc {
68     }
69     
70         public static Capabilities
71     getCapabilities()
72     {
73         return getOfflineCapableCapabilities( false );
74     }
75     
76     public void testConfigMBeans() {
77         assert (getDomainRoot().getWebServiceMgr() != null);
78
79        final Set JavaDoc<WebServiceEndpointConfig> s =
80         getDomainRoot().getQueryMgr().queryJ2EETypeSet(
81                               XTypes.WEB_SERVICE_ENDPOINT_CONFIG);
82
83        for( final WebServiceEndpointConfig wsc : s )
84        {
85             String JavaDoc oldSize = wsc.getMaxHistorySize();
86             System.out.println("Old Max History size is " + oldSize);
87             System.out.println("Setting Max History size to 1 " );
88             wsc.setMaxHistorySize("1");
89             System.out.println("New Max History size is "
90                 + wsc.getMaxHistorySize());
91             assert( "1".equals(wsc.getMaxHistorySize()));
92             System.out.println("Resetting Max History size to " + oldSize );
93             wsc.setMaxHistorySize(oldSize);
94             System.out.println("Config value is " + wsc.getMonitoringLevel());
95
96             Map JavaDoc m = wsc.getTransformationRuleConfigMap();
97
98             System.out.println("Transformation rules found " + m.size());
99
100            Iterator JavaDoc itr = m.values().iterator();
101            while ( itr.hasNext()) {
102                 TransformationRuleConfig tc = (TransformationRuleConfig)
103                 itr.next();
104                 System.out.println("rule name is " + tc.getName());
105            }
106            System.out.println("Getting tranformation rules in order ");
107             List JavaDoc l = wsc.getTransformationRuleConfigList();
108
109             System.out.println("Transformation rules found " + l.size());
110
111            Iterator JavaDoc litr = l.iterator();
112            while ( litr.hasNext()) {
113                 TransformationRuleConfig tc = (TransformationRuleConfig)
114                 litr.next();
115                 System.out.println("rule name is " + tc.getName());
116            }
117        }
118        assert(true);
119     }
120 }
121
122
123
Popular Tags