Repository: camel Updated Branches: refs/heads/camel-2.15.x 7b84f410e -> 594e11a49 refs/heads/camel-2.16.x 2d83364ac -> 3c613a666
CAMEL-9272. Add appid param as the user key is required since 9/10/2015 to access the openweathermap service Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3c613a66 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3c613a66 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3c613a66 Branch: refs/heads/camel-2.16.x Commit: 3c613a666d7b5ff3213a9ee3f0f2568d8f1bba7b Parents: 2d83364 Author: Charles Moulliard <cmoulli...@apache.org> Authored: Thu Oct 29 17:52:28 2015 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Fri Oct 30 07:41:45 2015 +0100 ---------------------------------------------------------------------- .../component/weather/WeatherConfiguration.java | 20 +++++++++++++++++++- .../CurrentWeatherMadridProducerTest.java | 4 +++- 2 files changed, 22 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/3c613a66/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConfiguration.java b/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConfiguration.java index c77f5f1..e0c87d6 100644 --- a/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConfiguration.java +++ b/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConfiguration.java @@ -52,6 +52,8 @@ public class WeatherConfiguration { private WeatherUnits units = METRIC; @UriParam private String headerName; + @UriParam + private String appid; public WeatherConfiguration(WeatherComponent component) { this.component = notNull(component, "component"); @@ -155,6 +157,18 @@ public class WeatherConfiguration { public void setLon(String lon) { this.lon = lon; } + + /** + * APPID ID used to authenticate the user connected to the API Server + */ + public void setAppid(String appid) { + this.appid = appid; + } + + public String getAppid() { + return appid; + } + public String getQuery() throws Exception { return getQuery(getLocation()); @@ -171,7 +185,7 @@ public class WeatherConfiguration { // assuming the location is a town or country location = "q=" + location; } - + if (isEmpty(getPeriod())) { answer += "weather?" + location; } else { @@ -188,6 +202,10 @@ public class WeatherConfiguration { answer += "&mode=" + getMode().name().toLowerCase(); } + if (getAppid() != null) { + answer += "&APPID=" + getAppid(); + } + return answer; } http://git-wip-us.apache.org/repos/asf/camel/blob/3c613a66/components/camel-weather/src/test/java/org/apache/camel/component/weather/CurrentWeatherMadridProducerTest.java ---------------------------------------------------------------------- diff --git a/components/camel-weather/src/test/java/org/apache/camel/component/weather/CurrentWeatherMadridProducerTest.java b/components/camel-weather/src/test/java/org/apache/camel/component/weather/CurrentWeatherMadridProducerTest.java index 9592513..61b7dc6 100644 --- a/components/camel-weather/src/test/java/org/apache/camel/component/weather/CurrentWeatherMadridProducerTest.java +++ b/components/camel-weather/src/test/java/org/apache/camel/component/weather/CurrentWeatherMadridProducerTest.java @@ -86,8 +86,10 @@ public class CurrentWeatherMadridProducerTest extends BaseWeatherConsumerTest { return new RouteBuilder() { @Override public void configure() throws Exception { + + /* The Camel Route uses the apache-camel appid to access the openweathermap service */ from("direct:start") - .to("weather:foo?location=Madrid,Spain") + .to("weather:foo?location=Madrid,Spain&appid=9162755b2efa555823cfe0451d7fff38") .to("mock:result"); } };