You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by cm...@apache.org on 2015/10/29 17:52:39 UTC
camel git commit: CAMEL-9272. Add appid param as the user key is
required since 9/10/2015 to access the openweathermap service
Repository: camel
Updated Branches:
refs/heads/master 6cefe5eeb -> a7c8c5c97
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/a7c8c5c9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a7c8c5c9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a7c8c5c9
Branch: refs/heads/master
Commit: a7c8c5c971dfa293ff0cd9ba39284aaf24a69fa4
Parents: 6cefe5e
Author: Charles Moulliard <cm...@apache.org>
Authored: Thu Oct 29 17:52:28 2015 +0100
Committer: Charles Moulliard <cm...@apache.org>
Committed: Thu Oct 29 17:52:28 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/a7c8c5c9/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/a7c8c5c9/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");
}
};