activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r519969 - /activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/RouteBuilderTest.java
Date Mon, 19 Mar 2007 15:04:14 GMT
Author: jstrachan
Date: Mon Mar 19 08:04:13 2007
New Revision: 519969

URL: http://svn.apache.org/viewvc?view=rev&rev=519969
Log:
updated the snippet macros some

Modified:
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/RouteBuilderTest.java

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/RouteBuilderTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/RouteBuilderTest.java?view=diff&rev=519969&r1=519968&r2=519969
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/RouteBuilderTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/RouteBuilderTest.java Mon
Mar 19 08:04:13 2007
@@ -42,7 +42,7 @@
         // START SNIPPET: e1
         RouteBuilder<Exchange> builder = new RouteBuilder<Exchange>() {
             public void configure() {
-                from("seda://a").to("seda://b");
+                from("seda:a").to("seda:b");
             }
         };
         // END SNIPPET: e1
@@ -52,12 +52,12 @@
         assertEquals("Number routes created", 1, routes.size());
         for (Map.Entry<Endpoint<Exchange>, Processor<Exchange>> route :
routes) {
             Endpoint<Exchange> key = route.getKey();
-            assertEquals("From endpoint", "seda://a", key.getEndpointUri());
+            assertEquals("From endpoint", "seda:a", key.getEndpointUri());
             Processor processor = route.getValue();
 
             assertTrue("Processor should be a SendProcessor but was: " + processor + " with
type: " + processor.getClass().getName(), processor instanceof SendProcessor);
             SendProcessor sendProcessor = (SendProcessor) processor;
-            assertEquals("Endpoint URI", "seda://b", sendProcessor.getDestination().getEndpointUri());
+            assertEquals("Endpoint URI", "seda:b", sendProcessor.getDestination().getEndpointUri());
         }
     }
 
@@ -65,7 +65,7 @@
         // START SNIPPET: e2
         RouteBuilder<Exchange> builder = new RouteBuilder<Exchange>() {
             public void configure() {
-                from("seda://a").filter(headerEquals("foo", "bar")).to("seda://b");
+                from("seda:a").filter(headerEquals("foo", "bar")).to("seda:b");
             }
         };
         // END SNIPPET: e2
@@ -77,14 +77,14 @@
         assertEquals("Number routes created", 1, routes.size());
         for (Map.Entry<Endpoint<Exchange>, Processor<Exchange>> route :
routes) {
             Endpoint<Exchange> key = route.getKey();
-            assertEquals("From endpoint", "seda://a", key.getEndpointUri());
+            assertEquals("From endpoint", "seda:a", key.getEndpointUri());
             Processor processor = route.getValue();
 
             assertTrue("Processor should be a FilterProcessor but was: " + processor + "
with type: " + processor.getClass().getName(), processor instanceof FilterProcessor);
             FilterProcessor filterProcessor = (FilterProcessor) processor;
 
             SendProcessor sendProcessor = (SendProcessor) filterProcessor.getProcessor();
-            assertEquals("Endpoint URI", "seda://b", sendProcessor.getDestination().getEndpointUri());
+            assertEquals("Endpoint URI", "seda:b", sendProcessor.getDestination().getEndpointUri());
         }
     }
 
@@ -92,10 +92,10 @@
         // START SNIPPET: e3
         RouteBuilder<Exchange> builder = new RouteBuilder<Exchange>() {
             public void configure() {
-                from("seda://a").choice()
-                        .when(headerEquals("foo", "bar")).to("seda://b")
-                        .when(headerEquals("foo", "cheese")).to("seda://c")
-                        .otherwise().to("seda://d");
+                from("seda:a").choice()
+                        .when(headerEquals("foo", "bar")).to("seda:b")
+                        .when(headerEquals("foo", "cheese")).to("seda:c")
+                        .otherwise().to("seda:d");
             }
         };
         // END SNIPPET: e3
@@ -107,7 +107,7 @@
         assertEquals("Number routes created", 1, routes.size());
         for (Map.Entry<Endpoint<Exchange>, Processor<Exchange>> route :
routes) {
             Endpoint<Exchange> key = route.getKey();
-            assertEquals("From endpoint", "seda://a", key.getEndpointUri());
+            assertEquals("From endpoint", "seda:a", key.getEndpointUri());
             Processor processor = route.getValue();
 
             assertTrue("Processor should be a ChoiceProcessor but was: " + processor + "
with type: " + processor.getClass().getName(), processor instanceof ChoiceProcessor);
@@ -117,32 +117,37 @@
             assertEquals("Should be two when clauses", 2, filters.size());
 
             FilterProcessor<Exchange> filter1 = filters.get(0);
-            assertSendTo(filter1.getProcessor(), "seda://b");
+            assertSendTo(filter1.getProcessor(), "seda:b");
 
             FilterProcessor<Exchange> filter2 = filters.get(1);
-            assertSendTo(filter2.getProcessor(), "seda://c");
+            assertSendTo(filter2.getProcessor(), "seda:c");
 
-            assertSendTo(choiceProcessor.getOtherwise(), "seda://d");
+            assertSendTo(choiceProcessor.getOtherwise(), "seda:d");
         }
     }
 
     public void testCustomProcessor() throws Exception {
         // START SNIPPET: e4
+        final Processor<Exchange> myProcessor = new Processor<Exchange>() {
+            public void onExchange(Exchange exchange) {
+                System.out.println("Called with exchange: " + exchange);
+            }
+        };
+
         RouteBuilder<Exchange> builder = new RouteBuilder<Exchange>() {
             public void configure() {
-                from("seda://a").process(myProcessor);
+                from("seda:a").process(myProcessor);
             }
         };
         // END SNIPPET: e4
 
         Map<Endpoint<Exchange>, Processor<Exchange>> routeMap = builder.getRouteMap();
-        System.out.println("Created map: " + routeMap);
 
         Set<Map.Entry<Endpoint<Exchange>, Processor<Exchange>>> routes
= routeMap.entrySet();
         assertEquals("Number routes created", 1, routes.size());
         for (Map.Entry<Endpoint<Exchange>, Processor<Exchange>> route :
routes) {
             Endpoint<Exchange> key = route.getKey();
-            assertEquals("From endpoint", "seda://a", key.getEndpointUri());
+            assertEquals("From endpoint", "seda:a", key.getEndpointUri());
             Processor processor = route.getValue();
 
             assertEquals("Should be called with my processor", myProcessor, processor);
@@ -153,7 +158,7 @@
         // START SNIPPET: e5
         RouteBuilder<Exchange> builder = new RouteBuilder<Exchange>() {
             public void configure() {
-                from("seda://a").filter(headerEquals("foo", "bar")).process(myProcessor);
+                from("seda:a").filter(headerEquals("foo", "bar")).process(myProcessor);
             }
         };
         // END SNIPPET: e5
@@ -165,7 +170,7 @@
         assertEquals("Number routes created", 1, routes.size());
         for (Map.Entry<Endpoint<Exchange>, Processor<Exchange>> route :
routes) {
             Endpoint<Exchange> key = route.getKey();
-            assertEquals("From endpoint", "seda://a", key.getEndpointUri());
+            assertEquals("From endpoint", "seda:a", key.getEndpointUri());
             Processor processor = route.getValue();
 
             assertTrue("Processor should be a FilterProcessor but was: " + processor + "
with type: " + processor.getClass().getName(), processor instanceof FilterProcessor);



Mime
View raw message