1 17 package org.apache.servicemix.jsr181; 18 19 import javax.naming.InitialContext ; 20 import javax.xml.namespace.QName ; 21 22 import junit.framework.TestCase; 23 24 import org.apache.servicemix.jbi.container.JBIContainer; 25 import org.apache.servicemix.jsr181.Jsr181Endpoint; 26 import org.apache.servicemix.jsr181.Jsr181SpringComponent; 27 28 import test.EchoService; 29 import test.EchoService2; 30 31 public class Jsr181OverrideTest extends TestCase { 32 33 protected JBIContainer container; 34 35 protected void setUp() throws Exception { 36 container = new JBIContainer(); 37 container.setUseMBeanServer(false); 38 container.setCreateMBeanServer(false); 39 container.setMonitorInstallationDirectory(false); 40 container.setNamingContext(new InitialContext ()); 41 container.setEmbedded(true); 42 container.init(); 43 container.start(); 44 } 45 46 protected void tearDown() throws Exception { 47 if (container != null) { 48 container.shutDown(); 49 } 50 } 51 52 public void testWithSpecifiedNamesWithAnnotations() throws Exception { 53 QName svcName = new QName ("svcUri", "service"); 54 QName itfName = new QName ("itfUri", "interface"); 55 String epName = "endpoint"; 56 Jsr181SpringComponent component = new Jsr181SpringComponent(); 57 Jsr181Endpoint endpoint = new Jsr181Endpoint(); 58 endpoint.setService(svcName); 59 endpoint.setInterfaceName(itfName); 60 endpoint.setEndpoint(epName); 61 endpoint.setPojo(new EchoService()); 62 component.setEndpoints(new Jsr181Endpoint[] { endpoint }); 63 container.activateComponent(component, "JSR181Component"); 64 } 65 66 public void testWithSpecifiedNamesWithoutAnnotations() throws Exception { 67 QName svcName = new QName ("svcUri", "service"); 68 QName itfName = new QName ("itfUri", "interface"); 69 String epName = "endpoint"; 70 Jsr181SpringComponent component = new Jsr181SpringComponent(); 71 Jsr181Endpoint endpoint = new Jsr181Endpoint(); 72 endpoint.setService(svcName); 73 endpoint.setInterfaceName(itfName); 74 endpoint.setEndpoint(epName); 75 endpoint.setPojo(new EchoService2()); 76 component.setEndpoints(new Jsr181Endpoint[] { endpoint }); 77 container.activateComponent(component, "JSR181Component"); 78 } 79 80 } 81 | Popular Tags |