You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/10/05 14:04:56 UTC

[GitHub] [camel] zbendhiba opened a new pull request #4363: CAMEL-15632: Geocoder - Mock API google Maps when no API key available

zbendhiba opened a new pull request #4363:
URL: https://github.com/apache/camel/pull/4363


   - enabling tests units in Geocoder component while not possible to call API.
   - I've added a wrapper, to mock the request call within the google maps API.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] ppalaga commented on pull request #4363: CAMEL-15632: Geocoder - Mock API google Maps when no API key available

Posted by GitBox <gi...@apache.org>.
ppalaga commented on pull request #4363:
URL: https://github.com/apache/camel/pull/4363#issuecomment-704154916


   > If you have ideas on how I can mock that URL or call, or how we can use a mock proxy to redirect to another URL, as described here [googlemaps/google-maps-services-java#132](https://github.com/googlemaps/google-maps-services-java/issues/132).
   
   I think the proxy solution could work for us in Camel Quarkus without any change here in Camel. The rough idea is as follows:
   
   * Have a set of HTTP endpoints on `localhost:somePort` that would return the pre-recorded JSONs as you have them here. This can be done using `platform-http` as we do in telegram: https://github.com/apache/camel-quarkus/blob/master/integration-tests/telegram/src/main/java/org/apache/camel/quarkus/component/telegram/it/TelegramRoutes.java#L75-L93
   * Set the geocoder component's proxy options to `localhost:somePort`. This would be done only if `GOOGLE_API_KEY` is not set, so that we test against the real remote API if GOOGLE_API_KEY is available. Again, this would be similar to what we do in Telegram: https://github.com/apache/camel-quarkus/blob/master/integration-tests/telegram/src/main/java/org/apache/camel/quarkus/component/telegram/it/TelegramRoutes.java#L55-L71
   
   That might do what we need. WDYT?


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] zbendhiba commented on pull request #4363: CAMEL-15632: Geocoder - Mock API google Maps when no API key available

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on pull request #4363:
URL: https://github.com/apache/camel/pull/4363#issuecomment-704157720


   @ppalaga  I'll try that option


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] zbendhiba commented on pull request #4363: CAMEL-15632: Geocoder - Mock API google Maps when no API key available

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on pull request #4363:
URL: https://github.com/apache/camel/pull/4363#issuecomment-704096887


   If you have ideas on how I can mock that URL or call, or how we can use a mock proxy to redirect  to another URL, as described here https://github.com/googlemaps/google-maps-services-java/issues/132.
   For camel-quarkus, it would be cool if you can test the API, since it needs reflection. So that we can check that newer versions of the API are still compatible with native mode. With this solution, I have some part of the API tested + the response classes that needed reflection, but not the call of the API and parsing the response.
   Also it would be nice to test our producer, since we just ignore the tests completely.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] ppalaga commented on pull request #4363: CAMEL-15632: Geocoder - Mock API google Maps when no API key available

Posted by GitBox <gi...@apache.org>.
ppalaga commented on pull request #4363:
URL: https://github.com/apache/camel/pull/4363#issuecomment-703695757


   Being able to test an API client component like this without accessing the actual remote API is a good thing and we'd definitely like to utilize that option in Camel Quarkus. The question is only where in the stack should the mocking happen. The current proposal 36fe01b does that inside the Camel component, thus fully circumventing the Google API client and the HTTP communication. I think that esp. when testing Camel Quarkus native mode, keeping the Google API client and the HTTP communication in game is very important and thus the mocking should happen on the remote side of the REST API. So what I think we'd need is a way to switch the URI base of the Google API client. 


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] zbendhiba closed pull request #4363: CAMEL-15632: Geocoder - Mock API google Maps when no API key available

Posted by GitBox <gi...@apache.org>.
zbendhiba closed pull request #4363:
URL: https://github.com/apache/camel/pull/4363


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org