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

   Part of #3261: Citrus tests for the Transformation, JSON and EIP actions 
that had none. They come before #3117 adds data types to these Kamelets. Each 
test records the body type and the `Content-Type` that the Kamelet gives now, 
so the #3117 PR shows in its diff what changes.
   
   ### The tests
   
   Each test sends one message from `timer:` through the Kamelet to the Citrus 
HTTP server, and checks the body there. Right after the Kamelet, the route 
copies two things into headers, so the test can check them:
   - `X-Body-Type`: the Java type of the body;
   - `X-Content-Type`: the `Content-Type` header (`ct=` when it is not set).
   
   | Kamelet | Test | Body after the Kamelet |
   |---|---|---|
   | `freemarker-template-action`, `velocity-template-action`, 
`mustache-template-action`, `mvel-template-action`, `string-template-action` | 
A template file with the body and a header: `Dear Ann, your order ORD-1 has 
shipped.` | `String` |
   | `jolt-transformation-action` | A shift of JSON text: 
`{"customer":"Ann","prices":[2,3]}` | `LinkedHashMap` |
   | `jslt-action` | JSON text and a header: 
`{"customer":"Ann","source":"web"}` | `String` |
   | `pdf-action` | Two lines of text give a PDF (`%PDF-`) | 
`ByteArrayOutputStream` |
   | `xj-template-action` | `JSON2XML` with a stylesheet: 
`<order><customer>Ann</customer></order>` | `String` |
   | `json-serialize-action` | Parsed JSON from `json-deserialize-action` gives 
JSON text, `Content-Type: application/json` | `InputStreamCache` |
   | `jsonata-action` | Parsed JSON: `{"customer":"Ann","total":5}` | 
`ObjectNode` |
   | `json-schema-validator-action` | A message that breaks the schema fails 
with `JSON validation error`; the next one passes unchanged | `String` |
   | `drop-header-action` | `name: X-DROP` removes `x-drop` (not 
case-sensitive) and keeps `x-keep` | |
   | `drop-headers-action` | `pattern: x-tmp-*` with `excludePattern: 
x-tmp-keep` | |
   | `header-matches-filter-action` | `x-order-1` is dropped, as the expression 
must match the whole value; `order-2` passes | |
   
   The template files are in `templates/` next to the tests, and `camel run` 
gets them through `resources:`, so the Kamelets load them with `classpath:`. 
The JSON tests are in a new `json` package, with its factory in `CommonIT`.
   
   Both `pdf-action` (`ByteArrayOutputStream`) and `jolt-transformation-action` 
(a `Map`) give a body that the next step may not expect. #3117 will decide 
their data types.
   
   Two routes send two messages, and branch on `CamelTimerCounter`. The `timer` 
component only sets that property with `includeMetadata: true`, so these routes 
set it.
   
   The `camel.apache.org/kamelet.verified` label is left for a separate PR, 
which will set it on every Kamelet with a passing test. Today many tested 
Kamelets, such as `hoist-field-action`, do not have it.
   
   ### Tests
   `CommonIT#transformation+json+header+filter+xj`: 28 of 28 pass, the 15 new 
tests among them. `./mvnw clean install` from the root passes.
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 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