KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > servicedesc > TestServiceDesc


1 /*
2  * Copyright 2002-2004 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 package test.servicedesc;
17
18 import java.util.List JavaDoc;
19
20 import junit.framework.TestCase;
21
22 import org.apache.axis.description.JavaServiceDesc;
23 import org.apache.axis.description.OperationDesc;
24 import org.apache.axis.encoding.DefaultTypeMappingImpl;
25
26 import javax.xml.namespace.QName JavaDoc;
27
28 public class TestServiceDesc extends TestCase {
29     
30     public TestServiceDesc(String JavaDoc name) {
31         super(name);
32     }
33     
34     public TestServiceDesc() {
35         super("Test ServiceDesc Synch");
36     }
37  
38     public void testFaultSynch() throws Exception JavaDoc {
39         JavaServiceDesc desc = new JavaServiceDesc();
40         desc.setTypeMapping(DefaultTypeMappingImpl.getSingletonDelegate());
41
42         desc.loadServiceDescByIntrospection(ServiceClass.class);
43
44         List JavaDoc operations = desc.getOperations();
45
46         assertTrue(operations != null);
47         assertEquals("invalid number of registered operations",
48                      2, operations.size());
49         
50         OperationDesc operation;
51         List JavaDoc faults;
52
53         operation = (OperationDesc)operations.get(0);
54         assertEquals("doIt1", operation.getName());
55
56         faults = operation.getFaults();
57
58         assertTrue(faults != null);
59         assertEquals("invalid number of registered faults",
60                      2, faults.size());
61
62         operation = (OperationDesc)operations.get(1);
63         assertEquals("doIt2", operation.getName());
64
65         faults = operation.getFaults();
66
67         assertTrue(faults != null);
68         assertEquals("invalid number of registered faults",
69                      2, faults.size());
70
71
72     }
73
74 }
75
Popular Tags