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/16 16:03:52 UTC

svn commit: r1410385 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/model/ camel-core/src/main/java/org/apache/camel/model/dataformat/ components/camel-xmlrpc/ components/camel-xmlrpc/src/test/java/org/apache/camel/dataformat/xmlrpc/ comp...

Author: ningjiang
Date: Fri Nov 16 15:03:50 2012
New Revision: 1410385

URL: http://svn.apache.org/viewvc?rev=1410385&view=rev
Log:
CAMEL-5778 Added xmlrpc dataformat

Added:
    camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.java
    camel/trunk/components/camel-xmlrpc/src/test/resources/org/
    camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/
    camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/
    camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/
    camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/xmlrpc/
    camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.xml
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java
    camel/trunk/components/camel-xmlrpc/pom.xml

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java?rev=1410385&r1=1410384&r2=1410385&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java Fri Nov 16 15:03:50 2012
@@ -49,6 +49,7 @@ import org.apache.camel.model.dataformat
 import org.apache.camel.model.dataformat.XMLSecurityDataFormat;
 import org.apache.camel.model.dataformat.XStreamDataFormat;
 import org.apache.camel.model.dataformat.XmlJsonDataFormat;
+import org.apache.camel.model.dataformat.XmlRpcDataFormat;
 import org.apache.camel.model.dataformat.ZipDataFormat;
 import org.apache.camel.processor.MarshalProcessor;
 import org.apache.camel.spi.DataFormat;
@@ -93,6 +94,7 @@ public class MarshalDefinition extends N
     @XmlElement(required = false, name = "tidyMarkup", type = TidyMarkupDataFormat.class),
     @XmlElement(required = false, name = "xmlBeans", type = XMLBeansDataFormat.class),
     @XmlElement(required = false, name = "xmljson", type = XmlJsonDataFormat.class),
+    @XmlElement(required = false, name = "xmlrpc", type = XmlRpcDataFormat.class),
     @XmlElement(required = false, name = "xstream", type = XStreamDataFormat.class),
     @XmlElement(required = false, name = "pgp", type = PGPDataFormat.class),
     @XmlElement(required = false, name = "zip", type = ZipDataFormat.class)}

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java?rev=1410385&r1=1410384&r2=1410385&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java Fri Nov 16 15:03:50 2012
@@ -49,6 +49,7 @@ import org.apache.camel.model.dataformat
 import org.apache.camel.model.dataformat.XMLSecurityDataFormat;
 import org.apache.camel.model.dataformat.XStreamDataFormat;
 import org.apache.camel.model.dataformat.XmlJsonDataFormat;
+import org.apache.camel.model.dataformat.XmlRpcDataFormat;
 import org.apache.camel.model.dataformat.ZipDataFormat;
 import org.apache.camel.processor.UnmarshalProcessor;
 import org.apache.camel.spi.DataFormat;
@@ -93,6 +94,7 @@ public class UnmarshalDefinition extends
     @XmlElement(required = false, name = "tidyMarkup", type = TidyMarkupDataFormat.class),
     @XmlElement(required = false, name = "xmlBeans", type = XMLBeansDataFormat.class),
     @XmlElement(required = false, name = "xmljson", type = XmlJsonDataFormat.class),
+    @XmlElement(required = false, name = "xmlrpc", type = XmlRpcDataFormat.class),
     @XmlElement(required = false, name = "xstream", type = XStreamDataFormat.class),
     @XmlElement(required = false, name = "pgp", type = PGPDataFormat.class),
     @XmlElement(required = false, name = "zip", type = ZipDataFormat.class)}

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java?rev=1410385&r1=1410384&r2=1410385&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java Fri Nov 16 15:03:50 2012
@@ -60,6 +60,7 @@ public class DataFormatsDefinition {
         @XmlElement(required = false, name = "tidyMarkup", type = TidyMarkupDataFormat.class),
         @XmlElement(required = false, name = "xmlBeans", type = XMLBeansDataFormat.class),
         @XmlElement(required = false, name = "xmljson", type = XmlJsonDataFormat.class),
+        @XmlElement(required = false, name = "xmlrpc", type = XmlRpcDataFormat.class),
         @XmlElement(required = false, name = "xstream", type = XStreamDataFormat.class),
         @XmlElement(required = false, name = "pgp", type = PGPDataFormat.class),
         @XmlElement(required = false, name = "zip", type = ZipDataFormat.class)}

Modified: camel/trunk/components/camel-xmlrpc/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlrpc/pom.xml?rev=1410385&r1=1410384&r2=1410385&view=diff
==============================================================================
--- camel/trunk/components/camel-xmlrpc/pom.xml (original)
+++ camel/trunk/components/camel-xmlrpc/pom.xml Fri Nov 16 15:03:50 2012
@@ -66,6 +66,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test-spring</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-jetty</artifactId>
       <scope>test</scope>
     </dependency>

Added: camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.java?rev=1410385&view=auto
==============================================================================
--- camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.java (added)
+++ camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.java Fri Nov 16 15:03:50 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.dataformat.xmlrpc;
+
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.xmlrpc.XmlRpcRequestImpl;
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.apache.xmlrpc.XmlRpcRequest;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class SpringXmlRpcDataFormatTest extends CamelSpringTestSupport {
+    
+    @Test
+    public void testRequestMessage() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:request");
+        mock.expectedMessageCount(1);
+        XmlRpcRequest result = template.requestBody("direct:request", new XmlRpcRequestImpl("greet", new Object[]{"you", 2}), XmlRpcRequest.class);
+        assertNotNull(result);
+        assertEquals("Get a wrong request operation name", "greet", result.getMethodName());
+        assertEquals("Get a wrong request parameter size", 2, result.getParameterCount());
+        assertEquals("Get a wrong request parameter", 2, result.getParameter(1));
+        assertMockEndpointsSatisfied();
+        
+    }
+    
+    @Test
+    public void testResponseMessage() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:response");
+        mock.expectedBodiesReceived("GreetMe from XmlRPC");
+        template.sendBody("direct:response", "GreetMe from XmlRPC");
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected AbstractApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.xml");
+    }
+
+}

Added: camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.xml?rev=1410385&view=auto
==============================================================================
--- camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.xml (added)
+++ camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.xml Fri Nov 16 15:03:50 2012
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+    <!-- START SNIPPET: e1 -->
+    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+
+        <!-- we define the xml rpc data formats to be used -->
+        <dataFormats>
+            <xmlrpc id="xmlrpcRequest" request="true"/>
+            <xmlrpc id="xmlrpcResponse" request="false"/>
+        </dataFormats>
+
+        <route>
+            <from uri="direct:request"/>
+            <marshal ref="xmlrpcRequest"/>
+            <unmarshal>
+               <xmlrpc request="true"/>
+            </unmarshal>
+            <to uri="mock:request" />
+        </route>
+
+        <route>
+            <from uri="direct:response"/>
+            <marshal>
+                <xmlrpc request="false"/>
+            </marshal>
+            <unmarshal ref="xmlrpcResponse"/>
+            <to uri="mock:response" />
+        </route>
+    </camelContext>
+    <!-- END SNIPPET: e1 -->
+
+</beans>



Re: svn commit: r1410385 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/model/ camel-core/src/main/java/org/apache/camel/model/dataformat/ components/camel-xmlrpc/components/camel-xmlrpc/src/test/java/org/apache/camel/dataformat/xmlrpc/ comp...

Posted by Willem jiang <wi...@gmail.com>.
I'm sorry, I just commit the missing file.
The CI build should be fixed shortly.

Thanks for pointing that out. 

-- 
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang 
Weibo: willemjiang





On Saturday, November 17, 2012 at 3:42 PM, Claus Ibsen wrote:

> Hi Willem
> 
> I think you forgot the add a .java file as we got compilation error
> now on trunk code
> 
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 1:13.141s
> [INFO] Finished at: Sat Nov 17 08:41:21 CET 2012
> [INFO] Final Memory: 85M/190M
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile
> (default-compile) on project camel-core: Compilation failure:
> Compilation failure:
> [ERROR] /Users/davsclaus/workspace/camel/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java:[52,40]
> cannot find symbol
> [ERROR] symbol : class XmlRpcDataFormat
> [ERROR] location: package org.apache.camel.model.dataformat
> [ERROR] /Users/davsclaus/workspace/camel/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java:[52,40]
> cannot find symbol
> ...
> 
> 
> On Fri, Nov 16, 2012 at 4:03 PM, <ningjiang@apache.org (mailto:ningjiang@apache.org)> wrote:
> > Author: ningjiang
> > Date: Fri Nov 16 15:03:50 2012
> > New Revision: 1410385
> > 
> > URL: http://svn.apache.org/viewvc?rev=1410385&view=rev
> > Log:
> > CAMEL-5778 Added xmlrpc dataformat
> > 
> > Added:
> > camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.java
> > camel/trunk/components/camel-xmlrpc/src/test/resources/org/
> > camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/
> > camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/
> > camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/
> > camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/xmlrpc/
> > camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.xml
> > Modified:
> > camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
> > camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
> > camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java
> > camel/trunk/components/camel-xmlrpc/pom.xml
> > 
> > Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
> > URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java?rev=1410385&r1=1410384&r2=1410385&view=diff
> > ==============================================================================
> > --- camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java (original)
> > +++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java Fri Nov 16 15:03:50 2012
> > @@ -49,6 +49,7 @@ import org.apache.camel.model.dataformat
> > import org.apache.camel.model.dataformat.XMLSecurityDataFormat;
> > import org.apache.camel.model.dataformat.XStreamDataFormat;
> > import org.apache.camel.model.dataformat.XmlJsonDataFormat;
> > +import org.apache.camel.model.dataformat.XmlRpcDataFormat;
> > import org.apache.camel.model.dataformat.ZipDataFormat;
> > import org.apache.camel.processor.MarshalProcessor;
> > import org.apache.camel.spi.DataFormat;
> > @@ -93,6 +94,7 @@ public class MarshalDefinition extends N
> > @XmlElement(required = false, name = "tidyMarkup", type = TidyMarkupDataFormat.class),
> > @XmlElement(required = false, name = "xmlBeans", type = XMLBeansDataFormat.class),
> > @XmlElement(required = false, name = "xmljson", type = XmlJsonDataFormat.class),
> > + @XmlElement(required = false, name = "xmlrpc", type = XmlRpcDataFormat.class),
> > @XmlElement(required = false, name = "xstream", type = XStreamDataFormat.class),
> > @XmlElement(required = false, name = "pgp", type = PGPDataFormat.class),
> > @XmlElement(required = false, name = "zip", type = ZipDataFormat.class)}
> > 
> > Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
> > URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java?rev=1410385&r1=1410384&r2=1410385&view=diff
> > ==============================================================================
> > --- camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java (original)
> > +++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java Fri Nov 16 15:03:50 2012
> > @@ -49,6 +49,7 @@ import org.apache.camel.model.dataformat
> > import org.apache.camel.model.dataformat.XMLSecurityDataFormat;
> > import org.apache.camel.model.dataformat.XStreamDataFormat;
> > import org.apache.camel.model.dataformat.XmlJsonDataFormat;
> > +import org.apache.camel.model.dataformat.XmlRpcDataFormat;
> > import org.apache.camel.model.dataformat.ZipDataFormat;
> > import org.apache.camel.processor.UnmarshalProcessor;
> > import org.apache.camel.spi.DataFormat;
> > @@ -93,6 +94,7 @@ public class UnmarshalDefinition extends
> > @XmlElement(required = false, name = "tidyMarkup", type = TidyMarkupDataFormat.class),
> > @XmlElement(required = false, name = "xmlBeans", type = XMLBeansDataFormat.class),
> > @XmlElement(required = false, name = "xmljson", type = XmlJsonDataFormat.class),
> > + @XmlElement(required = false, name = "xmlrpc", type = XmlRpcDataFormat.class),
> > @XmlElement(required = false, name = "xstream", type = XStreamDataFormat.class),
> > @XmlElement(required = false, name = "pgp", type = PGPDataFormat.class),
> > @XmlElement(required = false, name = "zip", type = ZipDataFormat.class)}
> > 
> > Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java
> > URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java?rev=1410385&r1=1410384&r2=1410385&view=diff
> > ==============================================================================
> > --- camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java (original)
> > +++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java Fri Nov 16 15:03:50 2012
> > @@ -60,6 +60,7 @@ public class DataFormatsDefinition {
> > @XmlElement(required = false, name = "tidyMarkup", type = TidyMarkupDataFormat.class),
> > @XmlElement(required = false, name = "xmlBeans", type = XMLBeansDataFormat.class),
> > @XmlElement(required = false, name = "xmljson", type = XmlJsonDataFormat.class),
> > + @XmlElement(required = false, name = "xmlrpc", type = XmlRpcDataFormat.class),
> > @XmlElement(required = false, name = "xstream", type = XStreamDataFormat.class),
> > @XmlElement(required = false, name = "pgp", type = PGPDataFormat.class),
> > @XmlElement(required = false, name = "zip", type = ZipDataFormat.class)}
> > 
> > Modified: camel/trunk/components/camel-xmlrpc/pom.xml
> > URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlrpc/pom.xml?rev=1410385&r1=1410384&r2=1410385&view=diff
> > ==============================================================================
> > --- camel/trunk/components/camel-xmlrpc/pom.xml (original)
> > +++ camel/trunk/components/camel-xmlrpc/pom.xml Fri Nov 16 15:03:50 2012
> > @@ -66,6 +66,11 @@
> > </dependency>
> > <dependency>
> > <groupId>org.apache.camel</groupId>
> > + <artifactId>camel-test-spring</artifactId>
> > + <scope>test</scope>
> > + </dependency>
> > + <dependency>
> > + <groupId>org.apache.camel</groupId>
> > <artifactId>camel-jetty</artifactId>
> > <scope>test</scope>
> > </dependency>
> > 
> > Added: camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.java
> > URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.java?rev=1410385&view=auto
> > ==============================================================================
> > --- camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.java (added)
> > +++ camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.java Fri Nov 16 15:03:50 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.dataformat.xmlrpc;
> > +
> > +import org.apache.camel.component.mock.MockEndpoint;
> > +import org.apache.camel.component.xmlrpc.XmlRpcRequestImpl;
> > +import org.apache.camel.test.junit4.CamelSpringTestSupport;
> > +import org.apache.xmlrpc.XmlRpcRequest;
> > +import org.junit.Test;
> > +import org.springframework.context.support.AbstractApplicationContext;
> > +import org.springframework.context.support.ClassPathXmlApplicationContext;
> > +
> > +public class SpringXmlRpcDataFormatTest extends CamelSpringTestSupport {
> > +
> > + @Test
> > + public void testRequestMessage() throws Exception {
> > + MockEndpoint mock = getMockEndpoint("mock:request");
> > + mock.expectedMessageCount(1);
> > + XmlRpcRequest result = template.requestBody("direct:request", new XmlRpcRequestImpl("greet", new Object[]{"you", 2}), XmlRpcRequest.class);
> > + assertNotNull(result);
> > + assertEquals("Get a wrong request operation name", "greet", result.getMethodName());
> > + assertEquals("Get a wrong request parameter size", 2, result.getParameterCount());
> > + assertEquals("Get a wrong request parameter", 2, result.getParameter(1));
> > + assertMockEndpointsSatisfied();
> > +
> > + }
> > +
> > + @Test
> > + public void testResponseMessage() throws Exception {
> > + MockEndpoint mock = getMockEndpoint("mock:response");
> > + mock.expectedBodiesReceived("GreetMe from XmlRPC");
> > + template.sendBody("direct:response", "GreetMe from XmlRPC");
> > + assertMockEndpointsSatisfied();
> > + }
> > +
> > + @Override
> > + protected AbstractApplicationContext createApplicationContext() {
> > + return new ClassPathXmlApplicationContext("org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.xml");
> > + }
> > +
> > +}
> > 
> > Added: camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.xml
> > URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.xml?rev=1410385&view=auto
> > ==============================================================================
> > --- camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.xml (added)
> > +++ camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.xml Fri Nov 16 15:03:50 2012
> > @@ -0,0 +1,53 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +<!--
> > + 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.
> > +-->
> > +<beans xmlns="http://www.springframework.org/schema/beans"
> > + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > + xsi:schemaLocation="
> > + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> > + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
> > +
> > + <!-- START SNIPPET: e1 -->
> > + <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
> > +
> > + <!-- we define the xml rpc data formats to be used -->
> > + <dataFormats>
> > + <xmlrpc id="xmlrpcRequest" request="true"/>
> > + <xmlrpc id="xmlrpcResponse" request="false"/>
> > + </dataFormats>
> > +
> > + <route>
> > + <from uri="direct:request"/>
> > + <marshal ref="xmlrpcRequest"/>
> > + <unmarshal>
> > + <xmlrpc request="true"/>
> > + </unmarshal>
> > + <to uri="mock:request" />
> > + </route>
> > +
> > + <route>
> > + <from uri="direct:response"/>
> > + <marshal>
> > + <xmlrpc request="false"/>
> > + </marshal>
> > + <unmarshal ref="xmlrpcResponse"/>
> > + <to uri="mock:response" />
> > + </route>
> > + </camelContext>
> > + <!-- END SNIPPET: e1 -->
> > +
> > +</beans>
> 
> 
> 
> 
> 
> -- 
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cibsen@redhat.com (mailto:cibsen@redhat.com)
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen




Re: svn commit: r1410385 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/model/ camel-core/src/main/java/org/apache/camel/model/dataformat/ components/camel-xmlrpc/ components/camel-xmlrpc/src/test/java/org/apache/camel/dataformat/xmlrpc/ comp...

Posted by Claus Ibsen <cl...@gmail.com>.
Hi Willem

I think you forgot the add a .java file as we got compilation error
now on trunk code

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:13.141s
[INFO] Finished at: Sat Nov 17 08:41:21 CET 2012
[INFO] Final Memory: 85M/190M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile
(default-compile) on project camel-core: Compilation failure:
Compilation failure:
[ERROR] /Users/davsclaus/workspace/camel/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java:[52,40]
cannot find symbol
[ERROR] symbol  : class XmlRpcDataFormat
[ERROR] location: package org.apache.camel.model.dataformat
[ERROR] /Users/davsclaus/workspace/camel/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java:[52,40]
cannot find symbol
...


On Fri, Nov 16, 2012 at 4:03 PM,  <ni...@apache.org> wrote:
> Author: ningjiang
> Date: Fri Nov 16 15:03:50 2012
> New Revision: 1410385
>
> URL: http://svn.apache.org/viewvc?rev=1410385&view=rev
> Log:
> CAMEL-5778 Added xmlrpc dataformat
>
> Added:
>     camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.java
>     camel/trunk/components/camel-xmlrpc/src/test/resources/org/
>     camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/
>     camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/
>     camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/
>     camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/xmlrpc/
>     camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.xml
> Modified:
>     camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
>     camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
>     camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java
>     camel/trunk/components/camel-xmlrpc/pom.xml
>
> Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
> URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java?rev=1410385&r1=1410384&r2=1410385&view=diff
> ==============================================================================
> --- camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java (original)
> +++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java Fri Nov 16 15:03:50 2012
> @@ -49,6 +49,7 @@ import org.apache.camel.model.dataformat
>  import org.apache.camel.model.dataformat.XMLSecurityDataFormat;
>  import org.apache.camel.model.dataformat.XStreamDataFormat;
>  import org.apache.camel.model.dataformat.XmlJsonDataFormat;
> +import org.apache.camel.model.dataformat.XmlRpcDataFormat;
>  import org.apache.camel.model.dataformat.ZipDataFormat;
>  import org.apache.camel.processor.MarshalProcessor;
>  import org.apache.camel.spi.DataFormat;
> @@ -93,6 +94,7 @@ public class MarshalDefinition extends N
>      @XmlElement(required = false, name = "tidyMarkup", type = TidyMarkupDataFormat.class),
>      @XmlElement(required = false, name = "xmlBeans", type = XMLBeansDataFormat.class),
>      @XmlElement(required = false, name = "xmljson", type = XmlJsonDataFormat.class),
> +    @XmlElement(required = false, name = "xmlrpc", type = XmlRpcDataFormat.class),
>      @XmlElement(required = false, name = "xstream", type = XStreamDataFormat.class),
>      @XmlElement(required = false, name = "pgp", type = PGPDataFormat.class),
>      @XmlElement(required = false, name = "zip", type = ZipDataFormat.class)}
>
> Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
> URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java?rev=1410385&r1=1410384&r2=1410385&view=diff
> ==============================================================================
> --- camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java (original)
> +++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java Fri Nov 16 15:03:50 2012
> @@ -49,6 +49,7 @@ import org.apache.camel.model.dataformat
>  import org.apache.camel.model.dataformat.XMLSecurityDataFormat;
>  import org.apache.camel.model.dataformat.XStreamDataFormat;
>  import org.apache.camel.model.dataformat.XmlJsonDataFormat;
> +import org.apache.camel.model.dataformat.XmlRpcDataFormat;
>  import org.apache.camel.model.dataformat.ZipDataFormat;
>  import org.apache.camel.processor.UnmarshalProcessor;
>  import org.apache.camel.spi.DataFormat;
> @@ -93,6 +94,7 @@ public class UnmarshalDefinition extends
>      @XmlElement(required = false, name = "tidyMarkup", type = TidyMarkupDataFormat.class),
>      @XmlElement(required = false, name = "xmlBeans", type = XMLBeansDataFormat.class),
>      @XmlElement(required = false, name = "xmljson", type = XmlJsonDataFormat.class),
> +    @XmlElement(required = false, name = "xmlrpc", type = XmlRpcDataFormat.class),
>      @XmlElement(required = false, name = "xstream", type = XStreamDataFormat.class),
>      @XmlElement(required = false, name = "pgp", type = PGPDataFormat.class),
>      @XmlElement(required = false, name = "zip", type = ZipDataFormat.class)}
>
> Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java
> URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java?rev=1410385&r1=1410384&r2=1410385&view=diff
> ==============================================================================
> --- camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java (original)
> +++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java Fri Nov 16 15:03:50 2012
> @@ -60,6 +60,7 @@ public class DataFormatsDefinition {
>          @XmlElement(required = false, name = "tidyMarkup", type = TidyMarkupDataFormat.class),
>          @XmlElement(required = false, name = "xmlBeans", type = XMLBeansDataFormat.class),
>          @XmlElement(required = false, name = "xmljson", type = XmlJsonDataFormat.class),
> +        @XmlElement(required = false, name = "xmlrpc", type = XmlRpcDataFormat.class),
>          @XmlElement(required = false, name = "xstream", type = XStreamDataFormat.class),
>          @XmlElement(required = false, name = "pgp", type = PGPDataFormat.class),
>          @XmlElement(required = false, name = "zip", type = ZipDataFormat.class)}
>
> Modified: camel/trunk/components/camel-xmlrpc/pom.xml
> URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlrpc/pom.xml?rev=1410385&r1=1410384&r2=1410385&view=diff
> ==============================================================================
> --- camel/trunk/components/camel-xmlrpc/pom.xml (original)
> +++ camel/trunk/components/camel-xmlrpc/pom.xml Fri Nov 16 15:03:50 2012
> @@ -66,6 +66,11 @@
>      </dependency>
>      <dependency>
>        <groupId>org.apache.camel</groupId>
> +      <artifactId>camel-test-spring</artifactId>
> +      <scope>test</scope>
> +    </dependency>
> +    <dependency>
> +      <groupId>org.apache.camel</groupId>
>        <artifactId>camel-jetty</artifactId>
>        <scope>test</scope>
>      </dependency>
>
> Added: camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.java
> URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.java?rev=1410385&view=auto
> ==============================================================================
> --- camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.java (added)
> +++ camel/trunk/components/camel-xmlrpc/src/test/java/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.java Fri Nov 16 15:03:50 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.dataformat.xmlrpc;
> +
> +import org.apache.camel.component.mock.MockEndpoint;
> +import org.apache.camel.component.xmlrpc.XmlRpcRequestImpl;
> +import org.apache.camel.test.junit4.CamelSpringTestSupport;
> +import org.apache.xmlrpc.XmlRpcRequest;
> +import org.junit.Test;
> +import org.springframework.context.support.AbstractApplicationContext;
> +import org.springframework.context.support.ClassPathXmlApplicationContext;
> +
> +public class SpringXmlRpcDataFormatTest extends CamelSpringTestSupport {
> +
> +    @Test
> +    public void testRequestMessage() throws Exception {
> +        MockEndpoint mock = getMockEndpoint("mock:request");
> +        mock.expectedMessageCount(1);
> +        XmlRpcRequest result = template.requestBody("direct:request", new XmlRpcRequestImpl("greet", new Object[]{"you", 2}), XmlRpcRequest.class);
> +        assertNotNull(result);
> +        assertEquals("Get a wrong request operation name", "greet", result.getMethodName());
> +        assertEquals("Get a wrong request parameter size", 2, result.getParameterCount());
> +        assertEquals("Get a wrong request parameter", 2, result.getParameter(1));
> +        assertMockEndpointsSatisfied();
> +
> +    }
> +
> +    @Test
> +    public void testResponseMessage() throws Exception {
> +        MockEndpoint mock = getMockEndpoint("mock:response");
> +        mock.expectedBodiesReceived("GreetMe from XmlRPC");
> +        template.sendBody("direct:response", "GreetMe from XmlRPC");
> +        assertMockEndpointsSatisfied();
> +    }
> +
> +    @Override
> +    protected AbstractApplicationContext createApplicationContext() {
> +        return new ClassPathXmlApplicationContext("org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.xml");
> +    }
> +
> +}
>
> Added: camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.xml
> URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.xml?rev=1410385&view=auto
> ==============================================================================
> --- camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.xml (added)
> +++ camel/trunk/components/camel-xmlrpc/src/test/resources/org/apache/camel/dataformat/xmlrpc/SpringXmlRpcDataFormatTest.xml Fri Nov 16 15:03:50 2012
> @@ -0,0 +1,53 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<!--
> +    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.
> +-->
> +<beans xmlns="http://www.springframework.org/schema/beans"
> +       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> +       xsi:schemaLocation="
> +       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> +       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
> +
> +    <!-- START SNIPPET: e1 -->
> +    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
> +
> +        <!-- we define the xml rpc data formats to be used -->
> +        <dataFormats>
> +            <xmlrpc id="xmlrpcRequest" request="true"/>
> +            <xmlrpc id="xmlrpcResponse" request="false"/>
> +        </dataFormats>
> +
> +        <route>
> +            <from uri="direct:request"/>
> +            <marshal ref="xmlrpcRequest"/>
> +            <unmarshal>
> +               <xmlrpc request="true"/>
> +            </unmarshal>
> +            <to uri="mock:request" />
> +        </route>
> +
> +        <route>
> +            <from uri="direct:response"/>
> +            <marshal>
> +                <xmlrpc request="false"/>
> +            </marshal>
> +            <unmarshal ref="xmlrpcResponse"/>
> +            <to uri="mock:response" />
> +        </route>
> +    </camelContext>
> +    <!-- END SNIPPET: e1 -->
> +
> +</beans>
>
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen