Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 1199 invoked from network); 26 Jun 2008 04:51:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Jun 2008 04:51:58 -0000 Received: (qmail 59560 invoked by uid 500); 26 Jun 2008 04:51:59 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 59500 invoked by uid 500); 26 Jun 2008 04:51:59 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 59490 invoked by uid 99); 26 Jun 2008 04:51:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Jun 2008 21:51:59 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Jun 2008 04:51:17 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id F077023889F3; Wed, 25 Jun 2008 21:51:06 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r671732 - in /cxf/branches/2.0.x-fixes: ./ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/ rt/frontend/s... Date: Thu, 26 Jun 2008 04:51:06 -0000 To: commits@cxf.apache.org From: ningjiang@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080626045106.F077023889F3@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ningjiang Date: Wed Jun 25 21:51:06 2008 New Revision: 671732 URL: http://svn.apache.org/viewvc?rev=671732&view=rev Log: Merged revisions 671544-671548 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r671544 | ningjiang | 2008-06-25 21:13:04 +0800 (Wed, 25 Jun 2008) | 1 line CXF-1667 Get the wsdlLocation attribute work in and ........ r671548 | ningjiang | 2008-06-25 21:46:44 +0800 (Wed, 25 Jun 2008) | 1 line CXF-1667 added the files which I forgot with my last commit ........ Added: cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/GreeterImplDoc.java - copied unchanged from r671548, cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/GreeterImplDoc.java cxf/branches/2.0.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/simple.wsdl - copied unchanged from r671548, cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/simple.wsdl Modified: cxf/branches/2.0.x-fixes/ (props changed) cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/NamespaceHandler.java cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/servers.xml cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java cxf/branches/2.0.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/SpringBeansTest.java cxf/branches/2.0.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/servers.xml Propchange: cxf/branches/2.0.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/NamespaceHandler.java URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/NamespaceHandler.java?rev=671732&r1=671731&r2=671732&view=diff ============================================================================== --- cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/NamespaceHandler.java (original) +++ cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/NamespaceHandler.java Wed Jun 25 21:51:06 2008 @@ -32,25 +32,25 @@ public class NamespaceHandler extends NamespaceHandlerSupport { public void init() { - registerBeanDefinitionParser("client", new JaxWsProxyFactoryBeanDefinitionParser()); + registerBeanDefinitionParser("client", new JaxWsProxyFactoryBeanDefinitionParser()); registerBeanDefinitionParser("endpoint", new EndpointDefinitionParser()); registerBeanDefinitionParser("schemaLocation", new StringBeanDefinitionParser()); - + ServerFactoryBeanDefinitionParser parser = new ServerFactoryBeanDefinitionParser(); - parser.setBeanClass(JaxWsServerFactoryBean.class); - registerBeanDefinitionParser("server", parser); + parser.setBeanClass(SpringServerFactoryBean.class); + registerBeanDefinitionParser("server", parser); } - + public static class SpringServerFactoryBean extends JaxWsServerFactoryBean implements ApplicationContextAware { - + public SpringServerFactoryBean() { super(); } public SpringServerFactoryBean(JaxWsServiceFactoryBean fact) { super(fact); } - + public void setApplicationContext(ApplicationContext ctx) throws BeansException { if (getBus() == null) { Bus bus = BusFactory.getThreadDefaultBus(); Modified: cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java?rev=671732&r1=671731&r2=671732&view=diff ============================================================================== --- cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java (original) +++ cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java Wed Jun 25 21:51:06 2008 @@ -48,6 +48,7 @@ import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; import org.apache.cxf.jaxws.JaxWsServerFactoryBean; import org.apache.cxf.jaxws.service.Hello; +import org.apache.cxf.jaxws.spring.NamespaceHandler.SpringServerFactoryBean; import org.apache.cxf.transport.http.WSDLQueryHandler; import org.apache.hello_world_soap_http.Greeter; import org.junit.After; @@ -56,7 +57,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; public class SpringBeansTest extends Assert { - + @After public void tearDown() throws Exception { if (BusFactory.getDefaultBus(false) != null) { @@ -66,29 +67,29 @@ @Test public void testEndpoints() throws Exception { - ClassPathXmlApplicationContext ctx = + ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] {"/org/apache/cxf/jaxws/spring/endpoints.xml"}); Object bean = ctx.getBean("simple"); assertNotNull(bean); - + EndpointImpl ep = (EndpointImpl) bean; assertNotNull(ep.getImplementor()); assertNotNull(ep.getServer()); - + bean = ctx.getBean("simpleWithAddress"); assertNotNull(bean); - - ep = (EndpointImpl) bean; + + ep = (EndpointImpl) bean; if (!(ep.getImplementor() instanceof org.apache.hello_world_soap_http.GreeterImpl)) { fail("can't get the right implementor object"); - } - assertEquals("http://localhost:8080/simpleWithAddress", + } + assertEquals("http://localhost:8080/simpleWithAddress", ep.getServer().getEndpoint().getEndpointInfo().getAddress()); - + bean = ctx.getBean("inlineImplementor"); assertNotNull(bean); - + ep = (EndpointImpl) bean; if (!(ep.getImplementor() instanceof org.apache.hello_world_soap_http.GreeterImpl)) { fail("can't get the right implementor object"); @@ -97,7 +98,7 @@ (org.apache.hello_world_soap_http.GreeterImpl)ep.getImplementor(); assertEquals("The property was not injected rightly", impl.getPrefix(), "hello"); assertNotNull(ep.getServer()); - + bean = ctx.getBean("inlineInvoker"); assertNotNull(bean); @@ -105,13 +106,13 @@ assertTrue(ep.getInvoker() instanceof NullInvoker); assertTrue(ep.getService().getInvoker() instanceof NullInvoker); - bean = ctx.getBean("simpleWithBindingUri"); + bean = ctx.getBean("simpleWithBindingUri"); assertNotNull(bean); ep = (EndpointImpl) bean; - assertEquals("get the wrong bindingId", + assertEquals("get the wrong bindingId", ep.getBindingUri(), "http://cxf.apache.org/bindings/xformat"); - + bean = ctx.getBean("simpleWithBinding"); assertNotNull(bean); ep = (EndpointImpl) bean; @@ -121,56 +122,56 @@ assertTrue(sbc.getVersion() instanceof Soap12); assertTrue("the soap configure should set isMtomEnabled to be true", sbc.isMtomEnabled()); - + bean = ctx.getBean("implementorClass"); assertNotNull(bean); ep = (EndpointImpl) bean; assertEquals(Hello.class, ep.getImplementorClass()); assertTrue(ep.getImplementor().getClass() == Object.class); - + bean = ctx.getBean("epWithProps"); assertNotNull(bean); - + ep = (EndpointImpl) bean; assertEquals("bar", ep.getProperties().get("foo")); - + bean = ctx.getBean("classImpl"); assertNotNull(bean); - + ep = (EndpointImpl) bean; assertTrue(ep.getImplementor() instanceof Hello); - + QName name = ep.getServer().getEndpoint().getService().getName(); assertEquals("http://service.jaxws.cxf.apache.org/service", name.getNamespaceURI()); assertEquals("HelloServiceCustomized", name.getLocalPart()); - + name = ep.getServer().getEndpoint().getEndpointInfo().getName(); assertEquals("http://service.jaxws.cxf.apache.org/endpoint", name.getNamespaceURI()); assertEquals("HelloEndpointCustomized", name.getLocalPart()); - + bean = ctx.getBean("wsdlLocation"); assertNotNull(bean); - + bean = ctx.getBean("publishedEndpointUrl"); assertNotNull(bean); String expectedEndpointUrl = "http://cxf.apache.org/Greeter"; ep = (EndpointImpl) bean; assertEquals(expectedEndpointUrl, ep.getPublishedEndpointUrl()); - + // test for existence of Endpoint without an id element boolean found = false; String[] names = ctx.getBeanNamesForType(EndpointImpl.class); for (String n : names) { - if (n.startsWith(EndpointImpl.class.getPackage().getName())) { + if (n.startsWith(EndpointImpl.class.getPackage().getName())) { found = true; } } assertTrue("Could not find server factory with autogenerated id", found); - + testInterceptors(ctx); } - + private void testNamespaceMapping(ApplicationContext ctx) throws Exception { AnonymousComplexType act = (AnonymousComplexType) ctx.getBean("bookClient"); Client client = ClientProxy.getClient(act); @@ -202,7 +203,7 @@ } assertTrue(saaj); assertTrue(logging); - + saaj = false; logging = false; for (Interceptor i : ep.getOutInterceptors()) { @@ -214,19 +215,19 @@ } assertTrue(saaj); } - + @Test public void testServers() throws Exception { - ClassPathXmlApplicationContext ctx = + ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] {"/org/apache/cxf/jaxws/spring/servers.xml"}); JaxWsServerFactoryBean bean; BindingConfiguration bc; SoapBindingConfiguration sbc; - + bean = (JaxWsServerFactoryBean) ctx.getBean("inlineSoapBindingRPC"); assertNotNull(bean); - + bc = bean.getBindingConfig(); assertTrue(bc instanceof SoapBindingConfiguration); sbc = (SoapBindingConfiguration) bc; @@ -240,48 +241,52 @@ String wsdl = bout.toString(); assertTrue(wsdl.contains("name=\"stringArray\"")); assertTrue(wsdl.contains("name=\"stringArray\"")); - + bean = (JaxWsServerFactoryBean) ctx.getBean("simple"); assertNotNull(bean); + bean = (JaxWsServerFactoryBean) ctx.getBean("inlineWsdlLocation"); + assertNotNull(bean); + assertEquals(bean.getWsdlLocation(), "wsdl/hello_world_doc_lit.wsdl"); + bean = (JaxWsServerFactoryBean) ctx.getBean("inlineSoapBinding"); assertNotNull(bean); - + bc = bean.getBindingConfig(); assertTrue(bc instanceof SoapBindingConfiguration); sbc = (SoapBindingConfiguration) bc; assertTrue("Not soap version 1.2: " + sbc.getVersion(), sbc.getVersion() instanceof Soap12); - + bean = (JaxWsServerFactoryBean) ctx.getBean("inlineDataBinding"); - + boolean found = false; - String[] names = ctx.getBeanNamesForType(JaxWsServerFactoryBean.class); + String[] names = ctx.getBeanNamesForType(SpringServerFactoryBean.class); for (String n : names) { - if (n.startsWith(JaxWsServerFactoryBean.class.getName())) { + if (n.startsWith(SpringServerFactoryBean.class.getName())) { found = true; } } assertTrue("Could not find server factory with autogenerated id", found); testNamespaceMapping(ctx); } - + @Test public void testClients() throws Exception { - ClassPathXmlApplicationContext ctx = + ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] {"/org/apache/cxf/jaxws/spring/clients.xml"}); Object bean = ctx.getBean("client1.proxyFactory"); assertNotNull(bean); - + Greeter greeter = (Greeter) ctx.getBean("client1"); assertNotNull(greeter); - + Client client = ClientProxy.getClient(greeter); assertNotNull("expected ConduitSelector", client.getConduitSelector()); assertTrue("unexpected ConduitSelector", client.getConduitSelector() instanceof NullConduitSelector); - + List inInterceptors = client.getInInterceptors(); boolean saaj = false; boolean logging = false; @@ -294,7 +299,7 @@ } assertTrue(saaj); assertTrue(logging); - + saaj = false; logging = false; for (Interceptor i : client.getOutInterceptors()) { @@ -306,17 +311,17 @@ } assertTrue(saaj); assertTrue(logging); - + assertTrue(client.getEndpoint().getService().getDataBinding() instanceof SourceDataBinding); - + JaxWsProxyFactoryBean factory = (JaxWsProxyFactoryBean)ctx.getBean("wsdlLocation.proxyFactory"); assertNotNull(factory); String wsdlLocation = factory.getWsdlLocation(); assertEquals("We should get the right wsdl location" , wsdlLocation, "wsdl/hello_world.wsdl"); - + factory = (JaxWsProxyFactoryBean)ctx.getBean("inlineSoapBinding.proxyFactory"); assertNotNull(factory); - + BindingConfiguration bc = factory.getBindingConfig(); assertTrue(bc instanceof SoapBindingConfiguration); SoapBindingConfiguration sbc = (SoapBindingConfiguration) bc; @@ -324,5 +329,5 @@ assertTrue("the soap configure should set isMtomEnabled to be true", sbc.isMtomEnabled()); } - + } Modified: cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/servers.xml URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/servers.xml?rev=671732&r1=671731&r2=671732&view=diff ============================================================================== --- cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/servers.xml (original) +++ cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/servers.xml Wed Jun 25 21:51:06 2008 @@ -28,7 +28,7 @@ - + @@ -38,26 +38,26 @@ - + - - + - - @@ -71,10 +71,10 @@ - + @@ -97,35 +97,41 @@ - - - - + + + - - - + - + Modified: cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java?rev=671732&r1=671731&r2=671732&view=diff ============================================================================== --- cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java (original) +++ cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java Wed Jun 25 21:51:06 2008 @@ -50,9 +50,9 @@ /** - * This class helps take a {@link org.apache.cxf.service.Service} and + * This class helps take a {@link org.apache.cxf.service.Service} and * expose as a server side endpoint. - * If there is no Service, it can create one for you using a + * If there is no Service, it can create one for you using a * {@link ReflectionServiceFactoryBean}. *

* For most scenarios you'll want to just have the ServerFactoryBean handle everything @@ -87,14 +87,14 @@ private Object serviceBean; private List schemaLocations; private Invoker invoker; - + public ServerFactoryBean() { - this(new ReflectionServiceFactoryBean()); + this(new ReflectionServiceFactoryBean()); } public ServerFactoryBean(ReflectionServiceFactoryBean sbean) { super(sbean); } - + public String getBeanName() { return this.getClass().getName(); } @@ -110,21 +110,21 @@ } else if (serviceBean != null) { getServiceFactory().setInvoker(createInvoker()); } - + Endpoint ep = createEndpoint(); - server = new ServerImpl(getBus(), - ep, - getDestinationFactory(), + server = new ServerImpl(getBus(), + ep, + getDestinationFactory(), getBindingFactory()); - + if (invoker == null) { if (serviceBean != null) { ep.getService().setInvoker(createInvoker()); - } + } } else { ep.getService().setInvoker(invoker); } - + if (start) { server.start(); } @@ -135,29 +135,29 @@ } catch (IOException e) { throw new ServiceConstructionException(e); } - + if (serviceBean != null) { initializeAnnotationInterceptors(server.getEndpoint(), ClassHelper.getRealClass(getServiceBean())); } - + applyFeatures(); return server; } - + @Override protected void initializeServiceFactory() { super.initializeServiceFactory(); - + DataBinding db = getServiceFactory().getDataBinding(); if (db instanceof AbstractDataBinding && schemaLocations != null) { ResourceManager rr = getBus().getExtension(ResourceManager.class); - + List schemas = new ArrayList(); for (String l : schemaLocations) { URL url = rr.resolveResource(l, URL.class); - + if (url == null) { URIResolver res; try { @@ -165,13 +165,13 @@ } catch (IOException e) { throw new ServiceConstructionException(new Message("INVALID_SCHEMA_URL", LOG), e); } - + if (!res.isResolved()) { throw new ServiceConstructionException(new Message("INVALID_SCHEMA_URL", LOG)); } url = res.getURL(); } - + Document d; try { d = DOMUtils.readXml(url.openStream()); @@ -181,7 +181,7 @@ } schemas.add(new DOMSource(d, url.toString())); } - + ((AbstractDataBinding)db).setSchemas(schemas); } } @@ -204,8 +204,8 @@ } } } - - + + protected Invoker createInvoker() { return new BeanInvoker(getServiceBean()); } @@ -230,10 +230,10 @@ this.start = start; } - public Object getServiceBean() { + public Object getServiceBean() { return serviceBean; } - + public Class getServiceBeanClass() { if (serviceBean != null) { return ClassHelper.getRealClass(serviceBean); @@ -245,7 +245,7 @@ /** * Set the backing service bean. If this is set a BeanInvoker is created for * the provided bean. - * + * * @return */ public void setServiceBean(Object serviceBean) { @@ -268,4 +268,12 @@ this.invoker = invoker; } + public void setWsdlLocation(String location) { + setWsdlURL(location); + } + + public String getWsdlLocation() { + return getWsdlURL(); + } + } Modified: cxf/branches/2.0.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/SpringBeansTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/SpringBeansTest.java?rev=671732&r1=671731&r2=671732&view=diff ============================================================================== --- cxf/branches/2.0.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/SpringBeansTest.java (original) +++ cxf/branches/2.0.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/SpringBeansTest.java Wed Jun 25 21:51:06 2008 @@ -19,7 +19,6 @@ package org.apache.cxf.frontend.spring; import java.util.List; - import junit.framework.Assert; import org.apache.cxf.binding.BindingConfiguration; @@ -42,6 +41,8 @@ import org.junit.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; + + public class SpringBeansTest extends Assert { @Test @@ -63,8 +64,6 @@ bean = (ServerFactoryBean) ctx.getBean("inlineSoapBinding"); assertNotNull(bean); - - BindingConfiguration bc = bean.getBindingConfig(); assertTrue(bc instanceof SoapBindingConfiguration); SoapBindingConfiguration sbc = (SoapBindingConfiguration) bc; @@ -75,6 +74,9 @@ bean.getBindingId(), "http://cxf.apache.org/bindings/xformat"); + bean = (ServerFactoryBean) ctx.getBean("simpleWithWSDL"); + assertNotNull(bean); + assertEquals(bean.getWsdlLocation(), "org/apache/cxf/frontend/spring/simple.wsdl"); } @Test Modified: cxf/branches/2.0.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/servers.xml URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/servers.xml?rev=671732&r1=671731&r2=671732&view=diff ============================================================================== --- cxf/branches/2.0.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/servers.xml (original) +++ cxf/branches/2.0.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/servers.xml Wed Jun 25 21:51:06 2008 @@ -29,7 +29,7 @@ - + @@ -40,25 +40,30 @@ - + - - - + + - + - - @@ -68,13 +73,13 @@ - + - -