You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2010/09/19 17:47:01 UTC

svn commit: r998687 - in /camel/trunk/components/camel-cxf/src: main/java/org/apache/camel/component/cxf/cxfbean/ test/java/org/apache/camel/component/cxf/cxfbean/ test/java/org/apache/camel/wsdl_first/ test/resources/org/apache/camel/component/cxf/cxf...

Author: davsclaus
Date: Sun Sep 19 15:47:01 2010
New Revision: 998687

URL: http://svn.apache.org/viewvc?rev=998687&view=rev
Log:
CAMEL-3136: cxfbean component should use existing bean instance instead of re-creating a new instance.

Added:
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanAndIoCTest.java
      - copied, changed from r998598, camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanTest.java
    camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanAndIoCTest-context.xml   (contents, props changed)
      - copied, changed from r998598, camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanTest-context.xml
Modified:
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonImplWithWsdl.java

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java?rev=998687&r1=998686&r2=998687&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java Sun Sep 19 15:47:01 2010
@@ -102,6 +102,8 @@ public class CxfBeanEndpoint extends Pro
             JaxWsServerFactoryBean bean = new JaxWsServerFactoryBean();
             bean.setTransportId(CxfBeanTransportFactory.TRANSPORT_ID);
             bean.setServiceClass(serviceBeans.get(0).getClass());
+            // set the bean instance as well, otherwise CXF will re-create a new instance of the class
+            bean.setServiceBean(serviceBeans.get(0));
             if (bean.getServiceFactory() != null) {
                 bean.getServiceFactory().setPopulateFromClass(isPopulateFromClass());
             }

Copied: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanAndIoCTest.java (from r998598, camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanAndIoCTest.java?p2=camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanAndIoCTest.java&p1=camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanTest.java&r1=998598&r2=998687&rev=998687&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanTest.java (original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanAndIoCTest.java Sun Sep 19 15:47:01 2010
@@ -31,7 +31,7 @@ import static org.junit.Assert.assertEqu
  * @version $Revision: 835174 $
  */
 @ContextConfiguration
-public class CxfBeanWithWsdlLocationInBeanTest extends AbstractJUnit4SpringContextTests {
+public class CxfBeanWithWsdlLocationInBeanAndIoCTest extends AbstractJUnit4SpringContextTests {
 
     @Test
     public void testDoNotUseWsdlDefinedInJaxWsBeanByDefault() throws Exception {        
@@ -50,7 +50,7 @@ public class CxfBeanWithWsdlLocationInBe
             String response = post.getResponseBodyAsString();
             String correct = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body>"
                 + "<GetPersonResponse xmlns=\"http://camel.apache.org/wsdl-first/types\">"
-                + "<personId>hello</personId><ssn>000-000-0000</ssn><name>Bonjour</name></GetPersonResponse></soap:Body></soap:Envelope>";
+                + "<personId>hello</personId><ssn>000-000-0000</ssn><name>Bye</name></GetPersonResponse></soap:Body></soap:Envelope>";
             
             assertEquals("Get a wrong response", correct, response);
         } finally {

Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonImplWithWsdl.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonImplWithWsdl.java?rev=998687&r1=998686&r2=998687&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonImplWithWsdl.java (original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonImplWithWsdl.java Sun Sep 19 15:47:01 2010
@@ -25,6 +25,8 @@ import javax.xml.ws.Holder;
         endpointInterface = "org.apache.camel.wsdl_first.Person")
 public class PersonImplWithWsdl implements Person {
 
+    private String reply = "Bonjour";
+
     public void getPerson(Holder<String> personId, Holder<String> ssn,
             Holder<String> name) throws UnknownPersonFault {
         if (personId.value == null || personId.value.length() == 0) {
@@ -33,8 +35,15 @@ public class PersonImplWithWsdl implemen
             fault.setPersonId(personId.value);
             throw new UnknownPersonFault("Get the null value of person name", fault);
         }
-        name.value = "Bonjour";
+        name.value = reply;
         ssn.value = "000-000-0000";
     }
 
+    public String getReply() {
+        return reply;
+    }
+
+    public void setReply(String reply) {
+        this.reply = reply;
+    }
 }

Copied: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanAndIoCTest-context.xml (from r998598, camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanTest-context.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanAndIoCTest-context.xml?p2=camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanAndIoCTest-context.xml&p1=camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanTest-context.xml&r1=998598&r2=998687&rev=998687&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanTest-context.xml (original)
+++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanAndIoCTest-context.xml Sun Sep 19 15:47:01 2010
@@ -21,7 +21,9 @@
        http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
     ">
 
-  <bean class="org.apache.camel.wsdl_first.PersonImplWithWsdl" id="jaxwsBean" />
+  <bean class="org.apache.camel.wsdl_first.PersonImplWithWsdl" id="jaxwsBean">
+      <property name="reply" value="Bye"/>
+  </bean>
 
   <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
     <route>

Propchange: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanAndIoCTest-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native