davsclaus opened a new pull request, #28182:
URL: https://github.com/apache/camel/pull/28182

   The route coverage dump of the tests gets the body types each step has been 
reached with in #28181, when the tests run with the message history on. This PR 
lets the `route-coverage` goal of the camel-report-maven-plugin show them.
   
   ```
   mvn camel-report:route-coverage -Dcamel.bodyTypes=true
   ```
   
   ```
     Line #       Count    Route          Body types
     ------       -----    -----          ----------
          3           2    from
          4           2      unmarshal    String
          7           2      to           LinkedHashMap | String (data and 
payload)
   ```
   
   The kinds are added when a step was reached with bodies of more than one 
kind. Then some messages bring data where others bring a payload, which is the 
step that needs attention. Without the option the table is unchanged.
   
   ## How
   
   - **camel-route-parser:**
     - `CoverageData` gets `bodyTypes` and `bodyKinds`;
     - `RouteCoverageHelper` reads them from the dump. Each test writes a dump 
file, and the helper already merges them per step by summing the counts; the 
body types are merged too, as the union in the order first seen.
   - **camel-report-maven-plugin:**
     - `RouteCoverageNode` carries them, including through the anonymous-route 
merge;
     - the table moves into `printTable`, which adds the "Body types" column 
with the `bodyTypes` option (`camel.bodyTypes`);
     - when the option is on but no dump has body types, the goal says how to 
get them (the message history on, Camel 4.24 or newer).
   - **Docs:** a "Showing the body types" section and the option, in the plugin 
page and its copy in the module (they were identical, and still are).
   
   It only reads optional XML attributes, so it works from main, independent of 
the stacked #28180/#28181. With an older dump it shows nothing extra.
   
   ## Tests
   
   - New `RouteCoverageHelperTest` (camel-route-parser): two dump files of one 
route (one test sent text, the other data) give the summed counts and the union 
of the body types; a dump without them.
   - New `RouteCoverageBodyTypesTest` (camel-report-maven-plugin): the column, 
the alignment, the kinds, and the table without the option.
   - **End to end:** I ran the goal, from a scratch local repository, on a 
throwaway project with an XML route and a dump file. The output above is from 
that run, and without the option the table was unchanged.
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to