You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2011/11/25 12:54:23 UTC

svn commit: r1206127 - in /camel/branches/camel-2.8.x: ./ components/camel-cxf/src/main/java/org/apache/camel/component/cxf/ components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/ components/camel-cxf/src/test/resources/org/apache/ca...

Author: ningjiang
Date: Fri Nov 25 11:54:22 2011
New Revision: 1206127

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

........
  r1206116 | ningjiang | 2011-11-25 18:32:23 +0800 (Fri, 25 Nov 2011) | 1 line
  
  CAMEL-4711 Supports to set the properties on the ClientFactoryBean
........

Modified:
    camel/branches/camel-2.8.x/   (props changed)
    camel/branches/camel-2.8.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
    camel/branches/camel-2.8.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
    camel/branches/camel-2.8.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov 25 11:54:22 2011
@@ -1 +1 @@
-/camel/trunk:1202148,1202167,1202204-1202206,1202215,1202223,1202659,1202685,1203879,1203978,1204338,1205124,1205372,1205412,1205429,1205431,1205713
+/camel/trunk:1202148,1202167,1202204-1202206,1202215,1202223,1202659,1202685,1203879,1203978,1204338,1205124,1205372,1205412,1205429,1205431,1205713,1206116

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

Modified: camel/branches/camel-2.8.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java?rev=1206127&r1=1206126&r2=1206127&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java (original)
+++ camel/branches/camel-2.8.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java Fri Nov 25 11:54:22 2011
@@ -282,7 +282,7 @@ public class CxfEndpoint extends Default
             } else {
                 sfb.setProperties(getProperties());
             }
-            LOG.debug("ServerFactoryBean: {} added properties: {}", sfb, properties);
+            LOG.debug("ServerFactoryBean: {} added properties: {}", sfb, getProperties());
         }
 
         sfb.setBus(getBus());
@@ -419,6 +419,17 @@ public class CxfEndpoint extends Default
         if (getWrappedStyle() != null) {
             factoryBean.getServiceFactory().setWrapped(getWrappedStyle());
         }
+        
+        // any optional properties
+        if (getProperties() != null) {
+            if (factoryBean.getProperties() != null) {
+                // add to existing properties
+                factoryBean.getProperties().putAll(getProperties());
+            } else {
+                factoryBean.setProperties(getProperties());
+            }
+            LOG.debug("ClientFactoryBean: {} added properties: {}", factoryBean, getProperties());
+        }
 
         factoryBean.setBus(getBus());
     }

Modified: camel/branches/camel-2.8.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java?rev=1206127&r1=1206126&r2=1206127&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java (original)
+++ camel/branches/camel-2.8.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java Fri Nov 25 11:54:22 2011
@@ -18,6 +18,9 @@ package org.apache.camel.component.cxf.s
 
 import org.apache.camel.component.cxf.CxfEndpoint;
 import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.component.cxf.CxfProducer;
+import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.transport.http.HTTPConduit;
 import org.junit.Test;
 
 public class CxfEndpointBeanTest extends AbstractSpringBeanTestSupport {
@@ -44,4 +47,14 @@ public class CxfEndpointBeanTest extends
         assertEquals("Got the wrong schemalocations size", 1, routerEndpoint.getSchemaLocations().size());
         assertEquals("Got the wrong schemalocation", "classpath:wsdl/Message.xsd", routerEndpoint.getSchemaLocations().get(0));
     }
+    
+    @Test
+    public void testPropertiesSettingOnCxfClient() throws Exception {
+        CxfEndpoint clientEndpoint = (CxfEndpoint)ctx.getBean("clientEndpoint");
+        CxfProducer producer = (CxfProducer) clientEndpoint.createProducer();
+        Client client = producer.getClient();
+        HTTPConduit conduit = (HTTPConduit)client.getConduit();
+        assertEquals("Got the wrong user name", "test", conduit.getAuthorization().getUserName());
+    }
+      
 }

Modified: camel/branches/camel-2.8.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml?rev=1206127&r1=1206126&r2=1206127&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml (original)
+++ camel/branches/camel-2.8.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml Fri Nov 25 11:54:22 2011
@@ -39,5 +39,16 @@
 
   <cxf:cxfEndpoint id="serviceEndpoint" address="http://localhost:${CxfEndpointBeanTest.port2}/helloworld"
     serviceClass="org.apache.camel.component.cxf.HelloService"/>
+    
+  <cxf:cxfEndpoint id="clientEndpoint" address="http://localhost:${CxfEndpointBeanTest.port2}/CxfEndpointBeanTest/helloworld"
+    serviceClass="org.apache.camel.component.cxf.HelloService">
+    <cxf:properties>
+       <entry key="org.apache.cxf.configuration.security.AuthorizationPolicy" value-ref="myPolicy"/>
+    </cxf:properties>
+  </cxf:cxfEndpoint>
+  
+  <bean id="myPolicy" class="org.apache.cxf.configuration.security.AuthorizationPolicy" >
+     <property name="UserName" value="test" />
+  </bean>
 
 </beans>