You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/09/22 09:09:22 UTC

[1/3] git commit: CAMEL-7839 Fixed the issue that Xpath is not namespace aware in choice

Repository: camel
Updated Branches:
  refs/heads/camel-2.12.x 57b1099f4 -> 46efbb671
  refs/heads/camel-2.13.x 978011461 -> 61867a060
  refs/heads/camel-2.14.x fc99a62fd -> 191a84796


CAMEL-7839 Fixed the issue that Xpath is not namespace aware in choice


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/191a8479
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/191a8479
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/191a8479

Branch: refs/heads/camel-2.14.x
Commit: 191a8479656ce09ab26f2235fd8a0bd77ffb6807
Parents: fc99a62
Author: Willem Jiang <wi...@gmail.com>
Authored: Mon Sep 22 15:05:59 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon Sep 22 15:08:15 2014 +0800

----------------------------------------------------------------------
 .../camel/model/ProcessorDefinitionHelper.java  |  3 ++
 .../model/ProcessorDefinitionHelperTest.java    |  6 ++-
 ...erWithNamespaceOnImportRouteContextTest.java | 38 +++++++++++++++++++
 .../xpathChoiceWithNamespaceOnRouteContext.xml  | 32 ++++++++++++++++
 ...eWithNamespaceOnRouteContextRouteContext.xml | 39 ++++++++++++++++++++
 5 files changed, 116 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/191a8479/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
index c94599c..87689a3 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
@@ -220,6 +220,9 @@ public final class ProcessorDefinitionHelper {
             if (out instanceof ChoiceDefinition) {
                 ChoiceDefinition choice = (ChoiceDefinition) out;
                 for (WhenDefinition when : choice.getWhenClauses()) {
+                    if (type.isInstance(when)) {
+                        found.add((T)when);   
+                    }
                     List<ProcessorDefinition<?>> children = when.getOutputs();
                     doFindType(children, type, found);
                 }

http://git-wip-us.apache.org/repos/asf/camel/blob/191a8479/camel-core/src/test/java/org/apache/camel/model/ProcessorDefinitionHelperTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/model/ProcessorDefinitionHelperTest.java b/camel-core/src/test/java/org/apache/camel/model/ProcessorDefinitionHelperTest.java
index 4aa1d7e..8aa7b0c 100644
--- a/camel-core/src/test/java/org/apache/camel/model/ProcessorDefinitionHelperTest.java
+++ b/camel-core/src/test/java/org/apache/camel/model/ProcessorDefinitionHelperTest.java
@@ -29,7 +29,9 @@ public class ProcessorDefinitionHelperTest extends ContextTestSupport {
         Iterator<ProcessorDefinition> it = ProcessorDefinitionHelper.filterTypeInOutputs(route.getOutputs(), ProcessorDefinition.class);
         assertNotNull(it);
 
+        assertEquals("whenfoo", it.next().getId());
         assertEquals("foo", it.next().getId());
+        assertEquals("whenbar", it.next().getId());
         assertEquals("bar", it.next().getId());
         assertEquals("baz", it.next().getId());
         assertFalse(it.hasNext());
@@ -42,8 +44,8 @@ public class ProcessorDefinitionHelperTest extends ContextTestSupport {
             public void configure() throws Exception {
                 from("direct:start")
                     .choice()
-                        .when(header("foo")).to("mock:foo").id("foo")
-                        .when(header("bar")).to("mock:bar").id("bar")
+                        .when(header("foo")).id("whenfoo").to("mock:foo").id("foo")
+                        .when(header("bar")).id("whenbar").to("mock:bar").id("bar")
                     .otherwise()
                         .to("mock:baz").id("baz");
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/191a8479/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnImportRouteContextTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnImportRouteContextTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnImportRouteContextTest.java
new file mode 100644
index 0000000..0a1a42e
--- /dev/null
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnImportRouteContextTest.java
@@ -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 SpringXPathFilterWithNamespaceOnImportRouteContextTest 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/xpathChoiceWithNamespaceOnRouteContext.xml");
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/191a8479/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContext.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContext.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContext.xml
new file mode 100644
index 0000000..d39bd34
--- /dev/null
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContext.xml
@@ -0,0 +1,32 @@
+<?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
+    ">
+
+  <import resource="xpathChoiceWithNamespaceOnRouteContextRouteContext.xml" />
+ 
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <routeContextRef ref="myCoolRoutes"/>
+  </camelContext>
+
+
+</beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/191a8479/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContextRouteContext.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContextRouteContext.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContextRouteContext.xml
new file mode 100644
index 0000000..885a837
--- /dev/null
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContextRouteContext.xml
@@ -0,0 +1,39 @@
+<?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" />
+      <choice>
+        <when>
+          <xpath>/foo:person[@name='James']</xpath>
+          <to uri="mock:result" />
+        </when>
+      </choice>
+    </route>
+
+  </routeContext>
+
+</beans>
\ No newline at end of file


[3/3] git commit: CAMEL-7839 Fixed the issue that Xpath is not namespace aware in choice

Posted by ni...@apache.org.
CAMEL-7839 Fixed the issue that Xpath is not namespace aware in choice


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/46efbb67
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/46efbb67
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/46efbb67

Branch: refs/heads/camel-2.12.x
Commit: 46efbb67144eb2eb4fa32112d9826e154cdbe52b
Parents: 57b1099
Author: Willem Jiang <wi...@gmail.com>
Authored: Mon Sep 22 15:05:59 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon Sep 22 15:08:54 2014 +0800

----------------------------------------------------------------------
 .../camel/model/ProcessorDefinitionHelper.java  |  3 ++
 .../model/ProcessorDefinitionHelperTest.java    |  6 ++-
 ...erWithNamespaceOnImportRouteContextTest.java | 38 +++++++++++++++++++
 .../xpathChoiceWithNamespaceOnRouteContext.xml  | 32 ++++++++++++++++
 ...eWithNamespaceOnRouteContextRouteContext.xml | 39 ++++++++++++++++++++
 5 files changed, 116 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/46efbb67/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
index 2ae283b..a46502f 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
@@ -210,6 +210,9 @@ public final class ProcessorDefinitionHelper {
             if (out instanceof ChoiceDefinition) {
                 ChoiceDefinition choice = (ChoiceDefinition) out;
                 for (WhenDefinition when : choice.getWhenClauses()) {
+                    if (type.isInstance(when)) {
+                        found.add((T)when);   
+                    }
                     List<ProcessorDefinition<?>> children = when.getOutputs();
                     doFindType(children, type, found);
                 }

http://git-wip-us.apache.org/repos/asf/camel/blob/46efbb67/camel-core/src/test/java/org/apache/camel/model/ProcessorDefinitionHelperTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/model/ProcessorDefinitionHelperTest.java b/camel-core/src/test/java/org/apache/camel/model/ProcessorDefinitionHelperTest.java
index 4aa1d7e..8aa7b0c 100644
--- a/camel-core/src/test/java/org/apache/camel/model/ProcessorDefinitionHelperTest.java
+++ b/camel-core/src/test/java/org/apache/camel/model/ProcessorDefinitionHelperTest.java
@@ -29,7 +29,9 @@ public class ProcessorDefinitionHelperTest extends ContextTestSupport {
         Iterator<ProcessorDefinition> it = ProcessorDefinitionHelper.filterTypeInOutputs(route.getOutputs(), ProcessorDefinition.class);
         assertNotNull(it);
 
+        assertEquals("whenfoo", it.next().getId());
         assertEquals("foo", it.next().getId());
+        assertEquals("whenbar", it.next().getId());
         assertEquals("bar", it.next().getId());
         assertEquals("baz", it.next().getId());
         assertFalse(it.hasNext());
@@ -42,8 +44,8 @@ public class ProcessorDefinitionHelperTest extends ContextTestSupport {
             public void configure() throws Exception {
                 from("direct:start")
                     .choice()
-                        .when(header("foo")).to("mock:foo").id("foo")
-                        .when(header("bar")).to("mock:bar").id("bar")
+                        .when(header("foo")).id("whenfoo").to("mock:foo").id("foo")
+                        .when(header("bar")).id("whenbar").to("mock:bar").id("bar")
                     .otherwise()
                         .to("mock:baz").id("baz");
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/46efbb67/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnImportRouteContextTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnImportRouteContextTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnImportRouteContextTest.java
new file mode 100644
index 0000000..0a1a42e
--- /dev/null
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnImportRouteContextTest.java
@@ -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 SpringXPathFilterWithNamespaceOnImportRouteContextTest 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/xpathChoiceWithNamespaceOnRouteContext.xml");
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/46efbb67/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContext.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContext.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContext.xml
new file mode 100644
index 0000000..d39bd34
--- /dev/null
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContext.xml
@@ -0,0 +1,32 @@
+<?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
+    ">
+
+  <import resource="xpathChoiceWithNamespaceOnRouteContextRouteContext.xml" />
+ 
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <routeContextRef ref="myCoolRoutes"/>
+  </camelContext>
+
+
+</beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/46efbb67/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContextRouteContext.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContextRouteContext.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContextRouteContext.xml
new file mode 100644
index 0000000..885a837
--- /dev/null
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContextRouteContext.xml
@@ -0,0 +1,39 @@
+<?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" />
+      <choice>
+        <when>
+          <xpath>/foo:person[@name='James']</xpath>
+          <to uri="mock:result" />
+        </when>
+      </choice>
+    </route>
+
+  </routeContext>
+
+</beans>
\ No newline at end of file


[2/3] git commit: CAMEL-7839 Fixed the issue that Xpath is not namespace aware in choice

Posted by ni...@apache.org.
CAMEL-7839 Fixed the issue that Xpath is not namespace aware in choice


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/61867a06
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/61867a06
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/61867a06

Branch: refs/heads/camel-2.13.x
Commit: 61867a06054b57d8e6b218d78cec0c9e4ed8c8ea
Parents: 9780114
Author: Willem Jiang <wi...@gmail.com>
Authored: Mon Sep 22 15:05:59 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon Sep 22 15:08:24 2014 +0800

----------------------------------------------------------------------
 .../camel/model/ProcessorDefinitionHelper.java  |  3 ++
 .../model/ProcessorDefinitionHelperTest.java    |  6 ++-
 ...erWithNamespaceOnImportRouteContextTest.java | 38 +++++++++++++++++++
 .../xpathChoiceWithNamespaceOnRouteContext.xml  | 32 ++++++++++++++++
 ...eWithNamespaceOnRouteContextRouteContext.xml | 39 ++++++++++++++++++++
 5 files changed, 116 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/61867a06/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
index 2ae283b..a46502f 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
@@ -210,6 +210,9 @@ public final class ProcessorDefinitionHelper {
             if (out instanceof ChoiceDefinition) {
                 ChoiceDefinition choice = (ChoiceDefinition) out;
                 for (WhenDefinition when : choice.getWhenClauses()) {
+                    if (type.isInstance(when)) {
+                        found.add((T)when);   
+                    }
                     List<ProcessorDefinition<?>> children = when.getOutputs();
                     doFindType(children, type, found);
                 }

http://git-wip-us.apache.org/repos/asf/camel/blob/61867a06/camel-core/src/test/java/org/apache/camel/model/ProcessorDefinitionHelperTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/model/ProcessorDefinitionHelperTest.java b/camel-core/src/test/java/org/apache/camel/model/ProcessorDefinitionHelperTest.java
index 4aa1d7e..8aa7b0c 100644
--- a/camel-core/src/test/java/org/apache/camel/model/ProcessorDefinitionHelperTest.java
+++ b/camel-core/src/test/java/org/apache/camel/model/ProcessorDefinitionHelperTest.java
@@ -29,7 +29,9 @@ public class ProcessorDefinitionHelperTest extends ContextTestSupport {
         Iterator<ProcessorDefinition> it = ProcessorDefinitionHelper.filterTypeInOutputs(route.getOutputs(), ProcessorDefinition.class);
         assertNotNull(it);
 
+        assertEquals("whenfoo", it.next().getId());
         assertEquals("foo", it.next().getId());
+        assertEquals("whenbar", it.next().getId());
         assertEquals("bar", it.next().getId());
         assertEquals("baz", it.next().getId());
         assertFalse(it.hasNext());
@@ -42,8 +44,8 @@ public class ProcessorDefinitionHelperTest extends ContextTestSupport {
             public void configure() throws Exception {
                 from("direct:start")
                     .choice()
-                        .when(header("foo")).to("mock:foo").id("foo")
-                        .when(header("bar")).to("mock:bar").id("bar")
+                        .when(header("foo")).id("whenfoo").to("mock:foo").id("foo")
+                        .when(header("bar")).id("whenbar").to("mock:bar").id("bar")
                     .otherwise()
                         .to("mock:baz").id("baz");
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/61867a06/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnImportRouteContextTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnImportRouteContextTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnImportRouteContextTest.java
new file mode 100644
index 0000000..0a1a42e
--- /dev/null
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnImportRouteContextTest.java
@@ -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 SpringXPathFilterWithNamespaceOnImportRouteContextTest 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/xpathChoiceWithNamespaceOnRouteContext.xml");
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/61867a06/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContext.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContext.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContext.xml
new file mode 100644
index 0000000..d39bd34
--- /dev/null
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContext.xml
@@ -0,0 +1,32 @@
+<?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
+    ">
+
+  <import resource="xpathChoiceWithNamespaceOnRouteContextRouteContext.xml" />
+ 
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <routeContextRef ref="myCoolRoutes"/>
+  </camelContext>
+
+
+</beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/61867a06/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContextRouteContext.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContextRouteContext.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContextRouteContext.xml
new file mode 100644
index 0000000..885a837
--- /dev/null
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContextRouteContext.xml
@@ -0,0 +1,39 @@
+<?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" />
+      <choice>
+        <when>
+          <xpath>/foo:person[@name='James']</xpath>
+          <to uri="mock:result" />
+        </when>
+      </choice>
+    </route>
+
+  </routeContext>
+
+</beans>
\ No newline at end of file