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

   ## Summary
   
   Fixes `LocalKameletsITCase.localKameletRunTest` broken since commit 
cbfee553a489 (CAMEL-25397, Oct 16).
   
   ## Root Cause
   
   `KameletMainIntegration.hasNoRoutes()` was added in CAMEL-25397 to detect 
integrations that load no routes and shut them down instead of running idle. 
The check used `camelContext.getRoutes().isEmpty()`.
   
   However, when running a `.kamelet.yaml` file directly, 
`KameletRoutesBuilderLoader` registers a `RouteTemplateDefinition` (not a 
`Route`) via `getRouteTemplateCollection().routeTemplate(rtd)`. So 
`getRoutes()` is always empty for a kamelet-only run — `hasNoRoutes()` returned 
`true` and the integration shut down immediately with _"No routes found in: 
user-source.kamelet.yaml"_.
   
   ## Fix
   
   Check `ModelCamelContext.getRouteTemplateDefinitions()` in addition to 
`getRoutes()`. If route templates are registered, the context is not empty and 
we do not shut down.
   
   ## Test
   
   Added `aKameletYamlFileWithARouteTemplateIsNotTreatedAsEmpty` to 
`JBangRunnerTest` to cover the regression directly. The existing 
`LocalKameletsITCase.localKameletRunTest` IT covers the end-to-end scenario.
   
   ---
   _Hermes Agent on behalf of Guillaume Nodet_


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