activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r534800 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/builder/ camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/test/java/org/apache/camel/builder/ camel-sprin...
Date Thu, 03 May 2007 11:35:33 GMT
Author: jstrachan
Date: Thu May  3 04:35:30 2007
New Revision: 534800

URL: http://svn.apache.org/viewvc?view=rev&rev=534800
Log:
made it a little easier to use references to refer to Endpoints from within the XML configuration; so <from ref="someEndpoint"> or <to ref="someEndpoint"/> also avoided the need for <routes> within a <camelContext/> to simplify the XML

Added:
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/RouteBuilderFactoryBean.java
      - copied, changed from r534725, activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/RouteBuilderFactory.java
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/StatementRouteBuilder.java   (with props)
    activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/EndpointReferenceTest.java   (contents, props changed)
      - copied, changed from r534725, activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/EndpointXmlConfigTest.java
    activemq/camel/trunk/camel-spring/src/test/resources/log4j.properties   (with props)
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/camelContextFactoryBeanTest.xml   (contents, props changed)
      - copied, changed from r534725, activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/camel_context_factory_bean_test.xml
Removed:
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/RouteBuilderFactory.java
    activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/EndpointXmlConfigTest.java
    activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryAndNamespacesTest.java
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/camel_context_factory_bean_test.xml
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingCamelContextFactoryWithNamespacesTest.xml
Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FluentArg.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FromBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
    activemq/camel/trunk/camel-spring/pom.xml
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelBeanDefinitionParser.java
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelNamespaceHandler.java
    activemq/camel/trunk/camel-spring/src/main/resources/org/apache/camel/spring/camel-1.0.xsd
    activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java
    activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/xml/XmlRouteBuilderTest.java
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/builder/spring_route_builder_test.xml
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/endpointReference.xml
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/examples.xml
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingCamelContextFactoryTest.xml
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingProcessor.xml

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java?view=diff&rev=534800&r1=534799&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java Thu May  3 04:35:30 2007
@@ -122,7 +122,7 @@
      *
      * @param routes the routes to add
      */
-    void addRoutes(Collection<Route> routes);
+    void addRoutes(Collection<Route> routes) throws Exception;
 
     /**
      * Adds a collection of routes to this context using the given builder

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FluentArg.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FluentArg.java?view=diff&rev=534800&r1=534799&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FluentArg.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FluentArg.java Thu May  3 04:35:30 2007
@@ -30,4 +30,5 @@
 	String value();
 	boolean attribute() default true;
 	boolean element() default false;
+    boolean reference() default false;
 }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FromBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FromBuilder.java?view=diff&rev=534800&r1=534799&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FromBuilder.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FromBuilder.java Thu May  3 04:35:30 2007
@@ -72,7 +72,7 @@
      * Sends the exchange to the given endpoint
      */
     @Fluent
-    public ProcessorFactory to(@FluentArg("endpoint")Endpoint endpoint) {
+    public ProcessorFactory to(@FluentArg("ref")Endpoint endpoint) {
         ToBuilder answer = new ToBuilder(this, endpoint);
         addProcessBuilder(answer);
         return answer;

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java?view=diff&rev=534800&r1=534799&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java Thu May  3 04:35:30 2007
@@ -57,7 +57,7 @@
     }
 
     @Fluent
-    public FromBuilder from( @FluentArg("endpoint") Endpoint endpoint) {
+    public FromBuilder from( @FluentArg("ref") Endpoint endpoint) {
         FromBuilder answer = new FromBuilder(this, endpoint);
         fromBuilders.add(answer);
         return answer;

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?view=diff&rev=534800&r1=534799&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java Thu May  3 04:35:30 2007
@@ -222,13 +222,16 @@
         this.routes = routes;
     }
 
-    public void addRoutes(Collection<Route> routes) {
+    public void addRoutes(Collection<Route> routes) throws Exception {
         if (this.routes == null) {
             this.routes = new ArrayList<Route>(routes);
         }
         else {
             this.routes.addAll(routes);
         }
+        if (isStarted()) {
+            startRoutes(routes);
+        }
     }
 
     public void addRoutes(RouteBuilder builder) throws Exception {
@@ -292,9 +295,21 @@
             	startServices(component);
             }
         }
-        
-        if (routes != null) {
-            for (Route<Exchange> route : routes) {
+        startRoutes(routes);
+    }
+
+    protected void doStop() throws Exception {
+        stopServices(servicesToClose);
+    	if (components != null) {
+            for (Component component : components.values()) {
+                stopServices(component);
+            }
+        }
+    }
+
+    protected void startRoutes(Collection<Route> routeList) throws Exception {
+        if (routeList != null) {
+            for (Route<Exchange> route : routeList) {
                 Processor processor = route.getProcessor();
                 Consumer<Exchange> consumer = route.getEndpoint().createConsumer(processor);
                 if (consumer != null) {
@@ -306,15 +321,6 @@
                     service.start();
                     servicesToClose.add(service);
                 }
-            }
-        }
-    }
-
-    protected void doStop() throws Exception {
-        stopServices(servicesToClose);
-    	if (components != null) {
-            for (Component component : components.values()) {
-                stopServices(component);
             }
         }
     }

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java?view=diff&rev=534800&r1=534799&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java Thu May  3 04:35:30 2007
@@ -45,7 +45,7 @@
     protected DelegateProcessor interceptor1;
     protected DelegateProcessor interceptor2;
 
-    protected RouteBuilder buildSimpleRoute() {
+    protected List<Route> buildSimpleRoute() throws Exception {
         // START SNIPPET: e1
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
@@ -53,13 +53,12 @@
             }
         };
         // END SNIPPET: e1
-        return builder;
+        return builder.getRouteList();
     }
 
     public void testSimpleRoute() throws Exception {
-        RouteBuilder builder = buildSimpleRoute();
+        List<Route> routes = buildSimpleRoute();
 
-        List<Route> routes = builder.getRouteList();
         assertEquals("Number routes created", 1, routes.size());
         for (Route<Exchange> route : routes) {
             Endpoint<Exchange> key = route.getEndpoint();
@@ -71,7 +70,7 @@
         }
     }
 
-    protected RouteBuilder buildSimpleRouteWithHeaderPredicate() {
+    protected List<Route> buildSimpleRouteWithHeaderPredicate() throws Exception {
         // START SNIPPET: e2
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
@@ -79,13 +78,12 @@
             }
         };
         // END SNIPPET: e2
-        return builder;
+        return builder.getRouteList();
     }
 
     public void testSimpleRouteWithHeaderPredicate() throws Exception {
-        RouteBuilder builder = buildSimpleRouteWithHeaderPredicate();
+        List<Route> routes = buildSimpleRouteWithHeaderPredicate();
 
-        List<Route> routes = builder.getRouteList();
         log.debug("Created routes: " + routes);
 
         assertEquals("Number routes created", 1, routes.size());
@@ -100,7 +98,7 @@
         }
     }
 
-    protected RouteBuilder buildSimpleRouteWithChoice() {
+    protected List<Route> buildSimpleRouteWithChoice() throws Exception {
         // START SNIPPET: e3
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
@@ -111,13 +109,12 @@
             }
         };
         // END SNIPPET: e3
-        return builder;
+        return builder.getRouteList();
     }
 
     public void testSimpleRouteWithChoice() throws Exception {
-        RouteBuilder builder = buildSimpleRouteWithChoice();
+        List<Route> routes = buildSimpleRouteWithChoice();
 
-        List<Route> routes = builder.getRouteList();
         log.debug("Created routes: " + routes);
 
         assertEquals("Number routes created", 1, routes.size());
@@ -140,7 +137,7 @@
         }
     }
 
-    protected RouteBuilder buildCustomProcessor() {
+    protected List<Route> buildCustomProcessor() throws Exception {
         // START SNIPPET: e4
         myProcessor = new Processor() {
             public void process(Exchange exchange) {
@@ -154,13 +151,11 @@
             }
         };
         // END SNIPPET: e4
-        return builder;
+        return builder.getRouteList();
     }
 
     public void testCustomProcessor() throws Exception {
-        RouteBuilder builder = buildCustomProcessor();
-
-        List<Route> routes = builder.getRouteList();
+        List<Route> routes = buildCustomProcessor();
 
         assertEquals("Number routes created", 1, routes.size());
         for (Route route : routes) {
@@ -172,7 +167,7 @@
         }
     }
 
-    protected RouteBuilder buildCustomProcessorWithFilter() {
+    protected List<Route> buildCustomProcessorWithFilter() throws Exception {
         // START SNIPPET: e5
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
@@ -180,13 +175,12 @@
             }
         };
         // END SNIPPET: e5
-        return builder;
+        return builder.getRouteList();
     }
 
     public void testCustomProcessorWithFilter() throws Exception {
-        RouteBuilder builder = buildCustomProcessorWithFilter();
+        List<Route> routes = buildCustomProcessorWithFilter();
 
-        List<Route> routes = builder.getRouteList();
         log.debug("Created routes: " + routes);
 
         assertEquals("Number routes created", 1, routes.size());
@@ -200,7 +194,7 @@
         }
     }
 
-    protected RouteBuilder buildWireTap() {
+    protected List<Route> buildWireTap() throws Exception {
         // START SNIPPET: e6
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
@@ -208,13 +202,12 @@
             }
         };
         // END SNIPPET: e6
-        return builder;
+        return builder.getRouteList();
     }
 
     public void testWireTap() throws Exception {
-        RouteBuilder builder = buildWireTap();
+        List<Route> routes = buildWireTap();
 
-        List<Route> routes = builder.getRouteList();
         log.debug("Created routes: " + routes);
 
         assertEquals("Number routes created", 1, routes.size());
@@ -232,7 +225,7 @@
         }
     }
 
-    protected RouteBuilder buildRouteWithInterceptor() {
+    protected List<Route> buildRouteWithInterceptor() throws Exception {
         interceptor1 = new DelegateProcessor() {
         };
 
@@ -249,14 +242,13 @@
             }
         };
         // END SNIPPET: e7
-        return builder;
+        return builder.getRouteList();
     }
 
     public void testRouteWithInterceptor() throws Exception {
 
-        RouteBuilder builder = buildRouteWithInterceptor();
+        List<Route> routes = buildRouteWithInterceptor();
 
-        List<Route> routes = builder.getRouteList();
         log.debug("Created routes: " + routes);
 
         assertEquals("Number routes created", 1, routes.size());
@@ -303,7 +295,7 @@
         }
     }
 
-    protected RouteBuilder buildStaticRecipientList() {
+    protected List<Route> buildStaticRecipientList() throws Exception {
         // START SNIPPET: e8
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
@@ -311,10 +303,10 @@
             }
         };
         // END SNIPPET: e8
-        return builder;
+        return builder.getRouteList();
     }
 
-    protected RouteBuilder buildDynamicRecipientList() {
+    protected List<Route> buildDynamicRecipientList() throws Exception {
         // START SNIPPET: e9
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
@@ -322,14 +314,13 @@
             }
         };
         // END SNIPPET: e9
-        return builder;
+        return builder.getRouteList();
     }
 
     public void testRouteDynamicReceipentList() throws Exception {
 
-        RouteBuilder builder = buildDynamicRecipientList();
+        List<Route> routes = buildDynamicRecipientList();
 
-        List<Route> routes = builder.getRouteList();
         log.debug("Created routes: " + routes);
 
         assertEquals("Number routes created", 1, routes.size());
@@ -342,7 +333,7 @@
         }
     }
 
-    protected RouteBuilder buildSplitter() {
+    protected List<Route> buildSplitter() throws Exception {
         // START SNIPPET: splitter
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
@@ -350,14 +341,13 @@
             }
         };
         // END SNIPPET: splitter
-        return builder;
+        return builder.getRouteList();
     }
 
     public void testSplitter() throws Exception {
 
-        RouteBuilder builder = buildSplitter();
+        List<Route> routes = buildSplitter();
 
-        List<Route> routes = builder.getRouteList();
         log.debug("Created routes: " + routes);
 
         assertEquals("Number routes created", 1, routes.size());
@@ -370,7 +360,7 @@
         }
     }
 
-    protected RouteBuilder buildIdempotentConsumer() {
+    protected List<Route> buildIdempotentConsumer() throws Exception {
         // START SNIPPET: idempotent
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
@@ -380,14 +370,13 @@
             }
         };
         // END SNIPPET: idempotent
-        return builder;
+        return builder.getRouteList();
     }
 
     public void testIdempotentConsumer() throws Exception {
 
-        RouteBuilder builder = buildIdempotentConsumer();
+        List<Route> routes = buildIdempotentConsumer();
 
-        List<Route> routes = builder.getRouteList();
         log.debug("Created routes: " + routes);
 
         assertEquals("Number routes created", 1, routes.size());

Modified: activemq/camel/trunk/camel-spring/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/pom.xml?view=diff&rev=534800&r1=534799&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-spring/pom.xml (original)
+++ activemq/camel/trunk/camel-spring/pom.xml Thu May  3 04:35:30 2007
@@ -46,14 +46,6 @@
       <optional>true</optional>
       <scope>test</scope>
     </dependency>
-
-    <!--
-    <dependency>
-      <groupId>org.apache.xbean</groupId>
-      <artifactId>xbean-spring</artifactId>
-      <version>2.8</version>
-    </dependency>
-    -->
     
     <dependency>
       <groupId>org.springframework</groupId>

Modified: activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java?view=diff&rev=534800&r1=534799&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java (original)
+++ activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java Thu May  3 04:35:30 2007
@@ -37,7 +37,6 @@
  */
 public class CamelContextFactoryBean implements FactoryBean, InitializingBean, DisposableBean, ApplicationContextAware {
     private CamelContext context;
-    private boolean singleton = true;
     private RouteBuilder routeBuilder;
     private List<RouteBuilder> additionalBuilders = new ArrayList<RouteBuilder>();
     private String[] packages = {};
@@ -52,7 +51,7 @@
     }
 
     public boolean isSingleton() {
-        return singleton;
+        return true;
     }
 
     public void afterPropertiesSet() throws Exception {

Modified: activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelBeanDefinitionParser.java?view=diff&rev=534800&r1=534799&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelBeanDefinitionParser.java (original)
+++ activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelBeanDefinitionParser.java Thu May  3 04:35:30 2007
@@ -28,6 +28,7 @@
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Set;
+import java.util.Map;
 
 import org.apache.camel.Expression;
 import org.apache.camel.builder.Fluent;
@@ -51,7 +52,7 @@
 public class CamelBeanDefinitionParser extends AbstractBeanDefinitionParser {
 
 	protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
-		BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(RouteBuilderFactory.class);
+		BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(RouteBuilderFactoryBean.class);
 
 		List childElements = DomUtils.getChildElementsByTagName(element, "route");
 		ArrayList<BuilderStatement> routes = new ArrayList<BuilderStatement>(childElements.size());
@@ -159,7 +160,20 @@
 		if (match == null)
 			throw new IllegalActionException(actionName, previousElement == null ? null : previousElement.getLocalName());
 
-		// Move element arguments into the attributeArguments map if needed. 
+        // lets convert any references
+        Set<Map.Entry<String, Object>> attributeEntries = attributeArguments.entrySet();
+        for (Map.Entry<String, Object> entry : attributeEntries) {
+            String name = entry.getKey();
+            FluentArg arg = match.parameterAnnotations.get(name);
+            if (arg != null && (arg.reference() || name.equals("ref"))) {
+                Object value = entry.getValue();
+                if (value instanceof String) {
+                    entry.setValue(new RuntimeBeanReference(value.toString()));
+                }
+            }
+        }
+
+        // Move element arguments into the attributeArguments map if needed.
 		Set<String> parameterNames = new HashSet<String>(match.parameters.keySet());
 		parameterNames.removeAll(attributeArguments.keySet());
 		for (String key : parameterNames) {

Modified: activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelNamespaceHandler.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelNamespaceHandler.java?view=diff&rev=534800&r1=534799&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelNamespaceHandler.java (original)
+++ activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelNamespaceHandler.java Thu May  3 04:35:30 2007
@@ -1,17 +1,23 @@
 package org.apache.camel.spring.xml;
 
+import static org.apache.camel.util.ObjectHelper.isNotNullOrBlank;
 import org.apache.camel.spring.CamelContextFactoryBean;
 import org.apache.camel.spring.EndpointFactoryBean;
+import org.apache.camel.util.ObjectHelper;
 import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
 import org.springframework.beans.factory.xml.ParserContext;
 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
 import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.RuntimeBeanReference;
 import org.springframework.beans.factory.parsing.BeanComponentDefinition;
 import org.springframework.beans.PropertyValue;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
+import org.w3c.dom.Node;
 
 public class CamelNamespaceHandler extends NamespaceHandlerSupport {
+    private int counter;
+
     protected CamelBeanDefinitionParser routesParser = new CamelBeanDefinitionParser();
     protected BeanDefinitionParserSupport endpointParser = new BeanDefinitionParserSupport(EndpointFactoryBean.class);
 
@@ -26,24 +32,60 @@
             protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
                 super.doParse(element, parserContext, builder);
 
+                String contextId = element.getAttribute("id");
+
+                Element routes = element.getOwnerDocument().createElement("routes");
+                // now lets move all the content there...
+                NodeList list = element.getChildNodes();
+                for (int size = list.getLength(), i = 0; i < size; i++) {
+                    Node child = list.item(i);
+                    if (child instanceof Element) {
+                        element.removeChild(child);
+                        routes.appendChild(child);
+                    }
+                }
+                String routeId = contextId + ":routes";
+                routes.setAttribute("id", routeId);
+
+                    BeanDefinition definition = routesParser.parse(routes, parserContext);
+                    definition.getPropertyValues().addPropertyValue("context", new RuntimeBeanReference(contextId));
+                    //definition.getPropertyValues().addPropertyValue("context", builder.getBeanDefinition());
+                    //builder.addPropertyValue("routeBuilder", definition);
+                    parserContext.registerComponent(new BeanComponentDefinition(definition, routeId));
+
+/*
                 NodeList list = element.getElementsByTagName("routes");
                 for (int size = list.getLength(), i = 0; i < size; i++) {
                     Element node = (Element) list.item(i);
-                    BeanDefinition definition = routesParser.parseInternal(node, parserContext);
-                    builder.addPropertyValue("routeBuilder", definition);
+                    String routeId = node.getAttribute("id");
+                    if (!isNotNullOrBlank(routeId)) {
+                        routeId = "__camel_route_" + nextCounter();
+                        node.setAttribute("id", routeId);
+                    }
+                    BeanDefinition definition = routesParser.parse(node, parserContext);
+                    definition.getPropertyValues().addPropertyValue("context", new RuntimeBeanReference(contextId));
+                    //definition.getPropertyValues().addPropertyValue("context", builder.getBeanDefinition());
+                    //builder.addPropertyValue("routeBuilder", definition);
+                    parserContext.registerComponent(new BeanComponentDefinition(definition, routeId));
                 }
 
-                list = element.getElementsByTagName("endpoint");
+*/
+                list = routes.getElementsByTagName("endpoint");
                 for (int size = list.getLength(), i = 0; i < size; i++) {
                     Element node = (Element) list.item(i);
-                    BeanDefinition definition = endpointParser.parse(node, parserContext);
+                    definition = endpointParser.parse(node, parserContext);
                     String id = node.getAttribute("id");
-                    if (id != null) {
-                        definition.getPropertyValues().addPropertyValue("context", builder.getBeanDefinition()); 
+                    if (isNotNullOrBlank(id)) {
+                        //definition.getPropertyValues().addPropertyValue("context", builder.getBeanDefinition());
+                        definition.getPropertyValues().addPropertyValue("context", new RuntimeBeanReference(contextId));
                         parserContext.registerComponent(new BeanComponentDefinition(definition, id));
                     }
                 }
             }
         });
+    }
+
+    protected synchronized int nextCounter() {
+        return ++counter;
     }
 }

Copied: activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/RouteBuilderFactoryBean.java (from r534725, activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/RouteBuilderFactory.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/RouteBuilderFactoryBean.java?view=diff&rev=534800&p1=activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/RouteBuilderFactory.java&r1=534725&p2=activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/RouteBuilderFactoryBean.java&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/RouteBuilderFactory.java (original)
+++ activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/RouteBuilderFactoryBean.java Thu May  3 04:35:30 2007
@@ -17,63 +17,40 @@
  */
 package org.apache.camel.spring.xml;
 
+import static org.apache.camel.util.ObjectHelper.notNull;
+
 import java.util.ArrayList;
 
-import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.CamelContext;
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.BeanFactory;
 import org.springframework.beans.factory.BeanFactoryAware;
 import org.springframework.beans.factory.FactoryBean;
+import org.springframework.beans.factory.InitializingBean;
 
 /**
- * A {@link FactoryBean} which creates a RouteBuilder by parsing an XML file
+ * A {@link FactoryBean} which creates a RouteBuilder by parsing an XML file. This factory bean
+ * must be injected with a context and will then install the rules in the context when the routing rules
+ * are created. 
  *
  * @version $Revision: 521369 $
  */
-public class RouteBuilderFactory implements FactoryBean, BeanFactoryAware {
+public class RouteBuilderFactoryBean implements FactoryBean, BeanFactoryAware, InitializingBean {
 	private ArrayList<BuilderStatement> routes;
-	private boolean singleton;
 	private BeanFactory beanFactory;
+    private CamelContext context;
+    private StatementRouteBuilder builder = new StatementRouteBuilder();
 
-	class SpringRouteBuilder extends RouteBuilder {
-		private ArrayList<BuilderStatement> routes;
-		private BeanFactory beanFactory;
-
-		@Override
-		public void configure() {
-			for (BuilderStatement routeFactory : routes) {
-				routeFactory.create(beanFactory, this);
-			}
-		}
-
-		public ArrayList<BuilderStatement> getRoutes() {
-			return routes;
-		}
-		public void setRoutes(ArrayList<BuilderStatement> routes) {
-			this.routes = routes;
-		}
-
-		public void setBeanFactory(BeanFactory beanFactory) {
-			this.beanFactory = beanFactory;
-		}
-	}
-	
-	public Object getObject() throws Exception {
-		SpringRouteBuilder builder = new SpringRouteBuilder();
-		builder.setBeanFactory(beanFactory);
-		builder.setRoutes(routes);
-		return builder;
+    public Object getObject() throws Exception {
+        return builder;
 	}
 
 	public Class getObjectType() {
-		return SpringRouteBuilder.class;
+		return StatementRouteBuilder.class;
 	}
 
 	public boolean isSingleton() {
-		return singleton;
-	}
-	public void setSingleton(boolean singleton) {
-		this.singleton = singleton;
+		return true;
 	}
 
 	public ArrayList<BuilderStatement> getRoutes() {
@@ -87,4 +64,21 @@
 		this.beanFactory = beanFactory;
 	}
 
+    public CamelContext getContext() {
+        return context;
+    }
+
+    public void setContext(CamelContext context) {
+        this.context = context;
+    }
+
+    public void afterPropertiesSet() throws Exception {
+        notNull(context, "context");
+        notNull(routes, "routes");
+		builder.setBeanFactory(beanFactory);
+		builder.setRoutes(routes);
+
+        // now lets install the routes in the context
+        context.addRoutes(builder);
+    }
 }

Added: activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/StatementRouteBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/StatementRouteBuilder.java?view=auto&rev=534800
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/StatementRouteBuilder.java (added)
+++ activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/StatementRouteBuilder.java Thu May  3 04:35:30 2007
@@ -0,0 +1,54 @@
+/**
+ *
+ * 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.spring.xml;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.BeanFactory;
+
+import java.util.ArrayList;
+
+/**
+ * A {@link RouteBuilder} which is given a list of {@link BuilderStatement} objects
+ * to use to create the routes. This is used by the Spring 2 XML parsing code in particular
+ * the {@link RouteBuilderFactoryBean}
+ *
+ * @version $Revision: 1.1 $
+*/
+public class StatementRouteBuilder extends RouteBuilder  {
+    private ArrayList<BuilderStatement> routes;
+    private BeanFactory beanFactory;
+
+    @Override
+    public void configure() {
+        for (BuilderStatement routeFactory : routes) {
+            routeFactory.create(beanFactory, this);
+        }
+    }
+
+    public ArrayList<BuilderStatement> getRoutes() {
+        return routes;
+    }
+    public void setRoutes(ArrayList<BuilderStatement> routes) {
+        this.routes = routes;
+    }
+
+    public void setBeanFactory(BeanFactory beanFactory) {
+        this.beanFactory = beanFactory;
+    }
+}

Propchange: activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/StatementRouteBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/camel/trunk/camel-spring/src/main/resources/org/apache/camel/spring/camel-1.0.xsd
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/resources/org/apache/camel/spring/camel-1.0.xsd?view=diff&rev=534800&r1=534799&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/resources/org/apache/camel/spring/camel-1.0.xsd (original)
+++ activemq/camel/trunk/camel-spring/src/main/resources/org/apache/camel/spring/camel-1.0.xsd Thu May  3 04:35:30 2007
@@ -10,13 +10,20 @@
 
   <xs:import namespace="http://www.springframework.org/schema/beans"/>
 
+
+  <xs:annotation>
+    <xs:documentation>
+      The Apache Camel Configuration Schema
+    </xs:documentation>
+  </xs:annotation>
+  
   <xs:element name="camelContext">
     <xs:complexType>
       <xs:complexContent>
         <xs:extension base="s:identifiedType">
             <xs:choice minOccurs="0" maxOccurs="unbounded">
               <xs:element minOccurs="0" maxOccurs="1" ref="c:endpoint"/>
-              <xs:element minOccurs="0" maxOccurs="1" ref="c:routes"/>
+              <xs:element minOccurs="0" maxOccurs="1" ref="c:route"/>
             </xs:choice>
           <xs:attribute name="packages" type="xs:NMTOKEN"/>
         </xs:extension>
@@ -34,6 +41,7 @@
     </xs:complexType>
   </xs:element>
 
+  <!--
   <xs:element name="routes">
     <xs:complexType>
       <xs:sequence>
@@ -41,6 +49,7 @@
       </xs:sequence>
     </xs:complexType>
   </xs:element>
+-->
 
   <xs:element name="routeBuilder">
     <xs:complexType>
@@ -74,10 +83,8 @@
   </xs:element>
   <xs:element name="from">
     <xs:complexType>
-      <xs:attribute name="endpoint" type="xs:NMTOKEN"/>
-      <xs:attribute name="endpoints" type="xs:NMTOKEN"/>
       <xs:attribute name="uri" type="xs:anyURI"/>
-      <xs:attribute name="uris" type="xs:anyURI"/>
+      <xs:attribute name="ref" type="xs:string"/>
     </xs:complexType>
   </xs:element>
   <xs:element name="filter" type="c:predicate"/>
@@ -167,10 +174,8 @@
       <xs:sequence>
         <xs:element minOccurs="0" maxOccurs="unbounded" ref="c:uri"/>
       </xs:sequence>
-      <xs:attribute name="endpoint" type="xs:NMTOKEN"/>
-      <xs:attribute name="endpoints" type="xs:NMTOKEN"/>
+      <xs:attribute name="ref" type="xs:string"/>
       <xs:attribute name="uri" type="xs:anyURI"/>
-      <xs:attribute name="uris" type="xs:anyURI"/>
     </xs:complexType>
   </xs:element>
   <xs:element name="uri" type="xs:anyURI"/>

Modified: activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java?view=diff&rev=534800&r1=534799&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java (original)
+++ activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java Thu May  3 04:35:30 2007
@@ -18,8 +18,6 @@
 package org.apache.camel.spring;
 
 import java.util.List;
-import java.util.Map;
-import java.util.Set;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
@@ -38,14 +36,14 @@
     private static final transient Log log = LogFactory.getLog(CamelContextFactoryBeanTest.class);
     
     public void testClassPathRouteLoading() throws Exception {
-        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/spring/camel_context_factory_bean_test.xml");
+        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/spring/camelContextFactoryBeanTest.xml");
 
         CamelContext context = (CamelContext) applicationContext.getBean("camel");
         assertValidContext(context);
     }
 
     public void testClassPathRouteLoadingUsingNamespaces() throws Exception {
-        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/spring/camel_context_factory_bean_test.xml");
+        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/spring/camelContextFactoryBeanTest.xml");
 
         CamelContext context = (CamelContext) applicationContext.getBean("camel3");
         assertValidContext(context);
@@ -68,14 +66,15 @@
     }
 
     public void testXMLRouteLoading() throws Exception {
-        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/spring/camel_context_factory_bean_test.xml");
+        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/spring/camelContextFactoryBeanTest.xml");
 
         CamelContext context = (CamelContext) applicationContext.getBean("camel2");
         assertNotNull("No context found!", context);
 
         List<Route> routes = context.getRoutes();
         log.debug("Found routes: " + routes);
-
+        
+        assertNotNull("Should have found some routes", routes);
         assertEquals("One Route should be found", 1, routes.size());
 
         for (Route route : routes) {

Copied: activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/EndpointReferenceTest.java (from r534725, activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/EndpointXmlConfigTest.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/EndpointReferenceTest.java?view=diff&rev=534800&p1=activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/EndpointXmlConfigTest.java&r1=534725&p2=activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/EndpointReferenceTest.java&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/EndpointXmlConfigTest.java (original)
+++ activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/EndpointReferenceTest.java Thu May  3 04:35:30 2007
@@ -17,24 +17,65 @@
  */
 package org.apache.camel.spring;
 
+import org.apache.camel.CamelClient;
 import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.Route;
+import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.spring.example.DummyBean;
+import org.apache.camel.spring.xml.StatementRouteBuilder;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
+import java.util.List;
+
 /**
  * @version $Revision: 521586 $
  */
-public class EndpointXmlConfigTest extends SpringTestSupport {
+public class EndpointReferenceTest extends SpringTestSupport {
+    protected static Object body = "<hello>world!</hello>";
+
     public void testEndpointConfiguration() throws Exception {
         Endpoint endpoint = getMandatoryBean(Endpoint.class, "endpoint1");
 
-        assertEquals("endpoint URI", "mock:endpoint1", endpoint.getEndpointUri());
+        assertEquals("endpoint URI", "direct:start", endpoint.getEndpointUri());
 
         DummyBean dummyBean = getMandatoryBean(DummyBean.class, "mybean");
         assertNotNull("The bean should have an endpoint injected", dummyBean.getEndpoint());
-        assertEquals("endpoint URI", "mock:endpoint1", dummyBean.getEndpoint().getEndpointUri());
+        assertEquals("endpoint URI", "direct:start", dummyBean.getEndpoint().getEndpointUri());
 
         log.debug("Found dummy bean: " + dummyBean);
+
+        SpringCamelContext context = (SpringCamelContext) applicationContext.getBean("camel");
+        assertValidContext(context);
+
+        MockEndpoint resultEndpoint = (MockEndpoint) resolveMandatoryEndpoint(context, "mock:end");
+        resultEndpoint.expectedBodiesReceived(body);
+
+        // now lets send a message
+        CamelClient<Exchange> client = new CamelClient<Exchange>(context);
+        client.sendBody("direct:start", body);
+
+        resultEndpoint.assertIsSatisfied();
+    }
+
+    public void testEndpointConfigurationAfterEnsuringThatTheStatementRouteBuilderWasCreated() throws Exception {
+        String[] names = applicationContext.getBeanDefinitionNames();
+        for (String name : names) {
+            log.debug("Found bean name: " + name);
+        }
+
+        // internally used by the Spring 2 XML
+        getMandatoryBean(StatementRouteBuilder.class, "camel:routes");
+
+        testEndpointConfiguration();
+    }
+
+    protected void assertValidContext(SpringCamelContext context) {
+        assertNotNull("No context found!", context);
+
+        List<Route> routes = context.getRoutes();
+        assertNotNull("Should have some routes defined", routes);
+        assertEquals("Number of routes defined", 1, routes.size());
     }
 
     protected ClassPathXmlApplicationContext createApplicationContext() {

Propchange: activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/EndpointReferenceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/xml/XmlRouteBuilderTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/xml/XmlRouteBuilderTest.java?view=diff&rev=534800&r1=534799&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/xml/XmlRouteBuilderTest.java (original)
+++ activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/xml/XmlRouteBuilderTest.java Thu May  3 04:35:30 2007
@@ -16,119 +16,112 @@
  */
 package org.apache.camel.spring.xml;
 
-import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.Route;
 import org.apache.camel.builder.RouteBuilderTest;
 import org.apache.camel.processor.DelegateProcessor;
+import org.apache.camel.spring.SpringCamelContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
+import java.util.List;
+
 /**
- * TODO: re-implement the route building logic using spring and 
+ * TODO: re-implement the route building logic using spring and
  * then test it by overriding the buildXXX methods in the RouteBuilderTest
- * 
+ *
  * @version $Revision: 520164 $
  */
 public class XmlRouteBuilderTest extends RouteBuilderTest {
-	private ClassPathXmlApplicationContext ctx;
+    private static ClassPathXmlApplicationContext applicationContext;
+    private static boolean closeContext = false;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        if (applicationContext == null) {
+            applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/spring/builder/spring_route_builder_test.xml");
+        }
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        if (closeContext) {
+            applicationContext.close();
+            applicationContext = null;
+        }
+        super.tearDown();
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    protected List<Route> buildSimpleRoute() {
+        return getRoutesFromContext("buildSimpleRoute");
+    }
+
+    @Override
+    protected List<Route> buildCustomProcessor() {
+        myProcessor = (Processor) applicationContext.getBean("myProcessor");
+        return getRoutesFromContext("buildCustomProcessor");
+    }
+
+    @Override
+    protected List<Route> buildCustomProcessorWithFilter() {
+        myProcessor = (Processor) applicationContext.getBean("myProcessor");
+        return getRoutesFromContext("buildCustomProcessorWithFilter");
+    }
+
+    @Override
+    protected List<Route> buildRouteWithInterceptor() {
+        interceptor1 = (DelegateProcessor) applicationContext.getBean("interceptor1");
+        interceptor2 = (DelegateProcessor) applicationContext.getBean("interceptor2");
+        return getRoutesFromContext("buildRouteWithInterceptor");
+    }
+
+    @Override
+    protected List<Route> buildSimpleRouteWithHeaderPredicate() {
+        return getRoutesFromContext("buildSimpleRouteWithHeaderPredicate");
+    }
+
+    @Override
+    protected List<Route> buildSimpleRouteWithChoice() {
+        return getRoutesFromContext("buildSimpleRouteWithChoice");
+    }
+
+    @Override
+    protected List<Route> buildWireTap() {
+        return getRoutesFromContext("buildWireTap");
+    }
+
+    @Override
+    protected List<Route> buildDynamicRecipientList() {
+        return getRoutesFromContext("buildDynamicRecipientList");
+    }
+
+    @Override
+    protected List<Route> buildStaticRecipientList() {
+        return getRoutesFromContext("buildStaticRecipientList");
+    }
+
+    @Override
+    protected List<Route> buildSplitter() {
+        return getRoutesFromContext("buildSplitter");
+    }
 
-	@Override
-	protected void setUp() throws Exception {
-		super.setUp();
-		ctx = new ClassPathXmlApplicationContext("org/apache/camel/spring/builder/spring_route_builder_test.xml");
-	}
-
-	@Override
-	protected void tearDown() throws Exception {
-		ctx.close();
-		super.tearDown();
-	}
-
-	@Override
-	@SuppressWarnings("unchecked")
-	protected RouteBuilder buildSimpleRoute() {
-		RouteBuilder builder = (RouteBuilder) ctx.getBean("buildSimpleRoute");
-		assertNotNull(builder);
-		return builder;
-	}
-	
-	@Override
-	protected RouteBuilder buildCustomProcessor() {
-		myProcessor = (Processor) ctx.getBean("myProcessor");
-		RouteBuilder builder = (RouteBuilder) ctx.getBean("buildCustomProcessor");
-		assertNotNull(builder);
-		return builder;
-	}
-	
-	@Override
-	protected RouteBuilder buildCustomProcessorWithFilter() {
-		myProcessor = (Processor) ctx.getBean("myProcessor");
-		RouteBuilder builder = (RouteBuilder) ctx.getBean("buildCustomProcessorWithFilter");
-		assertNotNull(builder);
-		return builder;
-	}
-	
-	@Override
-	protected RouteBuilder buildRouteWithInterceptor() {
-		interceptor1 = (DelegateProcessor) ctx.getBean("interceptor1");
-		interceptor2 = (DelegateProcessor) ctx.getBean("interceptor2");
-		RouteBuilder builder = (RouteBuilder) ctx.getBean("buildRouteWithInterceptor");
-		assertNotNull(builder);
-		return builder;
-	}
-	
-	@Override
-	protected RouteBuilder buildSimpleRouteWithHeaderPredicate() {
-		RouteBuilder builder = (RouteBuilder) ctx.getBean("buildSimpleRouteWithHeaderPredicate");
-		assertNotNull(builder);
-		return builder;
-	}
-
-	@Override
-	protected RouteBuilder buildSimpleRouteWithChoice() {
-		RouteBuilder builder = (RouteBuilder) ctx.getBean("buildSimpleRouteWithChoice");
-		assertNotNull(builder);
-		return builder;
-	}
-	
-	
-	@Override
-	protected RouteBuilder buildWireTap() {
-		RouteBuilder builder = (RouteBuilder) ctx.getBean("buildWireTap");
-		assertNotNull(builder);
-		return builder;
-	}
-	
-	@Override
-	protected RouteBuilder buildDynamicRecipientList() {
-		RouteBuilder builder = (RouteBuilder) ctx.getBean("buildDynamicRecipientList");
-		assertNotNull(builder);
-		return builder;
-	}
-	
-	@Override
-	protected RouteBuilder buildStaticRecipientList() {
-		RouteBuilder builder = (RouteBuilder) ctx.getBean("buildStaticRecipientList");
-		assertNotNull(builder);
-		return builder;
-	}
-	
-	@Override
-	protected RouteBuilder buildSplitter() {
-		RouteBuilder builder = (RouteBuilder) ctx.getBean("buildSplitter");
-		assertNotNull(builder);
-		return builder;
-	}
-
-    @Override
-    protected RouteBuilder buildIdempotentConsumer() {
-        RouteBuilder builder = (RouteBuilder) ctx.getBean("buildIdempotentConsumer");
-        assertNotNull(builder);
-        return builder;
+    @Override
+    protected List<Route> buildIdempotentConsumer() {
+        return getRoutesFromContext("buildIdempotentConsumer");
     }
 
     @Override
     public void testIdempotentConsumer() throws Exception {
         // TODO
+    }
+
+    protected List<Route> getRoutesFromContext(String name) {
+        SpringCamelContext context = (SpringCamelContext) applicationContext.getBean(name);
+        assertNotNull("No Camel Context for name: " + name, context);
+        List<Route> routes = context.getRoutes();
+        assertNotNull("No routes available for context: " + name, routes);
+        return routes;
     }
 }

Added: activemq/camel/trunk/camel-spring/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/log4j.properties?view=auto&rev=534800
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/log4j.properties (added)
+++ activemq/camel/trunk/camel-spring/src/test/resources/log4j.properties Thu May  3 04:35:30 2007
@@ -0,0 +1,30 @@
+## ------------------------------------------------------------------------
+## 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 debug output on the console.
+#
+log4j.rootLogger=INFO, out
+
+#log4j.logger.org.apache.camel=DEBUG
+log4j.logger.org.springframework=WARN
+
+# CONSOLE appender not used by default
+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.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n

Propchange: activemq/camel/trunk/camel-spring/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/builder/spring_route_builder_test.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/builder/spring_route_builder_test.xml?view=diff&rev=534800&r1=534799&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/builder/spring_route_builder_test.xml (original)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/builder/spring_route_builder_test.xml Thu May  3 04:35:30 2007
@@ -26,19 +26,19 @@
         from("queue:a").to("queue:b");
      -->
     <!-- START SNIPPET: e1 -->
-    <routeBuilder id="buildSimpleRoute" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <camelContext id="buildSimpleRoute" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
        <route>
          <from uri="queue:a"/>
          <to uri="queue:b"/>
        </route>
-    </routeBuilder>
+    </camelContext>
     <!-- END SNIPPET: e1 -->
     
     <!-- 
         from("queue:a").filter(header("foo").isEqualTo("bar")).to("queue:b");
      -->
     <!-- START SNIPPET: e2 -->
-    <routeBuilder id="buildSimpleRouteWithHeaderPredicate" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <camelContext id="buildSimpleRouteWithHeaderPredicate" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
        <route>
          <from uri="queue:a"/>
          <filter>
@@ -49,7 +49,7 @@
          </filter>
          <to uri="queue:b"/>
        </route>
-    </routeBuilder>
+    </camelContext>
     <!-- END SNIPPET: e2 -->
     
     
@@ -60,7 +60,7 @@
                 .otherwise().to("queue:d");
      -->
     <!-- START SNIPPET: e3 -->
-    <routeBuilder id="buildSimpleRouteWithChoice" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <camelContext id="buildSimpleRouteWithChoice" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
        <route>
          <from uri="queue:a"/>
          <choice>
@@ -83,7 +83,7 @@
              </otherwise>
          </choice>
        </route>
-    </routeBuilder>
+    </camelContext>
     <!-- END SNIPPET: e3 -->
 
     
@@ -92,19 +92,19 @@
      -->
     <!-- START SNIPPET: e4 -->
     <bean id="myProcessor" class="org.apache.camel.builder.MyProcessor"/>
-    <routeBuilder id="buildCustomProcessor" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <camelContext id="buildCustomProcessor" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
        <route>
          <from uri="queue:a"/>
          <process ref="#myProcessor"/>
        </route>
-    </routeBuilder>
+    </camelContext>
     <!-- END SNIPPET: e4 -->
 
     <!-- 
         from("queue:a").filter(header("foo").isEqualTo("bar")).process(myProcessor);
      -->
     <!-- START SNIPPET: e5 -->
-    <routeBuilder id="buildCustomProcessorWithFilter" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <camelContext id="buildCustomProcessorWithFilter" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
        <route>
          <from uri="queue:a"/>
          <filter>
@@ -115,7 +115,7 @@
          </filter>
          <process ref="#myProcessor"/>
        </route>
-    </routeBuilder>
+    </camelContext>
     <!-- END SNIPPET: e5 -->
 
 
@@ -123,7 +123,7 @@
         from("queue:a").to("queue:tap", "queue:b");
      -->
     <!-- START SNIPPET: e6-->
-    <routeBuilder id="buildWireTap" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <camelContext id="buildWireTap" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
        <route>
          <from uri="queue:a"/>
          <to>
@@ -131,7 +131,7 @@
             <uri>queue:b</uri>
          </to>
        </route>
-    </routeBuilder>
+    </camelContext>
     <!-- END SNIPPET: e6 -->
     
 
@@ -145,7 +145,7 @@
     <!-- START SNIPPET: e7 -->
     <bean id="interceptor1" class="org.apache.camel.builder.MyInterceptorProcessor"/>
     <bean id="interceptor2" class="org.apache.camel.builder.MyInterceptorProcessor"/>     
-    <routeBuilder id="buildRouteWithInterceptor" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <camelContext id="buildRouteWithInterceptor" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
        <route>
          <from uri="queue:a"/>
          <intercept>
@@ -154,14 +154,14 @@
          </intercept>
          <to uri="queue:d"/>
        </route>
-    </routeBuilder>
+    </camelContext>
     <!-- END SNIPPET: e7 -->
 
     <!-- 
         from("queue:a").to("queue:b", "queue:c", "queue:d");
      -->
     <!-- START SNIPPET: e8 -->
-    <routeBuilder id="buildStaticRecipientList" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <camelContext id="buildStaticRecipientList" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
        <route>
          <from uri="queue:a"/>
          <to>
@@ -170,7 +170,7 @@
             <uri>queue:d</uri>
          </to>
        </route>
-    </routeBuilder>
+    </camelContext>
     <!-- END SNIPPET: e8 -->
     
 
@@ -178,7 +178,7 @@
         from("queue:a").recipientList(header("foo"));
      -->
     <!-- START SNIPPET: e9 -->
-    <routeBuilder id="buildDynamicRecipientList" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <camelContext id="buildDynamicRecipientList" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
        <route>
          <from uri="queue:a"/>
          <recipientList>
@@ -187,14 +187,14 @@
             </recipients>
          </recipientList>
        </route>
-    </routeBuilder>
+    </camelContext>
     <!-- END SNIPPET: e9 -->
                     
     <!-- 
         from("queue:a").splitter(bodyAs(String.class).tokenize("\n")).to("queue:b");
      -->
     <!-- START SNIPPET: splitter -->
-    <routeBuilder id="buildSplitter" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <camelContext id="buildSplitter" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
        <route>
          <from uri="queue:a"/>
          <splitter>
@@ -206,14 +206,14 @@
          </splitter>
          <to uri="queue:b"/>
        </route>
-    </routeBuilder>
+    </camelContext>
     <!-- END SNIPPET: splitter -->
 
     <!--
         from("queue:a").idempotentConsumer(header("myMessageId"), memoryMessageIdRepository()).to("queue:b");
      -->
     <!-- START SNIPPET: idempotent -->
-    <routeBuilder id="buildIdempotentConsumer" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <camelContext id="buildIdempotentConsumer" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
        <route>
          <from uri="queue:a"/>
 <!--
@@ -222,7 +222,7 @@
 -->
          <to uri="queue:b"/>
        </route>
-    </routeBuilder>
+    </camelContext>
     <!-- END SNIPPET: idempotent -->
 
 </beans>

Copied: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/camelContextFactoryBeanTest.xml (from r534725, activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/camel_context_factory_bean_test.xml)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/camelContextFactoryBeanTest.xml?view=diff&rev=534800&p1=activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/camel_context_factory_bean_test.xml&r1=534725&p2=activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/camelContextFactoryBeanTest.xml&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/camel_context_factory_bean_test.xml (original)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/camelContextFactoryBeanTest.xml Thu May  3 04:35:30 2007
@@ -16,8 +16,8 @@
     limitations under the License.
 -->
 <beans xmlns="http://www.springframework.org/schema/beans"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="
+       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.0.xsd
        http://activemq.apache.org/camel/schema/camel-1.0.xsd http://activemq.apache.org/camel/schema/camel-1.0.xsd
     ">
@@ -27,22 +27,19 @@
     <property name="packages" value="org.apache.camel.spring.example"/>
   </bean>
   <!-- END SNIPPET: example -->
-  
+
   <!-- START SNIPPET: example2 -->
-  <bean id="camel2" class="org.apache.camel.spring.CamelContextFactoryBean">
-    <property name="routeBuilder">
-	    <routeBuilder xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
-	       <route>
-	         <from uri="queue:test.c"/>
-	         <to uri="queue:test.d"/>
-	       </route>
-	    </routeBuilder>
-    </property>
-  </bean>
+  <camelContext id="camel2" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <route>
+      <from uri="queue:test.c"/>
+      <to uri="queue:test.d"/>
+    </route>
+  </camelContext>
   <!-- END SNIPPET: example2 -->
-  
+
   <!-- START SNIPPET: example3 -->
-  <camelContext id="camel3" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd" packages="org.apache.camel.spring.example"/>
+  <camelContext id="camel3" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd"
+                packages="org.apache.camel.spring.example"/>
   <!-- END SNIPPET: example3 -->
 
 </beans>

Propchange: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/camelContextFactoryBeanTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/camelContextFactoryBeanTest.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/camelContextFactoryBeanTest.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/endpointReference.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/endpointReference.xml?view=diff&rev=534800&r1=534799&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/endpointReference.xml (original)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/endpointReference.xml Thu May  3 04:35:30 2007
@@ -16,8 +16,8 @@
     limitations under the License.
 -->
 <beans xmlns="http://www.springframework.org/schema/beans"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="
+       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.0.xsd
        http://activemq.apache.org/camel/schema/camel-1.0.xsd http://activemq.apache.org/camel/schema/camel-1.0.xsd
     ">
@@ -28,10 +28,14 @@
   </bean>
 
   <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
-    <endpoint id="endpoint1" uri="mock:endpoint1"/>
-    <routes>
-    </routes>
+    <endpoint id="endpoint1" uri="direct:start"/>
+    <endpoint id="endpoint2" uri="mock:end"/>
+
+    <route>
+      <from ref="endpoint1"/>
+      <to ref="endpoint2"/>
+    </route>
   </camelContext>
   <!-- END SNIPPET: example -->
-  
+
 </beans>

Modified: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/examples.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/examples.xml?view=diff&rev=534800&r1=534799&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/examples.xml (original)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/examples.xml Thu May  3 04:35:30 2007
@@ -16,163 +16,156 @@
     limitations under the License.
 -->
 <beans xmlns="http://www.springframework.org/schema/beans"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="
+       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.0.xsd
        http://activemq.apache.org/camel/schema/camel-1.0.xsd http://activemq.apache.org/camel/schema/camel-1.0.xsd
     ">
-    
-    <!--  
-          put all combinations of possible usages in this file so that XML->XSD converters
-          (like trang) can generate a pretty good XSD.
-     -->
-
-    <routeBuilder id="buildSimpleRoute" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
-    </routeBuilder>
-    
-    <routeBuilder id="buildSimpleRoute" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
-       <route>
-         <from uri="queue:a"/>
-         <to uri="queue:b"/>
-       </route>
-       <route>
-         <from uris="queue:a"/>
-         <to uris="queue:b"/>
-       </route>
-       <route>
-         <from endpoint="queue:a"/>
-         <to endpoint="queue:b"/>
-       </route>
-       <route>
-         <from endpoints="queue:a"/>
-         <to endpoints="queue:b"/>
-       </route>
-
-       <route>
-         <from uri="queue:a"/>
-         <process ref="myProcessor"/>
-       </route>
-
-       <route>
-         <from uri="queue:a"/>
-         <filter>
-             <predicate>
-                <header name="foo"/>
-                <isEqualTo value="bar"/>
-             </predicate>
-         </filter>
-         <filter>
-             <predicate>
-                <header name="foo"/>
-                <isEqualTo value="bar"/>
-             </predicate>
-         </filter>
-         <process ref="#myProcessor"/>
-       </route>
-
-       <route>
-         <from uri="queue:a"/>
-         <intercept>
-             <interceptor ref="interceptor1"/>
-             <interceptor ref="#interceptor2"/>
-         </intercept>
-         <intercept>
-             <interceptor ref="#interceptor1"/>
-             <interceptor ref="interceptor2"/>
-         </intercept>
-         <to uri="queue:b"/>
-       </route>
-
-       <route>
-         <from uri="queue:a"/>
-         <choice>
-             <when>
-                 <predicate>
-                    <header name="foo"/>
-                    <isEqualTo value="bar"/>
-                 </predicate>
-                 <to uri="queue:b"/>
-             </when>
-             <when>
-                 <predicate>
-                    <header name="foo"/>
-                    <isNotEqualTo value="cheese"/>
-                 </predicate>
-                 <to endpoint="queue:c"/>
-             </when>
-             <otherwise>
-                 <to uri="queue:d"/>
-             </otherwise>
-         </choice>
-       </route>
-
-       <route>
-         <from uri="queue:a"/>
-         <filter>
-             <predicate>
-                <header name="foo"/>
-                <isEqualTo value="bar"/>
-             </predicate>
-         </filter>
-         <to uri="queue:b"/>
-       </route>
-
-       <route>
-         <from uri="queue:a"/>
-         <to>
-            <uri>queue:tap</uri>
-            <uri>queue:a</uri>
-         </to>
-       </route>
-       
-       <route>
-         <from uri="queue:a"/>
-         <recipientList>
-         	<recipients>
-              <header name=""/>
-            </recipients>
-         </recipientList>
-       </route>
-       
-       <route>
-         <from uri="queue:a"/>
-         <recipientList>
-         	<recipients>
-              <header name=""/>
-              <tokenize token=","/>
-            </recipients>
-         </recipientList>
-       </route>
-       
-       <route>
-         <from uri="queue:a"/>
-         <filter>
-             <predicate>
-                <body/>
-                <isNotEqualTo value="none"/>
-             </predicate>
-         </filter>
-         <recipientList>
-         	<recipients>
-              <body/>
-            </recipients>
-         </recipientList>
-       </route>
-       
-       
-       <route>
-         <from uri="queue:a"/>
-         <splitter>
-         	<recipients>
-	            <bodyAs class="java.lang.String"/>
-	            <tokenize token="
+
+  <!--
+       put all combinations of possible usages in this file so that XML->XSD converters
+       (like trang) can generate a pretty good XSD.
+  -->
+
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <route>
+      <from uri="queue:a"/>
+      <to uri="queue:b"/>
+    </route>
+    <route>
+      <from uri="queue:a"/>
+      <to uri="queue:b"/>
+    </route>
+    <route>
+      <from ref="a"/>
+      <to ref="b"/>
+    </route>
+
+    <route>
+      <from uri="queue:a"/>
+      <process ref="myProcessor"/>
+    </route>
+
+    <route>
+      <from uri="queue:a"/>
+      <filter>
+        <predicate>
+          <header name="foo"/>
+          <isEqualTo value="bar"/>
+        </predicate>
+      </filter>
+      <filter>
+        <predicate>
+          <header name="foo"/>
+          <isEqualTo value="bar"/>
+        </predicate>
+      </filter>
+      <process ref="#myProcessor"/>
+    </route>
+
+    <route>
+      <from uri="queue:a"/>
+      <intercept>
+        <interceptor ref="interceptor1"/>
+        <interceptor ref="#interceptor2"/>
+      </intercept>
+      <intercept>
+        <interceptor ref="#interceptor1"/>
+        <interceptor ref="interceptor2"/>
+      </intercept>
+      <to uri="queue:b"/>
+    </route>
+
+    <route>
+      <from uri="queue:a"/>
+      <choice>
+        <when>
+          <predicate>
+            <header name="foo"/>
+            <isEqualTo value="bar"/>
+          </predicate>
+          <to uri="queue:b"/>
+        </when>
+        <when>
+          <predicate>
+            <header name="foo"/>
+            <isNotEqualTo value="cheese"/>
+          </predicate>
+          <to uri="queue:c"/>
+        </when>
+        <otherwise>
+          <to uri="queue:d"/>
+        </otherwise>
+      </choice>
+    </route>
+
+    <route>
+      <from uri="queue:a"/>
+      <filter>
+        <predicate>
+          <header name="foo"/>
+          <isEqualTo value="bar"/>
+        </predicate>
+      </filter>
+      <to uri="queue:b"/>
+    </route>
+
+    <route>
+      <from uri="queue:a"/>
+      <to>
+        <uri>queue:tap</uri>
+        <uri>queue:a</uri>
+      </to>
+    </route>
+
+    <route>
+      <from uri="queue:a"/>
+      <recipientList>
+        <recipients>
+          <header name=""/>
+        </recipients>
+      </recipientList>
+    </route>
+
+    <route>
+      <from uri="queue:a"/>
+      <recipientList>
+        <recipients>
+          <header name=""/>
+          <tokenize token=","/>
+        </recipients>
+      </recipientList>
+    </route>
+
+    <route>
+      <from uri="queue:a"/>
+      <filter>
+        <predicate>
+          <body/>
+          <isNotEqualTo value="none"/>
+        </predicate>
+      </filter>
+      <recipientList>
+        <recipients>
+          <body/>
+        </recipients>
+      </recipientList>
+    </route>
+
+
+    <route>
+      <from uri="queue:a"/>
+      <splitter>
+        <recipients>
+          <bodyAs class="java.lang.String"/>
+          <tokenize token="
 "/>
-         	</recipients>
-         </splitter>
-         <to uri="queue:b"/>
-       </route>
-       
-    </routeBuilder>
+        </recipients>
+      </splitter>
+      <to uri="queue:b"/>
+    </route>
+
+  </camelContext>
 
 </beans>
-<!-- END SNIPPET: example -->
+        <!-- END SNIPPET: example -->

Modified: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingCamelContextFactoryTest.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingCamelContextFactoryTest.xml?view=diff&rev=534800&r1=534799&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingCamelContextFactoryTest.xml (original)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingCamelContextFactoryTest.xml Thu May  3 04:35:30 2007
@@ -16,23 +16,19 @@
     limitations under the License.
 -->
 <beans xmlns="http://www.springframework.org/schema/beans"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="
+       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.0.xsd
        http://activemq.apache.org/camel/schema/camel-1.0.xsd http://activemq.apache.org/camel/schema/camel-1.0.xsd
     ">
 
   <!-- START SNIPPET: example -->
-  <bean id="camel" class="org.apache.camel.spring.CamelContextFactoryBean">
-    <property name="routeBuilder">
-	    <routeBuilder xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
-	       <route>
-	         <from uri="queue:start"/>
-	         <to uri="mock:result"/>
-	       </route>
-	    </routeBuilder>
-    </property>
-  </bean>
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <route>
+      <from uri="queue:start"/>
+      <to uri="mock:result"/>
+    </route>
+  </camelContext>
   <!-- END SNIPPET: example -->
-  
+
 </beans>

Modified: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingProcessor.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingProcessor.xml?view=diff&rev=534800&r1=534799&r2=534800
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingProcessor.xml (original)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingProcessor.xml Thu May  3 04:35:30 2007
@@ -16,25 +16,21 @@
     limitations under the License.
 -->
 <beans xmlns="http://www.springframework.org/schema/beans"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="
+       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.0.xsd
        http://activemq.apache.org/camel/schema/camel-1.0.xsd http://activemq.apache.org/camel/schema/camel-1.0.xsd
     ">
 
   <!-- START SNIPPET: example -->
-  <bean id="camel" class="org.apache.camel.spring.CamelContextFactoryBean">
-    <property name="routeBuilder">
-	    <routeBuilder xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
-	       <route>
-	         <from uri="direct:start"/>
-	         <process ref="#myProcessor"/>
-	       </route>
-	    </routeBuilder>
-    </property>
-  </bean>
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <route>
+      <from uri="direct:start"/>
+      <process ref="myProcessor"/>
+    </route>
+  </camelContext>
 
   <bean id="myProcessor" class="org.apache.camel.spring.example.MyProcessor"/>
   <!-- END SNIPPET: example -->
-  
+
 </beans>



Mime
View raw message