01: package org.objectweb.celtix.routing;
02:
03: import java.net.URL;
04: import java.util.HashMap;
05: import java.util.List; //import java.util.List;
06: import java.util.Map;
07:
08: import javax.wsdl.Definition;
09: import javax.xml.namespace.QName;
10:
11: import junit.framework.TestCase;
12: import org.objectweb.celtix.Bus;
13: import org.objectweb.celtix.routing.configuration.RouteType;
14: import org.objectweb.hello_world_doc_lit.Greeter;
15:
16: public class SEIImplHandlerTest extends TestCase {
17:
18: private Map<String, Object> properties;
19:
20: public void setUp() {
21: properties = new HashMap<String, Object>();
22: }
23:
24: public void tearDown() throws Exception {
25: Bus bus = Bus.getCurrent();
26: bus.shutdown(true);
27: Bus.setCurrent(null);
28: }
29:
30: public void testServiceCreation() throws Exception {
31: properties.put("org.objectweb.celtix.BusId", "MPT1");
32: Bus bus = Bus.init(null, properties);
33: Bus.setCurrent(bus);
34:
35: URL wsdlUrl = getClass().getResource("resources/router.wsdl");
36: Definition def = bus.getWSDLManager().getDefinition(wsdlUrl);
37:
38: QName sourceSrv = new QName("http://objectweb.org/HWRouter",
39: "HTTPXMLServiceSource");
40: String sourcePort = new String("HTTPXMLPortSource");
41: QName destSrv = new QName("http://objectweb.org/HWRouter",
42: "HTTPSoapServiceDestination");
43: String destPort = new String("HTTPSoapPortDestination");
44:
45: RouteType rt = RouteTypeUtil.createRouteType("normal_route",
46: sourceSrv, sourcePort, destSrv, destPort);
47:
48: TestHandler th = new TestHandler(def, rt);
49: List<Object> proxyList = th.doInit(Greeter.class);
50:
51: assertNotNull("List of Client Proxies should notbe null",
52: proxyList);
53: assertEquals("Should have one client proxy", 1, proxyList
54: .size());
55: }
56:
57: public static void main(String[] args) {
58: junit.textui.TestRunner.run(SEIImplHandlerTest.class);
59: }
60:
61: class TestHandler extends SEIImplHandler {
62: public TestHandler(Definition model, RouteType rt) {
63: super (model, rt);
64: }
65:
66: public List<Object> doInit(Class<?> seiClass) {
67: super.init(seiClass);
68: return super.proxyList;
69: }
70: }
71: }
|