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/12/30 10:15:24 UTC

[camel] branch camel-2.21.x updated (f3a0c50 -> 0bb530d)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch camel-2.21.x
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from f3a0c50  CAMEL-13008: Odata-connector assumes '/' at end of URI
     new 8a2677e  CAMEL-12974: Polished
     new 0bb530d  CAMEL-12974: XML DSL tree parser should skip when/otherwise to parse similar like the Java DSL does

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/camel/parser/helper/CamelXmlTreeParserHelper.java    | 6 ++++--
 .../java/org/apache/camel/parser/helper/RouteCoverageHelper.java    | 6 +++---
 2 files changed, 7 insertions(+), 5 deletions(-)


[camel] 01/02: CAMEL-12974: Polished

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-2.21.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 8a2677eb77f0e71d3b592b10da73b76e059ce58b
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Dec 30 10:59:44 2018 +0100

    CAMEL-12974: Polished
---
 .../java/org/apache/camel/parser/helper/RouteCoverageHelper.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/RouteCoverageHelper.java b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/RouteCoverageHelper.java
index 109a2a5..387f713 100644
--- a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/RouteCoverageHelper.java
+++ b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/RouteCoverageHelper.java
@@ -83,7 +83,7 @@ public final class RouteCoverageHelper {
     }
 
     public static Map<String, List<CoverageData>> parseDumpRouteCoverageByClassAndTestMethod(String directory) throws Exception {
-        Map<String, List<CoverageData>> answer = new LinkedHashMap();
+        Map<String, List<CoverageData>> answer = new LinkedHashMap<>();
 
         File[] files = new File(directory).listFiles(f -> f.getName().endsWith(".xml"));
         if (files == null) {
@@ -138,10 +138,10 @@ public final class RouteCoverageHelper {
 
         // only calculate for elements within the route or children of policy/transaction
         if (!"route".equals(key) && !"policy".equals(key) && !"transacted".equals(key)) {
-            Integer count = 0;
+            int count = 0;
             Node total = node.getAttributes().getNamedItem("exchangesTotal");
             if (total != null) {
-                count = Integer.valueOf(total.getNodeValue());
+                count = Integer.parseInt(total.getNodeValue());
             }
             CoverageData holder = data.size() > counter.get() ? data.get(counter.get()) : null;
             if (holder != null && holder.getNode().equals(key)) {


[camel] 02/02: CAMEL-12974: XML DSL tree parser should skip when/otherwise to parse similar like the Java DSL does

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-2.21.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 0bb530d2302bb8d2f67d28c8b11fbf97c4674a8b
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Dec 30 11:09:48 2018 +0100

    CAMEL-12974: XML DSL tree parser should skip when/otherwise to parse similar like the Java DSL does
---
 .../org/apache/camel/parser/helper/CamelXmlTreeParserHelper.java    | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/CamelXmlTreeParserHelper.java b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/CamelXmlTreeParserHelper.java
index 23c291b..ca24642 100644
--- a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/CamelXmlTreeParserHelper.java
+++ b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/CamelXmlTreeParserHelper.java
@@ -75,11 +75,13 @@ public final class CamelXmlTreeParserHelper {
         boolean isRoute = "route".equals(name) || "from".equals(name);
         // must be an eip model that has either input or output as we only want to track processors (also accept from)
         boolean isEip = camelCatalog.findModelNames().contains(name) && (hasInput(name) || hasOutput(name));
+        // skip when/otherwise (as we do this in Java DSL)
+        boolean isWhenOrOtherwise = "when".equals(name) || "otherwise".equals(name);
 
         // only include if its a known Camel model (dont include languages)
         if (isRoute || isEip) {
-            // skip route as we just keep from
-            if (!"route".equals(name)) {
+            // skip route as we just keep from (and also skip when/otherwise)
+            if (!"route".equals(name) && !isWhenOrOtherwise) {
                 String lineNumber = (String) node.getUserData(XmlLineNumberParser.LINE_NUMBER);
                 String lineNumberEnd = (String) node.getUserData(XmlLineNumberParser.LINE_NUMBER_END);
                 newNode = nodeFactory.newNode(parent, name);