KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > description > RegistryTest


1 /*
2  * Copyright 2004,2005 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  
17 package org.apache.axis2.description;
18
19 import org.apache.axis2.AbstractTestCase;
20 import org.apache.axis2.context.MessageContext;
21 import org.apache.axis2.engine.AxisConfiguration;
22 import org.apache.axis2.engine.AxisFault;
23 import org.apache.axis2.engine.Handler;
24 import org.apache.axis2.handlers.AbstractHandler;
25
26 import javax.xml.namespace.QName JavaDoc;
27
28 public class RegistryTest extends AbstractTestCase {
29     private AxisConfiguration reg;
30
31     public RegistryTest(String JavaDoc testName) {
32         super(testName);
33     }
34
35
36     public void testRegistry() throws Exception JavaDoc {
37         //TODO fix me Srinath
38
/* GlobalDescription ag = new GlobalDescription();
39         testParameteInClude(ag);
40         reg = new AxisSystemImpl(ag);
41
42         QName moduleName = new QName("module1");
43         ModuleDescription modlue = new ModuleDescription(moduleName);
44         reg.addMdoule(modlue);
45
46         QName serviceName = new QName("service");
47         ServiceDescription service = new ServiceDescription(serviceName);
48         reg.addService(service);
49
50         assertSame(modlue, reg.getModule(moduleName));
51         assertSame(service, reg.getService(serviceName));
52         reg.removeService(serviceName);
53         assertSame(ag, reg.getGlobal());
54         assertNull(reg.getService(serviceName));*/

55
56     }
57
58     public void testHandlerMedatata() {
59         HandlerDescription hmd = new HandlerDescription();
60         testParameteInClude(hmd);
61     }
62
63     public void testService() {
64         ServiceDescription service = new ServiceDescription(new QName JavaDoc("Service1"));
65         testParameteInClude(service);
66         testFlowIncludeTest(service);
67
68
69     }
70
71     public void testModule() {
72         ModuleDescription module = new ModuleDescription(new QName JavaDoc("module1"));
73         testParameteInClude(module);
74         testFlowIncludeTest(module);
75     }
76
77     public void testOpeartion() {
78         OperationDescription op = new OperationDescription(new QName JavaDoc("op"));
79         testParameteInClude(op);
80     }
81
82
83     public void testParameteInClude(ParameterInclude parmInclude) {
84         String JavaDoc key = "value1";
85         Parameter p = new ParameterImpl(key, "value2");
86         parmInclude.addParameter(p);
87         assertEquals(p, parmInclude.getParameter(key));
88     }
89
90     public void testFlowIncludeTest(FlowInclude flowInclude) {
91         Flow flow1 = new FlowImpl();
92         Flow flow2 = new FlowImpl();
93         Flow flow3 = new FlowImpl();
94
95         flowInclude.setInFlow(flow1);
96         flowInclude.setFaultInFlow(flow2);
97         flowInclude.setOutFlow(flow3);
98         assertSame(flow1, flowInclude.getInFlow());
99         assertSame(flow2, flowInclude.getFaultInFlow());
100         assertSame(flow3, flowInclude.getOutFlow());
101     }
102
103  
104
105     public void testHandlers() throws AxisFault {
106         Handler handler = new AbstractHandler() {
107             public void invoke(MessageContext msgContext) throws AxisFault {
108             }
109         };
110         handler.init(new HandlerDescription());
111         assertNull(handler.getName());
112         assertNull(handler.getParameter("hello"));
113         handler.cleanup();
114     }
115
116
117 }
118
Popular Tags