This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch camel-2.21.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-2.21.x by this push:
     new 2efdb01  CAMEL-12540 Avoid the address setting of 
CxfRsEndpointConfigurer
2efdb01 is described below

commit 2efdb0149f0e9eb39ac605f57dbae06650c3cd36
Author: Willem Jiang <jiangni...@huawei.com>
AuthorDate: Sun May 27 13:58:47 2018 +0800

    CAMEL-12540 Avoid the address setting of CxfRsEndpointConfigurer
---
 .../camel/component/cxf/jaxrs/CxfRsBlueprintEndpoint.java      |  1 +
 .../org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java    | 10 +++++-----
 .../apache/camel/component/cxf/jaxrs/CxfRsSpringEndpoint.java  |  2 ++
 .../cxf/jaxrs/CxfRsProducerEndpointConfigurerTest.java         |  4 ++++
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git 
a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsBlueprintEndpoint.java
 
b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsBlueprintEndpoint.java
index e9cd9b9..d6a3d50 100644
--- 
a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsBlueprintEndpoint.java
+++ 
b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsBlueprintEndpoint.java
@@ -91,6 +91,7 @@ public class CxfRsBlueprintEndpoint extends CxfRsEndpoint {
     @Override
     protected JAXRSClientFactoryBean newJAXRSClientFactoryBean() {
         checkBeanType(bean, JAXRSClientFactoryBean.class);
+        // TODO Need to find a way to setup the JAXRSClientFactory Bean, as 
the JAXRSClientFactoryBean properties could be changed by the configurer
         return (RsClientBlueprintBean)bean;
     }
     
diff --git 
a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
 
b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
index 015918a..69e2471 100644
--- 
a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
+++ 
b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
@@ -266,7 +266,7 @@ public class CxfRsEndpoint extends DefaultEndpoint 
implements HeaderFilterStrate
         getNullSafeCxfRsEndpointConfigurer().configure(sfb);
     }
 
-    private CxfRsEndpointConfigurer getNullSafeCxfRsEndpointConfigurer() {
+    protected CxfRsEndpointConfigurer getNullSafeCxfRsEndpointConfigurer() {
         if (cxfRsEndpointConfigurer == null) {
             return new 
ChainedCxfRsEndpointConfigurer.NullCxfRsEndpointConfigurer();
         }
@@ -304,10 +304,6 @@ public class CxfRsEndpoint extends DefaultEndpoint 
implements HeaderFilterStrate
     }
 
     protected void setupJAXRSClientFactoryBean(JAXRSClientFactoryBean cfb, 
String address) {
-        // address
-        if (address != null) {
-            cfb.setAddress(address);
-        }
         if (modelRef != null) {
             cfb.setModelRef(modelRef);
         }
@@ -318,6 +314,10 @@ public class CxfRsEndpoint extends DefaultEndpoint 
implements HeaderFilterStrate
         setupCommonFactoryProperties(cfb);
         cfb.setThreadSafe(true);
         getNullSafeCxfRsEndpointConfigurer().configure(cfb);
+        // Add the address could be override by message header
+        if (address != null) {
+            cfb.setAddress(address);
+        }
     }
 
     protected void setupCommonFactoryProperties(AbstractJAXRSFactoryBean 
factory) {
diff --git 
a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpoint.java
 
b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpoint.java
index d10d6c5..954d984 100644
--- 
a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpoint.java
+++ 
b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpoint.java
@@ -75,6 +75,8 @@ public class CxfRsSpringEndpoint extends CxfRsEndpoint 
implements BeanIdAware {
     @Override
     protected void setupJAXRSClientFactoryBean(JAXRSClientFactoryBean cfb, 
String address) {
         configurer.configureBean(beanId, cfb);
+        // support to call the configurer here
+        getNullSafeCxfRsEndpointConfigurer().configure(cfb);
         cfb.setAddress(address);
         cfb.setThreadSafe(true);
     }
diff --git 
a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerEndpointConfigurerTest.java
 
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerEndpointConfigurerTest.java
index dbca65a..46dbc2f 100644
--- 
a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerEndpointConfigurerTest.java
+++ 
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerEndpointConfigurerTest.java
@@ -66,6 +66,7 @@ public class CxfRsProducerEndpointConfigurerTest extends 
CamelTestSupport {
             inMessage.setBody(messageContentsList);
         });
         getMockEndpoint("mock:result").expectedHeaderReceived("foo", "bar");
+        getMockEndpoint("mock:end").expectedMessageCount(1);
         assertMockEndpointsSatisfied();
     }
 
@@ -80,6 +81,7 @@ public class CxfRsProducerEndpointConfigurerTest extends 
CamelTestSupport {
             inMessage.setHeader(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS, 
Customer.class);
         });
         getMockEndpoint("mock:result").expectedHeaderReceived("foo", "bar");
+        getMockEndpoint("mock:end").expectedMessageCount(1);
         assertMockEndpointsSatisfied();
     }
 
@@ -87,6 +89,8 @@ public class CxfRsProducerEndpointConfigurerTest extends 
CamelTestSupport {
 
         @Override
         public void configure(AbstractJAXRSFactoryBean factoryBean) {
+            // setup the wrong address here, it should be override from the 
address
+            factoryBean.setAddress("xxxx");
         }
 
         @Override

-- 
To stop receiving notification emails like this one, please contact
ningji...@apache.org.

Reply via email to