KickJava   Java API By Example, From Geeks To Geeks.

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


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/WebServiceConfigCRTest.java,v 1.3 2006/03/09 20:30:57 llc Exp $
26  * $Revision: 1.3 $
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.HashMap JavaDoc;
36
37
38 import javax.management.ObjectName JavaDoc;
39 import javax.management.AttributeList JavaDoc;
40 import javax.management.MBeanServerConnection JavaDoc;
41 import javax.management.NotCompliantMBeanException JavaDoc;
42
43 import com.sun.appserv.management.j2ee.J2EEDomain;
44
45
46 import com.sun.appserv.management.util.jmx.MBeanServerConnectionConnectionSource;
47
48 import com.sun.enterprise.management.support.AMXNonConfigImplBase;
49 import com.sun.enterprise.management.support.QueryMgrImpl;
50 import com.sun.appserv.management.ext.wsmgmt.WebServiceMgr;
51 import com.sun.appserv.management.util.misc.ExceptionUtil;
52
53 import com.sun.appserv.management.config.WebServiceEndpointConfig;
54 import com.sun.appserv.management.config.TransformationRuleConfig;
55 import com.sun.appserv.management.config.J2EEApplicationConfig;
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 WebServiceConfigCRTest extends AMXTestBase
65 {
66
67     public WebServiceConfigCRTest() throws IOException JavaDoc {
68     }
69     
70         public static Capabilities
71     getCapabilities()
72     {
73         return getOfflineCapableCapabilities( false );
74     }
75     
76     public void testConfigCR() {
77         assert (getDomainRoot().getWebServiceMgr() != null);
78
79        final Set JavaDoc<J2EEApplicationConfig> s =
80         getDomainRoot().getQueryMgr().queryJ2EETypeSet( XTypes.J2EE_APPLICATION_CONFIG);
81
82        final Iterator JavaDoc iter = s.iterator();
83        while ( iter.hasNext() )
84        {
85
86             J2EEApplicationConfig ac = (J2EEApplicationConfig)iter.next();
87             System.out.println("config name is " + ac.getName());
88                             
89             Map JavaDoc m = ac.getWebServiceEndpointConfigMap();
90             int init = m.size();
91             System.out.println("WebServiceEndpoints found " + init);
92             Iterator JavaDoc itr = m.values().iterator();
93             while (itr.hasNext()) {
94                 WebServiceEndpointConfig wsCfg = (WebServiceEndpointConfig)
95                 itr.next();
96                 System.out.println("WebServiceEndpoint's name " +
97                         wsCfg.getName());
98             }
99
100             /*
101              if ( !( ac.getName().equals("jaxrpc-simple") ) ){
102                 continue;
103              }
104
105             ac.createWebServiceEndpointConfig("remove#me", null);
106
107             m = ac.getWebServiceEndpointConfigMap();
108             int afterCreate = m.size();
109             System.out.println("WebServiceEndpoints found " + afterCreate);
110
111             assert ( init +1== afterCreate);
112             */

113        }
114        assert(true);
115     }
116
117     public void testWSConfigCR() {
118         assert (getDomainRoot().getWebServiceMgr() != null);
119
120        final Set JavaDoc<WebServiceEndpointConfig> s =
121         getDomainRoot().getQueryMgr().queryJ2EETypeSet(
122                               XTypes.WEB_SERVICE_ENDPOINT_CONFIG);
123
124        for( final WebServiceEndpointConfig wsc : s )
125        {
126             Map JavaDoc m = wsc.getTransformationRuleConfigMap();
127             int init = m.size();
128             System.out.println("Transformation rules found " + init);
129             Iterator JavaDoc itr = m.values().iterator();
130             while (itr.hasNext()) {
131                 TransformationRuleConfig trCfg = (TransformationRuleConfig)
132                 itr.next();
133                 System.out.println("Transformation Rule's name "+
134                         trCfg.getName());
135             }
136
137             /*
138
139             /* Finish later, creating a transformation rule requires the
140              * transformation file to be uploaded to DAS.
141
142             wsc.createTransformationRuleConfig("xrule22",
143                 "/tmp/req.xsl", false, "request", null);
144
145             m = wsc.getTransformationRuleConfigMap();
146             int afterCreate = m.size();
147             System.out.println("Transformation rules found " + afterCreate);
148
149             assert ( init +1== afterCreate);
150
151             wsc.removeTransformationRuleConfig("xrule22");
152             m = wsc.getTransformationRuleConfigMap();
153             int afterDel = m.size();
154             System.out.println("Transformation rules found " + afterDel);
155
156             assert ( init == afterDel);
157             */

158        }
159        assert(true);
160     }
161
162 }
163
164
165
Popular Tags