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/09 04:51:39 UTC

svn commit: r1199606 - in /camel/trunk/components/camel-cxf/src: main/java/org/apache/camel/component/cxf/ main/resources/schema/ main/resources/schema/blueprint/ test/java/org/apache/camel/component/cxf/spring/ test/resources/org/apache/camel/componen...

Author: ningjiang
Date: Wed Nov  9 03:51:39 2011
New Revision: 1199606

URL: http://svn.apache.org/viewvc?rev=1199606&view=rev
Log:
CAMEL-4645 Enhancement of loggingFeature setting on the cxfEndpoint

Modified:
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
    camel/trunk/components/camel-cxf/src/main/resources/schema/blueprint/camel-cxf.xsd
    camel/trunk/components/camel-cxf/src/main/resources/schema/cxfEndpoint.xsd
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
    camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java?rev=1199606&r1=1199605&r2=1199606&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java Wed Nov  9 03:51:39 2011
@@ -122,6 +122,7 @@ public class CxfEndpoint extends Default
     private AtomicBoolean getBusHasBeenCalled = new AtomicBoolean(false);
     private boolean isSetDefaultBus;
     private boolean loggingFeatureEnabled;
+    private int loggingSizeLimit;
     private String address;
     private boolean mtomEnabled;
     private boolean skipPayloadMessagePartCheck;
@@ -264,7 +265,11 @@ public class CxfEndpoint extends Default
         }
 
         if (isLoggingFeatureEnabled()) {
-            sfb.getFeatures().add(new LoggingFeature());
+            if (getLoggingSizeLimit() > 0) {
+                sfb.getFeatures().add(new LoggingFeature(getLoggingSizeLimit()));
+            } else {
+                sfb.getFeatures().add(new LoggingFeature());
+            }
         }
 
         if (getDataFormat() == DataFormat.PAYLOAD) {
@@ -415,7 +420,11 @@ public class CxfEndpoint extends Default
         }
 
         if (isLoggingFeatureEnabled()) {
-            factoryBean.getFeatures().add(new LoggingFeature());
+            if (getLoggingSizeLimit() > 0) {
+                factoryBean.getFeatures().add(new LoggingFeature(getLoggingSizeLimit()));
+            } else {
+                factoryBean.getFeatures().add(new LoggingFeature());
+            }
         }
 
         // set the document-literal wrapped style
@@ -699,6 +708,14 @@ public class CxfEndpoint extends Default
         return loggingFeatureEnabled;
     }
 
+    public int getLoggingSizeLimit() {
+        return loggingSizeLimit;
+    }
+
+    public void setLoggingSizeLimit(int loggingSizeLimit) {
+        this.loggingSizeLimit = loggingSizeLimit;
+    }
+
     protected boolean isSkipPayloadMessagePartCheck() {
         return skipPayloadMessagePartCheck;
     }

Modified: camel/trunk/components/camel-cxf/src/main/resources/schema/blueprint/camel-cxf.xsd
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/resources/schema/blueprint/camel-cxf.xsd?rev=1199606&r1=1199605&r2=1199606&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/resources/schema/blueprint/camel-cxf.xsd (original)
+++ camel/trunk/components/camel-cxf/src/main/resources/schema/blueprint/camel-cxf.xsd Wed Nov  9 03:51:39 2011
@@ -57,7 +57,8 @@
           <xsd:attribute name="wsdlURL" type="xsd:string"/>
           <xsd:attribute name="endpointName" type="xsd:QName"/>
           <xsd:attribute name="serviceName" type="xsd:QName"/>
-          <xsd:attribute name="loggingFeatureEnabled" type="xsd:boolean" default="true"/>
+          <xsd:attribute name="loggingFeatureEnabled" type="xsd:boolean" default="false"/>
+          <xsd:attribute name="loggingSizeLimit" type="xsd:integer" />
         </xsd:extension>
       </xsd:complexContent>
     </xsd:complexType>

Modified: camel/trunk/components/camel-cxf/src/main/resources/schema/cxfEndpoint.xsd
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/resources/schema/cxfEndpoint.xsd?rev=1199606&r1=1199605&r2=1199606&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/resources/schema/cxfEndpoint.xsd (original)
+++ camel/trunk/components/camel-cxf/src/main/resources/schema/cxfEndpoint.xsd Wed Nov  9 03:51:39 2011
@@ -55,7 +55,8 @@
           <xsd:attribute name="wsdlURL" type="xsd:string" />
           <xsd:attribute name="endpointName" type="xsd:string" />
           <xsd:attribute name="serviceName" type="xsd:string" />
-          <xsd:attribute name="loggingFeatureEnabled" type="xsd:boolean" default="true"/>
+          <xsd:attribute name="loggingFeatureEnabled" type="xsd:boolean" default="false"/>
+          <xsd:attribute name="loggingSizeLimit" type="xsd:integer" />
         </xsd:extension>
       </xsd:complexContent>
     </xsd:complexType>

Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java?rev=1199606&r1=1199605&r2=1199606&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java (original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java Wed Nov  9 03:51:39 2011
@@ -47,6 +47,8 @@ public class CxfEndpointBeanTest extends
                      + "/CxfEndpointBeanTest/router", routerEndpoint.getAddress());
         assertEquals("Got the wrong endpont service class", "org.apache.camel.component.cxf.HelloService",
                          routerEndpoint.getServiceClass().getName());
+        assertEquals("loggingFeatureEnabled should be false", false, routerEndpoint.isLoggingFeatureEnabled());
+        assertEquals("loggingSizeLimit should not be set", 0, routerEndpoint.getLoggingSizeLimit());
         assertEquals("Got the wrong handlers size", 1, routerEndpoint.getHandlers().size());
         assertEquals("Got the wrong schemalocations size", 1, routerEndpoint.getSchemaLocations().size());
         assertEquals("Got the wrong schemalocation", "classpath:wsdl/Message.xsd", routerEndpoint.getSchemaLocations().get(0));
@@ -55,6 +57,7 @@ public class CxfEndpointBeanTest extends
         assertEquals("Got the wrong endpointName", endpointName, myEndpoint.getPortName());
         assertEquals("Got the wrong serviceName", serviceName, myEndpoint.getServiceName());
         assertEquals("loggingFeatureEnabled should be true", true, myEndpoint.isLoggingFeatureEnabled());
+        assertEquals("loggingSizeLimit should be set", 200, myEndpoint.getLoggingSizeLimit());
         assertTrue("We should get a soap binding", myEndpoint.getBindingConfig() instanceof SoapBindingConfiguration);
         SoapBindingConfiguration configuration = (SoapBindingConfiguration)myEndpoint.getBindingConfig();
         assertEquals("We should get a right soap version", "1.2", String.valueOf(configuration.getVersion().getVersion()));

Modified: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml?rev=1199606&r1=1199605&r2=1199606&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml (original)
+++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml Wed Nov  9 03:51:39 2011
@@ -44,7 +44,7 @@
 
   <cxf:cxfEndpoint id="myEndpoint" address="http://localhost:${CXFTestSupport.port3}/test"
     serviceClass="org.apache.camel.wsdl_first.Person" serviceName="${CxfEndpointBeans.serviceName}" endpointName="${CxfEndpointBeans.endpointName}"
-    wsdlURL="person.wsdl" loggingFeatureEnabled="true">
+    wsdlURL="person.wsdl" loggingFeatureEnabled="true" loggingSizeLimit="200">
     <cxf:binding>
          <soap:soapBinding version="1.2"/>
     </cxf:binding>