camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1209676 - in /camel/trunk/components/camel-cxf/src: main/java/org/apache/camel/component/cxf/spring/ test/java/org/apache/camel/component/cxf/spring/ test/resources/org/apache/camel/component/cxf/ test/resources/org/apache/camel/component/...
Date Fri, 02 Dec 2011 20:04:16 GMT
Author: dkulp
Date: Fri Dec  2 20:04:15 2011
New Revision: 1209676

URL: http://svn.apache.org/viewvc?rev=1209676&view=rev
Log:
[CAMEL-3731] Enhance how the bus wiring is done for cxf endpoints
Support both CXF >=2.5.1 and older CXF versions that don't have
the bug fixed there.
Also fix some tests that will start failing with CXF 2.5.1 that were
referencing an undefined bus.

Modified:
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanBusSettingTest.java
    camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/CxfDispatchMessageBeans.xml
    camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/CxfDispatchPayloadBeans.xml
    camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeansBusSetting.xml

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java?rev=1209676&r1=1209675&r2=1209676&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java
(original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java
Fri Dec  2 20:04:15 2011
@@ -23,6 +23,7 @@ import javax.xml.namespace.QName;
 import org.w3c.dom.Element;
 
 import org.apache.camel.component.cxf.CxfSpringEndpoint;
+import org.apache.cxf.common.util.StringUtils;
 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
 import org.springframework.beans.factory.xml.ParserContext;
 
@@ -43,6 +44,17 @@ public class CxfEndpointBeanDefinitionPa
     }
 
     @Override
+    protected boolean parseAttributes(Element element, ParserContext ctx, BeanDefinitionBuilder
bean) {
+        boolean addedBus = super.parseAttributes(element, ctx, bean);
+        final String bus = element.getAttribute("bus");
+        if (!addedBus && !StringUtils.isEmpty(bus)) {
+            bean.addPropertyReference("bus", bus.startsWith("#") ? bus.substring(1) : bus);
+            addedBus = true;
+        }
+        return addedBus;
+    }
+
+    @Override
     protected void mapAttribute(BeanDefinitionBuilder bean, Element e, String name, String
val) {
         if ("endpointName".equals(name) || "serviceName".equals(name)) {
             if (isSpringPlaceHolder(val)) {

Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanBusSettingTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanBusSettingTest.java?rev=1209676&r1=1209675&r2=1209676&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanBusSettingTest.java
(original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanBusSettingTest.java
Fri Dec  2 20:04:15 2011
@@ -46,20 +46,17 @@ public class CxfEndpointBeanBusSettingTe
         Bus cxf1 = endpoint.getBus();
         
         assertEquals(cxf1, ctx.getBean("cxf1"));
-        assertTrue(cxf1.getOutInterceptors().size() >= 1);
-        assertTrue(cxf1.getInInterceptors().size() == 0);
-        LoggingOutInterceptor log1 = getInterceptor(cxf1.getOutInterceptors(), LoggingOutInterceptor.class);
-        assertNotNull(log1);
+        assertEquals(cxf1, endpoint.getBus());
+        assertEquals("barf", endpoint.getBus().getProperty("foo"));
         
         endpoint = (CxfEndpoint)camelContext.getEndpoint("cxf:bean:serviceEndpoint");
         assertEquals("Get a wrong endpoint uri", "cxf://bean:serviceEndpoint", endpoint.getEndpointUri());
         Bus cxf2 = endpoint.getBus();
         
         assertEquals(cxf2, ctx.getBean("cxf2"));
-        assertTrue(cxf2.getInInterceptors().size() >= 1);
-        assertTrue(cxf2.getOutInterceptors().size() == 0);
-        LoggingInInterceptor log2 = getInterceptor(cxf2.getInInterceptors(), LoggingInInterceptor.class);
-        assertNotNull(log2);
+        assertEquals(cxf2, endpoint.getBus());
+        assertEquals("snarf", endpoint.getBus().getProperty("foo"));
+        
     }
     
     

Modified: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/CxfDispatchMessageBeans.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/CxfDispatchMessageBeans.xml?rev=1209676&r1=1209675&r2=1209676&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/CxfDispatchMessageBeans.xml
(original)
+++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/CxfDispatchMessageBeans.xml
Fri Dec  2 20:04:15 2011
@@ -32,7 +32,7 @@
 		   address="http://localhost:${CXFTestSupport.port1}/CxfDispatchMessageTest/SoapContext/GreeterPort"
 		   endpointName="s:GreeterPort" 
 		   serviceName="s:GreeterService"
-		   bus="#bus">
+		   bus="#cxf">
 
       <cxf:properties>
          <entry key="dataFormat" value="MESSAGE"/>

Modified: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/CxfDispatchPayloadBeans.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/CxfDispatchPayloadBeans.xml?rev=1209676&r1=1209675&r2=1209676&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/CxfDispatchPayloadBeans.xml
(original)
+++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/CxfDispatchPayloadBeans.xml
Fri Dec  2 20:04:15 2011
@@ -33,7 +33,7 @@
 		   address="http://localhost:${CXFTestSupport.port1}/CxfDispatchPayloadTest/SoapContext/GreeterPort"
 		   endpointName="s:GreeterPort" 
 		   serviceName="s:GreeterService"
-		   bus="#bus">
+		   bus="#cxf">
 
       <cxf:properties>
          <entry key="dataFormat" value="PAYLOAD"/>

Modified: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeansBusSetting.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeansBusSetting.xml?rev=1209676&r1=1209675&r2=1209676&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeansBusSetting.xml
(original)
+++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeansBusSetting.xml
Fri Dec  2 20:04:15 2011
@@ -29,20 +29,16 @@
     ">
     <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
 
-    <bean id="cxf1" class="org.apache.cxf.bus.extension.ExtensionManagerBus"/>
-    <bean id="cxf2" class="org.apache.cxf.bus.extension.ExtensionManagerBus"/>
-
-    <!-- The bus configure doesn't create the CXF bus instance -->
     <cxfcore:bus bus="cxf1">
-        <cxfcore:outInterceptors>
-        <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
-        </cxfcore:outInterceptors>
+        <cxfcore:properties>
+            <entry key="foo" value="barf"/>
+        </cxfcore:properties>
     </cxfcore:bus>
 
     <cxfcore:bus bus="cxf2">
-        <cxfcore:inInterceptors>
-        <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
-        </cxfcore:inInterceptors>
+        <cxfcore:properties>
+            <entry key="foo" value="snarf"/>
+        </cxfcore:properties>
     </cxfcore:bus>
    
   



Mime
View raw message