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

   Fixes [CAMEL-26133](https://issues.apache.org/jira/browse/CAMEL-26133).
   
   ### 1. The consumer can never deliver
   
   **What was wrong:** the consumer polls with an empty exchange (null body). 
`RobotFrameworkCamelUtils.createRobotVariablesFromCamelExchange` converted the 
body with `mandatoryConvertTo(String.class, ...)`, so every poll failed with 
`NoTypeConversionAvailableException` and no test ever ran.
   
   **What changed:** a null body is not passed as a robot variable.
   
   **Test:** new `RobotFrameworkConsumerTest` (`repeatCount=1`) expects one 
exchange with `CamelRobotReturnCode` 0. It failed before the fix (no exchange 
arrived).
   
   ### 2. The producer fails on a null body or any null header, variable or 
property
   
   **What was wrong:** the same `mandatoryConvertTo` was used for every header, 
variable and exchange property, so one null value failed the exchange. The doc 
examples that set only a header or only a property (no body) failed for this 
reason.
   
   **What changed:** null values are skipped. A Robot Framework variable cannot 
be null, and skipping (rather than passing an empty string) keeps "no value" 
apart from "empty value": the robot test can give the variable a default in its 
own `*** Variables ***` table, as the `-v` values from Camel override that 
table.
   
   **Related bug fixed in the same method:** a nested map value (such as a 
header that is a `Map`) added its first entry twice, and an empty nested map 
added a variable with no value (`headers.inner`). The map walk is rewritten to 
add each entry once and to pass the name as a plain prefix instead of a shared 
`StringBuilder`.
   
   **Tests:** `RobotFrameworkCamelUtilsTest` gets three unit tests (null body, 
null header/property/variable incl. inside a nested map, nested map entries 
added once); `RobotFrameworkComponentTest` gets a producer test with no body 
and null header and property, against a new robot file that checks the default 
`${body}` and that the null ones do not exist. All failed before the fix.
   
   ### 3. The doc examples put the body into an evaluated expression
   
   **What changed:** the examples use `Should Be Equal    ${myvar}    ${body}` 
instead of `Should Be True    ${myvar} == ${body}`, with a note that the values 
should be compared as strings and not be put into an expression Robot Framework 
evaluates as Python (`Should Be True`, `Evaluate`). While there: fixed the 
`.setProperty"testProperty"` typo, added `allowContextMapAll=true` to the 
property example (properties are only passed with it), and documented the 
`variables.name` variables and the null handling.
   
   ### Generated files
   
   The `@BodyTypes` producer description no longer says a null value fails the 
exchange. Regenerated `robotframework.json` and copied it plus the component 
doc into `catalog/camel-catalog`.
   
   ### Not changed
   
   No upgrade-guide entry: the change turns failures into working exchanges; 
the `CamelRobotVariables` header no longer has the duplicated nested entry.
   
   Module build `mvn clean install -Psourcecheck`: 14 tests, all pass.
   
   _Claude Code on behalf of Claus Ibsen (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