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

   ## Summary
   
   Fixes [CAMEL-25651](https://issues.apache.org/jira/browse/CAMEL-25651): when 
dumping routes to YAML, the \`LwModelToYAMLDumper\` was silently dropping 
context-scoped (top-level) \`errorHandler\`, \`intercept\`, \`interceptFrom\`, 
\`interceptSendToEndpoint\`, and \`onCompletion\` definitions, and was 
incorrectly emitting a top-level \`onCompletion\` as a step inside the route.
   
   ## Root cause
   
   \`LwModelToYAMLDumper\` only collected \`OnExceptionDefinition\` from route 
outputs, ignoring the other four constructs.  Additionally, 
\`InterceptReifier.createProcessor()\` removes plain \`intercept\` entries from 
\`route.getOutputs()\` during \`context.start()\`, making output-scanning 
insufficient even if added.
   
   ## Changes
   
   ### Model (`camel-core-model`)
   
   - **\`InterceptDefinition\` / \`InterceptSendToEndpointDefinition\`**: add 
\`@XmlTransient boolean routeScoped\` (default \`true\`) with getter/setter so 
the dumper can distinguish context-scoped intercepts from route-scoped ones.
   - **\`RouteDefinition\`**: add \`transient List<InterceptDefinition> 
contextScopedIntercepts\` with \`addContextScopedIntercept()\` accessor — a 
persistent reference that survives \`InterceptReifier\`'s removal from route 
outputs during context start.
   - **\`RouteDefinitionHelper.doInitInterceptors\`**: mark each context-scoped 
\`InterceptDefinition\` / \`InterceptSendToEndpointDefinition\` / 
\`InterceptFromDefinition\` / \`OnCompletionDefinition\` with 
\`routeScoped=false\`, and record context-scoped intercepts on the 
\`RouteDefinition\` before reification runs.
   
   ### Dumper (`camel-yaml-io`)
   
   - **\`LwModelToYAMLDumper\`**: new private helpers collect context-scoped 
instances of each construct (deduplicated across routes by identity), plus the 
context-level error handler from 
\`CamelContextExtension.getErrorHandlerFactory()\`. The \`roots\` list now 
emits them in canonical order — \`errorHandler → intercept → interceptFrom → 
interceptSendToEndpoint → onCompletion → onException → routes\` — before the 
route entries.
   
   ### Test (`camel-yaml-dsl`)
   
   - **\`ContextScopedTopLevelYamlDumpTest\`**: parameterized tests for all 
five constructs × \`{started=false, started=true}\`, plus round-trip (dump → 
reload → re-dump) validation.
   
   ## Test results
   
   696 tests run across \`camel-yaml-io\` and \`camel-yaml-dsl\`, 0 failures.


-- 
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