Author: davsclaus
Date: Sun May 29 13:49:53 2011
New Revision: 1128876

URL: http://svn.apache.org/viewvc?rev=1128876&view=rev
Log:
CAMEL-4025: Fixed using <routeContext> with xpath and namespaces.

Added:
    
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnRouteContextTest.java
    
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathFilterWithNamespaceOnRouteContext.xml
Modified:
    
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java

Modified: 
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java?rev=1128876&r1=1128875&r2=1128876&view=diff
==============================================================================
--- 
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
 (original)
+++ 
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
 Sun May 29 13:49:53 2011
@@ -267,6 +267,12 @@ public class CamelNamespaceHandler exten
                 CamelRouteContextFactoryBean factoryBean = 
(CamelRouteContextFactoryBean) value;
                 builder.addPropertyValue("routes", factoryBean.getRoutes());
             }
+
+            // lets inject the namespaces into any namespace aware POJOs
+            injectNamespaces(element, binder);
+
+            // TODO: We need to inject bean post processors
+            // but we need to camelContext id its referred from
         }
     }
 

Added: 
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnRouteContextTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnRouteContextTest.java?rev=1128876&view=auto
==============================================================================
--- 
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnRouteContextTest.java
 (added)
+++ 
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnRouteContextTest.java
 Sun May 29 13:49:53 2011
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.XPathFilterTest;
+
+import static 
org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+/**
+ *
+ */
+public class SpringXPathFilterWithNamespaceOnRouteContextTest extends 
XPathFilterTest {
+
+    @Override
+    protected void setUp() throws Exception {
+        matchingBody = "<person name='James' city='London' 
xmlns='http://example.com/person'/>";
+        super.setUp();
+    }
+
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, 
"org/apache/camel/spring/processor/xpathFilterWithNamespaceOnRouteContext.xml");
+    }
+}

Added: 
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathFilterWithNamespaceOnRouteContext.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathFilterWithNamespaceOnRouteContext.xml?rev=1128876&view=auto
==============================================================================
--- 
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathFilterWithNamespaceOnRouteContext.xml
 (added)
+++ 
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathFilterWithNamespaceOnRouteContext.xml
 Sun May 29 13:49:53 2011
@@ -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";
+       xmlns:foo="http://example.com/person";
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+  <routeContext id="myCoolRoutes" 
xmlns="http://camel.apache.org/schema/spring";>
+    <route>
+      <from uri="direct:start"/>
+      <filter>
+        <xpath>/foo:person[@name='James']</xpath>
+        <to uri="mock:result"/>
+      </filter>
+    </route>
+  </routeContext>
+
+  <camelContext xmlns="http://camel.apache.org/schema/spring";>
+    <routeContextRef ref="myCoolRoutes"/>
+  </camelContext>
+
+</beans>
\ No newline at end of file


Reply via email to