camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r901190 [1/2] - in /camel/trunk/examples/camel-example-cafe: ./ 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/example/ src/main/java/org/apache/came...
Date Wed, 20 Jan 2010 13:30:49 GMT
Author: ningjiang
Date: Wed Jan 20 13:30:47 2010
New Revision: 901190

URL: http://svn.apache.org/viewvc?rev=901190&view=rev
Log:
CAMEL-2383 Added Cafe Demo example

Added:
    camel/trunk/examples/camel-example-cafe/
    camel/trunk/examples/camel-example-cafe/README.txt   (with props)
    camel/trunk/examples/camel-example-cafe/build.xml   (with props)
    camel/trunk/examples/camel-example-cafe/pom.xml   (with props)
    camel/trunk/examples/camel-example-cafe/src/
    camel/trunk/examples/camel-example-cafe/src/main/
    camel/trunk/examples/camel-example-cafe/src/main/java/
    camel/trunk/examples/camel-example-cafe/src/main/java/org/
    camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/
    camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/
    camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/
    camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/
    camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/CafeRouteBuilder.java   (with props)
    camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Delivery.java   (with props)
    camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Drink.java   (with props)
    camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/DrinkType.java   (with props)
    camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Order.java   (with props)
    camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/OrderItem.java   (with props)
    camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/
    camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/Barista.java   (with props)
    camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/CafeAggregationStrategy.java   (with props)
    camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/DrinkRouter.java   (with props)
    camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/OrderSplitter.java   (with props)
    camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/Waiter.java   (with props)
    camel/trunk/examples/camel-example-cafe/src/main/resources/
    camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/
    camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/LICENSE.txt   (with props)
    camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/NOTICE.txt   (with props)
    camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/beans.xml   (with props)
    camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/spring/
    camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/spring/camel-context.xml   (with props)
    camel/trunk/examples/camel-example-cafe/src/main/resources/log4j.properties   (with props)
    camel/trunk/examples/camel-example-cafe/src/test/
    camel/trunk/examples/camel-example-cafe/src/test/java/
    camel/trunk/examples/camel-example-cafe/src/test/java/org/
    camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/
    camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/
    camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/
    camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/
    camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteBuilderTest.java   (with props)
    camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteSpringIntegrationTest.java   (with props)
    camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteSpringTest.java   (with props)
    camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/test/
    camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/test/TestDrinkRouter.java   (with props)
    camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/test/TestWaiter.java   (with props)
    camel/trunk/examples/camel-example-cafe/src/test/resources/
    camel/trunk/examples/camel-example-cafe/src/test/resources/META-INF/
    camel/trunk/examples/camel-example-cafe/src/test/resources/META-INF/LICENSE.txt   (with props)
    camel/trunk/examples/camel-example-cafe/src/test/resources/META-INF/NOTICE.txt   (with props)
    camel/trunk/examples/camel-example-cafe/src/test/resources/META-INF/beans.xml   (with props)

Added: camel/trunk/examples/camel-example-cafe/README.txt
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/README.txt?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/README.txt (added)
+++ camel/trunk/examples/camel-example-cafe/README.txt Wed Jan 20 13:30:47 2010
@@ -0,0 +1,59 @@
+Spring Example
+==============
+
+This example shows how to work with files and JMS, using Spring to boot up
+Camel and configure the routes. It can be run using Maven or Ant.
+
+The example consumes messages from a queue and writes them to the file
+system.
+
+You will need to compile this example first:
+  mvn compile
+
+To run the example type
+  mvn camel:run
+
+To run the example with Ant
+  a. You need to have Apache ActiveMQ installed. It can be downloaded from 
+    http://activemq.apache.org/
+
+  b. Export / Set ACTIVEMQ_HOME to the top level Apache ActiveMQ intall
+  directory
+    UNIX
+    export ACTIVEMQ_HOME=<path to ActiveMQ install directory>
+    Windows
+    set ACTIVEMQ_HOME=<path to ActiveMQ install directory>
+
+  c. To Run the example using Ant, type
+    ant
+  or to run the example and generate visualization graphs (refer to
+  http://camel.apache.org/visualisation.html), type
+    ant camel.dot
+
+You can see the routing rules by looking at the java code in the
+src/main/java directory and the Spring XML configuration lives in
+src/main/resources/META-INF/spring
+
+To stop the example hit ctrl + c
+
+To use log4j as the logging framework add this to the pom.xml:
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+    </dependency>
+and log4j.properties is located in src/main/resources 
+
+For the latest & greatest documentation on how to use this example please see
+  http://camel.apache.org/spring-example.html
+
+If you hit any problems please talk to us on the Camel Forums
+  http://camel.apache.org/discussion-forums.html
+
+Please help us make Apache Camel better - we appreciate any feedback you
+may have.  Enjoy!
+
+------------------------
+The Camel riders!
+
+
+

Propchange: camel/trunk/examples/camel-example-cafe/README.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/README.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: camel/trunk/examples/camel-example-cafe/build.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/build.xml?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/build.xml (added)
+++ camel/trunk/examples/camel-example-cafe/build.xml Wed Jan 20 13:30:47 2010
@@ -0,0 +1,40 @@
+<?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.
+-->
+
+<project name="camel-example-spring" default="run" basedir=".">
+
+  <import file="../common_build.xml"/>
+
+  <fail unless="env.SPRING_HOME" message="You must download Spring Framework and set your SPRING_HOME to run this demo."/>
+
+  <property name="project.name" value="camel-example-spring"/>
+
+  <path id="sample.build.classpath">
+    <fileset dir="${camel.lib}">
+      <exclude name="**/*-tests.jar"/>
+    </fileset>
+    <path refid="spring.classpath"/>
+    <path refid="camel.spring.classpath"/>
+  </path>
+
+  <target name="run" depends="build" description="Compile and run the sample">
+  	<camelrun mainClass="org.apache.camel.example.cafe.CafeRouteBuilder" />
+  </target>
+
+</project>

Propchange: camel/trunk/examples/camel-example-cafe/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/build.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/examples/camel-example-cafe/build.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: camel/trunk/examples/camel-example-cafe/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/pom.xml?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/pom.xml (added)
+++ camel/trunk/examples/camel-example-cafe/pom.xml Wed Jan 20 13:30:47 2010
@@ -0,0 +1,103 @@
+<?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.
+-->
+
+<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>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>examples</artifactId>
+    <version>2.2-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-example-cafe</artifactId>
+  <packaging>bundle</packaging>
+  <name>Camel :: Example :: Cafe </name>
+  <description>A cafe example showing how to work with Camel</description>
+
+  <properties>
+    <camel.osgi.export.pkg>org.apache.camel.example.cafe.*</camel.osgi.export.pkg>
+  </properties>
+
+  <pluginRepositories>
+    <pluginRepository>
+      <id>onejar-maven-plugin.googlecode.com</id>
+      <url>http://onejar-maven-plugin.googlecode.com/svn/mavenrepo</url>
+    </pluginRepository>
+  </pluginRepositories>
+  
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+    </dependency>
+
+    <!-- for testing -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+    <plugins>
+      <!-- Allows the routes to be run via 'mvn camel:run' -->
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-maven-plugin</artifactId>
+        <version>${project.version}</version>
+      </plugin>
+    
+    <!-- Allows the example to be run via 'mvn compile exec:java' -->
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <configuration>
+          <mainClass>org.apache.camel.example.cafe.CafeRouteBuilder</mainClass>
+          <includePluginDependencies>false</includePluginDependencies>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <reporting>
+    <plugins>
+      <!-- Generates nice PNG / SVG diagrams from our routes -->
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-maven-plugin</artifactId>
+        <version>${project.version}</version>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>

Propchange: camel/trunk/examples/camel-example-cafe/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/pom.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: camel/trunk/examples/camel-example-cafe/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/examples/camel-example-cafe/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/CafeRouteBuilder.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/CafeRouteBuilder.java?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/CafeRouteBuilder.java (added)
+++ camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/CafeRouteBuilder.java Wed Jan 20 13:30:47 2010
@@ -0,0 +1,91 @@
+/**
+ * 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.example.cafe;
+
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.example.cafe.stuff.Barista;
+import org.apache.camel.example.cafe.stuff.CafeAggregationStrategy;
+import org.apache.camel.example.cafe.stuff.DrinkRouter;
+import org.apache.camel.example.cafe.stuff.OrderSplitter;
+import org.apache.camel.example.cafe.stuff.Waiter;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.impl.JndiRegistry;
+
+
+/**
+ * A simple example router from Cafe Demo
+ *
+ * @version $Revision$
+ */
+public class CafeRouteBuilder extends RouteBuilder {
+    
+    public static void main(String[] args) throws Exception {
+        CafeRouteBuilder builder = new CafeRouteBuilder();
+        builder.runCafeRouteDemo();
+    }
+    
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = new JndiRegistry();
+        jndi.bind("drinkRouter", new DrinkRouter());
+        jndi.bind("orderSplitter", new OrderSplitter());
+        jndi.bind("barista", new Barista());
+        jndi.bind("waiter", new Waiter());
+        jndi.bind("aggregatorStrategy", new CafeAggregationStrategy());
+        return jndi;
+    }
+    
+    public void runCafeRouteDemo() throws Exception {
+        // create CamelContext
+        DefaultCamelContext camelContext = new DefaultCamelContext();
+        camelContext.setRegistry(createRegistry());
+        camelContext.addRoutes(this);
+        camelContext.start();
+        
+        ProducerTemplate template = camelContext.createProducerTemplate();
+        
+        Order order = new Order(2);
+        order.addItem(DrinkType.ESPRESSO, 2, true);
+        order.addItem(DrinkType.CAPPUCCINO, 4, false);
+        order.addItem(DrinkType.LATTE, 4, false);
+        order.addItem(DrinkType.MOCHA, 2, false);
+        
+        template.sendBody("direct:cafe", order);
+        
+        Thread.sleep(6000);
+        camelContext.stop();
+        
+    }
+    
+    public void configure() {
+        from("direct:cafe")
+            .split().method("orderSplitter").to("direct:drink");
+        
+        from("direct:drink").recipientList().method("drinkRouter");
+        
+        from("seda:coldDrinks?concurrentConsumers=2").to("bean:barista?method=prepareColdDrink").to("direct:deliveries");
+        from("seda:hotDrinks?concurrentConsumers=3").to("bean:barista?method=prepareHotDrink").to("direct:deliveries");
+        
+        from("direct:deliveries")
+            .aggregate(new CafeAggregationStrategy()).method("waiter", "checkOrder")
+            .batchTimeout(5 * 1000L)
+            .to("bean:waiter?method=prepareDelivery")
+            .to("bean:waiter?method=deliverCafes");
+        
+    }
+
+}

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/CafeRouteBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/CafeRouteBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Delivery.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Delivery.java?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Delivery.java (added)
+++ camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Delivery.java Wed Jan 20 13:30:47 2010
@@ -0,0 +1,56 @@
+/**
+ * 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.example.cafe;
+
+import java.util.List;
+
+public class Delivery {
+
+    private static final String SEPARATOR = "-----------------------";
+
+    private List<Drink> deliveredDrinks;
+
+    private int orderNumber;
+
+    public Delivery(List<Drink> deliveredDrinks) {
+        assert deliveredDrinks.size() > 0;
+        this.deliveredDrinks = deliveredDrinks;
+        this.orderNumber = deliveredDrinks.get(0).getOrderNumber();
+    }
+
+    public int getOrderNumber() {
+        return orderNumber;
+    }
+
+    public List<Drink> getDeliveredDrinks() {
+        return deliveredDrinks;
+    }
+
+    @Override
+    public String toString() {
+        StringBuffer buffer = new StringBuffer(SEPARATOR + "\n");
+        buffer.append("Order #" + getOrderNumber() + "\n");
+        for (Drink drink : getDeliveredDrinks()) {
+            buffer.append(drink);
+            buffer.append("\n");
+        }
+        buffer.append(SEPARATOR + "\n");
+        return buffer.toString();
+    }
+
+}
+

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Delivery.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Delivery.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Drink.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Drink.java?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Drink.java (added)
+++ camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Drink.java Wed Jan 20 13:30:47 2010
@@ -0,0 +1,68 @@
+/**
+ * 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.example.cafe;
+
+import org.apache.camel.util.ObjectHelper;
+
+public class Drink {
+
+    private boolean iced;
+
+    private int shots;
+
+    private DrinkType drinkType;
+
+    private int orderNumber;
+
+    public Drink(int orderNumber, DrinkType drinkType, boolean hot, int shots) {
+        this.orderNumber = orderNumber;
+        this.drinkType = drinkType;
+        this.iced = hot;
+        this.shots = shots;
+    }
+
+    public int getOrderNumber() {
+        return orderNumber;
+    }
+
+    @Override
+    public String toString() {
+        return (iced ? "Iced" : "Hot") + " " + drinkType.toString() + ", " + shots + " shots.";
+    }
+    
+    @Override
+    public boolean equals(Object o) {
+        if (o instanceof Drink) {
+            Drink that = (Drink)o;
+            return ObjectHelper.equal(this.drinkType, that.drinkType) 
+                && ObjectHelper.equal(this.orderNumber, that.orderNumber)
+                && ObjectHelper.equal(this.iced, that.iced)
+                && ObjectHelper.equal(this.shots, that.shots);                 
+        }
+        return false;
+    }
+  
+    @Override
+    public int hashCode() {
+        if (iced) {
+            return drinkType.hashCode() + orderNumber * 1000 + shots * 100;
+        } else {
+            return drinkType.hashCode() + orderNumber * 1000 + shots * 100 + 5;
+        }
+    }
+
+}

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Drink.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Drink.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/DrinkType.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/DrinkType.java?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/DrinkType.java (added)
+++ camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/DrinkType.java Wed Jan 20 13:30:47 2010
@@ -0,0 +1,27 @@
+/**
+ * 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.example.cafe;
+
+public enum DrinkType {
+
+    ESPRESSO,
+    LATTE,
+    CAPPUCCINO,
+    MOCHA
+
+}
+

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/DrinkType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/DrinkType.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Order.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Order.java?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Order.java (added)
+++ camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Order.java Wed Jan 20 13:30:47 2010
@@ -0,0 +1,47 @@
+/**
+ * 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.example.cafe;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Mark Fisher
+ * @author Marius Bogoevici
+ */
+public class Order {
+
+    private List<OrderItem> orderItems = new ArrayList<OrderItem>();
+
+    private int number;
+
+    public Order(int number) {
+        this.number = number;
+    }
+
+    public void addItem(DrinkType drinkType, int shots, boolean iced) {
+        this.orderItems.add(new OrderItem(this, drinkType, shots, iced));
+    }
+
+    public int getNumber() {
+        return number;
+    }
+
+    public List<OrderItem> getItems() {
+        return this.orderItems;
+    }
+
+}

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Order.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/Order.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/OrderItem.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/OrderItem.java?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/OrderItem.java (added)
+++ camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/OrderItem.java Wed Jan 20 13:30:47 2010
@@ -0,0 +1,79 @@
+/**
+ * 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.example.cafe;
+
+import org.apache.camel.util.ObjectHelper;
+
+public class OrderItem {
+
+    private DrinkType type;
+
+    private int shots = 1;
+
+    private boolean iced;
+
+    private final Order order;
+
+    public OrderItem(Order order, DrinkType type, int shots, boolean iced) {
+        this.order = order;
+        this.type = type;
+        this.shots = shots;
+        this.iced = iced;
+    }
+
+    public Order getOrder() {
+        return this.order;
+    }
+
+    public boolean isIced() {
+        return this.iced;
+    }
+
+    public int getShots() {
+        return shots;
+    }
+
+    public DrinkType getDrinkType() {
+        return this.type;
+    }
+
+    public String toString() {
+        return ((this.iced) ? "iced " : "hot ") + this.shots + " shot " + this.type;
+    }
+    
+    @Override
+    public boolean equals(Object o) {
+        if (o instanceof OrderItem) {
+            OrderItem that = (OrderItem)o;
+            return ObjectHelper.equal(this.type, that.type) 
+                && ObjectHelper.equal(this.order.getNumber(), that.order.getNumber())
+                && ObjectHelper.equal(this.iced, that.iced)
+                && ObjectHelper.equal(this.shots, that.shots);                 
+        }
+        return false;
+    }
+  
+    @Override
+    public int hashCode() {
+        if (iced) {
+            return type.hashCode() + order.getNumber() * 10000 + shots * 100;
+        } else {
+            return type.hashCode() + order.getNumber() * 10000 + shots * 100 + 5;
+        }
+    }
+
+}

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/OrderItem.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/OrderItem.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/Barista.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/Barista.java?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/Barista.java (added)
+++ camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/Barista.java Wed Jan 20 13:30:47 2010
@@ -0,0 +1,70 @@
+/**
+ * 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.example.cafe.stuff;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.camel.example.cafe.Drink;
+import org.apache.camel.example.cafe.OrderItem;
+
+public class Barista {
+
+    private long hotDrinkDelay = 500;
+
+    private long coldDrinkDelay = 100;
+
+    private AtomicInteger hotDrinkCounter = new AtomicInteger();
+
+    private AtomicInteger coldDrinkCounter = new AtomicInteger();
+
+    public void setHotDrinkDelay(long hotDrinkDelay) {
+        this.hotDrinkDelay = hotDrinkDelay;
+    }
+
+    public void setColdDrinkDelay(long coldDrinkDelay) {
+        this.coldDrinkDelay = coldDrinkDelay;
+    }
+
+    public Drink prepareHotDrink(OrderItem orderItem) {
+        try {
+            Thread.sleep(this.hotDrinkDelay);
+            System.out.println(Thread.currentThread().getName() + " prepared hot drink #"
+                               + hotDrinkCounter.incrementAndGet() + " for order #"
+                               + orderItem.getOrder().getNumber() + ": " + orderItem);
+            return new Drink(orderItem.getOrder().getNumber(), orderItem.getDrinkType(), orderItem.isIced(),
+                             orderItem.getShots());
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            return null;
+        }
+    }
+
+    public Drink prepareColdDrink(OrderItem orderItem) {
+        try {
+            Thread.sleep(this.coldDrinkDelay);
+            System.out.println(Thread.currentThread().getName() + " prepared cold drink #"
+                               + coldDrinkCounter.incrementAndGet() + " for order #"
+                               + orderItem.getOrder().getNumber() + ": " + orderItem);
+            return new Drink(orderItem.getOrder().getNumber(), orderItem.getDrinkType(), orderItem.isIced(),
+                             orderItem.getShots());
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            return null;
+        }
+    }
+
+}

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/Barista.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/Barista.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/CafeAggregationStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/CafeAggregationStrategy.java?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/CafeAggregationStrategy.java (added)
+++ camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/CafeAggregationStrategy.java Wed Jan 20 13:30:47 2010
@@ -0,0 +1,41 @@
+/**
+ * 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.example.cafe.stuff;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.example.cafe.Drink;
+import org.apache.camel.processor.aggregate.AggregationStrategy;
+
+public class CafeAggregationStrategy implements AggregationStrategy {
+
+    @SuppressWarnings("unchecked")
+    public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
+        List<Drink> drinks;
+        if (oldExchange == null) {
+            drinks = new ArrayList<Drink>();           
+        } else {
+            drinks = (List<Drink>) oldExchange.getIn().getBody();
+        }
+        drinks.add(newExchange.getIn().getBody(Drink.class));
+        newExchange.getIn().setBody(drinks);
+        return newExchange;
+    }
+
+}

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/CafeAggregationStrategy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/CafeAggregationStrategy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/DrinkRouter.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/DrinkRouter.java?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/DrinkRouter.java (added)
+++ camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/DrinkRouter.java Wed Jan 20 13:30:47 2010
@@ -0,0 +1,27 @@
+/**
+ * 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.example.cafe.stuff;
+
+import org.apache.camel.example.cafe.OrderItem;
+
+public class DrinkRouter {
+
+    public String resolveOrderItemChannel(OrderItem orderItem) {
+        return (orderItem.isIced()) ? "seda:coldDrinks" : "seda:hotDrinks";
+    }
+
+}

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/DrinkRouter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/DrinkRouter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/OrderSplitter.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/OrderSplitter.java?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/OrderSplitter.java (added)
+++ camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/OrderSplitter.java Wed Jan 20 13:30:47 2010
@@ -0,0 +1,31 @@
+/**
+ * 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.example.cafe.stuff;
+
+import java.util.List;
+
+import org.apache.camel.example.cafe.Order;
+import org.apache.camel.example.cafe.OrderItem;
+
+public class OrderSplitter {
+    
+    public List<OrderItem> split(Order order) {
+        return order.getItems();
+    }
+
+
+}

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/OrderSplitter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/OrderSplitter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/Waiter.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/Waiter.java?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/Waiter.java (added)
+++ camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/Waiter.java Wed Jan 20 13:30:47 2010
@@ -0,0 +1,41 @@
+/**
+ * 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.example.cafe.stuff;
+
+import java.util.List;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.example.cafe.Delivery;
+import org.apache.camel.example.cafe.Drink;
+
+
+public class Waiter {
+    
+    public Delivery prepareDelivery(List<Drink> drinks) {
+        return new Delivery(drinks);
+    }
+
+    
+    public void deliverCafes(Delivery delivery) {
+        System.out.println(delivery);
+    }
+    
+    public int checkOrder(Drink drink) {
+        return drink.getOrderNumber();
+    }
+
+}

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/Waiter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/main/java/org/apache/camel/example/cafe/stuff/Waiter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/LICENSE.txt
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/LICENSE.txt?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/LICENSE.txt (added)
+++ camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/LICENSE.txt Wed Jan 20 13:30:47 2010
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+

Propchange: camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/LICENSE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/LICENSE.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/NOTICE.txt
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/NOTICE.txt?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/NOTICE.txt (added)
+++ camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/NOTICE.txt Wed Jan 20 13:30:47 2010
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache Camel distribution.                    ==
+   =========================================================================
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Please read the different LICENSE files present in the licenses directory of
+   this distribution.

Propchange: camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/NOTICE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/NOTICE.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/beans.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/beans.xml?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/beans.xml (added)
+++ camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/beans.xml Wed Jan 20 13:30:47 2010
@@ -0,0 +1,31 @@
+<?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-2.5.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+  
+  <bean id="aggregatorStrategy" class="org.apache.camel.example.cafe.stuff.CafeAggregationStrategy"/>
+  <bean id="orderSplitter" class="org.apache.camel.example.cafe.stuff.OrderSplitter"/>
+  <bean id="drinkRouter" class="org.apache.camel.example.cafe.stuff.DrinkRouter"/>
+  <bean id="waiter" class="org.apache.camel.example.cafe.stuff.Waiter"/>
+  <bean id="barista" class="org.apache.camel.example.cafe.stuff.Barista"/>
+  
+</beans>

Propchange: camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/beans.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/beans.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/beans.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/spring/camel-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/spring/camel-context.xml?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/spring/camel-context.xml (added)
+++ camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/spring/camel-context.xml Wed Jan 20 13:30:47 2010
@@ -0,0 +1,64 @@
+<?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-2.5.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+ 
+  <import resource="classpath:META-INF/beans.xml"/>
+ 
+  <camelContext id="camel"
+                xmlns="http://camel.apache.org/schema/spring">
+     <route>
+         <from uri="direct:cafe"/>
+         <split>
+            <method bean="orderSplitter"/>
+            <to uri="direct:drink"/>
+        </split>
+     </route>
+     <route>
+         <from uri="direct:drink" />
+         <recipientList>
+            <method bean="drinkRouter"/>
+         </recipientList>
+     </route>
+     <route>
+         <from uri="seda:coldDrinks?concurrentConsumers=2"/>
+         <to uri="bean:barista?method=prepareColdDrink"/>
+         <to uri="direct:deliveries"/>
+     </route>
+     <route>
+         <from uri="seda:hotDrinks?concurrentConsumers=3"/>
+         <to uri="bean:barista?method=prepareHotDrink"/>
+         <to uri="direct:deliveries"/>
+     </route>
+     <route>
+         <from uri="direct:deliveries"/>
+         <aggregate strategyRef="aggregatorStrategy" >
+             <correlationExpression>  
+                 <method bean="waiter" method="checkOrder" />
+             </correlationExpression>  
+      	     <to uri="bean:waiter?method=prepareDelivery"/>
+      	     <to uri="bean:waiter?method=deliverCafes"/>
+         </aggregate>
+     </route>
+  </camelContext>
+
+</beans>

Propchange: camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/spring/camel-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/spring/camel-context.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/examples/camel-example-cafe/src/main/resources/META-INF/spring/camel-context.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: camel/trunk/examples/camel-example-cafe/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/main/resources/log4j.properties?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/main/resources/log4j.properties (added)
+++ camel/trunk/examples/camel-example-cafe/src/main/resources/log4j.properties Wed Jan 20 13:30:47 2010
@@ -0,0 +1,32 @@
+## ------------------------------------------------------------------------
+## 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 for eclipse testing, We want to see INFO output on the console.
+#
+log4j.rootLogger=INFO, out
+
+#
+# uncomment the following line to enable debugging of Camel
+#
+#log4j.logger.org.apache.camel=DEBUG
+
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
+
+log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer
\ No newline at end of file

Propchange: camel/trunk/examples/camel-example-cafe/src/main/resources/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/main/resources/log4j.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/examples/camel-example-cafe/src/main/resources/log4j.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteBuilderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteBuilderTest.java?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteBuilderTest.java (added)
+++ camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteBuilderTest.java Wed Jan 20 13:30:47 2010
@@ -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.example.cafe;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.example.cafe.stuff.Barista;
+import org.apache.camel.example.cafe.stuff.CafeAggregationStrategy;
+import org.apache.camel.example.cafe.stuff.OrderSplitter;
+import org.apache.camel.example.cafe.test.TestDrinkRouter;
+import org.apache.camel.example.cafe.test.TestWaiter;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+/**
+ * @version $Revision$
+ */
+public class CafeRouteBuilderTest extends CamelTestSupport {
+    protected TestWaiter waiter = new TestWaiter();
+    protected TestDrinkRouter driverRouter = new TestDrinkRouter();
+    
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+        jndi.bind("drinkRouter", driverRouter);
+        jndi.bind("orderSplitter", new OrderSplitter());
+        jndi.bind("barista", new Barista());
+        jndi.bind("waiter", waiter);
+        jndi.bind("aggregatorStrategy", new CafeAggregationStrategy());
+        return jndi;
+    }
+    
+    @Test
+    public void testSplitter() throws InterruptedException {
+        MockEndpoint coldDrinks = (MockEndpoint)context.getEndpoint("mock:coldDrinks");
+        MockEndpoint hotDrinks = (MockEndpoint)context.getEndpoint("mock:hotDrinks");
+        
+        Order order = new Order(1);
+        order.addItem(DrinkType.ESPRESSO, 2, true);
+        order.addItem(DrinkType.CAPPUCCINO, 2, false);
+        
+        coldDrinks.expectedBodiesReceived(new OrderItem(order, DrinkType.ESPRESSO, 2, true));
+        hotDrinks.expectedBodiesReceived(new OrderItem(order, DrinkType.CAPPUCCINO, 2, false));
+        
+        template.sendBody("direct:cafe", order);
+        
+        assertMockEndpointsSatisfied();
+        
+    }
+    
+    @Test
+    public void testCafeRoute() throws Exception {
+        driverRouter.setTestModel(false);
+        List<Drink> drinks = new ArrayList<Drink>();
+        Order order = new Order(2);
+        order.addItem(DrinkType.ESPRESSO, 2, true);
+        order.addItem(DrinkType.CAPPUCCINO, 4, false);
+        order.addItem(DrinkType.LATTE, 4, false);
+        order.addItem(DrinkType.MOCHA, 2, false);
+        
+        drinks.add(new Drink(2, DrinkType.ESPRESSO, true, 2));
+        drinks.add(new Drink(2, DrinkType.CAPPUCCINO, false, 4));
+        drinks.add(new Drink(2, DrinkType.LATTE, false, 4));
+        drinks.add(new Drink(2, DrinkType.MOCHA, false, 2));
+        
+        waiter.setVerfiyDrinks(drinks);
+        
+        template.sendBody("direct:cafe", order);
+        
+        Thread.sleep(6000);
+        
+        waiter.verifyDrinks();
+        
+    }
+    
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new CafeRouteBuilder();
+    }
+
+    
+}

Propchange: camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteBuilderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteBuilderTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteSpringIntegrationTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteSpringIntegrationTest.java?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteSpringIntegrationTest.java (added)
+++ camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteSpringIntegrationTest.java Wed Jan 20 13:30:47 2010
@@ -0,0 +1,70 @@
+/**
+ * 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.example.cafe;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class CafeRouteSpringIntegrationTest extends Assert {
+    private AbstractApplicationContext applicationContext;
+    private ProducerTemplate template;
+    
+    @Before
+    public void setUp() throws Exception {
+        applicationContext = new ClassPathXmlApplicationContext("META-INF/spring/camel-context.xml");
+        CamelContext camelContext = getCamelContext();
+        template = camelContext.createProducerTemplate();
+        
+    }
+    
+    @Test
+    public void testCafeRoute() throws Exception {
+        
+        Order order = new Order(2);
+        order.addItem(DrinkType.ESPRESSO, 2, true);
+        order.addItem(DrinkType.CAPPUCCINO, 4, false);
+        order.addItem(DrinkType.LATTE, 4, false);
+        order.addItem(DrinkType.MOCHA, 2, false);
+        
+        template.sendBody("direct:cafe", order);
+        
+        Thread.sleep(6000);
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+        if (applicationContext != null) {
+            applicationContext.stop();
+        }
+    }
+    
+    protected CamelContext getCamelContext() throws Exception {
+        return (DefaultCamelContext) applicationContext.getBean("camel");
+        
+    }
+
+}

Propchange: camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteSpringIntegrationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteSpringIntegrationTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteSpringTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteSpringTest.java?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteSpringTest.java (added)
+++ camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteSpringTest.java Wed Jan 20 13:30:47 2010
@@ -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.example.cafe;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.example.cafe.test.TestDrinkRouter;
+import org.apache.camel.example.cafe.test.TestWaiter;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.junit.After;
+import org.junit.Before;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class CafeRouteSpringTest extends CafeRouteBuilderTest {
+    private AbstractApplicationContext applicationContext;
+    private ProducerTemplate template;
+    
+    @Before
+    public void setUp() throws Exception {
+        applicationContext = new ClassPathXmlApplicationContext("META-INF/spring/camel-context.xml");
+        setUseRouteBuilder(false);
+        super.setUp();
+        waiter = (TestWaiter) applicationContext.getBean("waiter");
+        driverRouter = (TestDrinkRouter) applicationContext.getBean("drinkRouter");
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+        super.tearDown();
+        if (applicationContext != null) {
+            applicationContext.stop();
+        }
+    }
+    
+    protected CamelContext createCamelContext() throws Exception {
+        DefaultCamelContext camelcontext = (DefaultCamelContext) applicationContext.getBean("camel");
+        return camelcontext;
+    }
+
+}

Propchange: camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteSpringTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/CafeRouteSpringTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/test/TestDrinkRouter.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/test/TestDrinkRouter.java?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/test/TestDrinkRouter.java (added)
+++ camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/test/TestDrinkRouter.java Wed Jan 20 13:30:47 2010
@@ -0,0 +1,38 @@
+/**
+ * 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.example.cafe.test;
+
+import org.apache.camel.example.cafe.OrderItem;
+import org.apache.camel.example.cafe.stuff.DrinkRouter;
+
+public class TestDrinkRouter extends DrinkRouter {
+    private boolean testModel = true;
+    
+    public void setTestModel(boolean testModel) {
+        this.testModel = testModel; 
+    }
+    
+    public String resolveOrderItemChannel(OrderItem orderItem) {
+        if (testModel) {
+            return (orderItem.isIced()) ? "mock:coldDrinks" : "mock:hotDrinks";
+        } else {
+            return super.resolveOrderItemChannel(orderItem);
+        }
+    }
+
+}

Propchange: camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/test/TestDrinkRouter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/test/TestDrinkRouter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/test/TestWaiter.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/test/TestWaiter.java?rev=901190&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/test/TestWaiter.java (added)
+++ camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/test/TestWaiter.java Wed Jan 20 13:30:47 2010
@@ -0,0 +1,50 @@
+/**
+ * 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.example.cafe.test;
+
+import java.util.List;
+
+import org.apache.camel.example.cafe.Delivery;
+import org.apache.camel.example.cafe.Drink;
+import org.apache.camel.example.cafe.stuff.Waiter;
+
+public class TestWaiter extends Waiter {
+    protected List<Drink> expectDrinks;
+    protected List<Drink> deliveredDrinks;
+    
+    public void setVerfiyDrinks(List<Drink> drinks) {
+        this.expectDrinks = drinks;
+    }
+    
+    public void deliverCafes(Delivery delivery) {
+        super.deliverCafes(delivery);
+        deliveredDrinks = delivery.getDeliveredDrinks();
+    }
+   
+    public void verifyDrinks() {
+        if (expectDrinks.size() != deliveredDrinks.size()) {
+            throw new AssertionError("Can't get expect size of drinks");
+        }
+        for (Drink drink : expectDrinks) {
+            if (!deliveredDrinks.contains(drink)) {
+                throw new AssertionError("Can't find drink " + drink + " in the deliveredDrinks");
+            }
+        }
+    }
+
+}

Propchange: camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/test/TestWaiter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-cafe/src/test/java/org/apache/camel/example/cafe/test/TestWaiter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message