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

   # Description
   
   [CAMEL-27612](https://issues.apache.org/jira/browse/CAMEL-27612)
   
   The ticket lists five problems of camel-weather found while the option 
descriptions were written for CAMEL-23832 (#30948). I checked each one against 
main and all five are real. Four are fixed in full. For the fifth I fixed the 
comment and left out the new enum value.
   
   Fixed:
   1. **The consumer polled every 500 ms instead of once an hour.** 
`createConsumer()` set the one-hour delay, and then 
`ScheduledPollEndpoint.doConfigureConsumer()` replaced it with its own 500 ms 
default, because the `delay` of the endpoint was not set. The endpoint now has 
its own `delay` option with the one-hour default (3600000) and sets it in the 
constructor, as `MailEndpoint` and `SlackEndpoint` do. The metadata and the doc 
page now match the code.
   2. **The endpoint closed the httpClient on stop, also a client set by the 
user.** The default client was also created only once, in a field initializer, 
so an endpoint restarted after a stop used a closed client. The endpoint now 
creates the default client in `doInit()` and creates it again in `doStart()` 
after a stop. It closes only a client it created. (`doInit()` is needed because 
the producer builds its query when it is created, and that query can call the 
geolocation provider.)
   3. **weatherApi Hourly and Daily did nothing without period.** They now 
query the hourly or the daily forecast, with the length OpenWeatherMap uses by 
default, also for a single `ids` value. `Current` and `Station` are unchanged.
   4. **geolocationAccessKey and geolocationRequestHostIP were marked 
required.** That marker is removed, since they are only used when the location 
comes from the geolocation provider.
   5. **The units comment was wrong.** The comment in `WeatherQuery` is fixed: 
without `units`, OpenWeatherMap uses standard units (Kelvin). I did not add 
`STANDARD` to `WeatherUnits`, because leaving `units` unset already gives 
standard units, and #30948 documents that in the option description.
   
   Not changed:
   - `FeedEndpoint` in camel-atom, which the ticket says may have the problem 
of point 1. It is outside camel-weather and can get its own ticket.
   - `weatherApi=Current` with `period` still gives the daily forecast, as 
before. The ticket only notes this and does not propose a change.
   
   Behaviour changes for points 1, 2 and 3 are in the 4.24 upgrade guide.
   
   This touches the same generated files as #30948. Whichever is merged second 
needs a small rebase. The `httpClient` description in #30948 says the endpoint 
closes a client that is set, which is no longer true after this change.
   
   Tests (new `WeatherEndpointDefaultsTest`, no call to OpenWeatherMap):
   - the consumer delay is one hour by default, and `delay=2000` still sets it
   - a client that is set is not closed on stop
   - a restarted endpoint gets a new open client
   - Hourly and Daily without period query the forecast (with location and with 
one id), and Current or no `weatherApi` still query the current weather
   
   Against the main sources 5 of the 7 fail (delay 500, client closed, same 
closed client after restart, `weather?` query for Hourly and Daily). The 
`delay=2000` and current-weather tests pass on main too, as intended.
   
   Results (offline, module build of camel-weather, test phase): 27 unit tests 
run, 0 failures, 0 errors, 15 skipped. The skipped ones are `WeatherQueryTest`, 
which is off unless `enable.weather.tests=true`; I ran it with that property 
and its 15 tests pass. The new test class passes 5 runs in a row.
   
   Generated files: `weather.json` of the component and its catalog copy, the 
endpoint configurer, and `WeatherEndpointBuilderFactory`.
   
   Note for #30948 (CAMEL-23832 descriptions): its sentence "without period, 
Hourly and Daily get the current weather" no longer holds with this change, so 
whichever of the two PRs merges second should adjust it.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it): 
[CAMEL-27612](https://issues.apache.org/jira/browse/CAMEL-27612).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
     (I built camel-weather and ran its unit tests, and committed its 
regenerated files. The catalog copy and the endpoint DSL were regenerated from 
that JSON with the camel-package-maven-plugin DSL goal. I did not run the full 
root build.)
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
     This PR was prepared with Claude Code (Claude Opus 5.5). The commit 
carries a `Co-Authored-By` trailer.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 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