KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > celtix > bus > wsdl > WSDLManagerInstrumentationTest


1 package org.objectweb.celtix.bus.wsdl;
2
3 import java.net.URL JavaDoc;
4 import junit.framework.TestCase;
5
6
7 public class WSDLManagerInstrumentationTest extends TestCase {
8     private static final String JavaDoc DEFINITION_NAME =
9         "Definition: {http://objectweb.org/hello_world_soap_http}HelloWorld ";
10     private static final String JavaDoc SERVICE_NAME1 =
11         DEFINITION_NAME
12         + "Service: {http://objectweb.org/hello_world_soap_http}SOAPServiceAddressing";
13     private static final String JavaDoc PORTTYPE_NAME =
14         DEFINITION_NAME
15         + "PortType: {http://objectweb.org/hello_world_soap_http}Greeter";
16     private static final String JavaDoc BINDING_NAME =
17         DEFINITION_NAME
18         + "Binding: {http://objectweb.org/hello_world_soap_http}Greeter_SOAPBinding";
19     
20     private static final String JavaDoc[] OPERATIONS = {"sayHi", "greetMe", "greetMeSometime",
21                                                 "greetMeOneWay", "testDocLitFault",
22                                                 "testDocLitBare"};
23     
24     private static final String JavaDoc DEFINITION = "HelloWorld";
25     
26     private static final String JavaDoc PORTTYPE = "Greeter";
27     
28     private WSDLManagerImpl wsdlManager;
29     private WSDLManagerInstrumentation wi;
30                                                 
31     private void loadWSDL() throws Exception JavaDoc {
32         URL JavaDoc url = getClass().getResource("/wsdl/hello_world.wsdl");
33         wsdlManager = new WSDLManagerImpl(null);
34         wsdlManager.getDefinition(url);
35         wi = new WSDLManagerInstrumentation(wsdlManager);
36     }
37        
38     
39     public void testGetServices() throws Exception JavaDoc {
40         loadWSDL();
41         
42         String JavaDoc[] services = wi.getServices();
43         assertEquals("The Services number is not right", 4, services.length);
44         assertTrue("Get wrong Service Name ", services[2].compareTo(SERVICE_NAME1) == 0);
45     }
46     
47     public void testGetBindings() throws Exception JavaDoc {
48         loadWSDL();
49         
50         String JavaDoc[] bindings = wi.getBindings();
51        
52         assertEquals("The bindings number is not right", 1, bindings.length);
53         assertTrue("Get wrong binding Name ", bindings[0].compareTo(BINDING_NAME) == 0);
54     }
55     
56     public void testGetPortTypes() throws Exception JavaDoc {
57         loadWSDL();
58         
59         String JavaDoc[] ports = wi.getPorts();
60         assertEquals("The bindings number is not right", 1, ports.length);
61         assertTrue("Get wrong binding Name ", ports[0].compareTo(PORTTYPE_NAME) == 0);
62     }
63     
64     public void testGetOperation() throws Exception JavaDoc {
65         loadWSDL();
66         
67         String JavaDoc[] operations = wi.getOperation(DEFINITION, PORTTYPE);
68         assertEquals("The operation number is not right", OPERATIONS.length, operations.length);
69         for (int i = 0; i < operations.length; i++) {
70             assertTrue("Get wrong operation Name ",
71                        operations[i].compareTo("Operation: " + OPERATIONS[i]) == 0);
72         }
73         
74     }
75     
76     public void testGetEndpoints() throws Exception JavaDoc {
77         
78     }
79     
80     
81     
82
83 }
84
Popular Tags