You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by js...@apache.org on 2007/05/03 19:35:45 UTC

svn commit: r534941 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/builder/ camel-core/src/main/java/org/apache/camel/builder/xml/ camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/main/java/org/apache/camel/processo...

Author: jstrachan
Date: Thu May  3 10:35:43 2007
New Revision: 534941

URL: http://svn.apache.org/viewvc?view=rev&rev=534941
Log:
added a test case showing the use of xpath filter using spring XML; also tidied up the spring XML test cases to make it easier to deal with issues that arise in the spring 2.0 parsing code

Added:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/NoRouteBuilder.java   (with props)
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/xml/XPathWithNamespacesFromDomTest.java   (with props)
    activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/example/SpringXPathFilterTest.java   (with props)
    activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/xml/SpringXmlRouteBuilderTest.java   (with props)
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/example/
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/example/xpathFilter.xml   (with props)
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildCustomProcessor.xml   (with props)
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildCustomProcessorWithFilter.xml   (with props)
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildDynamicRecipientList.xml   (with props)
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildIdempotentConsumer.xml   (with props)
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildRouteWithInterceptor.xml   (with props)
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSimpleRoute.xml   (with props)
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSimpleRouteWithChoice.xml   (with props)
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSimpleRouteWithHeaderPredicate.xml   (with props)
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSplitter.xml   (with props)
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildStaticRecipientList.xml   (with props)
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildWireTap.xml   (with props)
Removed:
    activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/xml/XmlRouteBuilderTest.java
Modified:
    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/xml/DefaultNamespaceContext.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/FilterProcessor.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java
    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/SpringCamelContext.java
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/BeanDefinitionParserSupport.java
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/BuilderAction.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/resources/org/apache/camel/spring/builder/spring_route_builder_test.xml

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=534941&r1=534940&r2=534941
==============================================================================
--- 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 10:35:43 2007
@@ -16,10 +16,6 @@
  */
 package org.apache.camel.builder;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.Expression;
@@ -36,13 +32,15 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
 /**
  * @version $Revision$
  */
 public class FromBuilder extends BuilderSupport implements ProcessorFactory {
-	
-	public static final String DEFAULT_TRACE_CATEGORY = "org.apache.camel.TRACE";
-
+    public static final String DEFAULT_TRACE_CATEGORY = "org.apache.camel.TRACE";
     private RouteBuilder builder;
     private Endpoint from;
     private List<Processor> processors = new ArrayList<Processor>();
@@ -82,9 +80,7 @@
      * Sends the exchange to a list of endpoints using the {@link MulticastProcessor} pattern
      */
     @Fluent
-    public ProcessorFactory to(
-            @FluentArg(value = "uri", attribute = false, element = true)
-            String... uris) {
+    public ProcessorFactory to(String... uris) {
         return to(endpoints(uris));
     }
 
@@ -102,7 +98,8 @@
      * Sends the exchange to a list of endpoint using the {@link MulticastProcessor} pattern
      */
     @Fluent
-    public ProcessorFactory to(@FluentArg("endpoints")Collection<Endpoint> endpoints) {
+    public ProcessorFactory to(@FluentArg(value = "endpoint", attribute = false, element = true)
+    Collection<Endpoint> endpoints) {
         return addProcessBuilder(new MulticastBuilder(this, endpoints));
     }
 
@@ -206,7 +203,7 @@
      * @return the builder
      */
     @Fluent
-    public SplitterBuilder splitter(@FluentArg(value = "recipients", element = true) Expression receipients) {
+    public SplitterBuilder splitter(@FluentArg(value = "recipients", element = true)Expression receipients) {
         SplitterBuilder answer = new SplitterBuilder(this, receipients);
         addProcessBuilder(answer);
         return answer;
@@ -242,36 +239,36 @@
         addProcessBuilder(answer);
         return answer;
     }
-    
+
     /**
      * Trace logs the exchange before it goes to the next processing step using the {@link #DEFAULT_TRACE_CATEGORY} logging
      * category.
-     * 
+     *
      * @return
      */
     @Fluent
-	public FromBuilder trace() {
-		return trace(DEFAULT_TRACE_CATEGORY);
-	}
-	
+    public FromBuilder trace() {
+        return trace(DEFAULT_TRACE_CATEGORY);
+    }
+
     /**
      * Trace logs the exchange before it goes to the next processing step using the specified logging
      * category.
-     * 
+     *
      * @param category the logging category trace messages will sent to.
      * @return
      */
     @Fluent
-	public FromBuilder trace(@FluentArg("category")String category) {
-		final Log log = LogFactory.getLog(category);
-		return intercept(new DelegateProcessor(){
-			@Override
-			public void process(Exchange exchange) throws Exception {
-				log.trace(exchange);
-				processNext(exchange);
-			}
-		});
-	}    
+    public FromBuilder trace(@FluentArg("category")String category) {
+        final Log log = LogFactory.getLog(category);
+        return intercept(new DelegateProcessor() {
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                log.trace(exchange);
+                processNext(exchange);
+            }
+        });
+    }
 
     @Fluent
     public FromBuilder intercept(@FluentArg("interceptor")DelegateProcessor interceptor) {
@@ -283,7 +280,7 @@
 
     @Fluent(nestedActions = true)
     public PolicyBuilder policies() {
-    	PolicyBuilder answer = new PolicyBuilder(this);
+        PolicyBuilder answer = new PolicyBuilder(this);
         addProcessBuilder(answer);
         return answer;
     }
@@ -344,7 +341,6 @@
         return this;
     }
 
-
     /**
      * Adds a processor which sets the exchange property
      */
@@ -354,7 +350,6 @@
         return this;
     }
 
-
     /**
      * Converts the IN message body to the specified type
      */
@@ -451,5 +446,4 @@
     public List<Processor> getProcessors() {
         return processors;
     }
-
 }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/DefaultNamespaceContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/DefaultNamespaceContext.java?view=diff&rev=534941&r1=534940&r2=534941
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/DefaultNamespaceContext.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/DefaultNamespaceContext.java Thu May  3 10:35:43 2007
@@ -17,6 +17,11 @@
  */
 package org.apache.camel.builder.xml;
 
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.Attr;
+
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.xpath.XPathFactory;
 import java.util.HashMap;
@@ -94,5 +99,23 @@
             }
         }
         return set.iterator();
+    }
+
+    public void setNamespacesFromDom(Element element) {
+        // lets set the parent first in case we overload a prefix here
+        Node parentNode = element.getParentNode();
+        if (parentNode instanceof Element) {
+            setNamespacesFromDom((Element) parentNode);
+        }
+        NamedNodeMap attributes = element.getAttributes();
+        for (int i = 0, size = attributes.getLength(); i < size; i++) {
+            Attr node = (Attr) attributes.item(i);
+            String name = node.getName();
+            if (name.startsWith("xmlns:")) {
+                String prefix = name.substring("xmlns:".length());
+                String uri = node.getValue();
+                add(prefix, uri);
+            }
+        }
     }
 }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java?view=diff&rev=534941&r1=534940&r2=534941
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java Thu May  3 10:35:43 2007
@@ -24,6 +24,7 @@
 import org.apache.camel.RuntimeExpressionException;
 import org.apache.camel.Message;
 import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 import org.xml.sax.InputSource;
 
 import javax.xml.namespace.QName;
@@ -237,6 +238,10 @@
             expression = createXPathExpression();
         }
         return expression;
+    }
+
+    public void setNamespacesFromDom(Element node) {
+        getNamespaceContext().setNamespacesFromDom(node);        
     }
 
     // Implementation methods

Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/NoRouteBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/NoRouteBuilder.java?view=auto&rev=534941
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/NoRouteBuilder.java (added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/NoRouteBuilder.java Thu May  3 10:35:43 2007
@@ -0,0 +1,36 @@
+/**
+ *
+ * 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.impl;
+
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ * A helper class, usually used for testing which does not create any routes.
+ *
+ * @version $Revision: 1.1 $
+ */
+public class NoRouteBuilder extends RouteBuilder {
+    private static final NoRouteBuilder instance = new NoRouteBuilder();
+
+    public static NoRouteBuilder getInstance() {
+        return instance;
+    }
+
+    public void configure() throws Exception {
+    }
+}

Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/NoRouteBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/FilterProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/FilterProcessor.java?view=diff&rev=534941&r1=534940&r2=534941
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/FilterProcessor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/FilterProcessor.java Thu May  3 10:35:43 2007
@@ -43,7 +43,7 @@
 
     @Override
     public String toString() {
-        return "if (" + predicate + ") " + processor;
+        return "filter (" + predicate + ") " + processor;
     }
 
     public Predicate<Exchange> getPredicate() {

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java?view=diff&rev=534941&r1=534940&r2=534941
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java Thu May  3 10:35:43 2007
@@ -18,6 +18,7 @@
 package org.apache.camel;
 
 import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.impl.DefaultExchange;
 import org.apache.camel.CamelClient;
 import org.apache.camel.builder.RouteBuilder;
 
@@ -39,6 +40,8 @@
         context.addRoutes(createRouteBuilder());
 
         context.start();
+
+        log.debug("Routing Rules are: " + context.getRoutes());
     }
 
     @Override
@@ -77,5 +80,17 @@
                 in.setHeader("testCase", getName());
             }
         });
+    }
+
+    /**
+     * Creates an exchange with the given body
+     */
+    protected Exchange createExchangeWithBody(Object body) {
+        Exchange exchange = new DefaultExchange(context);
+        Message message = exchange.getIn();
+        message.setHeader("testName", getName());
+        message.setHeader("testClass", getClass().getName());
+        message.setBody(body);
+        return exchange;
     }
 }

Added: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/xml/XPathWithNamespacesFromDomTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/xml/XPathWithNamespacesFromDomTest.java?view=auto&rev=534941
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/xml/XPathWithNamespacesFromDomTest.java (added)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/xml/XPathWithNamespacesFromDomTest.java Thu May  3 10:35:43 2007
@@ -0,0 +1,52 @@
+/**
+ *
+ * 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.builder.xml;
+
+import org.apache.camel.TestSupport;
+import org.apache.camel.Expression;
+import org.apache.camel.Predicate;
+import org.apache.camel.Exchange;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Message;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.impl.DefaultExchange;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import javax.xml.xpath.XPathFunctionResolver;
+
+/**
+ * @version $Revision: 534495 $
+ */
+public class XPathWithNamespacesFromDomTest extends ContextTestSupport {
+
+    public void testXPathUsingDomForNamespaces() throws Exception {
+        Document document = context.getTypeConverter().convertTo(Document.class, "<x:foo xmlns:x='n1' xmlns:y='n2'><bar id='a' xmlns:y='n3'/></x:foo>");
+        Element element = (Element) document.getElementsByTagName("bar").item(0);
+        assertNotNull("Could not find element for id 'a'", element);
+
+        XPathBuilder builder = XPathBuilder.xpath("//y:foo[@id='z']");
+        builder.setNamespacesFromDom(element);
+        DefaultNamespaceContext namespaceContext = builder.getNamespaceContext();
+        assertEquals("y namespace", "n3", namespaceContext.getNamespaceURI("y"));
+
+        assertPredicateMatches(builder, createExchangeWithBody("<blah><foo xmlns='n3' id='z'/></blah>"));
+        assertPredicateDoesNotMatch(builder, createExchangeWithBody("<blah><foo xmlns='n2' id='z'/></blah>"));
+    }
+}

Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/xml/XPathWithNamespacesFromDomTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

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=534941&r1=534940&r2=534941
==============================================================================
--- 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 10:35:43 2007
@@ -74,7 +74,7 @@
     //-------------------------------------------------------------------------
     public CamelContext getContext() throws Exception {
         if (context == null) {
-            context = SpringCamelContext.springCamelContext(getApplicationContext());
+            context = new SpringCamelContext(getApplicationContext());
         }
         return context;
     }

Modified: activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java?view=diff&rev=534941&r1=534940&r2=534941
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java (original)
+++ activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java Thu May  3 10:35:43 2007
@@ -42,7 +42,19 @@
 public class SpringCamelContext extends DefaultCamelContext implements InitializingBean, DisposableBean, ApplicationContextAware {
     private ApplicationContext applicationContext;
 
+    public SpringCamelContext() {
+    }
+
+    public SpringCamelContext(ApplicationContext applicationContext) {
+        this.applicationContext = applicationContext;
+    }
+
     public static SpringCamelContext springCamelContext(ApplicationContext applicationContext) throws Exception {
+        // lets try and look up a configured camel context in the context
+        String[] names = applicationContext.getBeanNamesForType(SpringCamelContext.class);
+        if (names.length == 1) {
+            return (SpringCamelContext) applicationContext.getBean(names[0], SpringCamelContext.class);
+        }
         SpringCamelContext answer = new SpringCamelContext();
         answer.setApplicationContext(applicationContext);
         return answer;

Modified: activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/BeanDefinitionParserSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/BeanDefinitionParserSupport.java?view=diff&rev=534941&r1=534940&r2=534941
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/BeanDefinitionParserSupport.java (original)
+++ activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/BeanDefinitionParserSupport.java Thu May  3 10:35:43 2007
@@ -38,7 +38,7 @@
 
     @Override
     protected boolean isEligibleAttribute(String attributeName) {
-        return super.isEligibleAttribute(attributeName) && !attributeName.equals("xmlns");
+        return attributeName != null && super.isEligibleAttribute(attributeName) && !attributeName.equals("xmlns");
     }
 
     

Modified: activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/BuilderAction.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/BuilderAction.java?view=diff&rev=534941&r1=534940&r2=534941
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/BuilderAction.java (original)
+++ activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/xml/BuilderAction.java Thu May  3 10:35:43 2007
@@ -17,62 +17,76 @@
  */
 package org.apache.camel.spring.xml;
 
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.Map;
-
 import org.springframework.beans.SimpleTypeConverter;
 import org.springframework.beans.factory.BeanFactory;
 import org.springframework.beans.factory.config.RuntimeBeanReference;
 
-public class BuilderAction {
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
-	private final MethodInfo methodInfo;
-	private final HashMap<String, Object> parameterValues;
+public class BuilderAction {
+    private final MethodInfo methodInfo;
+    private final HashMap<String, Object> parameterValues;
 
-	public BuilderAction(MethodInfo methodInfo, HashMap<String, Object> parameterValues) {
-		this.methodInfo = methodInfo;
-		this.parameterValues = parameterValues;
-	}
-
-	public Object invoke(BeanFactory beanFactory, Object rootBuilder, Object contextBuilder) {
-		SimpleTypeConverter converter = new SimpleTypeConverter();
-		Object args[] = new Object[methodInfo.parameters.size()];
-		int pos=0;
-		for (Map.Entry<String, Class> entry :  methodInfo.parameters.entrySet()) {
-			String paramName = entry.getKey();
-			Class paramClass = entry.getValue();
-			Object value = parameterValues.get(paramName);
-			if( value != null ) {
-				if( value.getClass() == RuntimeBeanReference.class ) {
-					value = beanFactory.getBean(((RuntimeBeanReference)value).getBeanName());
-				}
-				if( value.getClass() == BuilderStatement.class ) {
-					BuilderStatement bs = (BuilderStatement) value;
-					value = bs.create(beanFactory, rootBuilder);
-				}				
-				args[pos] = converter.convertIfNecessary(value, paramClass);				
-			}
-			
-		}
-		
-		try {
-			return methodInfo.method.invoke(contextBuilder, args);
-		} catch (InvocationTargetException e) {
-			throw new IllegalArgumentException(e.getCause());
-		} catch (RuntimeException e) {
-			throw e;
-		} catch (Throwable e) {
-			throw new IllegalArgumentException(e);
-		}
-		
-	}
-
-	public String getName() {
-		return methodInfo.getName();
-	}
-
-	public MethodInfo getMethodInfo() {
-		return methodInfo;
-	}
+    public BuilderAction(MethodInfo methodInfo, HashMap<String, Object> parameterValues) {
+        this.methodInfo = methodInfo;
+        this.parameterValues = parameterValues;
+    }
+
+    public Object invoke(BeanFactory beanFactory, Object rootBuilder, Object contextBuilder) {
+        SimpleTypeConverter converter = new SimpleTypeConverter();
+        Object args[] = new Object[methodInfo.parameters.size()];
+        int pos = 0;
+        for (Map.Entry<String, Class> entry : methodInfo.parameters.entrySet()) {
+            String paramName = entry.getKey();
+            Class paramClass = entry.getValue();
+            Object value = parameterValues.get(paramName);
+            if (value != null) {
+                value = replaceBeanReferences(beanFactory, rootBuilder, value);
+                args[pos] = converter.convertIfNecessary(value, paramClass);
+            }
+        }
+
+        try {
+            return methodInfo.method.invoke(contextBuilder, args);
+        }
+        catch (InvocationTargetException e) {
+            throw new IllegalArgumentException(e.getCause());
+        }
+        catch (RuntimeException e) {
+            throw e;
+        }
+        catch (Throwable e) {
+            throw new IllegalArgumentException(e);
+        }
+    }
+
+    protected Object replaceBeanReferences(BeanFactory beanFactory, Object rootBuilder, Object value) {
+        // TODO why not using instanceof??
+        if (value.getClass() == RuntimeBeanReference.class) {
+            String beanName = ((RuntimeBeanReference) value).getBeanName();
+            value = beanFactory.getBean(beanName);
+        }
+        if (value.getClass() == BuilderStatement.class) {
+            BuilderStatement bs = (BuilderStatement) value;
+            value = bs.create(beanFactory, rootBuilder);
+        }
+        if (value instanceof List) {
+            List list = (List) value;
+            for (int i = 0, size = list.size(); i < size; i++) {
+                list.set(i, replaceBeanReferences(beanFactory, rootBuilder, list.get(i)));
+            }
+        }
+        return value;
+    }
+
+    public String getName() {
+        return methodInfo.getName();
+    }
+
+    public MethodInfo getMethodInfo() {
+        return methodInfo;
+    }
 }

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=534941&r1=534940&r2=534941
==============================================================================
--- 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 10:35:43 2007
@@ -37,8 +37,10 @@
 import org.apache.camel.builder.ValueBuilder;
 import org.springframework.beans.SimpleTypeConverter;
 import org.springframework.beans.factory.config.RuntimeBeanReference;
+import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.support.AbstractBeanDefinition;
 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.support.ChildBeanDefinition;
 import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
 import org.springframework.beans.factory.xml.ParserContext;
 import org.springframework.util.StringUtils;
@@ -50,8 +52,14 @@
 import org.w3c.dom.NodeList;
 
 public class CamelBeanDefinitionParser extends AbstractBeanDefinitionParser {
+    private final CamelNamespaceHandler namespaceHandler;
+    private int counter;
 
-	protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
+    public CamelBeanDefinitionParser(CamelNamespaceHandler namespaceHandler) {
+        this.namespaceHandler = namespaceHandler;
+    }
+
+    protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
 		BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(RouteBuilderFactoryBean.class);
 
 		List childElements = DomUtils.getChildElementsByTagName(element, "route");
@@ -62,7 +70,7 @@
 				Element routeElement = (Element) childElements.get(i);
 
 				ArrayList<BuilderAction> actions = new ArrayList<BuilderAction>();
-				Class type = parseBuilderElement(routeElement, RouteBuilder.class, actions);
+				Class type = parseBuilderElement(parserContext, routeElement, RouteBuilder.class, actions);
 				BuilderStatement statement = new BuilderStatement();
 				statement.setReturnType(type);
 				statement.setActions(actions);
@@ -77,19 +85,19 @@
 	/**
 	 * Use reflection to figure out what is the valid next element.
 	 */
-	private Class parseBuilderElement(Element element, Class<RouteBuilder> builder, ArrayList<BuilderAction> actions) {
+	private Class parseBuilderElement(ParserContext parserContext, Element element, Class<RouteBuilder> builder, ArrayList<BuilderAction> actions) {
 		Class currentBuilder = builder;
 		NodeList childElements = element.getChildNodes();
 		Element previousElement = null;
 		for (int i = 0; i < childElements.getLength(); ++i) {
 			Node node = childElements.item(i);
 			if (node.getNodeType() == Node.ELEMENT_NODE) {
-				currentBuilder = parseAction(currentBuilder, actions, (Element) node, previousElement);
+				currentBuilder = parseAction(parserContext, currentBuilder, actions, (Element) node, previousElement);
 				previousElement = (Element) node;
 				BuilderAction action = actions.get(actions.size()-1);
 				
 				if( action.getMethodInfo().methodAnnotation.nestedActions() ) {
-					currentBuilder = parseBuilderElement((Element) node, currentBuilder, actions);
+					currentBuilder = parseBuilderElement(parserContext, (Element) node, currentBuilder, actions);
 				} else {
 					// Make sure the there are no child elements.
 					if( hasChildElements(node) ) {
@@ -131,7 +139,7 @@
 		return false;
 	}
 
-	private Class parseAction(Class currentBuilder, ArrayList<BuilderAction> actions, Element element, Element previousElement) {
+	private Class parseAction(ParserContext parserContext, Class currentBuilder, ArrayList<BuilderAction> actions, Element element, Element previousElement) {
 
 		String actionName = element.getLocalName();
 
@@ -178,8 +186,11 @@
 		parameterNames.removeAll(attributeArguments.keySet());
 		for (String key : parameterNames) {
 			ArrayList<Element> elements = elementArguments.get(key);
-			Class clazz = match.parameters.get(key);
-			Object value = convertTo(elements, clazz);
+            if (elements == null) {
+                elements = getFirstChildElements(element);
+            }
+            Class clazz = match.parameters.get(key);
+			Object value = convertTo(parserContext, elements, clazz);
 			attributeArguments.put(key, value);
 			for (Element el : elements) {
 				// remove the argument nodes so that they don't get interpreted as
@@ -192,17 +203,42 @@
 		return match.method.getReturnType();
 	}
 
-	private Object convertTo(ArrayList<Element> elements, Class clazz) {
+    private ArrayList<Element> getFirstChildElements(Element element) {
+        ArrayList<Element> answer = new ArrayList<Element>();
+        NodeList list = element.getChildNodes();
+        for (int i = 0, size = list.getLength(); i < size; i++) {
+            Node node = list.item(i);
+            if (node instanceof Element) {
+                answer.add((Element) node);
+                break;
+            }
+        }
+        return answer;
+    }
+
+    private Object convertTo(ParserContext parserContext, ArrayList<Element> elements, Class clazz) {
 
 		if( clazz.isArray() || elements.size() > 1 ) {
-			Object array = Array.newInstance(clazz.getComponentType(), elements.size());
+            List list = new ArrayList();
 			for( int i=0; i < elements.size(); i ++ ) {
 				ArrayList<Element> e = new ArrayList<Element>(1);
 				e.add(elements.get(i));
-				Object value = convertTo(e, clazz.getComponentType());
-				Array.set(array, i, value);
+				Object value = convertTo(parserContext, e, clazz.getComponentType());
+
+                list.add(value);
+			}
+			return list;
+            /*
+            Object array = Array.newInstance(clazz.getComponentType(), elements.size());
+			for( int i=0; i < elements.size(); i ++ ) {
+				ArrayList<Element> e = new ArrayList<Element>(1);
+				e.add(elements.get(i));
+				Object value = convertTo(parserContext, e, clazz.getComponentType());
+
+                Array.set(array, i, value);
 			}
 			return array;
+			*/
 		} else {
 			
 			Element element = elements.get(0);
@@ -215,7 +251,7 @@
 			if( hasChildElements(element) ) {
 				
 				ArrayList<BuilderAction> actions = new ArrayList<BuilderAction>();
-				Class type = parseBuilderElement(element, RouteBuilder.class, actions);
+				Class type = parseBuilderElement(parserContext, element, RouteBuilder.class, actions);
 
 				if ( type == ValueBuilder.class && clazz==Expression.class ) {					
 					Method method;
@@ -239,14 +275,27 @@
 				
 				return statement;
 			} else {
-				// Just use the text in the element as the value.
+                // if we are on an element which has a custom parser, lets use that.
+                String name = element.getLocalName();
+                if (namespaceHandler.getParserElementNames().contains(name)) {
+                    String id = createBeanId(name);
+                    element.setAttribute("id", id);
+                    namespaceHandler.parse(element, parserContext);
+                    return new RuntimeBeanReference(id);
+                }
+
+                // Just use the text in the element as the value.
 				SimpleTypeConverter converter = new SimpleTypeConverter();
 				return converter.convertIfNecessary(element.getTextContent(), clazz);
 			}
 		}
 	}
 
-	private MethodInfo findMethodMatch(ArrayList<MethodInfo> methods, Set<String> attributeNames, Set<String> elementNames) {
+    protected synchronized String createBeanId(String name) {
+        return "_internal:camel:bean:" + name + (++counter);
+    }
+
+    private MethodInfo findMethodMatch(ArrayList<MethodInfo> methods, Set<String> attributeNames, Set<String> elementNames) {
 		for (MethodInfo method : methods) {
 
 			// make sure all the given attribute parameters can be assigned via
@@ -271,7 +320,8 @@
 			}
 
 			// We may still be able to match using elements as parameters.
-			for (String key : elementNames) {
+            /*
+            for (String key : elementNames) {
 				if (parameterNames.isEmpty()) {
 					break;
 				}
@@ -290,8 +340,9 @@
 			if (parameterNames.isEmpty()) {
 				return method;
 			}
-
-		}
+			*/
+            return method;
+        }
 		return null;
 	}
 

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=534941&r1=534940&r2=534941
==============================================================================
--- 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 10:35:43 2007
@@ -1,33 +1,35 @@
 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 static org.apache.camel.util.ObjectHelper.isNotNullOrBlank;
+import org.apache.camel.builder.xml.XPathBuilder;
 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.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.springframework.beans.factory.xml.BeanDefinitionParser;
+import org.springframework.util.xml.DomUtils;
 import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
 import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 
-public class CamelNamespaceHandler extends NamespaceHandlerSupport {
-    private int counter;
+import java.util.Set;
+import java.util.HashSet;
 
-    protected CamelBeanDefinitionParser routesParser = new CamelBeanDefinitionParser();
+public class CamelNamespaceHandler extends NamespaceHandlerSupport {
+    protected CamelBeanDefinitionParser routesParser = new CamelBeanDefinitionParser(this);
     protected BeanDefinitionParserSupport endpointParser = new BeanDefinitionParserSupport(EndpointFactoryBean.class);
+    private Set<String> parserElementNames = new HashSet<String>();
 
     public void init() {
-        registerBeanDefinitionParser("routes", routesParser);
-        registerBeanDefinitionParser("routeBuilder", routesParser);
-        registerBeanDefinitionParser("endpoint", endpointParser);
-
-        registerBeanDefinitionParser("camelContext", new BeanDefinitionParserSupport(CamelContextFactoryBean.class) {
+        registerParser("routes", routesParser);
+        registerParser("routeBuilder", routesParser);
+        registerParser("endpoint", endpointParser);
 
+        registerParser("camelContext", new BeanDefinitionParserSupport(CamelContextFactoryBean.class) {
             @Override
             protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
                 super.doParse(element, parserContext, builder);
@@ -47,45 +49,42 @@
                 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);
-                    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));
-                }
+                BeanDefinition definition = routesParser.parse(routes, parserContext);
+                definition.getPropertyValues().addPropertyValue("context", new RuntimeBeanReference(contextId));
+                parserContext.registerComponent(new BeanComponentDefinition(definition, routeId));
 
-*/
                 list = routes.getElementsByTagName("endpoint");
                 for (int size = list.getLength(), i = 0; i < size; i++) {
                     Element node = (Element) list.item(i);
                     definition = endpointParser.parse(node, parserContext);
                     String id = node.getAttribute("id");
                     if (isNotNullOrBlank(id)) {
-                        //definition.getPropertyValues().addPropertyValue("context", builder.getBeanDefinition());
                         definition.getPropertyValues().addPropertyValue("context", new RuntimeBeanReference(contextId));
+                        //definition.getPropertyValues().addPropertyValue("context", builder.getBeanDefinition());
                         parserContext.registerComponent(new BeanComponentDefinition(definition, id));
                     }
                 }
             }
         });
+
+        registerParser("xpath", new BeanDefinitionParserSupport(XPathBuilder.class) {
+            @Override
+            protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
+                // lets create a child context
+                String xpath = DomUtils.getTextValue(element);
+                builder.addConstructorArg(xpath);
+                super.doParse(element, parserContext, builder);
+                builder.addPropertyValue("namespacesFromDom", element);
+            }
+        });
+    }
+
+    protected void registerParser(String name, BeanDefinitionParser parser) {
+        parserElementNames.add(name);
+        registerBeanDefinitionParser(name, parser);
     }
 
-    protected synchronized int nextCounter() {
-        return ++counter;
+    public Set<String> getParserElementNames() {
+        return parserElementNames;
     }
 }

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=534941&r1=534940&r2=534941
==============================================================================
--- 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 10:35:43 2007
@@ -140,11 +140,14 @@
     </xs:complexType>
   </xs:element>
 
+  <!-- Predicate expressions -->
   <xs:complexType name="predicate">
-    <xs:sequence>
+    <xs:choice minOccurs="1" maxOccurs="1">
       <xs:element ref="c:predicate"/>
-    </xs:sequence>
+      <xs:element ref="c:xpath"/>
+    </xs:choice>
   </xs:complexType>
+
   <xs:element name="predicate">
     <xs:complexType>
       <xs:sequence>
@@ -159,6 +162,12 @@
       </xs:sequence>
     </xs:complexType>
   </xs:element>
+
+  <!-- Expressions -->
+  <xs:element name="xpath">
+  </xs:element>
+
+
   <xs:element name="isEqualTo">
     <xs:complexType>
       <xs:attribute name="value" use="required" type="xs:string"/>
@@ -172,13 +181,12 @@
   <xs:element name="to">
     <xs:complexType>
       <xs:sequence>
-        <xs:element minOccurs="0" maxOccurs="unbounded" ref="c:uri"/>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="c:endpoint"/>
       </xs:sequence>
       <xs:attribute name="ref" type="xs:string"/>
       <xs:attribute name="uri" type="xs:anyURI"/>
     </xs:complexType>
   </xs:element>
-  <xs:element name="uri" type="xs:anyURI"/>
   <xs:complexType name="recipients">
     <xs:sequence>
       <xs:element ref="c:recipients"/>

Added: activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/example/SpringXPathFilterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/example/SpringXPathFilterTest.java?view=auto&rev=534941
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/example/SpringXPathFilterTest.java (added)
+++ activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/example/SpringXPathFilterTest.java Thu May  3 10:35:43 2007
@@ -0,0 +1,40 @@
+/**
+ *
+ * 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.example;
+
+import org.apache.camel.processor.XPathFilterTest;
+import org.apache.camel.CamelContext;
+import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.impl.NoRouteBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class SpringXPathFilterTest extends XPathFilterTest {
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return SpringCamelContext.springCamelContext(new ClassPathXmlApplicationContext("org/apache/camel/spring/example/xpathFilter.xml"));
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return NoRouteBuilder.getInstance();
+    }
+}

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

Added: activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/xml/SpringXmlRouteBuilderTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/xml/SpringXmlRouteBuilderTest.java?view=auto&rev=534941
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/xml/SpringXmlRouteBuilderTest.java (added)
+++ activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/xml/SpringXmlRouteBuilderTest.java Thu May  3 10:35:43 2007
@@ -0,0 +1,120 @@
+/**
+ *
+ * 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.RouteBuilderTest;
+import org.apache.camel.Route;
+import org.apache.camel.Processor;
+import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.processor.DelegateProcessor;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+import java.util.List;
+
+/**
+ * A test case of the builder using Spring 2.0 to load the rules
+ *
+ * @version $Revision: 520164 $
+ */
+public class SpringXmlRouteBuilderTest extends RouteBuilderTest {
+    protected AbstractXmlApplicationContext applicationContext;
+
+    @Override
+    @SuppressWarnings("unchecked")
+    protected List<Route> buildSimpleRoute() {
+        return getRoutesFromContext("org/apache/camel/spring/xml/buildSimpleRoute.xml");
+    }
+
+    @Override
+    protected List<Route> buildCustomProcessor() {
+        List<Route> answer = getRoutesFromContext("org/apache/camel/spring/xml/buildCustomProcessor.xml");
+        myProcessor = (Processor) applicationContext.getBean("myProcessor");
+        return answer;
+    }
+
+    @Override
+    protected List<Route> buildCustomProcessorWithFilter() {
+        List<Route> answer = getRoutesFromContext("org/apache/camel/spring/xml/buildCustomProcessorWithFilter.xml");
+        myProcessor = (Processor) applicationContext.getBean("myProcessor");
+        return answer;
+    }
+
+    @Override
+    protected List<Route> buildRouteWithInterceptor() {
+        List<Route> answer = getRoutesFromContext("org/apache/camel/spring/xml/buildRouteWithInterceptor.xml");
+        interceptor1 = (DelegateProcessor) applicationContext.getBean("interceptor1");
+        interceptor2 = (DelegateProcessor) applicationContext.getBean("interceptor2");
+        return answer;
+    }
+
+    @Override
+    protected List<Route> buildSimpleRouteWithHeaderPredicate() {
+        return getRoutesFromContext("org/apache/camel/spring/xml/buildSimpleRouteWithHeaderPredicate.xml");
+    }
+
+    @Override
+    protected List<Route> buildSimpleRouteWithChoice() {
+        return getRoutesFromContext("org/apache/camel/spring/xml/buildSimpleRouteWithChoice.xml");
+    }
+
+    @Override
+    protected List<Route> buildWireTap() {
+        return getRoutesFromContext("org/apache/camel/spring/xml/buildWireTap.xml");
+    }
+
+    @Override
+    protected List<Route> buildDynamicRecipientList() {
+        return getRoutesFromContext("org/apache/camel/spring/xml/buildDynamicRecipientList.xml");
+    }
+
+    @Override
+    protected List<Route> buildStaticRecipientList() {
+        return getRoutesFromContext("org/apache/camel/spring/xml/buildStaticRecipientList.xml");
+    }
+
+    @Override
+    protected List<Route> buildSplitter() {
+        return getRoutesFromContext("org/apache/camel/spring/xml/buildSplitter.xml");
+    }
+
+    @Override
+    protected List<Route> buildIdempotentConsumer() {
+        return getRoutesFromContext("org/apache/camel/spring/xml/buildIdempotentConsumer.xml");
+    }
+
+    @Override
+    public void testIdempotentConsumer() throws Exception {
+        // TODO
+    }
+
+    @Override
+    public void testWireTap() throws Exception {
+        // TODO
+    }
+
+    protected List<Route> getRoutesFromContext(String classpathConfigFile) {
+        applicationContext = new ClassPathXmlApplicationContext(classpathConfigFile);
+        String name = "camel";
+        SpringCamelContext context = (SpringCamelContext) applicationContext.getBean(name);
+        assertNotNull("No Camel Context for name: " + name + " in file: " + classpathConfigFile, context);
+        List<Route> routes = context.getRoutes();
+        assertNotNull("No routes available for context: " + name + " in file: " + classpathConfigFile, routes);
+        return routes;
+    }
+}

Propchange: activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/xml/SpringXmlRouteBuilderTest.java
------------------------------------------------------------------------------
    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=534941&r1=534940&r2=534941
==============================================================================
--- 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 10:35:43 2007
@@ -22,7 +22,14 @@
        http://activemq.apache.org/camel/schema/camel-1.0.xsd http://activemq.apache.org/camel/schema/camel-1.0.xsd
     ">
 
-    <!-- 
+
+    <!--
+      TODO: DELETE ME once we are sure there are no more snippet macros on the wiki pointing to this file!
+      TODO: This file has been replaced by the individual files in org/apache/camel/spring/xml/*.xml
+    -->
+
+
+    <!--
         from("queue:a").to("queue:b");
      -->
     <!-- START SNIPPET: e1 -->

Added: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/example/xpathFilter.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/example/xpathFilter.xml?view=auto&rev=534941
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/example/xpathFilter.xml (added)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/example/xpathFilter.xml Thu May  3 10:35:43 2007
@@ -0,0 +1,37 @@
+<?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.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 -->
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <route>
+      <from uri="direct:start"/>
+      <filter>
+        <xpath>/person[@name='James']</xpath>
+      </filter>
+      <to uri="mock:result"/>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: example -->
+
+</beans>

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

Added: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildCustomProcessor.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildCustomProcessor.xml?view=auto&rev=534941
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildCustomProcessor.xml (added)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildCustomProcessor.xml Thu May  3 10:35:43 2007
@@ -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.
+-->
+<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.0.xsd
+       http://activemq.apache.org/camel/schema/camel-1.0.xsd http://activemq.apache.org/camel/schema/camel-1.0.xsd
+    ">
+
+  <!--
+        from("queue:a").process(myProcessor);
+  -->
+  <!-- START SNIPPET: example -->
+  <bean id="myProcessor" class="org.apache.camel.builder.MyProcessor"/>
+
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <route>
+      <from uri="queue:a"/>
+      <process ref="myProcessor"/>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: example -->
+
+
+</beans>

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

Added: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildCustomProcessorWithFilter.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildCustomProcessorWithFilter.xml?view=auto&rev=534941
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildCustomProcessorWithFilter.xml (added)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildCustomProcessorWithFilter.xml Thu May  3 10:35:43 2007
@@ -0,0 +1,46 @@
+<?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.0.xsd
+       http://activemq.apache.org/camel/schema/camel-1.0.xsd http://activemq.apache.org/camel/schema/camel-1.0.xsd
+    ">
+
+  <!--
+        from("queue:a").filter(header("foo").isEqualTo("bar")).process(myProcessor);
+  -->
+  <!-- START SNIPPET: example -->
+  <bean id="myProcessor" class="org.apache.camel.builder.MyProcessor"/>
+
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <route>
+      <from uri="queue:a"/>
+      <filter>
+        <predicate>
+          <header name="foo"/>
+          <isEqualTo value="bar"/>
+        </predicate>
+      </filter>
+      <process ref="myProcessor"/>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: example -->
+
+
+</beans>

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

Added: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildDynamicRecipientList.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildDynamicRecipientList.xml?view=auto&rev=534941
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildDynamicRecipientList.xml (added)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildDynamicRecipientList.xml Thu May  3 10:35:43 2007
@@ -0,0 +1,42 @@
+<?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.0.xsd
+       http://activemq.apache.org/camel/schema/camel-1.0.xsd http://activemq.apache.org/camel/schema/camel-1.0.xsd
+    ">
+
+  <!--
+        from("queue:a").recipientList(header("foo"));
+  -->
+  <!-- START SNIPPET: example -->
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <route>
+      <from uri="queue:a"/>
+      <recipientList>
+        <recipients>
+           <header name="foo"/>
+         </recipients>
+      </recipientList>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: example -->
+
+
+</beans>

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

Added: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildIdempotentConsumer.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildIdempotentConsumer.xml?view=auto&rev=534941
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildIdempotentConsumer.xml (added)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildIdempotentConsumer.xml Thu May  3 10:35:43 2007
@@ -0,0 +1,42 @@
+<?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.0.xsd
+       http://activemq.apache.org/camel/schema/camel-1.0.xsd http://activemq.apache.org/camel/schema/camel-1.0.xsd
+    ">
+
+  <!--
+        from("queue:a").idempotentConsumer(header("myMessageId"), memoryMessageIdRepository()).to("queue:b");
+  -->
+  <!-- START SNIPPET: example -->
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <route>
+      <from uri="queue:a"/>
+ <!--
+      <idempotentConsumer>
+      </idempotentConsumer>
+ -->
+      <to uri="queue:b"/>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: example -->
+
+
+</beans>

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

Added: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildRouteWithInterceptor.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildRouteWithInterceptor.xml?view=auto&rev=534941
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildRouteWithInterceptor.xml (added)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildRouteWithInterceptor.xml Thu May  3 10:35:43 2007
@@ -0,0 +1,49 @@
+<?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.0.xsd
+       http://activemq.apache.org/camel/schema/camel-1.0.xsd http://activemq.apache.org/camel/schema/camel-1.0.xsd
+    ">
+
+  <!--
+        from("queue:a")
+           .intercept()
+              .add(interceptor1)
+              .add(interceptor2)
+           .target().to("queue:d");
+  -->
+  <!-- START SNIPPET: example -->
+  <bean id="interceptor1" class="org.apache.camel.builder.MyInterceptorProcessor"/>
+  <bean id="interceptor2" class="org.apache.camel.builder.MyInterceptorProcessor"/>
+
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <route>
+      <from uri="queue:a"/>
+      <intercept>
+          <interceptor ref="interceptor1"/>
+          <interceptor ref="interceptor2"/>
+      </intercept>
+      <to uri="queue:d"/>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: example -->
+
+
+</beans>

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

Added: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSimpleRoute.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSimpleRoute.xml?view=auto&rev=534941
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSimpleRoute.xml (added)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSimpleRoute.xml Thu May  3 10:35:43 2007
@@ -0,0 +1,38 @@
+<?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.0.xsd
+       http://activemq.apache.org/camel/schema/camel-1.0.xsd http://activemq.apache.org/camel/schema/camel-1.0.xsd
+    ">
+
+  <!--
+     from("queue:a").to("queue:b");
+  -->
+  <!-- START SNIPPET: example -->
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <route>
+      <from uri="queue:a"/>
+      <to uri="queue:b"/>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: example -->
+
+
+</beans>

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

Added: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSimpleRouteWithChoice.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSimpleRouteWithChoice.xml?view=auto&rev=534941
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSimpleRouteWithChoice.xml (added)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSimpleRouteWithChoice.xml Thu May  3 10:35:43 2007
@@ -0,0 +1,59 @@
+<?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.0.xsd
+       http://activemq.apache.org/camel/schema/camel-1.0.xsd http://activemq.apache.org/camel/schema/camel-1.0.xsd
+    ">
+
+  <!--
+        from("queue:a").choice()
+                .when(header("foo").isEqualTo("bar")).to("queue:b")
+                .when(header("foo").isEqualTo("cheese")).to("queue:c")
+                .otherwise().to("queue:d");
+  -->
+  <!-- START SNIPPET: example -->
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <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"/>
+                 <isEqualTo value="cheese"/>
+              </predicate>
+              <to uri="queue:c"/>
+          </when>
+          <otherwise>
+              <to uri="queue:d"/>
+          </otherwise>
+      </choice>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: example -->
+
+
+</beans>

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

Added: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSimpleRouteWithHeaderPredicate.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSimpleRouteWithHeaderPredicate.xml?view=auto&rev=534941
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSimpleRouteWithHeaderPredicate.xml (added)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSimpleRouteWithHeaderPredicate.xml Thu May  3 10:35:43 2007
@@ -0,0 +1,44 @@
+<?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.0.xsd
+       http://activemq.apache.org/camel/schema/camel-1.0.xsd http://activemq.apache.org/camel/schema/camel-1.0.xsd
+    ">
+
+  <!--
+        from("queue:a").filter(header("foo").isEqualTo("bar")).to("queue:b");
+  -->
+  <!-- START SNIPPET: example -->
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <route>
+      <from uri="queue:a"/>
+      <filter>
+          <predicate>
+             <header name="foo"/>
+             <isEqualTo value="bar"/>
+          </predicate>
+      </filter>
+      <to uri="queue:b"/>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: example -->
+
+
+</beans>

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

Added: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSplitter.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSplitter.xml?view=auto&rev=534941
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSplitter.xml (added)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSplitter.xml Thu May  3 10:35:43 2007
@@ -0,0 +1,45 @@
+<?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.0.xsd
+       http://activemq.apache.org/camel/schema/camel-1.0.xsd http://activemq.apache.org/camel/schema/camel-1.0.xsd
+    ">
+
+  <!--
+        from("queue:a").splitter(bodyAs(String.class).tokenize("\n")).to("queue:b");
+  -->
+  <!-- START SNIPPET: example -->
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <route>
+      <from uri="queue:a"/>
+      <splitter>
+        <recipients>
+           <bodyAs class="java.lang.String"/>
+           <tokenize token="
+ "/>
+        </recipients>
+      </splitter>
+      <to uri="queue:b"/>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: example -->
+
+
+</beans>

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

Added: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildStaticRecipientList.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildStaticRecipientList.xml?view=auto&rev=534941
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildStaticRecipientList.xml (added)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildStaticRecipientList.xml Thu May  3 10:35:43 2007
@@ -0,0 +1,42 @@
+<?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.0.xsd
+       http://activemq.apache.org/camel/schema/camel-1.0.xsd http://activemq.apache.org/camel/schema/camel-1.0.xsd
+    ">
+
+  <!--
+        from("queue:a").to("queue:b", "queue:c", "queue:d");
+  -->
+  <!-- START SNIPPET: example -->
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <route>
+      <from uri="queue:a"/>
+      <to>
+         <uri>queue:b</uri>
+         <uri>queue:c</uri>
+         <uri>queue:d</uri>
+      </to>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: example -->
+
+
+</beans>

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

Added: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildWireTap.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildWireTap.xml?view=auto&rev=534941
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildWireTap.xml (added)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildWireTap.xml Thu May  3 10:35:43 2007
@@ -0,0 +1,41 @@
+<?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.0.xsd
+       http://activemq.apache.org/camel/schema/camel-1.0.xsd http://activemq.apache.org/camel/schema/camel-1.0.xsd
+    ">
+
+  <!--
+        from("queue:a").to("queue:tap", "queue:b");
+  -->
+  <!-- START SNIPPET: example -->
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+    <route>
+      <from uri="queue:a"/>
+      <to>
+         <endpoint uri="queue:tap"/>
+         <endpoint uri="queue:b"/>
+      </to>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: example -->
+
+
+</beans>

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