1 package org.objectweb.celtix.routing; 2 3 import java.net.URL ; 4 import java.util.HashMap ; 5 import java.util.List ; 6 import java.util.Map ; 8 9 import javax.wsdl.Definition; 10 import javax.xml.namespace.QName ; 11 12 import junit.framework.TestCase; 13 import org.objectweb.celtix.Bus; 14 import org.objectweb.celtix.routing.configuration.RouteType; 15 import org.objectweb.hello_world_doc_lit.Greeter; 16 17 public class SEIImplHandlerTest extends TestCase { 18 19 private Map <String , Object > properties; 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", "HTTPXMLServiceSource"); 39 String sourcePort = new String ("HTTPXMLPortSource"); 40 QName destSrv = new QName ("http://objectweb.org/HWRouter", "HTTPSoapServiceDestination"); 41 String destPort = new String ("HTTPSoapPortDestination"); 42 43 RouteType rt = 44 RouteTypeUtil.createRouteType("normal_route", 45 sourceSrv, sourcePort, 46 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", proxyList); 52 assertEquals("Should have one client proxy", 1 , proxyList.size()); 53 } 54 55 public static void main(String [] args) { 56 junit.textui.TestRunner.run(SEIImplHandlerTest.class); 57 } 58 59 class TestHandler extends SEIImplHandler { 60 public TestHandler(Definition model, RouteType rt) { 61 super(model, rt); 62 } 63 64 public List <Object > doInit(Class <?> seiClass) { 65 super.init(seiClass); 66 return super.proxyList; 67 } 68 } 69 } 70 | Popular Tags |