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 2023/08/16 18:52:44 UTC

[camel] branch main updated: Update jbang docs and regen

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 778bfafe11a Update jbang docs and regen
778bfafe11a is described below

commit 778bfafe11a532950433792ecaa3194af516485d
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Aug 16 20:52:31 2023 +0200

    Update jbang docs and regen
---
 .../modules/ROOT/pages/camel-jbang.adoc            | 16 +++++
 .../ROOT/pages/camel-report-maven-plugin.adoc      | 78 ++++++++++++++++++++--
 2 files changed, 87 insertions(+), 7 deletions(-)

diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
index 39d70b7e4f8..a4a97ebf10f 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
@@ -262,6 +262,22 @@ Then only the `jms:inbox` endpoint is stubbed.
 
 TIP: You can stub multiple components separated by comma, such as `--stub=jms,sql`
 
+Camel JBang comes with the `camel cmd stub` command that allows to list all endpoints which
+has been stubbed, and also browse any messages that are currently present in their internal queues.
+A stub endpoint is based on the `seda` component.
+
+[source,bash]
+----
+camel cmd stub
+----
+
+And to browse the messages:
+
+[source,bash]
+----
+camel cmd stub --browse
+----
+
 === Dev mode with live reload
 
 You can enable dev mode that comes with live reload of the route(s) when the source file is updated (saved),
diff --git a/docs/user-manual/modules/ROOT/pages/camel-report-maven-plugin.adoc b/docs/user-manual/modules/ROOT/pages/camel-report-maven-plugin.adoc
index 3b8338b2faa..5f83010137a 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-report-maven-plugin.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-report-maven-plugin.adoc
@@ -7,7 +7,7 @@ The Camel Report Maven Plugin supports the following goals
 
 == camel:validate
 
-For validating the source code for mis configured Camel:
+For validating the source code for mis-configured Camel:
 
 - endpoint uris
 - simple expressions or predicates
@@ -15,13 +15,13 @@ For validating the source code for mis configured Camel:
 - seda/direct endpoint pairs
 - configuration in properties files
 
-Then you can run the validate goal from the command line or from within your Java editor such as IDEA or Eclipse.
+Then you can run the `validate` goal from the command line or from within your Java editor such as IDEA or Eclipse.
 
 ----
 mvn camel-report:validate
 ----
 
-You can also enable the plugin to automatic run as part of the build to catch these errors.
+You can also enable the plugin to run automatically as part of the build to catch these errors.
 
 [source,xml]
 ----
@@ -64,6 +64,69 @@ changed accordingly to `process-test-classes` as shown below:
 </plugin>
 ----
 
+=== Running the goal on any Maven project
+
+You can also run the validate goal on any Maven project without having to add the plugin to the `pom.xml` file.
+Doing so requires to specify the plugin using its fully qualified name. For example to run the goal on
+the `camel-example-cdi` from Apache Camel you can run
+
+----
+$cd camel-example-cdi
+$mvn org.apache.camel:camel-report-maven-plugin:2.20.0:validate
+----
+
+which then runs and outputs the following:
+
+----
+[INFO] ------------------------------------------------------------------------
+[INFO] Building Camel :: Example :: CDI 3.0.0
+[INFO] ------------------------------------------------------------------------
+[INFO]
+[INFO] --- camel-report-maven-plugin:3.0.0:validate (default-cli) @ camel-example-cdi ---
+[INFO] Endpoint validation success: (4 = passed, 0 = invalid, 0 = incapable, 0 = unknown components)
+[INFO] Simple validation success: (0 = passed, 0 = invalid)
+[INFO] ------------------------------------------------------------------------
+[INFO] BUILD SUCCESS
+[INFO] ------------------------------------------------------------------------
+----
+
+The validation passed, and 4 endpoints was validated. Now suppose we made a typo in one of the Camel endpoint uris in the source code, such as:
+
+[source,java]
+----
+@Uri("timer:foo?period=5000")
+----
+
+
+is changed to include a typo error in the `period` option
+
+[source,java]
+----
+@Uri("timer:foo?perid=5000")
+----
+
+And when running the `validate` goal again reports the following:
+
+----
+[INFO] ------------------------------------------------------------------------
+[INFO] Building Camel :: Example :: CDI 3.0.0
+[INFO] ------------------------------------------------------------------------
+[INFO]
+[INFO] --- camel-report-maven-plugin:3.0.0:validate (default-cli) @ camel-example-cdi ---
+[WARNING] Endpoint validation error at: org.apache.camel.example.cdi.MyRoutes(MyRoutes.java:32)
+
+	timer:foo?perid=5000
+
+	                   perid    Unknown option. Did you mean: [period]
+
+
+[WARNING] Endpoint validation error: (3 = passed, 1 = invalid, 0 = incapable, 0 = unknown components)
+[INFO] Simple validation success: (0 = passed, 0 = invalid)
+[INFO] ------------------------------------------------------------------------
+[INFO] BUILD SUCCESS
+[INFO] ------------------------------------------------------------------------
+----
+
 === Options
 
 The maven plugin *validate* goal supports the following options which can be configured from the command line (use `-D` syntax), or defined in the `pom.xml` file in the `<configuration>` tag.
@@ -90,7 +153,7 @@ The maven plugin *validate* goal supports the following options which can be con
 | showAll | false | Whether to show all endpoints and simple expressions (both invalid and valid).
 |===
 
-For example to turn off ignoring usage of deprecated options from the command line, you can run:
+For example to turn on ignoring usage of deprecated options from the command line, you can run:
 
 ----
 $mvn camel-report:validate -Dcamel.ignoreDeprecated=true
@@ -113,9 +176,9 @@ $mvn org.apache.camel:camel-report-maven-plugin:3.0.0:validate -Dcamel.includeTe
 
 For generating a report of the coverage of your Camel routes from unit testing.
 In the same manner you can generate Java code coverage reports, then this is the same but for Camel routes.
-You can therefore use this to know which parts of your Camel routes has been used or not.
+You can therefore use this to know which parts of your Camel routes have been used or not.
 
-Camel uses JMX to capture metrics during tests which is used for calculating route coverage.
+Camel uses JMX to capture metrics during tests which are used for calculating route coverage.
 You must have `camel-management` JAR on the classpath (can be test scoped)
 such as by declaring the following Maven dependency in your pom.xml file:
 
@@ -264,6 +327,7 @@ The maven plugin *coverage* goal supports the following options which can be con
  By using route id's then its safer to match the route cover data with the route source code.
  Anonymous routes are less safe to use for route coverage as its harder to know exactly which route
  that was tested corresponds to which of the routes from the source code.
-| generateJacocoXmlReport | false | Whether to generate a coverage-report in Jacoco XML format, when enabled it will generate a file: `target/site/jacoco/xmlJacoco.xml`
+| generateJacocoXmlReport | false | Whether to generate a coverage-report in Jacoco XML format. When enabled it will generate the file: `target/site/jacoco/xmlJacoco.xml`
+| generateHtmlReport | false | Whether to generate a coverage-report in HTML format. When enabled it will generate the file: `target/site/route-coverage/html/index.html`
 |===