Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A62F2178B0 for ; Fri, 1 May 2015 06:25:07 +0000 (UTC) Received: (qmail 60804 invoked by uid 500); 1 May 2015 06:25:07 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 60743 invoked by uid 500); 1 May 2015 06:25:07 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 60730 invoked by uid 99); 1 May 2015 06:25:07 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 May 2015 06:25:07 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 71969E0016; Fri, 1 May 2015 06:25:07 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: davsclaus@apache.org To: commits@camel.apache.org Date: Fri, 01 May 2015 06:25:07 -0000 Message-Id: <595a22f7728e404799f4da69cfec47b8@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] camel git commit: CAMEL-8725: explainEndpointJson should order the options according to the given order from the endpoint Repository: camel Updated Branches: refs/heads/camel-2.15.x 0b9d33f11 -> c77d0f1c6 refs/heads/master 7156cf717 -> 4fac6a0bc CAMEL-8725: explainEndpointJson should order the options according to the given order from the endpoint Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4fac6a0b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4fac6a0b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4fac6a0b Branch: refs/heads/master Commit: 4fac6a0bcf0783598cba434a2ca8b07d189a708b Parents: 7156cf7 Author: Claus Ibsen Authored: Fri May 1 08:28:19 2015 +0200 Committer: Claus Ibsen Committed: Fri May 1 08:28:19 2015 +0200 ---------------------------------------------------------------------- .../apache/camel/impl/DefaultCamelContext.java | 19 +++++++++++++------ .../management/ManagedCamelContextTest.java | 14 ++++++++++++-- 2 files changed, 25 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/4fac6a0b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java index bc5ca4f..17de821 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java +++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java @@ -1795,6 +1795,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon // selected rows to use for answer Map selected = new LinkedHashMap(); + Map uriOptions = new LinkedHashMap(); // insert values from uri Map options = URISupport.parseParameters(u); @@ -1835,8 +1836,8 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon } } - // add as selected row - selected.put(name, new String[]{name, kind, label, required, type, javaType, deprecated, value, defaultValue, description}); + // remember this option from the uri + uriOptions.put(name, new String[]{name, kind, label, required, type, javaType, deprecated, value, defaultValue, description}); } // include other rows @@ -1859,11 +1860,17 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon value = URISupport.sanitizePath(value); } - // always include path options - if (includeAllOptions || "path".equals(kind)) { - // add as selected row + boolean isUriOption = uriOptions.containsKey(name); + + // always include from uri or path options + if (includeAllOptions || isUriOption || "path".equals(kind)) { if (!selected.containsKey(name)) { - selected.put(name, new String[]{name, kind, label, required, type, javaType, deprecated, value, defaultValue, description}); + // add as selected row, but take the value from uri options if it was from there + if (isUriOption) { + selected.put(name, uriOptions.get(name)); + } else { + selected.put(name, new String[]{name, kind, label, required, type, javaType, deprecated, value, defaultValue, description}); + } } } } http://git-wip-us.apache.org/repos/asf/camel/blob/4fac6a0b/camel-core/src/test/java/org/apache/camel/management/ManagedCamelContextTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedCamelContextTest.java b/camel-core/src/test/java/org/apache/camel/management/ManagedCamelContextTest.java index 3807dc0..f2fcf7f 100644 --- a/camel-core/src/test/java/org/apache/camel/management/ManagedCamelContextTest.java +++ b/camel-core/src/test/java/org/apache/camel/management/ManagedCamelContextTest.java @@ -260,6 +260,11 @@ public class ManagedCamelContextTest extends ManagementTestSupport { new String[]{"java.lang.String", "boolean"}); assertNotNull(json); + // the loggerName option should come before the groupDelay option + int pos = json.indexOf("loggerName"); + int pos2 = json.indexOf("groupDelay"); + assertTrue("LoggerName should come before groupDelay", pos < pos2); + assertEquals(8, StringHelper.countChar(json, '{')); assertEquals(8, StringHelper.countChar(json, '}')); @@ -267,7 +272,7 @@ public class ManagedCamelContextTest extends ManagementTestSupport { assertTrue(json.contains("\"label\": \"core,monitoring\"")); assertTrue(json.contains("\"groupDelay\": { \"kind\": \"parameter\", \"type\": \"integer\", \"javaType\": \"java.lang.Long\", \"deprecated\": \"false\", \"value\": \"2000\"," - + " \"description\": \"Set the initial delay for stats (in millis)\" },")); + + " \"description\": \"Set the initial delay for stats (in millis)\" }")); assertTrue(json.contains("\"groupSize\": { \"kind\": \"parameter\", \"type\": \"integer\", \"javaType\": \"java.lang.Integer\", \"deprecated\": \"false\", \"value\": \"5\"," + " \"description\": \"An integer that specifies a group size for throughput logging.\" }")); assertTrue(json.contains("\"loggerName\": { \"kind\": \"path\", \"required\": \"true\", \"type\": \"string\", \"javaType\": \"java.lang.String\", \"deprecated\": \"false\"," @@ -290,6 +295,11 @@ public class ManagedCamelContextTest extends ManagementTestSupport { new String[]{"java.lang.String", "boolean"}); assertNotNull(json); + // the loggerName option should come before the groupDelay option + int pos = json.indexOf("loggerName"); + int pos2 = json.indexOf("groupDelay"); + assertTrue("LoggerName should come before groupDelay", pos < pos2); + assertEquals(14, StringHelper.countChar(json, '{')); assertEquals(14, StringHelper.countChar(json, '}')); @@ -297,7 +307,7 @@ public class ManagedCamelContextTest extends ManagementTestSupport { assertTrue(json.contains("\"label\": \"core,monitoring\"")); assertTrue(json.contains("\"groupDelay\": { \"kind\": \"parameter\", \"type\": \"integer\", \"javaType\": \"java.lang.Long\", \"deprecated\": \"false\", \"value\": \"2000\"," - + " \"description\": \"Set the initial delay for stats (in millis)\" },")); + + " \"description\": \"Set the initial delay for stats (in millis)\" }")); assertTrue(json.contains("\"groupSize\": { \"kind\": \"parameter\", \"type\": \"integer\", \"javaType\": \"java.lang.Integer\", \"deprecated\": \"false\", \"value\": \"5\"," + " \"description\": \"An integer that specifies a group size for throughput logging.\" }")); assertTrue(json.contains("\"loggerName\": { \"kind\": \"path\", \"required\": \"true\", \"type\": \"string\", \"javaType\": \"java.lang.String\", \"deprecated\": \"false\","