Author: ningjiang
Date: Tue Jul 17 23:10:53 2007
New Revision: 557161
URL: http://svn.apache.org/viewvc?view=rev&rev=557161
Log:
Removed the useless code in the ServerFactoryBeanDefinitionParser
Removed the unsupport implementor element in simple.xsd
Added the rountrip test for local transport test
Added:
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/ClientServerTest.java
(with props)
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/rountrip.xml
(with props)
Modified:
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ServerFactoryBeanDefinitionParser.java
incubator/cxf/trunk/rt/frontend/simple/src/main/resources/schemas/simple.xsd
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/SpringBeansTest.java
Modified:
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ServerFactoryBeanDefinitionParser.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ServerFactoryBeanDefinitionParser.java?view=diff&rev=557161&r1=557160&r2=557161
==============================================================================
---
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ServerFactoryBeanDefinitionParser.java
(original)
+++
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ServerFactoryBeanDefinitionParser.java
Tue Jul 17 23:10:53 2007
@@ -23,16 +23,15 @@
import org.w3c.dom.Element;
-import org.apache.cxf.common.classloader.ClassLoaderUtils;
import org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser;
import org.apache.cxf.frontend.ServerFactoryBean;
-import org.springframework.beans.FatalBeanException;
+
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;
-import org.springframework.util.StringUtils;
+
public class ServerFactoryBeanDefinitionParser extends
AbstractBeanDefinitionParser {
- private static final String IMPLEMENTOR = "implementor";
+
public ServerFactoryBeanDefinitionParser() {
super();
@@ -50,15 +49,14 @@
setFirstChildAsProperty(el, ctx, bean, "serviceFactory.invoker");
} else if ("binding".equals(name)) {
setFirstChildAsProperty(el, ctx, bean, "bindingConfig");
- } else if ("inInterceptors".equals(name) ||
"inFaultInterceptors".equals(name)
+ } else if ("inInterceptors".equals(name) ||
"inFaultInterceptors".equals(name)
|| "outInterceptors".equals(name) ||
"outFaultInterceptors".equals(name)
|| "features".equals(name)) {
List list = ctx.getDelegate().parseListElement(el,
bean.getBeanDefinition());
bean.addPropertyValue(name, list);
} else {
- setFirstChildAsProperty(el, ctx, bean, name);
- }
-
+ setFirstChildAsProperty(el, ctx, bean, name);
+ }
}
@@ -71,30 +69,7 @@
// We don't really want to delay the registration of our Server
bean.setLazyInit(false);
}
-
- @Override
- protected void mapAttribute(BeanDefinitionBuilder bean, Element e, String
name, String val) {
- if (name.equals(IMPLEMENTOR)) {
- loadImplementor(bean, val);
- } else {
- super.mapAttribute(bean, e, name, val);
- }
- }
-
- private void loadImplementor(BeanDefinitionBuilder bean, String val) {
- if (StringUtils.hasText(val)) {
- if (val.startsWith("#")) {
- bean.addPropertyReference(IMPLEMENTOR, val.substring(1));
- } else {
- try {
- bean.addPropertyValue(IMPLEMENTOR,
- ClassLoaderUtils.loadClass(val,
getClass()).newInstance());
- } catch (Exception e) {
- throw new FatalBeanException("Could not load class: " +
val, e);
- }
- }
- }
- }
+
@Override
protected boolean hasBusProperty() {
Modified:
incubator/cxf/trunk/rt/frontend/simple/src/main/resources/schemas/simple.xsd
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/resources/schemas/simple.xsd?view=diff&rev=557161&r1=557160&r2=557161
==============================================================================
---
incubator/cxf/trunk/rt/frontend/simple/src/main/resources/schemas/simple.xsd
(original)
+++
incubator/cxf/trunk/rt/frontend/simple/src/main/resources/schemas/simple.xsd
Tue Jul 17 23:10:53 2007
@@ -39,8 +39,7 @@
<xsd:element name="binding" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="dataBinding" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="executor" type="xsd:anyType" minOccurs="0"/>
- <xsd:element name="features" type="xsd:anyType" minOccurs="0"/>
- <xsd:element name="implementor" type="xsd:anyType" minOccurs="0"/>
+ <xsd:element name="features" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="inInterceptors" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="inFaultInterceptors" type="xsd:anyType"
minOccurs="0"/>
<xsd:element name="invoker" type="xsd:anyType" minOccurs="0"/>
Added:
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/ClientServerTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/ClientServerTest.java?view=auto&rev=557161
==============================================================================
---
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/ClientServerTest.java
(added)
+++
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/ClientServerTest.java
Tue Jul 17 23:10:53 2007
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.frontend.spring;
+import junit.framework.Assert;
+import org.apache.cxf.service.factory.HelloService;
+import org.junit.Test;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+
+// set up the client and server with spring bean configuration
+
+public class ClientServerTest extends Assert {
+ @Test
+ public void testClientServer() {
+ ClassPathXmlApplicationContext ctx =
+ new ClassPathXmlApplicationContext(new String[]
{"/org/apache/cxf/frontend/spring/rountrip.xml"});
+
+ HelloService greeter = (HelloService) ctx.getBean("client");
+ assertNotNull(greeter);
+
+ String result = greeter.sayHello();
+ assertEquals("We get the wrong sayHello result", result, "hello");
+ }
+
+}
Propchange:
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/ClientServerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/ClientServerTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/SpringBeansTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/SpringBeansTest.java?view=diff&rev=557161&r1=557160&r2=557161
==============================================================================
---
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/SpringBeansTest.java
(original)
+++
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/SpringBeansTest.java
Tue Jul 17 23:10:53 2007
@@ -35,6 +35,7 @@
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.service.factory.HelloService;
+import org.apache.cxf.service.factory.HelloServiceImpl;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -47,14 +48,26 @@
ServerFactoryBean bean = (ServerFactoryBean) ctx.getBean("simple");
assertNotNull(bean);
+
+ if (!(bean.getServiceBean() instanceof HelloServiceImpl)) {
+ fail("can't get the right serviceBean");
+ }
+ bean = (ServerFactoryBean) ctx.getBean("inlineImplementor");
+ if (!(bean.getServiceBean() instanceof HelloServiceImpl)) {
+ fail("can't get the right serviceBean");
+ }
bean = (ServerFactoryBean) ctx.getBean("inlineSoapBinding");
- assertNotNull(bean);
+ assertNotNull(bean);
+
+
BindingConfiguration bc = bean.getBindingConfig();
assertTrue(bc instanceof SoapBindingConfiguration);
SoapBindingConfiguration sbc = (SoapBindingConfiguration) bc;
assertTrue(sbc.getVersion() instanceof Soap12);
+
+
}
@Test
Added:
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/rountrip.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/rountrip.xml?view=auto&rev=557161
==============================================================================
---
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/rountrip.xml
(added)
+++
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/rountrip.xml
Tue Jul 17 23:10:53 2007
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:simple="http://cxf.apache.org/simple"
+ xmlns:soap="http://cxf.apache.org/bindings/soap"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+http://cxf.apache.org/bindings/soap
http://cxf.apache.org/schemas/configuration/soap.xsd
+http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd">
+
+ <import resource="classpath:META-INF/cxf/cxf.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
+
+ <bean class="org.apache.cxf.transport.local.LocalTransportFactory"
lazy-init="false">
+ <property name="transportIds">
+ <list>
+ <value>http://cxf.apache.org/transports/local</value>
+ <value>http://schemas.xmlsoap.org/soap/http</value>
+ <value>http://schemas.xmlsoap.org/wsdl/soap/http</value>
+ </list>
+ </property>
+ </bean>
+
+ <bean id="greeter" class="org.apache.cxf.service.factory.HelloServiceImpl"/>
+ <simple:server id="server" serviceBean="#greeter"
+ serviceClass="org.apache.cxf.service.factory.HelloService"
+ address="local://hello" />
+
+ <simple:client id="client"
serviceClass="org.apache.cxf.service.factory.HelloService"
+ address="local://hello" />
+
+</beans>
Propchange:
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/rountrip.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/rountrip.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/rountrip.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml