svn commit: r713625 - /activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageRouterTest.java

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r713625 - /activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageRouterTest.java

ningjiang
Author: ningjiang
Date: Wed Nov 12 19:42:23 2008
New Revision: 713625

URL: http://svn.apache.org/viewvc?rev=713625&view=rev
Log:
CAMEL-1082 added the example and code snippet tags

Modified:
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageRouterTest.java

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageRouterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageRouterTest.java?rev=713625&r1=713624&r2=713625&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageRouterTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageRouterTest.java Wed Nov 12 19:42:23 2008
@@ -16,6 +16,13 @@
  */
 package org.apache.camel.component.cxf;
 
+import java.util.List;
+
+import org.w3c.dom.Element;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 
 public class CxfPayLoadMessageRouterTest extends CxfSimpleRouterTest {
@@ -24,7 +31,22 @@
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
-                from(routerEndpointURI).to("log:org.apache.camel?level=DEBUG").to(serviceEndpointURI);
+                // START SNIPPET: payload
+                from(routerEndpointURI).process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        Message inMessage = exchange.getIn();
+                        if(inMessage instanceof CxfMessage) {
+                            CxfMessage message = (CxfMessage) inMessage;
+                            List<Element> elements = message.getMessage().get(List.class);
+                            assertNotNull("We should get the elements here" , elements);
+                            assertEquals("Get the wrong elements size" , elements.size(), 1);
+                            assertEquals("Get the wrong namespace URI" , elements.get(0).getNamespaceURI(), "http://cxf.component.camel.apache.org/");
+                        }                        
+                    }
+                    
+                })
+                .to(serviceEndpointURI);
+                // END SNIPPET: payload
             }
         };
     }