camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r717969 - in /activemq/camel/branches/camel-1.x: ./ components/camel-cxf/src/main/java/org/apache/camel/component/cxf/ components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/ components/camel-cxf/src/test/java/org/apache/cam...
Date Sun, 16 Nov 2008 03:03:21 GMT
Author: ningjiang
Date: Sat Nov 15 19:03:21 2008
New Revision: 717969

URL: http://svn.apache.org/viewvc?rev=717969&view=rev
Log:
Merged revisions 717965 via svnmerge from 
https://svn.apache.org/repos/asf/activemq/camel/trunk

........
  r717965 | ningjiang | 2008-11-16 10:42:33 +0800 (Sun, 16 Nov 2008) | 1 line
  
  CAMEL-1094 Applied patch with thanks to William
........

Modified:
    activemq/camel/branches/camel-1.x/   (props changed)
    activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
    activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapProducer.java
    activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java
    activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/Dummy.java
    activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstProcessorTest.java
    activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java
    activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/JaxwsTestHandler.java
    activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstBeans.xml
    activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstProcessor.xml

Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Nov 15 19:03:21 2008
@@ -1 +1 @@
-/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713136,713273,713290,713292,713295,713314,713475,713625,713932,713944,714032
+/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713136,713273,713290,713292,713295,713314,713475,713625,713932,713944,714032,717965

Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java?rev=717969&r1=717968&r2=717969&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
(original)
+++ activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
Sat Nov 15 19:03:21 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.cxf;
 
+import java.lang.reflect.Proxy;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -42,7 +43,9 @@
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.Endpoint;
-import org.apache.cxf.frontend.ClientFactoryBean;
+import org.apache.cxf.frontend.ClientProxy;
+import org.apache.cxf.frontend.ClientProxyFactoryBean;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageContentsList;
@@ -86,15 +89,16 @@
                 throw new CamelException(e);
             }
         }
-
+        
         boolean jsr181Enabled = CxfEndpointUtils.hasWebServiceAnnotation(serviceClass);
         cfb.setJSR181Enabled(jsr181Enabled);
-        
-        return createClientFromClientFactoryBean(cfb);
+       
+        return createClientFromClientFactoryBean(jsr181Enabled ? new JaxWsProxyFactoryBean(cfb)
:
+            new ClientProxyFactoryBean(cfb));
     }
 
     // If cfb is null, we will try to find the right cfb to use.
-    private Client createClientFromClientFactoryBean(ClientFactoryBean cfb) throws CamelException
{
+    private Client createClientFromClientFactoryBean(ClientProxyFactoryBean cfb) throws CamelException
{
         Bus bus = null;
         if (endpoint.getApplicationContext() != null) {
             SpringBusFactory bf = new SpringBusFactory(endpoint.getApplicationContext());
@@ -153,7 +157,7 @@
         }
         
         cfb.setBus(bus);
-        return cfb.create();
+        return ((ClientProxy)Proxy.getInvocationHandler(cfb.create())).getClient();
     }
 
     public void process(Exchange exchange) throws Exception {

Modified: activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapProducer.java?rev=717969&r1=717968&r2=717969&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapProducer.java
(original)
+++ activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapProducer.java
Sat Nov 15 19:03:21 2008
@@ -17,6 +17,7 @@
 package org.apache.camel.component.cxf;
 
 import java.io.OutputStream;
+import java.lang.reflect.Proxy;
 
 import javax.xml.transform.Source;
 
@@ -36,6 +37,8 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.endpoint.ClientImpl;
 import org.apache.cxf.frontend.ClientFactoryBean;
+import org.apache.cxf.frontend.ClientProxy;
+import org.apache.cxf.frontend.ClientProxyFactoryBean;
 import org.apache.cxf.interceptor.InterceptorChain;
 import org.apache.cxf.interceptor.OutgoingChainInterceptor;
 import org.apache.cxf.io.CachedOutputStream;
@@ -74,7 +77,7 @@
 
         //create the endpoint and setup the interceptors
         Class sei = CxfEndpointUtils.getSEIClass(endpoint.getServiceClass());
-        ClientFactoryBean cfb = CxfEndpointUtils.getClientFactoryBean(sei);
+        ClientProxyFactoryBean cfb = CxfEndpointUtils.getClientFactoryBean(sei);
         if (sei == null) {
             cfb.setServiceClass(Dummy.class);
         } else {
@@ -88,7 +91,7 @@
             cfb.setEndpointName(endpoint.getEndpointName());
         }
         cfb.setConduitSelector(new NullConduitSelector());
-        client = (ClientImpl) cfb.create();
+        client = (ClientImpl)((ClientProxy)Proxy.getInvocationHandler(cfb.create())).getClient();
 
     }
 

Modified: activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java?rev=717969&r1=717968&r2=717969&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java
(original)
+++ activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java
Sat Nov 15 19:03:21 2008
@@ -35,9 +35,9 @@
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.frontend.ClientFactoryBean;
+import org.apache.cxf.frontend.ClientProxyFactoryBean;
 import org.apache.cxf.frontend.ServerFactoryBean;
-import org.apache.cxf.jaxws.JaxWsClientFactoryBean;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
 import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
 import org.apache.cxf.service.Service;
@@ -147,16 +147,16 @@
 
     }
 
-    public static ClientFactoryBean getClientFactoryBean(Class<?> cls) throws CamelException
{
-        ClientFactoryBean clientFactory = null;
+    public static ClientProxyFactoryBean getClientFactoryBean(Class<?> cls) throws
CamelException {
+        ClientProxyFactoryBean clientFactory = null;
         try {
             if (cls == null) {
-                clientFactory = new ClientFactoryBean();
+                clientFactory = new ClientProxyFactoryBean();
                 clientFactory.setServiceFactory(new WSDLSoapServiceFactoryBean());
             } else {
                 boolean isJSR181SEnabled = CxfEndpointUtils.hasWebServiceAnnotation(cls);
-                clientFactory = isJSR181SEnabled ? new JaxWsClientFactoryBean()
-                        : new ClientFactoryBean();
+                clientFactory = isJSR181SEnabled ? new JaxWsProxyFactoryBean()
+                        : new ClientProxyFactoryBean();
             }
             return clientFactory;
         } catch (Exception e) {
@@ -274,3 +274,4 @@
 }
 
 
+

Modified: activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/Dummy.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/Dummy.java?rev=717969&r1=717968&r2=717969&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/Dummy.java
(original)
+++ activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/Dummy.java
Sat Nov 15 19:03:21 2008
@@ -17,6 +17,6 @@
 package org.apache.camel.component.cxf.util;
 
 // Dummy class for setting service class
-public class Dummy {
+public interface Dummy {
 
 }

Modified: activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstProcessorTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstProcessorTest.java?rev=717969&r1=717968&r2=717969&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstProcessorTest.java
(original)
+++ activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstProcessorTest.java
Sat Nov 15 19:03:21 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.cxf;
 
+import org.apache.camel.wsdl_first.JaxwsTestHandler;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 public class CxfWsdlFirstProcessorTest extends CxfWsdlFirstTest {
@@ -26,12 +27,11 @@
     }
 
     @Override
-    protected int getExpectedJaxwsHandlerMessageCount() {
-        return 4;
-    }
-    
-    @Override
-    protected int getExpectedJaxwsHandlerFaultCount() {
-        return 2;
+    protected void verifyJaxwsHandlers(JaxwsTestHandler fromHandler, JaxwsTestHandler toHandler)
{
+        assertEquals(2, fromHandler.getFaultCount());
+        assertEquals(4, fromHandler.getMessageCount());
+        assertEquals(0, toHandler.getGetHeadersCount());
+        
     }
+
 }

Modified: activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java?rev=717969&r1=717968&r2=717969&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java
(original)
+++ activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java
Sat Nov 15 19:03:21 2008
@@ -84,8 +84,12 @@
 
     public void testInvokingServiceFromCXFClient() throws Exception {
 
-        JaxwsTestHandler myHandler = getMandatoryBean(JaxwsTestHandler.class, "myJaxwsHandler");
-        myHandler.reset();
+        JaxwsTestHandler fromHandler = getMandatoryBean(JaxwsTestHandler.class, "fromEndpointJaxwsHandler");
+        fromHandler.reset();
+        
+        JaxwsTestHandler toHandler = getMandatoryBean(JaxwsTestHandler.class, "toEndpointJaxwsHandler");
+        toHandler.reset();
+
         URL wsdlURL = getClass().getClassLoader().getResource("person.wsdl");
         PersonService ss = new PersonService(wsdlURL, new QName("http://camel.apache.org/wsdl-first",
"PersonService"));
         Person client = ss.getSoap();
@@ -113,17 +117,14 @@
             assertTrue("Should get the xml vaildate error!", ex.getMessage().indexOf("MyStringType")
> 0);         
         }
         
-        assertEquals(getExpectedJaxwsHandlerFaultCount(), myHandler.getFaultCount());
-        assertEquals(getExpectedJaxwsHandlerMessageCount(), myHandler.getMessageCount());
-
+        verifyJaxwsHandlers(fromHandler, toHandler);
     }
 
-    protected int getExpectedJaxwsHandlerMessageCount() {
-        return 11;
-    }
-
-    protected int getExpectedJaxwsHandlerFaultCount() {
-        return 8;
+    protected void verifyJaxwsHandlers(JaxwsTestHandler fromHandler, JaxwsTestHandler toHandler)
{
+        assertEquals(8, fromHandler.getFaultCount());
+        assertEquals(11, fromHandler.getMessageCount());
+        assertEquals(7, toHandler.getGetHeadersCount());
+        
     }
 
     @SuppressWarnings("unchecked")

Modified: activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/JaxwsTestHandler.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/JaxwsTestHandler.java?rev=717969&r1=717968&r2=717969&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/JaxwsTestHandler.java
(original)
+++ activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/JaxwsTestHandler.java
Sat Nov 15 19:03:21 2008
@@ -26,8 +26,14 @@
 
     private int faultCount;
     private int messageCount;
+    private int getHeadersCount;
+
+    public int getGetHeadersCount() {
+        return getHeadersCount;
+    }
 
     public Set<QName> getHeaders() {
+        getHeadersCount++;
         return null;
     }
 
@@ -48,6 +54,7 @@
     public void reset() {
         faultCount = 0;
         messageCount = 0;
+        getHeadersCount = 0;
     }
     
     public int getFaultCount() {

Modified: activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstBeans.xml
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstBeans.xml?rev=717969&r1=717968&r2=717969&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstBeans.xml
(original)
+++ activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstBeans.xml
Sat Nov 15 19:03:21 2008
@@ -36,7 +36,7 @@
             <entry key="schema-validation-enabled" value="true" />
       </cxf:properties>      
       <cxf:handlers>
-          <ref bean="myJaxwsHandler"/> 
+          <ref bean="fromEndpointJaxwsHandler"/> 
       </cxf:handlers>     
   </cxf:cxfEndpoint> 
 
@@ -45,7 +45,13 @@
                    serviceClass="org.apache.camel.wsdl_first.Person"
                    endpointName="person:soap"
                    serviceName="person:PersonService"                   
-                   xmlns:person="http://camel.apache.org/wsdl-first"/>
+                   xmlns:person="http://camel.apache.org/wsdl-first">
+      
+      <cxf:handlers>
+          <ref bean="toEndpointJaxwsHandler"/> 
+      </cxf:handlers>     
+
+  </cxf:cxfEndpoint>
       
 
    <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
@@ -61,7 +67,9 @@
 
     </camelContext>
 
-    <bean id="myJaxwsHandler" class="org.apache.camel.wsdl_first.JaxwsTestHandler"/>
+    <bean id="fromEndpointJaxwsHandler" class="org.apache.camel.wsdl_first.JaxwsTestHandler"/>
+    <bean id="toEndpointJaxwsHandler" class="org.apache.camel.wsdl_first.JaxwsTestHandler"/>
+    
 
 
 </beans>

Modified: activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstProcessor.xml
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstProcessor.xml?rev=717969&r1=717968&r2=717969&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstProcessor.xml
(original)
+++ activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstProcessor.xml
Sat Nov 15 19:03:21 2008
@@ -37,7 +37,7 @@
             <entry key="schema-validation-enabled" value="true" />
         </cxf:properties>
         <cxf:handlers>
-          <ref bean="myJaxwsHandler"/> 
+          <ref bean="fromEndpointJaxwsHandler"/> 
       </cxf:handlers>     
     </cxf:cxfEndpoint> 
 
@@ -46,7 +46,11 @@
 		serviceClass="org.apache.camel.wsdl_first.Person"
 		endpointName="person:soap"		
 		serviceName="person:PersonService"
-		xmlns:person="http://camel.apache.org/wsdl-first"/>    
+		xmlns:person="http://camel.apache.org/wsdl-first">
+		<cxf:handlers>
+          <ref bean="toEndpointJaxwsHandler"/> 
+        </cxf:handlers>
+	</cxf:cxfEndpoint>    
 
 	<bean id="personProcessor"
 		class="org.apache.camel.wsdl_first.PersonProcessor" />
@@ -67,7 +71,8 @@
 
 	</camelContext>
 	
-	<bean id="myJaxwsHandler" class="org.apache.camel.wsdl_first.JaxwsTestHandler"/>
+	<bean id="fromEndpointJaxwsHandler" class="org.apache.camel.wsdl_first.JaxwsTestHandler"/>
+	<bean id="toEndpointJaxwsHandler" class="org.apache.camel.wsdl_first.JaxwsTestHandler"/>
 
 
 </beans>



Mime
View raw message