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

   `DumpModelAsYamlUriAsParametersTest` fails on main: since CAMEL-25381 
(#27449) the YAML route dump writes the query options of an endpoint sorted 
a..z instead of in the order the route has them. The dump sorted them to stay 
idempotent, because the YAML DSL itself built the endpoint uri from 
`parameters:` with the options sorted (`TreeMap` in `YamlSupport` and in 
`EndpointUriFactorySupport.buildQueryParameters`).
   
   This fixes the order where the uri is built, so the dump can keep the 
written order and still be idempotent.
   
   ## Changes
   
   - `EndpointUriFactorySupport` (camel-support): `buildUri` keeps the order of 
an ordered map (`LinkedHashMap`, `SortedMap`) and sorts a map without an order 
(`HashMap`) a..z as before. The options of a multi valued map are put where the 
map option is, in the order of that map (sorted when it has none).
   - `endpoint-uri-factory.vm` + the 393 generated `*EndpointUriFactory` 
classes: copy the properties with `copyParameters(properties)` instead of `new 
HashMap<>(properties)`, which lost the order.
   - `AbstractCamelCatalog.asEndpointUri`: same rule; the order is decided on 
the caller's map before the `log` component filtering repackages it.
   - `YamlSupport` (camel-yaml-dsl-common): builds the query in the order the 
parameters are written.
   - `YamlModelWriterSupport` (camel-yaml-io): no longer sorts the options of a 
dump.
   - Upgrade guide 4.23: endpoint parameters keep the order they are written in.
   
   The endpoint resolved is the same, as Camel sorts the options when it 
normalizes the uri. Callers passing a `HashMap` (toD/pollEnrich dynamic-aware, 
rest component, CLI) get the same uri as before.
   
   ## Tests
   
   - `DumpModelAsYamlUriAsParametersTest` passes again.
   - `CustomEndpointUriFactoryTest`: tests that asserted a `LinkedHashMap` is 
sorted now assert insertion order; added a `HashMap` (sorted) test and an 
ordered multi valued test.
   - `CamelCatalogTest`: added `testAsEndpointUriInsertionOrder`.
   - Ran camel-core (endpoint uri / toD / pollEnrich / catalog / dump tests), 
camel-catalog, camel-yaml-io, camel-yaml-dsl and camel-jbang normalize tests: 
all green.
   
   _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