Camel component docs. Add group as a way of combining the options in a number of coheret groups based on their labels.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8fcc242f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8fcc242f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8fcc242f Branch: refs/heads/camel-2.16.x Commit: 8fcc242f270b1e7f36dbb0ca5da40933fd1bf937 Parents: ded4d3a Author: Claus Ibsen <davscl...@apache.org> Authored: Wed Nov 11 20:54:01 2015 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Thu Nov 12 09:20:30 2015 +0100 ---------------------------------------------------------------------- .../camel/tools/apt/helper/EndpointHelper.java | 14 ++++++++++---- .../tools/apt/EndpointOptionComparatorTest.java | 16 ++++++++-------- 2 files changed, 18 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/8fcc242f/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/EndpointHelper.java ---------------------------------------------------------------------- diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/EndpointHelper.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/EndpointHelper.java index b9c6eb6..a7dc35d 100644 --- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/EndpointHelper.java +++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/EndpointHelper.java @@ -49,11 +49,17 @@ public final class EndpointHelper { if (!Strings.isNullOrEmpty(value)) { // we want to put advanced into own group, so look for a label that has advanced as prefix x,advanced => x (advanced) - value = value.replaceFirst("(\\w),(advanced)", "$1 (advanced)"); + if (value.contains("advanced")) { + value = value.replaceFirst("(\\w),(advanced)", "$1 (advanced)"); + } - String[] array = value.split(","); - // grab last label which is the most specific label we want to use for the tab - answer = array[array.length - 1]; + if (value.contains(",")) { + String[] array = value.split(","); + // grab last label which is the most specific label we want to use for the tab + answer = array[array.length - 1]; + } else { + answer = value; + } // if we are in consumer/producer only mode, then enrich the advanced label to indicate its advanced of those if (answer.equals("advanced") && consumerOnly) { answer = "consumer (advanced)"; http://git-wip-us.apache.org/repos/asf/camel/blob/8fcc242f/tooling/apt/src/test/java/org/apache/camel/tools/apt/EndpointOptionComparatorTest.java ---------------------------------------------------------------------- diff --git a/tooling/apt/src/test/java/org/apache/camel/tools/apt/EndpointOptionComparatorTest.java b/tooling/apt/src/test/java/org/apache/camel/tools/apt/EndpointOptionComparatorTest.java index 85bfaa5..ceb834f 100644 --- a/tooling/apt/src/test/java/org/apache/camel/tools/apt/EndpointOptionComparatorTest.java +++ b/tooling/apt/src/test/java/org/apache/camel/tools/apt/EndpointOptionComparatorTest.java @@ -39,10 +39,10 @@ public class EndpointOptionComparatorTest { String group3 = EndpointHelper.labelAsGroupName(label3, false, false); String group4 = EndpointHelper.labelAsGroupName(label4, false, false); - EndpointOption op1 = new EndpointOption("aaa", "string", "true", "", "", "blah", false, group1, label1, false, null); - EndpointOption op2 = new EndpointOption("ccc", "string", "true", "", "", "blah", false, group2, label2, false, null); - EndpointOption op3 = new EndpointOption("ddd", "string", "true", "", "", "blah", false, group3, label3, false, null); - EndpointOption op4 = new EndpointOption("bbb", "string", "true", "", "", "blah", false, group4, label4, false, null); + EndpointOption op1 = new EndpointOption("first", "string", "true", "", "", "blah", false, group1, label1, false, null); + EndpointOption op2 = new EndpointOption("synchronous", "string", "true", "", "", "blah", false, group2, label2, false, null); + EndpointOption op3 = new EndpointOption("second", "string", "true", "", "", "blah", false, group3, label3, false, null); + EndpointOption op4 = new EndpointOption("country", "string", "true", "", "", "blah", false, group4, label4, false, null); List<EndpointOption> list = new ArrayList<EndpointOption>(); list.add(op1); @@ -53,9 +53,9 @@ public class EndpointOptionComparatorTest { // then by label into the groups Collections.sort(list, EndpointHelper.createGroupAndLabelComparator()); - assertEquals("aaa", list.get(0).getName()); - assertEquals("ddd", list.get(1).getName()); - assertEquals("bbb", list.get(2).getName()); - assertEquals("ccc", list.get(3).getName()); + assertEquals("first", list.get(0).getName()); // common + assertEquals("second", list.get(1).getName()); // common + assertEquals("synchronous", list.get(2).getName()); // advanced + assertEquals("country", list.get(3).getName()); // filter } }