camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r607750 - /activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XQueryRecipientListTest.java
Date Mon, 31 Dec 2007 16:25:59 GMT
Author: jstrachan
Date: Mon Dec 31 08:25:59 2007
New Revision: 607750

URL: http://svn.apache.org/viewvc?rev=607750&view=rev
Log:
added a test case showing how to use xquery with a Dynamic Recipient List

Added:
    activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XQueryRecipientListTest.java
      - copied, changed from r607734, activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XQueryFilterTest.java

Copied: activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XQueryRecipientListTest.java
(from r607734, activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XQueryFilterTest.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XQueryRecipientListTest.java?p2=activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XQueryRecipientListTest.java&p1=activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XQueryFilterTest.java&r1=607734&r2=607750&rev=607750&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XQueryFilterTest.java
(original)
+++ activemq/camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XQueryRecipientListTest.java
Mon Dec 31 08:25:59 2007
@@ -17,54 +17,53 @@
 package org.apache.camel.builder.saxon;
 
 import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.builder.xml.Namespaces;
 import org.apache.camel.component.mock.MockEndpoint;
 
 /**
  * @version $Revision: 1.1 $
  */
-public class XQueryFilterTest extends ContextTestSupport {
+public class XQueryRecipientListTest extends ContextTestSupport {
 
-    protected Endpoint<Exchange> startEndpoint;
-    protected MockEndpoint resultEndpoint;
+    protected MockEndpoint londonEndpoint;
+    protected MockEndpoint tampaEndpoint;
 
-    public void testSendMatchingMessage() throws Exception {
-        resultEndpoint.expectedMessageCount(1);
+    public void testSendLondonMessage() throws Exception {
+        londonEndpoint.expectedMessageCount(1);
+        tampaEndpoint.expectedMessageCount(0);
 
         template.sendBody("direct:start", "<person name='James' city='London'/>");
 
-        resultEndpoint.assertIsSatisfied();
+        assertMockEndpointsSatisifed();
     }
 
-    public void testSendNotMatchingMessage() throws Exception {
-        resultEndpoint.expectedMessageCount(0);
+    public void testSendTampaMessage() throws Exception {
+        londonEndpoint.expectedMessageCount(0);
+        tampaEndpoint.expectedMessageCount(1);
 
         template.sendBody("direct:start", "<person name='Hiram' city='Tampa'/>");
 
-
-        resultEndpoint.assertIsSatisfied();
+        assertMockEndpointsSatisifed();
     }
 
     @Override
     protected void setUp() throws Exception {
         super.setUp();
 
-        startEndpoint = resolveMandatoryEndpoint("direct:start");
-        resultEndpoint = getMockEndpoint("mock:result");
+        londonEndpoint = getMockEndpoint("mock:foo.London");
+        tampaEndpoint = getMockEndpoint("mock:foo.Tampa");
     }
 
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
+                // TODO is there a nicer way to do this with XQuery?
+                
                 // START SNIPPET: example
                 from("direct:start").
-                        filter().xquery("/person[@name='James']").
-                to("mock:result");
+                        recipientList().xquery("concat('mock:foo.', /person/@city)", String.class);
                 // END SNIPPET: example
             }
         };
     }
-}
+}
\ No newline at end of file



Mime
View raw message