You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2018/08/16 15:26:15 UTC
[camel] 01/02: CAMEL-12735 - provide test showing XMlRouteParser
doesn't support namespace prefix
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit b508f284d7084c9086648b7f8e122a7e2c153033
Author: Aurélien Pupier <ap...@redhat.com>
AuthorDate: Thu Aug 16 15:28:12 2018 +0200
CAMEL-12735 - provide test showing XMlRouteParser doesn't support
namespace prefix
Signed-off-by: Aurélien Pupier <ap...@redhat.com>
---
.../org/apache/camel/parser/xml/XmlRouteTest.java | 18 +++++++---
.../parser/xml/mycamel-withNamespacePrefix.xml | 38 ++++++++++++++++++++++
2 files changed, 52 insertions(+), 4 deletions(-)
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/xml/XmlRouteTest.java b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/xml/XmlRouteTest.java
index ed72feb..3b4e582 100644
--- a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/xml/XmlRouteTest.java
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/xml/XmlRouteTest.java
@@ -17,6 +17,7 @@
package org.apache.camel.parser.xml;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@@ -34,10 +35,19 @@ public class XmlRouteTest {
@Test
public void testXml() throws Exception {
- List<CamelEndpointDetails> endpoints = new ArrayList<>();
+ test("mycamel");
+ }
- InputStream is = new FileInputStream("src/test/resources/org/apache/camel/parser/xml/mycamel.xml");
- String fqn = "src/test/resources/org/apache/camel/camel/parser/xml/mycamel.xml";
+ @Test
+ public void testXmlWithNamespacePrefix() throws Exception {
+ test("mycamel-withNamespacePrefix");
+ }
+
+ private void test(String filename) throws FileNotFoundException, Exception {
+ List<CamelEndpointDetails> endpoints = new ArrayList<>();
+
+ InputStream is = new FileInputStream("src/test/resources/org/apache/camel/parser/xml/"+filename+".xml");
+ String fqn = "src/test/resources/org/apache/camel/camel/parser/xml/"+filename+".xml";
String baseDir = "src/test/resources";
XmlRouteParser.parseXmlRouteEndpoints(is, baseDir, fqn, endpoints);
@@ -48,6 +58,6 @@ public class XmlRouteTest {
Assert.assertEquals("stream:out", endpoints.get(1).getEndpointUri());
Assert.assertEquals("39", endpoints.get(1).getLineNumber());
Assert.assertEquals(29, endpoints.get(1).getLinePosition());
- }
+ }
}
diff --git a/tooling/camel-route-parser/src/test/resources/org/apache/camel/parser/xml/mycamel-withNamespacePrefix.xml b/tooling/camel-route-parser/src/test/resources/org/apache/camel/parser/xml/mycamel-withNamespacePrefix.xml
new file mode 100644
index 0000000..345969c
--- /dev/null
+++ b/tooling/camel-route-parser/src/test/resources/org/apache/camel/parser/xml/mycamel-withNamespacePrefix.xml
@@ -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.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+ <!-- START SNIPPET: e1 -->
+ <!-- camelContext is the Camel runtime, where we can host Camel routes -->
+ <camel:camelContext id="camelContext-4456db4f-45bb-4aa4-8698-10823e239dbc" xmlns:camel="http://camel.apache.org/schema/spring">
+ <camel:route id="myRoute">
+ <!-- read input from the console using the stream component -->
+ <!-- transform the input to upper case using the simple language -->
+ <!-- you can also use other languages such as groovy, ognl, mvel, javascript etc. -->
+ <camel:from id="_from1" uri="stream:in?promptMessage=Enter something: "/>
+ <!-- and then print to the console -->
+ <camel:transform id="_transform1">
+ <camel:simple>Hello ${body.toUpperCase()}</camel:simple>
+ </camel:transform>
+ <camel:to id="_to1" uri="stream:out"/>
+ </camel:route>
+ </camel:camelContext>
+ <!-- END SNIPPET: e1 -->
+</beans>