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 2012/11/09 09:57:49 UTC

svn commit: r1407387 - in /camel/trunk/components/camel-xmlrpc: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/camel/ src/main/java/org/apache/camel/component/ src/main/java/org/apache/camel/compo...

Author: ningjiang
Date: Fri Nov  9 08:57:47 2012
New Revision: 1407387

URL: http://svn.apache.org/viewvc?rev=1407387&view=rev
Log:
Merge branch 'camel-xmlrpc' into trunk

Added:
    camel/trunk/components/camel-xmlrpc/
    camel/trunk/components/camel-xmlrpc/pom.xml
    camel/trunk/components/camel-xmlrpc/src/
    camel/trunk/components/camel-xmlrpc/src/main/
    camel/trunk/components/camel-xmlrpc/src/main/java/
    camel/trunk/components/camel-xmlrpc/src/main/java/org/
    camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/
    camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/
    camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/
    camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/
    camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcAsyncCallback.java
    camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcComponent.java
    camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcConstants.java
    camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcEndpoint.java
    camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcProducer.java
    camel/trunk/components/camel-xmlrpc/src/main/resources/
    camel/trunk/components/camel-xmlrpc/src/main/resources/META-INF/
    camel/trunk/components/camel-xmlrpc/src/main/resources/META-INF/services/
    camel/trunk/components/camel-xmlrpc/src/main/resources/META-INF/services/org/
    camel/trunk/components/camel-xmlrpc/src/main/resources/META-INF/services/org/apache/
    camel/trunk/components/camel-xmlrpc/src/main/resources/META-INF/services/org/apache/camel/
    camel/trunk/components/camel-xmlrpc/src/main/resources/META-INF/services/org/apache/camel/component/
    camel/trunk/components/camel-xmlrpc/src/main/resources/META-INF/services/org/apache/camel/component/xmlrpc
    camel/trunk/components/camel-xmlrpc/src/test/
    camel/trunk/components/camel-xmlrpc/src/test/java/
    camel/trunk/components/camel-xmlrpc/src/test/java/org/
    camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/
    camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/
    camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/component/
    camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/component/xmlrpc/
    camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/component/xmlrpc/XmlRpcComponentTest.java
    camel/trunk/components/camel-xmlrpc/src/test/resources/
    camel/trunk/components/camel-xmlrpc/src/test/resources/log4j.properties

Added: camel/trunk/components/camel-xmlrpc/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlrpc/pom.xml?rev=1407387&view=auto
==============================================================================
--- camel/trunk/components/camel-xmlrpc/pom.xml (added)
+++ camel/trunk/components/camel-xmlrpc/pom.xml Fri Nov  9 08:57:47 2012
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>components</artifactId>
+    <groupId>org.apache.camel</groupId>
+    <version>2.11-SNAPSHOT</version>
+  </parent>
+
+  <groupId>org.apache.camel.component</groupId>
+  <artifactId>camel-xmlrpc</artifactId>
+  <packaging>jar</packaging>
+
+  
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+    </dependency>
+    
+    <dependency>
+	  <groupId>org.apache.xmlrpc</groupId>
+	  <artifactId>xmlrpc-client</artifactId>
+	  <version>3.1.3</version>
+    </dependency>
+
+    <!-- logging -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.2.17</version>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- testing -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <defaultGoal>install</defaultGoal>
+
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.5.1</version>
+        <configuration>
+          <source>1.6</source>
+          <target>1.6</target>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Added: camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcAsyncCallback.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcAsyncCallback.java?rev=1407387&view=auto
==============================================================================
--- camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcAsyncCallback.java (added)
+++ camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcAsyncCallback.java Fri Nov  9 08:57:47 2012
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.xmlrpc;
+
+import org.apache.camel.Exchange;
+import org.apache.xmlrpc.XmlRpcRequest;
+import org.apache.xmlrpc.client.AsyncCallback;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * 
+ */
+public class XmlRpcAsyncCallback implements AsyncCallback {
+    private static final Logger LOG = LoggerFactory.getLogger(XmlRpcAsyncCallback.class);
+
+    private final org.apache.camel.AsyncCallback camelAsyncCallback;
+    private final Exchange camelExchange;
+   
+    
+    public XmlRpcAsyncCallback(Exchange exchange, org.apache.camel.AsyncCallback callback) {
+        this.camelAsyncCallback = callback;
+        this.camelExchange = exchange;
+    }
+
+    @Override
+    public void handleResult(XmlRpcRequest pRequest, Object pResult) {
+        LOG.trace("Get the response {}", pResult);
+        camelExchange.getOut().setBody(pResult);
+        camelAsyncCallback.done(false);
+    }
+
+    @Override
+    public void handleError(XmlRpcRequest pRequest, Throwable pError) {
+        LOG.trace("Get the Error {}", pError);
+        camelExchange.setException(pError);
+        camelAsyncCallback.done(false);
+    }
+
+}

Added: camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcComponent.java?rev=1407387&view=auto
==============================================================================
--- camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcComponent.java (added)
+++ camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcComponent.java Fri Nov  9 08:57:47 2012
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.xmlrpc;
+
+import java.util.Map;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.impl.DefaultComponent;
+
+/**
+ * Represents the component that manages {@link XmlRpcEndpoint}.
+ */
+public class XmlRpcComponent extends DefaultComponent {
+
+    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+        // current we just use the uri as the server address
+        Endpoint endpoint = new XmlRpcEndpoint(uri, this, remaining);
+        setProperties(endpoint, parameters);
+        return endpoint;
+    }
+}

Added: camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcConstants.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcConstants.java?rev=1407387&view=auto
==============================================================================
--- camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcConstants.java (added)
+++ camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcConstants.java Fri Nov  9 08:57:47 2012
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.xmlrpc;
+
+public final class XmlRpcConstants {
+    public static final String OPERATION_NAME = "CamelXmlRpcOperationName";
+    private XmlRpcConstants() {
+        //Utils class
+    }
+}

Added: camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcEndpoint.java?rev=1407387&view=auto
==============================================================================
--- camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcEndpoint.java (added)
+++ camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcEndpoint.java Fri Nov  9 08:57:47 2012
@@ -0,0 +1,81 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.xmlrpc;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.impl.SynchronousDelegateProducer;
+import org.apache.xmlrpc.client.XmlRpcClient;
+import org.apache.xmlrpc.client.XmlRpcClientConfig;
+import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
+
+/**
+ * Represents a xmlrpc endpoint.
+ */
+public class XmlRpcEndpoint extends DefaultEndpoint {
+    private String address;
+
+    public XmlRpcEndpoint() {
+    }
+
+    public XmlRpcEndpoint(String uri, XmlRpcComponent component, String address) {
+        super(uri, component);
+        this.setAddress(address);
+    }
+
+    public Producer createProducer() throws Exception {
+        Producer answer = new XmlRpcProducer(this);
+        if (isSynchronous()) {
+            return new SynchronousDelegateProducer(answer);
+        } else {
+            return answer;
+        }
+    }
+
+    @Override
+    public Consumer createConsumer(Processor processor) throws Exception {
+        throw new UnsupportedOperationException("This component does not support consuming from this endpoint");
+    }
+
+    public boolean isSingleton() {
+        return true;
+    }
+
+    public XmlRpcClient createClient() throws MalformedURLException {
+        XmlRpcClient client = new XmlRpcClient();
+        // setup the client with the configuration from the XmlRpcEndpoint
+        XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+        config.setServerURL(new URL(getAddress()));
+        client.setConfig(config);
+        return client;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+    
+    
+}

Added: camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcProducer.java?rev=1407387&view=auto
==============================================================================
--- camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcProducer.java (added)
+++ camel/trunk/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcProducer.java Fri Nov  9 08:57:47 2012
@@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.xmlrpc;
+
+import java.util.List;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.AsyncProcessor;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.impl.DefaultProducer;
+import org.apache.xmlrpc.client.XmlRpcClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The xmlrpc producer.
+ */
+public class XmlRpcProducer extends DefaultProducer implements AsyncProcessor {
+    private static final transient Logger LOG = LoggerFactory.getLogger(XmlRpcProducer.class);
+    private XmlRpcEndpoint endpoint;
+    private XmlRpcClient client;
+
+    public XmlRpcProducer(XmlRpcEndpoint endpoint) {
+        super(endpoint);
+        this.endpoint = endpoint;
+    }
+
+    public void process(Exchange exchange) throws Exception {
+        LOG.trace("Process exchange: {} in the sync way.", exchange);
+        Message in = exchange.getIn();
+        String operationName = in.getHeader(XmlRpcConstants.OPERATION_NAME, String.class);
+        //TODO need to use the binding to handle the requests
+        Object result = client.execute(operationName, in.getBody(List.class));
+        //TODO what if the request is one way operation
+        exchange.getOut().setBody(result);
+    }
+    
+    public boolean process(Exchange exchange, AsyncCallback callback) {
+        LOG.trace("Process exchange: {} in the async way.", exchange);
+        Message in = exchange.getIn();
+        String operationName = in.getHeader(XmlRpcConstants.OPERATION_NAME, String.class);
+        XmlRpcAsyncCallback xmlRpcAsyncCallback = new XmlRpcAsyncCallback(exchange, callback);
+        //TODO need to use the binding to handle the requests
+        try {
+            client.executeAsync(operationName, in.getBody(List.class), xmlRpcAsyncCallback);
+            return false;
+        } catch (Exception ex) {
+            exchange.setException(ex);
+            callback.done(true);
+            return true;
+        }
+    }
+    
+    @Override
+    protected void doStart() throws Exception {
+        if (client == null) {
+            client = endpoint.createClient();
+        }
+    }
+    
+    @Override
+    protected void doStop() throws Exception {
+        super.doStop();
+        if (client != null) {
+            // Just release the client
+            client = null;
+        }
+    }
+
+}

Added: camel/trunk/components/camel-xmlrpc/src/main/resources/META-INF/services/org/apache/camel/component/xmlrpc
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlrpc/src/main/resources/META-INF/services/org/apache/camel/component/xmlrpc?rev=1407387&view=auto
==============================================================================
--- camel/trunk/components/camel-xmlrpc/src/main/resources/META-INF/services/org/apache/camel/component/xmlrpc (added)
+++ camel/trunk/components/camel-xmlrpc/src/main/resources/META-INF/services/org/apache/camel/component/xmlrpc Fri Nov  9 08:57:47 2012
@@ -0,0 +1 @@
+class=org.apache.camel.component.xmlrpc.XmlRpcComponent

Added: camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/component/xmlrpc/XmlRpcComponentTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/component/xmlrpc/XmlRpcComponentTest.java?rev=1407387&view=auto
==============================================================================
--- camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/component/xmlrpc/XmlRpcComponentTest.java (added)
+++ camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/component/xmlrpc/XmlRpcComponentTest.java Fri Nov  9 08:57:47 2012
@@ -0,0 +1,99 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.xmlrpc;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.xmlrpc.XmlRpcException;
+import org.junit.Test;
+
+public class XmlRpcComponentTest extends CamelTestSupport {
+    private static final String RESPONSE = 
+          "<methodResponse><params>"
+          + "<param><value><string>GreetMe!</string></value></param>" 
+          + "</params></methodResponse>";
+
+    private static final String FAULT_RESPONSE = 
+        "<methodResponse><fault><value>"
+        + "<struct><member><name>faultCode</name><value><int>4</int></value></member>"
+        + "<member><name>faultString</name><value><string>Too many parameters.</string></value></member>"
+        + "</struct></value></fault></methodResponse>";
+
+    @Test
+    public void testXmlRpcResponseMessage() throws Exception {
+        invokeService("direct:async");
+        invokeService("direct:sync");
+    }
+    
+    @Test
+    public void testXmlRpcFaultMessage() throws Exception {
+        invokeServiceFaultResponse("xmlrpc:http://localhost:9000/xmlrpc/fault");
+        invokeServiceFaultResponse("xmlrpc:http://localhost:9000/xmlrpc/fault?synchronous=true");
+    }
+    
+    private void invokeService(String uri) throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.reset();
+        mock.expectedBodiesReceived("GreetMe!");
+        
+        template.requestBodyAndHeader(uri, new Object[]{"me"}, XmlRpcConstants.OPERATION_NAME, "hello");
+        
+        assertMockEndpointsSatisfied();
+    }
+    
+    private void invokeServiceFaultResponse(String uri) throws Exception {
+        try {
+            template.requestBodyAndHeader(uri, new Object[]{"me"}, XmlRpcConstants.OPERATION_NAME, "hello");
+            fail("Expects the exception here");
+        } catch (Exception ex) {
+            assertTrue("Get a wrong exception.", ex instanceof CamelExecutionException);
+            assertTrue("Get a worng exception cause.", ex.getCause() instanceof XmlRpcException);
+            XmlRpcException xmlrpcException = (XmlRpcException)ex.getCause();
+            assertEquals("Get a worng exception message.", "Too many parameters.", xmlrpcException.getMessage());
+        }
+        
+    }
+    
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() {
+                from("direct:async")
+                    .to("xmlrpc:http://localhost:9000/xmlrpc/test")
+                    .to("mock:result");
+                from("direct:sync")
+                    .to("xmlrpc:http://localhost:9000/xmlrpc/test?synchronous=true")
+                    .to("mock:result");
+                // setup a mock test server for testing
+                from("jetty:http://localhost:9000/xmlrpc/test")
+                    .convertBodyTo(String.class)
+                    // here print out the message that we get 
+                    .to("log:org.apache.camel.component.xmlrpc")
+                    .transform().constant(RESPONSE);
+                // setup a mock test server for falt message
+                from("jetty:http://localhost:9000/xmlrpc/fault")
+                    .convertBodyTo(String.class)
+                    // here print out the message that we get 
+                    .to("log:org.apache.camel.component.xmlrpc")
+                    .transform().constant(FAULT_RESPONSE);
+                    
+            }
+        };
+    }
+}

Added: camel/trunk/components/camel-xmlrpc/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlrpc/src/test/resources/log4j.properties?rev=1407387&view=auto
==============================================================================
--- camel/trunk/components/camel-xmlrpc/src/test/resources/log4j.properties (added)
+++ camel/trunk/components/camel-xmlrpc/src/test/resources/log4j.properties Fri Nov  9 08:57:47 2012
@@ -0,0 +1,36 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=INFO, file
+
+# uncomment this to turn on debug of camel
+#log4j.logger.org.apache.camel=DEBUG
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.file.file=target/camel-xmlrpc-test.log
+log4j.appender.file.append=true