1 package org.objectweb.celtix.bus.jaxws; 2 3 import java.util.Properties ; 4 5 import javax.xml.ws.Endpoint; 6 import javax.xml.ws.soap.SOAPBinding; 7 import javax.xml.ws.spi.Provider; 8 9 import junit.framework.TestCase; 10 11 import org.objectweb.celtix.Bus; 12 import org.objectweb.celtix.bus.jaxws.spi.ProviderImpl; 13 import org.objectweb.hello_world_soap_http.AnnotatedGreeterImpl; 14 import org.objectweb.hello_world_soap_http.NotAnnotatedGreeterImpl; 15 16 public class EndpointFactoryImplTest extends TestCase { 17 18 private Bus bus; 19 private String epfClassName; 20 21 protected void setUp() throws Exception { 22 super.setUp(); 23 epfClassName = System.getProperty(Provider.JAXWSPROVIDER_PROPERTY); 24 System.setProperty(Provider.JAXWSPROVIDER_PROPERTY, 25 ProviderImpl.JAXWS_PROVIDER); 26 bus = Bus.init(); 27 } 28 29 protected void tearDown() throws Exception { 30 bus.shutdown(true); 31 if (null == epfClassName) { 32 Properties properties = System.getProperties(); 33 properties.remove(Provider.JAXWSPROVIDER_PROPERTY); 34 System.setProperties(properties); 35 } else { 36 System.setProperty(Provider.JAXWSPROVIDER_PROPERTY, epfClassName); 37 } 38 39 super.tearDown(); 40 } 41 42 public void testCreateWithNotAnnotatedImplementor() throws Exception { 43 Object implementor = new NotAnnotatedGreeterImpl(); 44 Endpoint ep = Endpoint.create(SOAPBinding.SOAP11HTTP_BINDING, implementor); 45 assertNotNull(ep); 46 } 47 48 public void testCreateWithCorrectlyAnnotatedImplementor() throws Exception { 49 Object implementor = new AnnotatedGreeterImpl(); 50 Endpoint ep = Endpoint.create(SOAPBinding.SOAP11HTTP_BINDING, implementor); 51 assertNotNull(ep); 52 } 53 54 } 55 | Popular Tags |