You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/11/06 10:58:34 UTC

[camel] branch master updated (2a4038c -> 3172a41)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 2a4038c  CAMEL-11987: skip unknown field types in Salesf...
     new 59d5a62  CAMEL-11959: Add new camel-yql component
     new 971bc32  Fix log4j2 properties wrong file name
     new 2599599  Change the way default configuration is setup
     new b490da3  Add connection pool to yql component
     new 709a67c  Add connection manager for http requests and improve yql config
     new bef1ea4  Add remaining YQL options and update doc and javadoc
     new 7d83103  Improve tests
     new 1489b6a  Update endpoint label
     new 60d4aea  Fixed CS. This closes #2070
     new 39abde2  CAMEL-11959: Polished.
     new 17e61e4  CAMEL-11959: Polished.
     new 3172a41  CAMEL-11959: Added itest and karaf feature

The 12 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 apache-camel/pom.xml                               |  19 ++
 apache-camel/src/main/descriptors/common-bin.xml   |   2 +
 bom/camel-bom/pom.xml                              |   5 +
 components/camel-yql/pom.xml                       | 116 ++++++++++
 .../camel-yql/src/main/docs/yql-component.adoc     | 236 +++++++++++++++++++++
 .../apache/camel/component/yql/YqlComponent.java   |  74 +++++++
 .../apache/camel/component/yql/YqlEndpoint.java    |  83 ++++++++
 .../apache/camel/component/yql/YqlProducer.java    |  57 +++++
 .../camel/component/yql/client/YqlClient.java      |  88 ++++++++
 .../camel/component/yql/client/YqlResponse.java    |  74 +++++++
 .../yql/configuration/YqlConfiguration.java        | 176 +++++++++++++++
 .../configuration/YqlConfigurationValidator.java   |  44 ++++
 .../component/yql/exception/YqlException.java      |  24 +++
 .../component/yql/exception/YqlHttpException.java  |  50 +++++
 .../camel-yql/src/main/resources}/LICENSE.txt      |   0
 .../services/org/apache/camel/component/yql        |  18 ++
 .../camel-yql/src/main/resources}/NOTICE.txt       |   0
 .../component/yql/YqlComponentIntegrationTest.java | 163 ++++++++++++++
 .../camel/component/yql/YqlComponentTest.java      | 110 ++++++++++
 .../YqlConfigurationValidatorTest.java             | 133 ++++++++++++
 .../camel-yql/src/test/resources/log4j2.properties |  33 +++
 components/pom.xml                                 |   1 +
 components/readme.adoc                             |   5 +-
 docs/user-manual/en/SUMMARY.md                     |   1 +
 parent/pom.xml                                     |  10 +
 .../karaf/features/src/main/resources/features.xml |   8 +
 .../components-starter/camel-yql-starter/pom.xml   |  61 ++++++
 .../springboot/YqlComponentAutoConfiguration.java  | 128 +++++++++++
 .../yql/springboot/YqlComponentConfiguration.java  |  66 ++++++
 .../src/main/resources/META-INF/LICENSE.txt        |   0
 .../src/main/resources/META-INF/NOTICE.txt         |   0
 .../src/main/resources/META-INF/spring.factories   |  19 ++
 .../src/main/resources/META-INF/spring.provides    |  17 ++
 platforms/spring-boot/components-starter/pom.xml   |   1 +
 .../camel-spring-boot-dependencies/pom.xml         |  10 +
 .../org/apache/camel/itest/karaf/CamelYqlTest.java |  34 +++
 .../camel/itest/springboot/CamelYqlTest.java       |  47 ++++
 37 files changed, 1912 insertions(+), 1 deletion(-)
 create mode 100644 components/camel-yql/pom.xml
 create mode 100644 components/camel-yql/src/main/docs/yql-component.adoc
 create mode 100644 components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
 create mode 100644 components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlEndpoint.java
 create mode 100644 components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlProducer.java
 create mode 100644 components/camel-yql/src/main/java/org/apache/camel/component/yql/client/YqlClient.java
 create mode 100644 components/camel-yql/src/main/java/org/apache/camel/component/yql/client/YqlResponse.java
 create mode 100644 components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java
 create mode 100644 components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfigurationValidator.java
 create mode 100644 components/camel-yql/src/main/java/org/apache/camel/component/yql/exception/YqlException.java
 create mode 100644 components/camel-yql/src/main/java/org/apache/camel/component/yql/exception/YqlHttpException.java
 copy {tooling/maven/guice-maven-plugin/src/main/resources/META-INF => components/camel-yql/src/main/resources}/LICENSE.txt (100%)
 create mode 100644 components/camel-yql/src/main/resources/META-INF/services/org/apache/camel/component/yql
 copy {tooling/maven/guice-maven-plugin/src/main/resources/META-INF => components/camel-yql/src/main/resources}/NOTICE.txt (100%)
 create mode 100644 components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentIntegrationTest.java
 create mode 100644 components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentTest.java
 create mode 100644 components/camel-yql/src/test/java/org/apache/camel/component/yql/configuration/YqlConfigurationValidatorTest.java
 create mode 100644 components/camel-yql/src/test/resources/log4j2.properties
 create mode 100644 platforms/spring-boot/components-starter/camel-yql-starter/pom.xml
 create mode 100644 platforms/spring-boot/components-starter/camel-yql-starter/src/main/java/org/apache/camel/component/yql/springboot/YqlComponentAutoConfiguration.java
 create mode 100644 platforms/spring-boot/components-starter/camel-yql-starter/src/main/java/org/apache/camel/component/yql/springboot/YqlComponentConfiguration.java
 copy {tooling/maven/guice-maven-plugin => platforms/spring-boot/components-starter/camel-yql-starter}/src/main/resources/META-INF/LICENSE.txt (100%)
 copy {tooling/maven/guice-maven-plugin => platforms/spring-boot/components-starter/camel-yql-starter}/src/main/resources/META-INF/NOTICE.txt (100%)
 create mode 100644 platforms/spring-boot/components-starter/camel-yql-starter/src/main/resources/META-INF/spring.factories
 create mode 100644 platforms/spring-boot/components-starter/camel-yql-starter/src/main/resources/META-INF/spring.provides
 create mode 100644 tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelYqlTest.java
 create mode 100644 tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelYqlTest.java

-- 
To stop receiving notification emails like this one, please contact
['"commits@camel.apache.org" <co...@camel.apache.org>'].

[camel] 10/12: CAMEL-11959: Polished.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 39abde2caa0d0f8b41014abfff906c7fd3bd94b3
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Nov 6 11:14:19 2017 +0100

    CAMEL-11959: Polished.
---
 .../camel-yql/src/main/docs/yql-component.adoc     | 72 ++++++++++------------
 .../camel/component/yql/YqlComponentTest.java      |  5 +-
 .../camel-yql/src/test/resources/log4j2.properties |  2 +-
 3 files changed, 35 insertions(+), 44 deletions(-)

diff --git a/components/camel-yql/src/main/docs/yql-component.adoc b/components/camel-yql/src/main/docs/yql-component.adoc
index 8319a89..43780f8 100644
--- a/components/camel-yql/src/main/docs/yql-component.adoc
+++ b/components/camel-yql/src/main/docs/yql-component.adoc
@@ -17,16 +17,15 @@ for this component:
 </dependency>
 ------------------------------------------------------------
 
-### URI format
+=== URI format
 
-[source,java]
---------------------------------------------
+----
 yql://query[?options]
---------------------------------------------
+----
 
 Where *query* represents the YQL query.
 
-### Options
+=== Options
 
 // component options: START
 The Yahoo Query Language component supports 2 options which are listed below.
@@ -69,43 +68,43 @@ with the following path and query parameters:
 | *diagnostics* (producer) | If true diagnostic information is returned with the response. | false | boolean
 | *env* (producer) | Allows you to use multiple Open Data Tables through a YQL environment file. More information https://developer.yahoo.com/yql/guide/yql_storage.htmlusing-records-env-files= |  | String
 | *format* (producer) | The expected format. Allowed values: xml or json. | json | String
-| *https* (producer) | Option to use HTTPS to communicate with YQL. | true | boolean
 | *jsonCompat* (producer) | Enables lossless JSON processing. The only allowed value is new. More information https://developer.yahoo.com/yql/guide/response.htmljson-to-json= |  | String
 | *throwExceptionOnFailure* (producer) | Option to disable throwing the YqlHttpException in case of failed responses from the remote server. This allows you to get all responses regardless of the HTTP status code. | true | boolean
 | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean
+| *https* (security) | Option to use HTTPS to communicate with YQL. | true | boolean
 |===
 // endpoint options: END
 
-### Exchange data format
+=== Exchange data format
 
 Camel will deliver the body as a JSON or XML formatted java.lang.String (see
 the `format` option above).
 
-### Message Headers
+=== Message Headers
 
 [width="100%",cols="10%,90%",options="header",]
-|=======================================================================
+|===
 |Header |Description
 |`CamelYqlHttpRequest` | Original HTTP request sent to YQL.
 |`CamelYqlHttpStatus` | Status code from the response.
-|=======================================================================
+|===
 
-### Samples
+=== Samples
 
-# Sample 1
+==== Sample 1
 
 In this example we query YQL to obtain the current wind and atmosphere data in Chicago:
 
 [source,java]
---------------------------------------------------------
+----
 from("direct:start")
   .to("yql://select wind, atmosphere from weather.forecast where woeid in (select woeid from geo.places(1) where text='chicago, il'");
---------------------------------------------------------
+----
 
 Which will setup the body as:
 
 [source,json]
---------------------------------------------------------
+----
 {
    "query":{
       "count":1,
@@ -128,31 +127,31 @@ Which will setup the body as:
       }
    }
 }
---------------------------------------------------------
+----
 
 and the headers:
 
 [width="100%",cols="30%,70%",options="header",]
-|=======================================================================
+|===
 |Header |Value
 |`CamelYqlHttpRequest` |https://query.yahooapis.com/v1/public/yql?q=select+wind%2C+atmosphere+from+weather.forecast+where+woeid+in+%28select+woeid+from+geo.places%281%29+where+text%3D%22chicago%2C+il%22%29&format=json&callback=&diagnostics=false&debug=false
 |`CamelYqlHttpStatus` |200
-|=======================================================================
+|===
 
-# Sample 2
+==== Sample 2
 
 In this example we query YQL to obtain the Google quote.
 
 [source,java]
---------------------------------------------------------
+----
 from("direct:start")
   .to("yql://select symbol, Ask, Bid, AverageDailyVolume from yahoo.finance.quotes where symbol in ('GOOG')?env=store://datatables.org/alltableswithkeys&https=false&callback=yqlCallback");
---------------------------------------------------------
+----
 
 Which will setup the body as:
 
 [source,json]
---------------------------------------------------------
+----
 /**/yqlCallback({
    "query":{
       "count":1,
@@ -168,31 +167,31 @@ Which will setup the body as:
       }
    }
 });
---------------------------------------------------------
+----
 
 and the headers:
 
 [width="100%",cols="30%,70%",options="header",]
-|=======================================================================
+|===
 |Header |Value
 |`CamelYqlHttpRequest` |http://query.yahooapis.com/v1/public/yql?q=select+symbol%2C+Ask%2C+Bid%2C+AverageDailyVolume+from+yahoo.finance.quotes+where+symbol+in+%28%27GOOG%27%29&format=json&callback=yqlCallback&diagnostics=false&debug=false&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys
 |`CamelYqlHttpStatus` |200
-|=======================================================================
+|===
 
-# Sample 3
+==== Sample 3
 
 In this example we query YQL to obtain one book written by Barack Obama
 
 [source,java]
---------------------------------------------------------
+----
 from("direct:start")
   .to("yql://select * from google.books where q='barack obama' and maxResults=1?format=xml&crossProduct=optimized&env=store://datatables.org/alltableswithkeys");
---------------------------------------------------------
+----
 
 Which will setup the body as:
 
 [source,xml]
---------------------------------------------------------
+----
 <?xml version="1.0" encoding="UTF-8"?>
 <query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="1" yahoo:created="2017-11-01T20:32:22Z" yahoo:lang="en-US">
    <results>
@@ -217,22 +216,17 @@ Which will setup the body as:
    </results>
 </query>
 <!-- total: 646 -->
---------------------------------------------------------
+----
 
 and the headers:
 
 [width="100%",cols="30%,70%",options="header",]
-|=======================================================================
+|===
 |Header |Value
 |`CamelYqlHttpRequest` |https://query.yahooapis.com/v1/public/yql?q=select+*+from+google.books+where+q%3D%27barack+obama%27+and+maxResults%3D1&format=xml&callback=&crossProduct=optimized&diagnostics=false&debug=false&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys
 |`CamelYqlHttpStatus` |200
-|=======================================================================
-
-### See Also
+|===
 
-* link:configuring-camel.html[Configuring Camel]
-* link:component.html[Component]
-* link:endpoint.html[Endpoint]
-* link:getting-started.html[Getting Started]
+=== See Also
 
-* https://developer.yahoo.com/yql/guide/[YQL Official Guide]
\ No newline at end of file
+* https://developer.yahoo.com/yql/guide/[YQL Official Guide]
diff --git a/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentTest.java b/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentTest.java
index 5c959ab..8328aff 100644
--- a/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentTest.java
+++ b/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentTest.java
@@ -25,9 +25,6 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.text.IsEmptyString.emptyString;
-
 public class YqlComponentTest extends CamelTestSupport {
 
     @Rule
@@ -89,7 +86,7 @@ public class YqlComponentTest extends CamelTestSupport {
         assertNotNull(yqlConfiguration);
         assertEquals("query", yqlConfiguration.getQuery());
         assertEquals("json", yqlConfiguration.getFormat());
-        assertThat(yqlConfiguration.getCallback(), is(emptyString()));
+        assertNull(yqlConfiguration.getCallback());
         assertNull(yqlConfiguration.getCrossProduct());
         assertFalse(yqlConfiguration.isDiagnostics());
         assertFalse(yqlConfiguration.isDebug());
diff --git a/components/camel-yql/src/test/resources/log4j2.properties b/components/camel-yql/src/test/resources/log4j2.properties
index 25d964b..21c4b43 100644
--- a/components/camel-yql/src/test/resources/log4j2.properties
+++ b/components/camel-yql/src/test/resources/log4j2.properties
@@ -30,4 +30,4 @@ appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
 #logger.camel.level =DEBUG
 
 rootLogger.level = INFO
-rootLogger.appenderRef.out.ref = out
+rootLogger.appenderRef.out.ref = file

-- 
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.

[camel] 04/12: Add connection pool to yql component

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b490da3ef9aca0713b458f8c7b333659937ad284
Author: Carl-Philipp Harmant <cp...@gmail.com>
AuthorDate: Tue Oct 31 15:55:45 2017 -0500

    Add connection pool to yql component
---
 .../apache/camel/component/yql/YqlComponent.java   | 30 +++++++++++++++++++++-
 .../apache/camel/component/yql/YqlEndpoint.java    | 25 +++++++++++++++++-
 .../apache/camel/component/yql/YqlProducer.java    |  6 ++---
 .../camel/component/yql/client/YqlClient.java      | 10 +++++---
 4 files changed, 63 insertions(+), 8 deletions(-)

diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
index 6c64a77..02b778f 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
@@ -21,19 +21,47 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.component.yql.configuration.YqlConfiguration;
 import org.apache.camel.component.yql.configuration.YqlConfigurationValidator;
 import org.apache.camel.impl.DefaultComponent;
+import org.apache.http.conn.HttpClientConnectionManager;
+import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
 
 public class YqlComponent extends DefaultComponent {
 
+    private HttpClientConnectionManager localConnectionManager;
+
     @Override
     protected Endpoint createEndpoint(final String uri, final String remaining, final Map<String, Object> parameters) throws Exception {
         final YqlConfiguration configuration = new YqlConfiguration();
         configuration.setQuery(remaining);
 
-        final Endpoint endpoint = new YqlEndpoint(uri, this, configuration);
+        final HttpClientConnectionManager connectionManager = createConnectionManager();
+
+        final Endpoint endpoint = new YqlEndpoint(uri, this, configuration, connectionManager);
 
         YqlConfigurationValidator.validateProperties(configuration);
 
         setProperties(configuration, parameters);
         return endpoint;
     }
+
+    @Override
+    protected void doStop() throws Exception {
+      if (localConnectionManager != null) {
+        localConnectionManager.shutdown();
+      }
+    }
+
+    public void setConnectionManager(final HttpClientConnectionManager connectionManager){
+      this.localConnectionManager = connectionManager;
+    }
+
+    private HttpClientConnectionManager createConnectionManager(){
+      if (localConnectionManager != null) {
+        return localConnectionManager;
+      }
+      final PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
+      connectionManager.setMaxTotal(200);
+      connectionManager.setDefaultMaxPerRoute(20);
+      setConnectionManager(connectionManager);
+      return connectionManager;
+    }
 }
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlEndpoint.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlEndpoint.java
index af283e4..90384c2 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlEndpoint.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlEndpoint.java
@@ -23,16 +23,23 @@ import org.apache.camel.component.yql.configuration.YqlConfiguration;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
+import org.apache.http.conn.HttpClientConnectionManager;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
 
 @UriEndpoint(firstVersion = "2.21.0", scheme = "yql", title = "Yahoo Query Language", syntax = "yql:query", producerOnly = true, label = "api,http")
 public class YqlEndpoint extends DefaultEndpoint {
 
     @UriParam
     private final YqlConfiguration configuration;
+    private final HttpClientConnectionManager connectionManager;
+    private CloseableHttpClient httpClient;
 
-    YqlEndpoint(final String uri, final YqlComponent component, final YqlConfiguration configuration) {
+    YqlEndpoint(final String uri, final YqlComponent component, final YqlConfiguration configuration, final HttpClientConnectionManager connectionManager) {
         super(uri, component);
         this.configuration = configuration;
+        this.connectionManager = connectionManager;
     }
 
     @Override
@@ -50,6 +57,22 @@ public class YqlEndpoint extends DefaultEndpoint {
         return true;
     }
 
+    @Override
+    protected void doStop() throws Exception {
+        if (httpClient != null) {
+            httpClient.close();
+        }
+    }
+
+    synchronized CloseableHttpClient getHttpClient() {
+        if (httpClient == null) {
+            httpClient = HttpClients.custom()
+                .setConnectionManager(connectionManager)
+                .build();
+        }
+        return httpClient;
+    }
+
     YqlConfiguration getConfiguration() {
         return configuration;
     }
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlProducer.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlProducer.java
index c63dc7b..c429c85 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlProducer.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlProducer.java
@@ -31,18 +31,18 @@ public class YqlProducer extends DefaultProducer {
     static final String CAMEL_YQL_HTTP_REQUEST = "CamelYqlHttpRequest";
 
     private final YqlEndpoint endpoint;
-    private final YqlClient yahooClient;
+    private final YqlClient yqlClient;
 
     YqlProducer(final YqlEndpoint endpoint) {
         super(endpoint);
         this.endpoint = endpoint;
-        this.yahooClient = new YqlClient();
+        this.yqlClient = new YqlClient(endpoint.getHttpClient());
     }
 
     @Override
     public void process(final Exchange exchange) throws Exception {
         final YqlConfiguration configuration = endpoint.getConfiguration();
-        final YqlResponse yqlResponse = yahooClient.get(
+        final YqlResponse yqlResponse = yqlClient.get(
                 configuration.getQuery(),
                 configuration.getFormat(),
                 configuration.isDiagnostics(),
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/client/YqlClient.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/client/YqlClient.java
index 0d5f00d..650243c 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/client/YqlClient.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/client/YqlClient.java
@@ -21,7 +21,6 @@ import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.utils.URIBuilder;
 import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
 import org.apache.http.util.EntityUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -29,7 +28,12 @@ import org.slf4j.LoggerFactory;
 public class YqlClient {
 
     private static final Logger LOG = LoggerFactory.getLogger(YqlClient.class);
-    private static final CloseableHttpClient HTTP_CLIENT = HttpClients.createDefault();
+
+    private final CloseableHttpClient httpClient;
+
+    public YqlClient(final CloseableHttpClient httpClient){
+        this.httpClient = httpClient;
+    }
 
     public YqlResponse get(final String query, final String format, final boolean diagnostics, final String callback) throws Exception {
 
@@ -47,7 +51,7 @@ public class YqlClient {
         LOG.debug("YQL query: {}", uri);
 
         final HttpGet httpget = new HttpGet(uri);
-        try (final CloseableHttpResponse response = HTTP_CLIENT.execute(httpget)) {
+        try (final CloseableHttpResponse response = httpClient.execute(httpget)) {
             final YqlResponse yqlResponse = YqlResponse.builder()
                     .httpRequest(uri.toString())
                     .status(response.getStatusLine().getStatusCode())

-- 
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.

[camel] 06/12: Add remaining YQL options and update doc and javadoc

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit bef1ea4e6348ca21f08e6ea2dfcf48c19885e9fe
Author: Carl-Philipp Harmant <cp...@gmail.com>
AuthorDate: Wed Nov 1 16:20:14 2017 -0500

    Add remaining YQL options and update doc and javadoc
---
 .../camel-yql/src/main/docs/yql-component.adoc     | 157 ++++++++++++++++++---
 .../apache/camel/component/yql/YqlComponent.java   |   9 +-
 .../apache/camel/component/yql/YqlProducer.java    |   9 +-
 .../camel/component/yql/client/YqlClient.java      |  36 +++--
 .../yql/configuration/YqlConfiguration.java        | 108 ++++++++++++--
 .../configuration/YqlConfigurationValidator.java   |   8 ++
 .../component/yql/YqlComponentIntegrationTest.java | 130 ++++++++++++++---
 .../YqlConfigurationValidatorTest.java             |  37 ++++-
 components/readme.adoc                             |   4 +-
 docs/user-manual/en/SUMMARY.md                     |   1 -
 .../yql/springboot/YqlComponentConfiguration.java  |  16 +++
 11 files changed, 434 insertions(+), 81 deletions(-)

diff --git a/components/camel-yql/src/main/docs/yql-component.adoc b/components/camel-yql/src/main/docs/yql-component.adoc
index efc13cb..8319a89 100644
--- a/components/camel-yql/src/main/docs/yql-component.adoc
+++ b/components/camel-yql/src/main/docs/yql-component.adoc
@@ -55,17 +55,22 @@ with the following path and query parameters:
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *query* | *Required* The YQL query to be sent. |  | String
+| *query* | *Required* The YQL statement to execute. |  | String
 |===
 
-==== Query Parameters (5 parameters):
+==== Query Parameters (10 parameters):
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *callback* (producer) | If specified the option will be included in the HTTP request to YQL. If the format is json then the response will contain a JSONP callback method. If the format is xml then the response will contain a JSONP-X callback method. More information: https://developer.yahoo.com/yql/guide/response.html |  | String
-| *diagnostics* (producer) | If true the option will be included in the HTTP request to YQL and the response will contain some diagnostics data. | false | boolean
-| *format* (producer) | The expected format. Can only be json or xml. | json | String
+| *callback* (producer) | The name of the JavaScript callback function for JSONP format. If callback is set and if format=json then the response format is JSON. For more information on using XML instead of JSON see JSONP-X. https://developer.yahoo.com/yql/guide/response.html |  | String
+| *crossProduct* (producer) | When given the value optimized the projected fields in SELECT statements that may be returned in separate item elements in the response are optimized to be in a single item element instead. The only allowed value is optimized. More information https://developer.yahoo.com/yql/guide/response.htmlresponse-optimizing= |  | String
+| *debug* (producer) | If true and if diagnostic is set to true debug data is returned with the response. More information: https://developer.yahoo.com/yql/guide/dev-external_tables.htmlodt-enable-logging= | false | boolean
+| *diagnostics* (producer) | If true diagnostic information is returned with the response. | false | boolean
+| *env* (producer) | Allows you to use multiple Open Data Tables through a YQL environment file. More information https://developer.yahoo.com/yql/guide/yql_storage.htmlusing-records-env-files= |  | String
+| *format* (producer) | The expected format. Allowed values: xml or json. | json | String
+| *https* (producer) | Option to use HTTPS to communicate with YQL. | true | boolean
+| *jsonCompat* (producer) | Enables lossless JSON processing. The only allowed value is new. More information https://developer.yahoo.com/yql/guide/response.htmljson-to-json= |  | String
 | *throwExceptionOnFailure* (producer) | Option to disable throwing the YqlHttpException in case of failed responses from the remote server. This allows you to get all responses regardless of the HTTP status code. | true | boolean
 | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean
 |===
@@ -81,18 +86,20 @@ the `format` option above).
 [width="100%",cols="10%,90%",options="header",]
 |=======================================================================
 |Header |Description
-|`CamelYqlHttpRequest` | Http request sent to YQL
-|`CamelYqlHttpStatus` | Status code from the response
+|`CamelYqlHttpRequest` | Original HTTP request sent to YQL.
+|`CamelYqlHttpStatus` | Status code from the response.
 |=======================================================================
 
 ### Samples
 
-In this example we query YQL to obtain Google quote:
+# Sample 1
+
+In this example we query YQL to obtain the current wind and atmosphere data in Chicago:
 
 [source,java]
 --------------------------------------------------------
 from("direct:start")
-  .to("yql://select * from yahoo.finance.quotes where symbol in ('GOOG')?format=json");
+  .to("yql://select wind, atmosphere from weather.forecast where woeid in (select woeid from geo.places(1) where text='chicago, il'");
 --------------------------------------------------------
 
 Which will setup the body as:
@@ -100,20 +107,26 @@ Which will setup the body as:
 [source,json]
 --------------------------------------------------------
 {
- "query": {
-  "count": 1,
-  "created": "2017-10-29T03:17:28Z",
-  "lang": "en-US",
-  "results": {
-   "quote": {
-    "symbol": "GOOG",
-    "Ask": "1024.50",
-    "AverageDailyVolume": "1356700",
-    "Bid": "1019.27",
-    ...
+   "query":{
+      "count":1,
+      "created":"2017-11-01T19:37:26Z",
+      "lang":"en-US",
+      "results":{
+         "channel":{
+            "wind":{
+               "chill":"32",
+               "direction":"165",
+               "speed":"22"
+            },
+            "atmosphere":{
+               "humidity":"71",
+               "pressure":"994.0",
+               "rising":"0",
+               "visibility":"16.1"
+            }
+         }
+      }
    }
-  }
- }
 }
 --------------------------------------------------------
 
@@ -122,6 +135,104 @@ and the headers:
 [width="100%",cols="30%,70%",options="header",]
 |=======================================================================
 |Header |Value
-|`CamelYqlHttpRequest` |http://query.yahooapis.com/v1/public/yql?format=json&diagnostics=false&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=yqlCallback&q=select+*+from+yahoo.finance.quotes+where+symbol+in+%28%27GOOG%27%29
+|`CamelYqlHttpRequest` |https://query.yahooapis.com/v1/public/yql?q=select+wind%2C+atmosphere+from+weather.forecast+where+woeid+in+%28select+woeid+from+geo.places%281%29+where+text%3D%22chicago%2C+il%22%29&format=json&callback=&diagnostics=false&debug=false
+|`CamelYqlHttpStatus` |200
+|=======================================================================
+
+# Sample 2
+
+In this example we query YQL to obtain the Google quote.
+
+[source,java]
+--------------------------------------------------------
+from("direct:start")
+  .to("yql://select symbol, Ask, Bid, AverageDailyVolume from yahoo.finance.quotes where symbol in ('GOOG')?env=store://datatables.org/alltableswithkeys&https=false&callback=yqlCallback");
+--------------------------------------------------------
+
+Which will setup the body as:
+
+[source,json]
+--------------------------------------------------------
+/**/yqlCallback({
+   "query":{
+      "count":1,
+      "created":"2017-11-01T19:48:17Z",
+      "lang":"en-US",
+      "results":{
+         "quote":{
+            "symbol":"GOOG",
+            "Bid":"1025.57",
+            "Ask":"1025.92",
+            "AverageDailyVolume":"1350640"AverageDailyVolume
+         }
+      }
+   }
+});
+--------------------------------------------------------
+
+and the headers:
+
+[width="100%",cols="30%,70%",options="header",]
+|=======================================================================
+|Header |Value
+|`CamelYqlHttpRequest` |http://query.yahooapis.com/v1/public/yql?q=select+symbol%2C+Ask%2C+Bid%2C+AverageDailyVolume+from+yahoo.finance.quotes+where+symbol+in+%28%27GOOG%27%29&format=json&callback=yqlCallback&diagnostics=false&debug=false&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys
 |`CamelYqlHttpStatus` |200
 |=======================================================================
+
+# Sample 3
+
+In this example we query YQL to obtain one book written by Barack Obama
+
+[source,java]
+--------------------------------------------------------
+from("direct:start")
+  .to("yql://select * from google.books where q='barack obama' and maxResults=1?format=xml&crossProduct=optimized&env=store://datatables.org/alltableswithkeys");
+--------------------------------------------------------
+
+Which will setup the body as:
+
+[source,xml]
+--------------------------------------------------------
+<?xml version="1.0" encoding="UTF-8"?>
+<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="1" yahoo:created="2017-11-01T20:32:22Z" yahoo:lang="en-US">
+   <results>
+      <json>
+         <kind>books#volumes</kind>
+         <totalItems>1993</totalItems>
+         <items>
+            <kind>books#volume</kind>
+            <id>HRCHJp-V0QUC</id>
+            <etag>SeTJeSgFDzo</etag>
+            <selfLink>https://www.googleapis.com/books/v1/volumes/HRCHJp-V0QUC</selfLink>
+            <volumeInfo>
+               <title>Dreams from My Father</title>
+               <subtitle>A Story of Race and Inheritance</subtitle>
+               <authors>Barack Obama</authors>
+               <publisher>Broadway Books</publisher>
+               <publishedDate>2007-01-09</publishedDate>
+               ...
+            </volumeInfo>
+         </items>
+      </json>
+   </results>
+</query>
+<!-- total: 646 -->
+--------------------------------------------------------
+
+and the headers:
+
+[width="100%",cols="30%,70%",options="header",]
+|=======================================================================
+|Header |Value
+|`CamelYqlHttpRequest` |https://query.yahooapis.com/v1/public/yql?q=select+*+from+google.books+where+q%3D%27barack+obama%27+and+maxResults%3D1&format=xml&callback=&crossProduct=optimized&diagnostics=false&debug=false&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys
+|`CamelYqlHttpStatus` |200
+|=======================================================================
+
+### See Also
+
+* link:configuring-camel.html[Configuring Camel]
+* link:component.html[Component]
+* link:endpoint.html[Endpoint]
+* link:getting-started.html[Getting Started]
+
+* https://developer.yahoo.com/yql/guide/[YQL Official Guide]
\ No newline at end of file
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
index fe02676..affc329 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
@@ -32,15 +32,12 @@ public class YqlComponent extends DefaultComponent {
     protected Endpoint createEndpoint(final String uri, final String remaining, final Map<String, Object> parameters) throws Exception {
         final YqlConfiguration configuration = new YqlConfiguration();
         configuration.setQuery(remaining);
+        setProperties(configuration, parameters);
+        YqlConfigurationValidator.validateProperties(configuration);
 
         final HttpClientConnectionManager connectionManager = createConnectionManager();
 
-        final Endpoint endpoint = new YqlEndpoint(uri, this, configuration, connectionManager);
-
-        YqlConfigurationValidator.validateProperties(configuration);
-
-        setProperties(configuration, parameters);
-        return endpoint;
+        return new YqlEndpoint(uri, this, configuration, connectionManager);
     }
 
     @Override
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlProducer.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlProducer.java
index f32a7a7..62fe95e 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlProducer.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlProducer.java
@@ -44,15 +44,12 @@ public class YqlProducer extends DefaultProducer {
     @Override
     public void process(final Exchange exchange) throws Exception {
         final YqlConfiguration configuration = endpoint.getConfiguration();
-        final YqlResponse yqlResponse = yqlClient.get(
-                configuration.getQuery(),
-                configuration.getFormat(),
-                configuration.isDiagnostics(),
-                configuration.getCallback()
-        );
+        final YqlResponse yqlResponse = yqlClient.get(configuration);
+
         if (configuration.isThrowExceptionOnFailure() && yqlResponse.getStatus() != HttpStatus.SC_OK) {
             throw YqlHttpException.failedWith(yqlResponse.getStatus(), yqlResponse.getBody(), yqlResponse.getHttpRequest());
         }
+
         exchange.getIn().setHeader(CAMEL_YQL_HTTP_STATUS, yqlResponse.getStatus());
         exchange.getIn().setHeader(CAMEL_YQL_HTTP_REQUEST, yqlResponse.getHttpRequest());
         exchange.getIn().setBody(yqlResponse.getBody());
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/client/YqlClient.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/client/YqlClient.java
index 650243c..fa10869 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/client/YqlClient.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/client/YqlClient.java
@@ -17,10 +17,15 @@
 package org.apache.camel.component.yql.client;
 
 import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.camel.component.yql.configuration.YqlConfiguration;
+import org.apache.http.NameValuePair;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.utils.URIBuilder;
 import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.message.BasicNameValuePair;
 import org.apache.http.util.EntityUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -31,21 +36,17 @@ public class YqlClient {
 
     private final CloseableHttpClient httpClient;
 
-    public YqlClient(final CloseableHttpClient httpClient){
+    public YqlClient(final CloseableHttpClient httpClient) {
         this.httpClient = httpClient;
     }
 
-    public YqlResponse get(final String query, final String format, final boolean diagnostics, final String callback) throws Exception {
+    public YqlResponse get(final YqlConfiguration yqlConfiguration) throws Exception {
 
         final URI uri = new URIBuilder()
-                .setScheme("http")
+                .setScheme(yqlConfiguration.isHttps() ? "https" : "http")
                 .setHost("query.yahooapis.com")
                 .setPath("/v1/public/yql")
-                .setParameter("format", format)
-                .setParameter("diagnostics", Boolean.toString(diagnostics))
-                .setParameter("env", "store://datatables.org/alltableswithkeys")
-                .setParameter("callback", callback)
-                .setParameter("q", query)
+                .setParameters(buildParameters(yqlConfiguration))
                 .build();
 
         LOG.debug("YQL query: {}", uri);
@@ -61,4 +62,23 @@ public class YqlClient {
             return yqlResponse;
         }
     }
+
+    private List<NameValuePair> buildParameters(final YqlConfiguration yqlConfiguration) {
+        final List<NameValuePair> nameValuePairs = new ArrayList<>();
+        nameValuePairs.add(new BasicNameValuePair("q", yqlConfiguration.getQuery()));
+        nameValuePairs.add(new BasicNameValuePair("format", yqlConfiguration.getFormat()));
+        nameValuePairs.add(new BasicNameValuePair("callback", yqlConfiguration.getCallback()));
+        if (yqlConfiguration.getCrossProduct() != null) {
+            nameValuePairs.add(new BasicNameValuePair("crossProduct", yqlConfiguration.getCrossProduct()));
+        }
+        nameValuePairs.add(new BasicNameValuePair("diagnostics", Boolean.toString(yqlConfiguration.isDiagnostics())));
+        nameValuePairs.add(new BasicNameValuePair("debug", Boolean.toString(yqlConfiguration.isDebug())));
+        if (yqlConfiguration.getEnv() != null) {
+            nameValuePairs.add(new BasicNameValuePair("env", yqlConfiguration.getEnv()));
+        }
+        if (yqlConfiguration.getJsonCompat() != null) {
+            nameValuePairs.add(new BasicNameValuePair("jsonCompat", yqlConfiguration.getJsonCompat()));
+        }
+        return nameValuePairs;
+    }
 }
\ No newline at end of file
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java
index 73ff453..b26e347 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java
@@ -21,33 +21,52 @@ import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriParams;
 import org.apache.camel.spi.UriPath;
 
+/**
+ * YQL configuration that should reflect https://developer.yahoo.com/yql/guide/users-overview.html
+ */
 @UriParams
 public class YqlConfiguration {
 
-    @UriPath(label="producer", description = "The YQL query to be sent.")
+    @UriPath(label = "producer", description = "The YQL statement to execute.")
     @Metadata(required = "true")
     private String query;
 
-    @UriParam(label="producer", enums = "json,xml", defaultValue = "json", description = "The expected format. Can only be json or xml.")
+    @UriParam(label = "producer", enums = "json,xml", defaultValue = "json", description = "The expected format. Allowed values: xml or json.")
     private String format = "json";
 
-    @UriParam(label="producer", defaultValue = "false", description = "If true, the option will be included in the HTTP request to YQL and the response will contain some diagnostics data.")
+    @UriParam(label = "producer", description = "The name of the JavaScript callback function for JSONP format. If callback is set and if format=json, then the response format is JSON. For more "
+            + "information on using XML instead of JSON, see JSONP-X.")
+    private String callback = "";
+
+    @UriParam(label = "producer", description = "When given the value optimized, the projected fields in SELECT statements that may be returned in separate item elements in the response are "
+            + "optimized to be in a single item element instead. The only allowed value is optimized.")
+    private String crossProduct;
+
+    @UriParam(label = "producer", defaultValue = "false", description = "If true, diagnostic information is returned with the response.")
     private boolean diagnostics = false;
 
-    @UriParam(label="producer", description = "If specified, the option will be included in the HTTP request to YQL. If the format is json, then the response will contain a JSONP callback method. "
-            + "If the format is xml, then the response will contain a JSONP-X callback method. More information: https://developer.yahoo.com/yql/guide/response.html")
-    private String callback = "";
+    @UriParam(label = "producer", defaultValue = "false", description = "If true, and if diagnostic is set to true, debug data is returned with the response.")
+    private boolean debug = false;
+
+    @UriParam(label = "producer", description = "Allows you to use multiple Open Data Tables through a YQL environment file.")
+    private String env;
+
+    @UriParam(label = "producer", description = "Enables lossless JSON processing. The only allowed value is new.")
+    private String jsonCompat;
 
     @UriParam(label = "producer", defaultValue = "true", description = "Option to disable throwing the YqlHttpException in case of failed responses from the remote server. "
             + "This allows you to get all responses regardless of the HTTP status code.")
     private boolean throwExceptionOnFailure = true;
 
+    @UriParam(label = "producer", defaultValue = "true", description = "Option to use HTTPS to communicate with YQL.")
+    private boolean https = true;
+
     public String getQuery() {
         return query;
     }
 
     /**
-     * The YQL query to be sent.
+     * The YQL statement to execute.
      */
     public void setQuery(final String query) {
         this.query = query;
@@ -58,33 +77,81 @@ public class YqlConfiguration {
     }
 
     /**
-     * The expected format. Can only be json or xml.
+     * The expected format. Allowed values: xml or json.
      */
     public void setFormat(final String format) {
         this.format = format;
     }
 
+    public String getCallback() {
+        return callback;
+    }
+
+    /**
+     * The name of the JavaScript callback function for JSONP format. If callback is set and if format=json, then the response format is JSON. For more
+     * information on using XML instead of JSON, see JSONP-X. https://developer.yahoo.com/yql/guide/response.html
+     */
+    public void setCallback(final String callback) {
+        this.callback = callback;
+    }
+
+    public String getCrossProduct() {
+        return crossProduct;
+    }
+
+    /**
+     * When given the value optimized, the projected fields in SELECT statements that may be returned in separate item elements in the response are optimized to be in a single item element instead.
+     * The only allowed value is optimized. More information https://developer.yahoo.com/yql/guide/response.html#response-optimizing=
+     */
+    public void setCrossProduct(final String crossProduct) {
+        this.crossProduct = crossProduct;
+    }
+
     public boolean isDiagnostics() {
         return diagnostics;
     }
 
     /**
-     * If true, the option will be included in the HTTP request to YQL and the response will contain some diagnostics data.
+     * If true, diagnostic information is returned with the response.
      */
     public void setDiagnostics(final boolean diagnostics) {
         this.diagnostics = diagnostics;
     }
 
-    public String getCallback() {
-        return callback;
+    public boolean isDebug() {
+        return debug;
     }
 
     /**
-     * If specified, the option will be included in the HTTP request to YQL. If the format is json, then the response will contain a JSONP callback method.
-     * If the format is xml, then the response will contain a JSONP-X callback method. More information: https://developer.yahoo.com/yql/guide/response.html
+     * If true, and if diagnostic is set to true, debug data is returned with the response.
+     * More information: https://developer.yahoo.com/yql/guide/dev-external_tables.html#odt-enable-logging=
      */
-    public void setCallback(final String callback) {
-        this.callback = callback;
+    public void setDebug(final boolean debug) {
+        this.debug = debug;
+    }
+
+    public String getEnv() {
+        return env;
+    }
+
+    /**
+     * Allows you to use multiple Open Data Tables through a YQL environment file.
+     * More information https://developer.yahoo.com/yql/guide/yql_storage.html#using-records-env-files=
+     */
+    public void setEnv(final String env) {
+        this.env = env;
+    }
+
+    public String getJsonCompat() {
+        return jsonCompat;
+    }
+
+    /**
+     * Enables lossless JSON processing. The only allowed value is new.
+     * More information https://developer.yahoo.com/yql/guide/response.html#json-to-json=
+     */
+    public void setJsonCompat(final String jsonCompat) {
+        this.jsonCompat = jsonCompat;
     }
 
     public boolean isThrowExceptionOnFailure() {
@@ -98,4 +165,15 @@ public class YqlConfiguration {
     public void setThrowExceptionOnFailure(final boolean throwExceptionOnFailure) {
         this.throwExceptionOnFailure = throwExceptionOnFailure;
     }
+
+    public boolean isHttps() {
+        return https;
+    }
+
+    /**
+     * Option to use HTTPS to communicate with YQL.
+     */
+    public void setHttps(final boolean https) {
+        this.https = https;
+    }
 }
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfigurationValidator.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfigurationValidator.java
index 0ab0ff7..124d8f7 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfigurationValidator.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfigurationValidator.java
@@ -32,5 +32,13 @@ public final class YqlConfigurationValidator {
         if (!StringUtils.equalsAny(configuration.getFormat(), "json", "xml")) {
             throw new YqlException("<format> is not valid!");
         }
+
+        if (configuration.getCrossProduct() != null && !configuration.getCrossProduct().equals("optimized")) {
+            throw new YqlException("<crossProduct> is not valid!");
+        }
+
+        if (configuration.getJsonCompat() != null && !configuration.getJsonCompat().equals("new")) {
+            throw new YqlException("<jsonCompat> is not valid!");
+        }
     }
 }
diff --git a/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentIntegrationTest.java b/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentIntegrationTest.java
index 6bbf8ee..e8164e7 100644
--- a/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentIntegrationTest.java
+++ b/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentIntegrationTest.java
@@ -16,6 +16,13 @@
  */
 package org.apache.camel.component.yql;
 
+import static org.apache.camel.component.yql.YqlProducer.CAMEL_YQL_HTTP_REQUEST;
+import static org.apache.camel.component.yql.YqlProducer.CAMEL_YQL_HTTP_STATUS;
+import static org.hamcrest.CoreMatchers.containsString;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import org.apache.camel.CamelExecutionException;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Exchange;
 import org.apache.camel.Produce;
@@ -23,46 +30,133 @@ import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.http.HttpStatus;
+import org.junit.Rule;
 import org.junit.Test;
-
-import static org.apache.camel.component.yql.YqlProducer.CAMEL_YQL_HTTP_REQUEST;
-import static org.apache.camel.component.yql.YqlProducer.CAMEL_YQL_HTTP_STATUS;
-import static org.hamcrest.CoreMatchers.containsString;
+import org.junit.rules.ExpectedException;
 
 public class YqlComponentIntegrationTest extends CamelTestSupport {
 
-    private static final String QUERY = "select * from yahoo.finance.quotes where symbol in ('GOOG')";
+    private static final String FINANCE_QUERY = "select symbol, Ask, Bid,  from yahoo.finance.quotes where symbol in ('GOOG')";
+    private static final String WEATHER_QUERY = "select wind, atmosphere from weather.forecast where woeid in (select woeid from geo.places(1) where text='chicago, il')";
+    private static final String BOOK_QUERY = "select * from google.books where q='barack obama' and maxResults=1";
     private static final String CALLBACK = "yqlCallback";
+    private static final String ENV = "store://datatables.org/alltableswithkeys";
+
+    @Rule
+    public final ExpectedException thrown = ExpectedException.none();
+
+    @Produce(uri = "direct:startFinance")
+    private ProducerTemplate templateFinance;
 
-    @Produce(uri = "direct:start")
-    private ProducerTemplate template;
+    @EndpointInject(uri = "mock:resultFinance")
+    private MockEndpoint endFinance;
 
-    @EndpointInject(uri = "mock:result")
-    private MockEndpoint end;
+    @Produce(uri = "direct:startWeather")
+    private ProducerTemplate templateWeather;
+
+    @EndpointInject(uri = "mock:resultWeather")
+    private MockEndpoint endWeather;
+
+    @Produce(uri = "direct:startBook")
+    private ProducerTemplate templateBook;
+
+    @EndpointInject(uri = "mock:resultBook")
+    private MockEndpoint endBook;
+
+    @Produce(uri = "direct:startFail")
+    private ProducerTemplate templateFail;
 
     @Override
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
-                from("direct:start")
-                        .to("yql://" + QUERY + "?format=json&callback=" + CALLBACK)
-                        .to("mock:result");
+                from("direct:startFinance")
+                        .to("yql://" + FINANCE_QUERY + "?format=json&callback=" + CALLBACK + "&https=false&env=" + ENV)
+                        .to("mock:resultFinance");
+
+                from("direct:startWeather")
+                        .to("yql://" + WEATHER_QUERY)
+                        .to("mock:resultWeather");
+
+                from("direct:startBook")
+                        .to("yql://" + BOOK_QUERY + "?format=xml&crossProduct=optimized&env=" + ENV)
+                        .to("mock:resultBook");
+
+                from("direct:startFail")
+                        .to("yql://" + FINANCE_QUERY)
+                        .to("mock:resultBook");
             }
         };
     }
 
     @Test
-    public void testFinanceQuote() {
-        template.sendBody("");
+    public void testFinanceQuote() throws UnsupportedEncodingException {
+        // when
+        templateFinance.sendBody("");
 
-        final Exchange exchange = end.getReceivedExchanges().get(0);
+        // then
+        final Exchange exchange = endFinance.getReceivedExchanges().get(0);
         final String body = exchange.getIn().getBody(String.class);
         final Integer status = exchange.getIn().getHeader(CAMEL_YQL_HTTP_STATUS, Integer.class);
         final String httpRequest = exchange.getIn().getHeader(CAMEL_YQL_HTTP_REQUEST, String.class);
+        assertThat(httpRequest, containsString("http"));
+        assertThat(httpRequest, containsString("q=" + URLEncoder.encode(FINANCE_QUERY, "UTF-8")));
+        assertThat(httpRequest, containsString("format=json"));
+        assertThat(httpRequest, containsString("callback=" + CALLBACK));
+        assertThat(httpRequest, containsString("diagnostics=false"));
+        assertThat(httpRequest, containsString("debug=false"));
+        assertThat(httpRequest, containsString("env=" + URLEncoder.encode(ENV, "UTF-8")));
         assertNotNull(body);
         assertThat(body, containsString(CALLBACK + "("));
-        assertNotNull(status);
-        assertEquals("http://query.yahooapis.com/v1/public/yql?format=json&diagnostics=false&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=yqlCallback&q=select+*+from+"
-                + "yahoo.finance.quotes+where+symbol+in+%28%27GOOG%27%29", httpRequest);
+        assertEquals(HttpStatus.SC_OK, status.intValue());
+    }
+
+    @Test
+    public void testWeather() throws UnsupportedEncodingException {
+        // when
+        templateWeather.sendBody("");
+
+        // then
+        final Exchange exchange = endWeather.getReceivedExchanges().get(0);
+        final String body = exchange.getIn().getBody(String.class);
+        final Integer status = exchange.getIn().getHeader(CAMEL_YQL_HTTP_STATUS, Integer.class);
+        final String httpRequest = exchange.getIn().getHeader(CAMEL_YQL_HTTP_REQUEST, String.class);
+        assertThat(httpRequest, containsString("https"));
+        assertThat(httpRequest, containsString("q=" + URLEncoder.encode(WEATHER_QUERY, "UTF-8")));
+        assertThat(httpRequest, containsString("format=json"));
+        assertThat(httpRequest, containsString("diagnostics=false"));
+        assertThat(httpRequest, containsString("debug=false"));
+        assertNotNull(body);
+        assertEquals(HttpStatus.SC_OK, status.intValue());
+    }
+
+    @Test
+    public void testBook() throws UnsupportedEncodingException {
+        // when
+        templateBook.sendBody("");
+
+        // then
+        final Exchange exchange = endBook.getReceivedExchanges().get(0);
+        final String body = exchange.getIn().getBody(String.class);
+        final Integer status = exchange.getIn().getHeader(CAMEL_YQL_HTTP_STATUS, Integer.class);
+        final String httpRequest = exchange.getIn().getHeader(CAMEL_YQL_HTTP_REQUEST, String.class);
+        assertThat(httpRequest, containsString("https"));
+        assertThat(httpRequest, containsString("q=" + URLEncoder.encode(BOOK_QUERY, "UTF-8")));
+        assertThat(httpRequest, containsString("format=xml"));
+        assertThat(httpRequest, containsString("diagnostics=false"));
+        assertThat(httpRequest, containsString("debug=false"));
+        assertThat(httpRequest, containsString("crossProduct=optimized"));
+        assertNotNull(body);
+        assertEquals(HttpStatus.SC_OK, status.intValue());
+    }
+
+    @Test
+    public void testFail() throws UnsupportedEncodingException {
+        // then
+        thrown.expect(CamelExecutionException.class);
+
+        // when
+        templateFail.sendBody("");
     }
 }
diff --git a/components/camel-yql/src/test/java/org/apache/camel/component/yql/configuration/YqlConfigurationValidatorTest.java b/components/camel-yql/src/test/java/org/apache/camel/component/yql/configuration/YqlConfigurationValidatorTest.java
index e7a6ce0..af7fa58 100644
--- a/components/camel-yql/src/test/java/org/apache/camel/component/yql/configuration/YqlConfigurationValidatorTest.java
+++ b/components/camel-yql/src/test/java/org/apache/camel/component/yql/configuration/YqlConfigurationValidatorTest.java
@@ -27,11 +27,13 @@ public class YqlConfigurationValidatorTest {
     public final ExpectedException thrown = ExpectedException.none();
 
     @Test
-    public void testGoodQuery() {
+    public void testValidQuery() {
         // given
         final YqlConfiguration yqlConfiguration = new YqlConfiguration();
         yqlConfiguration.setQuery("select * from ...");
         yqlConfiguration.setFormat("json");
+        yqlConfiguration.setCrossProduct("optimized");
+        yqlConfiguration.setJsonCompat("new");
 
         // when
         YqlConfigurationValidator.validateProperties(yqlConfiguration);
@@ -95,4 +97,37 @@ public class YqlConfigurationValidatorTest {
         // when
         YqlConfigurationValidator.validateProperties(yqlConfiguration);
     }
+
+    @Test
+    public void testWrongCrossProduct() {
+        // then
+        thrown.expect(YqlException.class);
+        thrown.expectMessage("<crossProduct> is not valid!");
+
+        // given
+        final YqlConfiguration yqlConfiguration = new YqlConfiguration();
+        yqlConfiguration.setQuery("query");
+        yqlConfiguration.setFormat("xml");
+        yqlConfiguration.setCrossProduct("optimizedddd");
+
+        // when
+        YqlConfigurationValidator.validateProperties(yqlConfiguration);
+    }
+
+    @Test
+    public void testWrongJsonCompat() {
+        // then
+        thrown.expect(YqlException.class);
+        thrown.expectMessage("<jsonCompat> is not valid!");
+
+        // given
+        final YqlConfiguration yqlConfiguration = new YqlConfiguration();
+        yqlConfiguration.setQuery("query");
+        yqlConfiguration.setFormat("xml");
+        yqlConfiguration.setCrossProduct("optimized");
+        yqlConfiguration.setJsonCompat("neww");
+
+        // when
+        YqlConfigurationValidator.validateProperties(yqlConfiguration);
+    }
 }
diff --git a/components/readme.adoc b/components/readme.adoc
index ca1a164..945fb13 100644
--- a/components/readme.adoc
+++ b/components/readme.adoc
@@ -1044,7 +1044,7 @@ Miscellaneous Components
 ^^^^^^^^^^^^^^^^^^^^^^^^
 
 // others: START
-Number of Miscellaneous Components: 38 in 38 JAR artifacts (14 deprecated)
+Number of Miscellaneous Components: 37 in 37 JAR artifacts (13 deprecated)
 
 [width="100%",cols="4,1,5",options="header"]
 |===
@@ -1100,8 +1100,6 @@ Number of Miscellaneous Components: 38 in 38 JAR artifacts (14 deprecated)
 
 | link:camel-spring-cloud-netflix/src/main/docs/spring-cloud-netflix.adoc[Spring Cloud Netflix] (camel-spring-cloud-netflix) | 2.19 | Camel Cloud integration with Spring Cloud Netflix
 
-| link:camel-spring-dm/src/main/docs/spring-dm.adoc[Spring DM] (camel-spring-dm) | 2.18 | *deprecated* Camel SpringDM (OSGi) XML DSL
-
 | link:camel-spring-javaconfig/src/main/docs/spring-javaconfig.adoc[Spring Java Configuration] (camel-spring-javaconfig) | 2.0 | Using Camel with Spring Java Configuration
 
 | link:camel-spring-security/src/main/docs/spring-security.adoc[Spring Security] (camel-spring-security) | 2.3 | Security using Spring Security
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index b55a6a5..b1dc1ca 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -417,7 +417,6 @@
 	* [Spring Boot](spring-boot.adoc)
 	* [Spring Cloud](spring-cloud.adoc)
 	* [Spring Cloud Netflix](spring-cloud-netflix.adoc)
-	* [Spring DM](spring-dm.adoc)
 	* [Spring Java Configuration](spring-javaconfig.adoc)
 	* [Spring Security](spring-security.adoc)
 	* [Swagger](swagger.adoc)
diff --git a/platforms/spring-boot/components-starter/camel-yql-starter/src/main/java/org/apache/camel/component/yql/springboot/YqlComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-yql-starter/src/main/java/org/apache/camel/component/yql/springboot/YqlComponentConfiguration.java
index 9fccdf3..4b736b5 100644
--- a/platforms/spring-boot/components-starter/camel-yql-starter/src/main/java/org/apache/camel/component/yql/springboot/YqlComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-yql-starter/src/main/java/org/apache/camel/component/yql/springboot/YqlComponentConfiguration.java
@@ -18,7 +18,9 @@ package org.apache.camel.component.yql.springboot;
 
 import javax.annotation.Generated;
 import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon;
+import org.apache.http.conn.HttpClientConnectionManager;
 import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.context.properties.NestedConfigurationProperty;
 
 /**
  * Camel Yahoo Query Language Component
@@ -32,12 +34,26 @@ public class YqlComponentConfiguration
             ComponentConfigurationPropertiesCommon {
 
     /**
+     * Set the connection manager.
+     */
+    @NestedConfigurationProperty
+    private HttpClientConnectionManager connectionManager;
+    /**
      * Whether the component should resolve property placeholders on itself when
      * starting. Only properties which are of String type can use property
      * placeholders.
      */
     private Boolean resolvePropertyPlaceholders = true;
 
+    public HttpClientConnectionManager getConnectionManager() {
+        return connectionManager;
+    }
+
+    public void setConnectionManager(
+            HttpClientConnectionManager connectionManager) {
+        this.connectionManager = connectionManager;
+    }
+
     public Boolean getResolvePropertyPlaceholders() {
         return resolvePropertyPlaceholders;
     }

-- 
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.

[camel] 09/12: Fixed CS. This closes #2070

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 60d4aeaec5a61fdee4dc8cc6cc4353d9ed7a2194
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Nov 6 11:12:35 2017 +0100

    Fixed CS. This closes #2070
---
 .../apache/camel/component/yql/YqlComponent.java   | 29 +++++++++++-----------
 .../camel/component/yql/client/YqlClient.java      |  6 ++++-
 .../yql/configuration/YqlConfiguration.java        | 29 ++++++++++------------
 .../component/yql/exception/YqlHttpException.java  |  2 +-
 .../component/yql/YqlComponentIntegrationTest.java |  9 ++++---
 .../camel/component/yql/YqlComponentTest.java      |  3 ++-
 6 files changed, 41 insertions(+), 37 deletions(-)

diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
index affc329..59e39a8 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.yql;
 
 import java.util.Map;
+
 import org.apache.camel.Endpoint;
 import org.apache.camel.component.yql.configuration.YqlConfiguration;
 import org.apache.camel.component.yql.configuration.YqlConfigurationValidator;
@@ -42,26 +43,26 @@ public class YqlComponent extends DefaultComponent {
 
     @Override
     protected void doStop() throws Exception {
-      if (localConnectionManager != null) {
-        localConnectionManager.shutdown();
-      }
+        if (localConnectionManager != null) {
+            localConnectionManager.shutdown();
+        }
     }
 
     /**
      * Set the connection manager.
      */
-    public void setConnectionManager(final HttpClientConnectionManager connectionManager){
-      this.localConnectionManager = connectionManager;
+    public void setConnectionManager(final HttpClientConnectionManager connectionManager) {
+        this.localConnectionManager = connectionManager;
     }
 
-    private HttpClientConnectionManager createConnectionManager(){
-      if (localConnectionManager != null) {
-        return localConnectionManager;
-      }
-      final PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
-      connectionManager.setMaxTotal(200);
-      connectionManager.setDefaultMaxPerRoute(20);
-      setConnectionManager(connectionManager);
-      return connectionManager;
+    private HttpClientConnectionManager createConnectionManager() {
+        if (localConnectionManager != null) {
+            return localConnectionManager;
+        }
+        final PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
+        connectionManager.setMaxTotal(200);
+        connectionManager.setDefaultMaxPerRoute(20);
+        setConnectionManager(connectionManager);
+        return connectionManager;
     }
 }
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/client/YqlClient.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/client/YqlClient.java
index fa10869..1f5a7c6 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/client/YqlClient.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/client/YqlClient.java
@@ -67,7 +67,11 @@ public class YqlClient {
         final List<NameValuePair> nameValuePairs = new ArrayList<>();
         nameValuePairs.add(new BasicNameValuePair("q", yqlConfiguration.getQuery()));
         nameValuePairs.add(new BasicNameValuePair("format", yqlConfiguration.getFormat()));
-        nameValuePairs.add(new BasicNameValuePair("callback", yqlConfiguration.getCallback()));
+        String callback = yqlConfiguration.getCallback();
+        if (callback == null) {
+            callback = "";
+        }
+        nameValuePairs.add(new BasicNameValuePair("callback", callback));
         if (yqlConfiguration.getCrossProduct() != null) {
             nameValuePairs.add(new BasicNameValuePair("crossProduct", yqlConfiguration.getCrossProduct()));
         }
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java
index b26e347..a9b0555 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java
@@ -27,38 +27,35 @@ import org.apache.camel.spi.UriPath;
 @UriParams
 public class YqlConfiguration {
 
-    @UriPath(label = "producer", description = "The YQL statement to execute.")
+    @UriPath
     @Metadata(required = "true")
     private String query;
 
-    @UriParam(label = "producer", enums = "json,xml", defaultValue = "json", description = "The expected format. Allowed values: xml or json.")
+    @UriParam(enums = "json,xml", defaultValue = "json")
     private String format = "json";
 
-    @UriParam(label = "producer", description = "The name of the JavaScript callback function for JSONP format. If callback is set and if format=json, then the response format is JSON. For more "
-            + "information on using XML instead of JSON, see JSONP-X.")
-    private String callback = "";
+    @UriParam
+    private String callback;
 
-    @UriParam(label = "producer", description = "When given the value optimized, the projected fields in SELECT statements that may be returned in separate item elements in the response are "
-            + "optimized to be in a single item element instead. The only allowed value is optimized.")
+    @UriParam
     private String crossProduct;
 
-    @UriParam(label = "producer", defaultValue = "false", description = "If true, diagnostic information is returned with the response.")
-    private boolean diagnostics = false;
+    @UriParam
+    private boolean diagnostics;
 
-    @UriParam(label = "producer", defaultValue = "false", description = "If true, and if diagnostic is set to true, debug data is returned with the response.")
-    private boolean debug = false;
+    @UriParam
+    private boolean debug;
 
-    @UriParam(label = "producer", description = "Allows you to use multiple Open Data Tables through a YQL environment file.")
+    @UriParam
     private String env;
 
-    @UriParam(label = "producer", description = "Enables lossless JSON processing. The only allowed value is new.")
+    @UriParam
     private String jsonCompat;
 
-    @UriParam(label = "producer", defaultValue = "true", description = "Option to disable throwing the YqlHttpException in case of failed responses from the remote server. "
-            + "This allows you to get all responses regardless of the HTTP status code.")
+    @UriParam(defaultValue = "true")
     private boolean throwExceptionOnFailure = true;
 
-    @UriParam(label = "producer", defaultValue = "true", description = "Option to use HTTPS to communicate with YQL.")
+    @UriParam(label = "security", defaultValue = "true")
     private boolean https = true;
 
     public String getQuery() {
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/exception/YqlHttpException.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/exception/YqlHttpException.java
index 3eea124..389bba7 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/exception/YqlHttpException.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/exception/YqlHttpException.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.yql.exception;
 /**
  * Signal a non 200 HTTP response
  */
-public class YqlHttpException extends YqlException {
+public final class YqlHttpException extends YqlException {
 
     private final int httpStatus;
     private final String body;
diff --git a/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentIntegrationTest.java b/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentIntegrationTest.java
index e8164e7..d0e86c7 100644
--- a/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentIntegrationTest.java
+++ b/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentIntegrationTest.java
@@ -16,12 +16,9 @@
  */
 package org.apache.camel.component.yql;
 
-import static org.apache.camel.component.yql.YqlProducer.CAMEL_YQL_HTTP_REQUEST;
-import static org.apache.camel.component.yql.YqlProducer.CAMEL_YQL_HTTP_STATUS;
-import static org.hamcrest.CoreMatchers.containsString;
-
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
+
 import org.apache.camel.CamelExecutionException;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Exchange;
@@ -35,6 +32,10 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 
+import static org.apache.camel.component.yql.YqlProducer.CAMEL_YQL_HTTP_REQUEST;
+import static org.apache.camel.component.yql.YqlProducer.CAMEL_YQL_HTTP_STATUS;
+import static org.hamcrest.CoreMatchers.containsString;
+
 public class YqlComponentIntegrationTest extends CamelTestSupport {
 
     private static final String FINANCE_QUERY = "select symbol, Ask, Bid,  from yahoo.finance.quotes where symbol in ('GOOG')";
diff --git a/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentTest.java b/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentTest.java
index fe63ec2..5c959ab 100644
--- a/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentTest.java
+++ b/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentTest.java
@@ -60,7 +60,8 @@ public class YqlComponentTest extends CamelTestSupport {
     @Test
     public void testConfigurationSetup() {
         // given
-        final YqlEndpoint yqlEndpoint = (YqlEndpoint) context.getEndpoint("yql://query?format=xml&callback=yqlCallback&diagnostics=true&debug=true&https=false&throwExceptionOnFailure=false&jsonCompat=new");
+        final YqlEndpoint yqlEndpoint = (YqlEndpoint) context.getEndpoint("yql://query?format=xml&callback=yqlCallback&diagnostics=true"
+            + "&debug=true&https=false&throwExceptionOnFailure=false&jsonCompat=new");
 
         // when
         final YqlConfiguration yqlConfiguration = yqlEndpoint.getConfiguration();

-- 
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.

[camel] 01/12: CAMEL-11959: Add new camel-yql component

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 59d5a62fa069cb7fd6fa536daf10056ab8fb8111
Author: Carl-Philipp Harmant <cp...@gmail.com>
AuthorDate: Mon Oct 30 21:20:57 2017 -0500

    CAMEL-11959: Add new camel-yql component
---
 apache-camel/pom.xml                               |   4 +
 apache-camel/src/main/descriptors/common-bin.xml   |   1 +
 bom/camel-bom/pom.xml                              |   5 +
 components/camel-yql/pom.xml                       | 116 ++++++++++++
 .../camel-yql/src/main/docs/yql-component.adoc     | 117 ++++++++++++
 .../apache/camel/component/yql/YqlComponent.java   |  42 +++++
 .../apache/camel/component/yql/YqlEndpoint.java    |  56 ++++++
 .../apache/camel/component/yql/YqlProducer.java    |  55 ++++++
 .../camel/component/yql/client/YqlClient.java      |  60 ++++++
 .../camel/component/yql/client/YqlResponse.java    |  74 ++++++++
 .../yql/configuration/YqlConfiguration.java        |  83 +++++++++
 .../configuration/YqlConfigurationValidator.java   |  36 ++++
 .../component/yql/exception/YqlException.java      |  24 +++
 .../camel-yql/src/main/resources/LICENSE.txt       | 203 +++++++++++++++++++++
 .../services/org/apache/camel/component/yql        |  18 ++
 components/camel-yql/src/main/resources/NOTICE.txt |  11 ++
 .../component/yql/YqlComponentIntegrationTest.java |  68 +++++++
 .../camel/component/yql/YqlComponentTest.java      | 103 +++++++++++
 .../YqlConfigurationValidatorTest.java             | 112 ++++++++++++
 .../camel-yql/src/test/resources/log4j2.properties |  33 ++++
 components/pom.xml                                 |   1 +
 components/readme.adoc                             |   9 +-
 docs/user-manual/en/SUMMARY.md                     |   2 +
 parent/pom.xml                                     |   5 +
 .../components-starter/camel-yql-starter/pom.xml   |  61 +++++++
 .../springboot/YqlComponentAutoConfiguration.java  | 128 +++++++++++++
 .../yql/springboot/YqlComponentConfiguration.java  |  49 +++++
 .../src/main/resources/META-INF/LICENSE.txt        | 203 +++++++++++++++++++++
 .../src/main/resources/META-INF/NOTICE.txt         |  11 ++
 .../src/main/resources/META-INF/spring.factories   |  19 ++
 .../src/main/resources/META-INF/spring.provides    |  17 ++
 platforms/spring-boot/components-starter/pom.xml   |   1 +
 .../camel-spring-boot-dependencies/pom.xml         |   5 +
 33 files changed, 1730 insertions(+), 2 deletions(-)

diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index faf8991..99439e3 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -1143,6 +1143,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-yql</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-zendesk</artifactId>
     </dependency>
     <dependency>
diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index 51c46bf..d795394 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -293,6 +293,7 @@
         <include>org.apache.camel:camel-xmpp</include>
         <include>org.apache.camel:camel-xstream</include>
         <include>org.apache.camel:camel-yammer</include>
+        <include>org.apache.camel:camel-yql</include>
         <include>org.apache.camel:camel-zendesk</include>
         <include>org.apache.camel:camel-zipfile</include>
         <include>org.apache.camel:camel-zipkin</include>
diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml
index 97e51ed..bbf6f0b 100644
--- a/bom/camel-bom/pom.xml
+++ b/bom/camel-bom/pom.xml
@@ -2720,6 +2720,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-yql</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-zendesk</artifactId>
         <version>${project.version}</version>
       </dependency>
diff --git a/components/camel-yql/pom.xml b/components/camel-yql/pom.xml
new file mode 100644
index 0000000..e8ec4d9
--- /dev/null
+++ b/components/camel-yql/pom.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+         http://www.apache.org/licenses/LICENSE-2.0
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>components</artifactId>
+    <version>2.21.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-yql</artifactId>
+  <packaging>jar</packaging>
+
+  <name>Camel :: Yql</name>
+  <description>Camel Yahoo Query Language Component</description>
+
+  <properties>
+    <camel.osgi.export.pkg>org.apache.camel.component.yql.*</camel.osgi.export.pkg>
+    <camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=yql</camel.osgi.export.service>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpclient</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+      <version>${commons-lang3-version}</version>
+    </dependency>
+
+    <!-- testing -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.hamcrest</groupId>
+      <artifactId>java-hamcrest</artifactId>
+      <version>${hamcrest-version}</version>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- logging -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+      <version>${log4j2-version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <version>${log4j2-version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+      <version>${log4j2-version}</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <profiles>
+    <profile>
+      <id>integration</id>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds>
+              <childDelegation>false</childDelegation>
+              <useFile>true</useFile>
+              <failIfNoTests>false</failIfNoTests>
+              <runOrder>alphabetical</runOrder>
+              <includes>
+                <include>**/*IntegrationTest.java</include>
+              </includes>
+              <excludes>
+                <exclude>**/*XXXTest.java</exclude>
+              </excludes>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>
\ No newline at end of file
diff --git a/components/camel-yql/src/main/docs/yql-component.adoc b/components/camel-yql/src/main/docs/yql-component.adoc
new file mode 100644
index 0000000..e7b0951
--- /dev/null
+++ b/components/camel-yql/src/main/docs/yql-component.adoc
@@ -0,0 +1,117 @@
+== Yahoo Query Language Component
+
+*Available as of Camel version 2.21*
+
+The *yql* component is used for accessing the https://developer.yahoo.com/yql/[Yahoo Query Language platform].
+
+Maven users will need to add the following dependency to their `pom.xml`
+for this component:
+
+[source,xml]
+------------------------------------------------------------
+<dependency>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-yql</artifactId>
+    <version>x.x.x</version>
+    <!-- use the same version as your Camel core version -->
+</dependency>
+------------------------------------------------------------
+
+### URI format
+
+[source,java]
+--------------------------------------------
+yql://query[?options]
+--------------------------------------------
+
+Where *query* represents the YQL query.
+
+### Options
+
+// component options: START
+The Yahoo Query Language component has no options.
+// component options: END
+
+// endpoint options: START
+The Yahoo Query Language endpoint is configured using URI syntax:
+
+----
+yql:query
+----
+
+with the following path and query parameters:
+
+==== Path Parameters (1 parameters):
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *query* | *Required* Set the YQL query |  | String
+|===
+
+==== Query Parameters (4 parameters):
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *callback* (producer) | Set the callback function |  | String
+| *diagnostics* (producer) | Set if diagnostics should be included in the query | false | boolean
+| *format* (producer) | Set the YQL format xml or json |  | String
+| *synchronous* (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean
+|===
+// endpoint options: END
+
+### Exchange data format
+
+Camel will deliver the body as a JSON or XML formatted java.lang.String (see
+the `format` option above).
+
+### Message Headers
+
+[width="100%",cols="10%,90%",options="header",]
+|=======================================================================
+|Header |Description
+|`CamelYqlHttpRequest` | Http request sent to YQL
+|`CamelYqlHttpStatus` | Status code from the response
+|=======================================================================
+
+### Samples
+
+In this example we query YQL to obtain Google quote:
+
+[source,java]
+--------------------------------------------------------
+from("direct:start")
+  .to("yql://select * from yahoo.finance.quotes where symbol in ('GOOG')?format=json");
+--------------------------------------------------------
+
+Which will setup the body as:
+
+[source,json]
+--------------------------------------------------------
+{
+ "query": {
+  "count": 1,
+  "created": "2017-10-29T03:17:28Z",
+  "lang": "en-US",
+  "results": {
+   "quote": {
+    "symbol": "GOOG",
+    "Ask": "1024.50",
+    "AverageDailyVolume": "1356700",
+    "Bid": "1019.27",
+    ...
+   }
+  }
+ }
+}
+--------------------------------------------------------
+
+and the headers:
+
+[width="100%",cols="30%,70%",options="header",]
+|=======================================================================
+|Header |Value
+|`CamelYqlHttpRequest` |http://query.yahooapis.com/v1/public/yql?format=json&diagnostics=false&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=yqlCallback&q=select+*+from+yahoo.finance.quotes+where+symbol+in+%28%27GOOG%27%29
+|`CamelYqlHttpStatus` |200
+|=======================================================================
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
new file mode 100644
index 0000000..8f5d496
--- /dev/null
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.yql;
+
+import java.util.Map;
+import org.apache.camel.Endpoint;
+import org.apache.camel.component.yql.configuration.YqlConfiguration;
+import org.apache.camel.component.yql.configuration.YqlConfigurationValidator;
+import org.apache.camel.impl.DefaultComponent;
+
+public class YqlComponent extends DefaultComponent {
+
+    @Override
+    protected Endpoint createEndpoint(final String uri, final String remaining, final Map<String, Object> parameters) throws Exception {
+        final YqlConfiguration configuration = new YqlConfiguration();
+        configuration.setQuery(remaining);
+        configuration.setFormat((String) parameters.getOrDefault("format", "json"));
+        configuration.setDiagnostics(Boolean.getBoolean((String) parameters.getOrDefault("diagnostics", "false")));
+        configuration.setCallback((String) parameters.getOrDefault("callback", ""));
+
+        final Endpoint endpoint = new YqlEndpoint(uri, this, configuration);
+
+        YqlConfigurationValidator.validateProperties(configuration);
+
+        setProperties(configuration, parameters);
+        return endpoint;
+    }
+}
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlEndpoint.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlEndpoint.java
new file mode 100644
index 0000000..af283e4
--- /dev/null
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlEndpoint.java
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.yql;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.component.yql.configuration.YqlConfiguration;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+
+@UriEndpoint(firstVersion = "2.21.0", scheme = "yql", title = "Yahoo Query Language", syntax = "yql:query", producerOnly = true, label = "api,http")
+public class YqlEndpoint extends DefaultEndpoint {
+
+    @UriParam
+    private final YqlConfiguration configuration;
+
+    YqlEndpoint(final String uri, final YqlComponent component, final YqlConfiguration configuration) {
+        super(uri, component);
+        this.configuration = configuration;
+    }
+
+    @Override
+    public Producer createProducer() throws Exception {
+        return new YqlProducer(this);
+    }
+
+    @Override
+    public Consumer createConsumer(final Processor processor) throws Exception {
+        throw new UnsupportedOperationException("Consumer does not supported for YQL component: " + getEndpointUri());
+    }
+
+    @Override
+    public boolean isSingleton() {
+        return true;
+    }
+
+    YqlConfiguration getConfiguration() {
+        return configuration;
+    }
+}
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlProducer.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlProducer.java
new file mode 100644
index 0000000..c63dc7b
--- /dev/null
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlProducer.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.yql;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.component.yql.client.YqlClient;
+import org.apache.camel.component.yql.client.YqlResponse;
+import org.apache.camel.component.yql.configuration.YqlConfiguration;
+import org.apache.camel.impl.DefaultProducer;
+
+/**
+ * A Producer that send messages to YQL
+ */
+public class YqlProducer extends DefaultProducer {
+
+    static final String CAMEL_YQL_HTTP_STATUS = "CamelYqlHttpStatus";
+    static final String CAMEL_YQL_HTTP_REQUEST = "CamelYqlHttpRequest";
+
+    private final YqlEndpoint endpoint;
+    private final YqlClient yahooClient;
+
+    YqlProducer(final YqlEndpoint endpoint) {
+        super(endpoint);
+        this.endpoint = endpoint;
+        this.yahooClient = new YqlClient();
+    }
+
+    @Override
+    public void process(final Exchange exchange) throws Exception {
+        final YqlConfiguration configuration = endpoint.getConfiguration();
+        final YqlResponse yqlResponse = yahooClient.get(
+                configuration.getQuery(),
+                configuration.getFormat(),
+                configuration.isDiagnostics(),
+                configuration.getCallback()
+        );
+        exchange.getIn().setHeader(CAMEL_YQL_HTTP_STATUS, yqlResponse.getStatus());
+        exchange.getIn().setHeader(CAMEL_YQL_HTTP_REQUEST, yqlResponse.getHttpRequest());
+        exchange.getIn().setBody(yqlResponse.getBody());
+    }
+}
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/client/YqlClient.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/client/YqlClient.java
new file mode 100644
index 0000000..0d5f00d
--- /dev/null
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/client/YqlClient.java
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.yql.client;
+
+import java.net.URI;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class YqlClient {
+
+    private static final Logger LOG = LoggerFactory.getLogger(YqlClient.class);
+    private static final CloseableHttpClient HTTP_CLIENT = HttpClients.createDefault();
+
+    public YqlResponse get(final String query, final String format, final boolean diagnostics, final String callback) throws Exception {
+
+        final URI uri = new URIBuilder()
+                .setScheme("http")
+                .setHost("query.yahooapis.com")
+                .setPath("/v1/public/yql")
+                .setParameter("format", format)
+                .setParameter("diagnostics", Boolean.toString(diagnostics))
+                .setParameter("env", "store://datatables.org/alltableswithkeys")
+                .setParameter("callback", callback)
+                .setParameter("q", query)
+                .build();
+
+        LOG.debug("YQL query: {}", uri);
+
+        final HttpGet httpget = new HttpGet(uri);
+        try (final CloseableHttpResponse response = HTTP_CLIENT.execute(httpget)) {
+            final YqlResponse yqlResponse = YqlResponse.builder()
+                    .httpRequest(uri.toString())
+                    .status(response.getStatusLine().getStatusCode())
+                    .body(EntityUtils.toString(response.getEntity()))
+                    .build();
+            LOG.debug("YQL response: {}", yqlResponse.getBody());
+            return yqlResponse;
+        }
+    }
+}
\ No newline at end of file
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/client/YqlResponse.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/client/YqlResponse.java
new file mode 100644
index 0000000..104ef53
--- /dev/null
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/client/YqlResponse.java
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.yql.client;
+
+public final class YqlResponse {
+
+    private final int status;
+    private final String body;
+    private final String httpRequest;
+
+    private YqlResponse(final Builder builder) {
+        this.status = builder.status;
+        this.body = builder.body;
+        this.httpRequest = builder.httpRequest;
+    }
+
+    public int getStatus() {
+        return status;
+    }
+
+    public String getBody() {
+        return body;
+    }
+
+    public String getHttpRequest() {
+        return httpRequest;
+    }
+
+    static YqlResponse.Builder builder() {
+        return new YqlResponse.Builder();
+    }
+
+    static class Builder {
+        private int status;
+        private String body;
+        private String httpRequest;
+
+        Builder() {
+        }
+
+        Builder status(final int status) {
+            this.status = status;
+            return this;
+        }
+
+        Builder body(final String body) {
+            this.body = body;
+            return this;
+        }
+
+        Builder httpRequest(final String httpRequest) {
+            this.httpRequest = httpRequest;
+            return this;
+        }
+
+        YqlResponse build() {
+            return new YqlResponse(this);
+        }
+    }
+}
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java
new file mode 100644
index 0000000..056327d
--- /dev/null
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java
@@ -0,0 +1,83 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.yql.configuration;
+
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
+import org.apache.camel.spi.UriPath;
+
+@UriParams
+public class YqlConfiguration {
+
+    @UriPath
+    @Metadata(required = "true")
+    private String query;
+
+    @UriParam
+    private String format;
+
+    @UriParam
+    private boolean diagnostics;
+
+    @UriParam
+    private String callback;
+
+    public String getQuery() {
+        return query;
+    }
+
+    /**
+     * Set the YQL query
+     */
+    public void setQuery(final String query) {
+        this.query = query;
+    }
+
+    public String getFormat() {
+        return format;
+    }
+
+    /**
+     * Set the YQL format, xml or json
+     */
+    public void setFormat(final String format) {
+        this.format = format;
+    }
+
+    public boolean isDiagnostics() {
+        return diagnostics;
+    }
+
+    /**
+     * Set if diagnostics should be included in the query
+     */
+    public void setDiagnostics(final boolean diagnostics) {
+        this.diagnostics = diagnostics;
+    }
+
+    public String getCallback() {
+        return callback;
+    }
+
+    /**
+     * Set the callback function
+     */
+    public void setCallback(final String callback) {
+        this.callback = callback;
+    }
+}
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfigurationValidator.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfigurationValidator.java
new file mode 100644
index 0000000..0ab0ff7
--- /dev/null
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfigurationValidator.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.yql.configuration;
+
+import org.apache.camel.component.yql.exception.YqlException;
+import org.apache.commons.lang3.StringUtils;
+
+public final class YqlConfigurationValidator {
+
+    private YqlConfigurationValidator() {
+    }
+
+    public static void validateProperties(final YqlConfiguration configuration) {
+        if (StringUtils.isEmpty(configuration.getQuery())) {
+            throw new YqlException("<query> is not present or not valid!");
+        }
+
+        if (!StringUtils.equalsAny(configuration.getFormat(), "json", "xml")) {
+            throw new YqlException("<format> is not valid!");
+        }
+    }
+}
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/exception/YqlException.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/exception/YqlException.java
new file mode 100644
index 0000000..d422e5c
--- /dev/null
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/exception/YqlException.java
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.yql.exception;
+
+public class YqlException extends RuntimeException {
+
+    public YqlException(final String message) {
+        super(message);
+    }
+}
diff --git a/components/camel-yql/src/main/resources/LICENSE.txt b/components/camel-yql/src/main/resources/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/components/camel-yql/src/main/resources/LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
diff --git a/components/camel-yql/src/main/resources/META-INF/services/org/apache/camel/component/yql b/components/camel-yql/src/main/resources/META-INF/services/org/apache/camel/component/yql
new file mode 100644
index 0000000..748b461
--- /dev/null
+++ b/components/camel-yql/src/main/resources/META-INF/services/org/apache/camel/component/yql
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+class=org.apache.camel.component.yql.YqlComponent
diff --git a/components/camel-yql/src/main/resources/NOTICE.txt b/components/camel-yql/src/main/resources/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ b/components/camel-yql/src/main/resources/NOTICE.txt
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache Camel distribution.                    ==
+   =========================================================================
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Please read the different LICENSE files present in the licenses directory of
+   this distribution.
diff --git a/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentIntegrationTest.java b/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentIntegrationTest.java
new file mode 100644
index 0000000..6bbf8ee
--- /dev/null
+++ b/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentIntegrationTest.java
@@ -0,0 +1,68 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.yql;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+import static org.apache.camel.component.yql.YqlProducer.CAMEL_YQL_HTTP_REQUEST;
+import static org.apache.camel.component.yql.YqlProducer.CAMEL_YQL_HTTP_STATUS;
+import static org.hamcrest.CoreMatchers.containsString;
+
+public class YqlComponentIntegrationTest extends CamelTestSupport {
+
+    private static final String QUERY = "select * from yahoo.finance.quotes where symbol in ('GOOG')";
+    private static final String CALLBACK = "yqlCallback";
+
+    @Produce(uri = "direct:start")
+    private ProducerTemplate template;
+
+    @EndpointInject(uri = "mock:result")
+    private MockEndpoint end;
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                from("direct:start")
+                        .to("yql://" + QUERY + "?format=json&callback=" + CALLBACK)
+                        .to("mock:result");
+            }
+        };
+    }
+
+    @Test
+    public void testFinanceQuote() {
+        template.sendBody("");
+
+        final Exchange exchange = end.getReceivedExchanges().get(0);
+        final String body = exchange.getIn().getBody(String.class);
+        final Integer status = exchange.getIn().getHeader(CAMEL_YQL_HTTP_STATUS, Integer.class);
+        final String httpRequest = exchange.getIn().getHeader(CAMEL_YQL_HTTP_REQUEST, String.class);
+        assertNotNull(body);
+        assertThat(body, containsString(CALLBACK + "("));
+        assertNotNull(status);
+        assertEquals("http://query.yahooapis.com/v1/public/yql?format=json&diagnostics=false&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=yqlCallback&q=select+*+from+"
+                + "yahoo.finance.quotes+where+symbol+in+%28%27GOOG%27%29", httpRequest);
+    }
+}
diff --git a/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentTest.java b/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentTest.java
new file mode 100644
index 0000000..dfa03e6
--- /dev/null
+++ b/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentTest.java
@@ -0,0 +1,103 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.yql;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Producer;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.yql.configuration.YqlConfiguration;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.text.IsEmptyString.emptyString;
+
+public class YqlComponentTest extends CamelTestSupport {
+
+    @Rule
+    public final ExpectedException thrown = ExpectedException.none();
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                from("direct:start")
+                        .to("yql://query?format=json")
+                        .to("mock:result");
+            }
+        };
+    }
+
+    @Test
+    public void testCreateProducer() throws Exception {
+        // given
+        final Endpoint yqlEndpoint = context.getEndpoint("yql://query?format=json");
+
+        // when
+        final Producer producer = yqlEndpoint.createProducer();
+
+        // then
+        assertNotNull(producer);
+        assertTrue(producer instanceof YqlProducer);
+    }
+
+    @Test
+    public void testConfigurationSetup() {
+        // given
+        final YqlEndpoint yqlEndpoint = (YqlEndpoint) context.getEndpoint("yql://query?format=xml&callback=yqlCallback&diagnostics=true");
+
+        // when
+        final YqlConfiguration yqlConfiguration = yqlEndpoint.getConfiguration();
+
+        // then
+        assertNotNull(yqlConfiguration);
+        assertEquals("query", yqlConfiguration.getQuery());
+        assertEquals("xml", yqlConfiguration.getFormat());
+        assertEquals("yqlCallback", yqlConfiguration.getCallback());
+        assertTrue(yqlConfiguration.isDiagnostics());
+    }
+
+    @Test
+    public void testConfigurationSetupDefault() {
+        // given
+        final YqlEndpoint yqlEndpoint = (YqlEndpoint) context.getEndpoint("yql://query");
+
+        // when
+        final YqlConfiguration yqlConfiguration = yqlEndpoint.getConfiguration();
+
+        // then
+        assertNotNull(yqlConfiguration);
+        assertEquals("query", yqlConfiguration.getQuery());
+        assertEquals("json", yqlConfiguration.getFormat());
+        assertThat(yqlConfiguration.getCallback(), is(emptyString()));
+        assertFalse(yqlConfiguration.isDiagnostics());
+    }
+
+    @Test
+    public void testCreateConsumer() throws Exception {
+        // then
+        thrown.expect(UnsupportedOperationException.class);
+
+        // given
+        final Endpoint yqlEndpoint = context.getEndpoint("yql://query?format=json");
+
+        // when
+        yqlEndpoint.createConsumer(null);
+    }
+}
diff --git a/components/camel-yql/src/test/java/org/apache/camel/component/yql/configuration/YqlConfigurationValidatorTest.java b/components/camel-yql/src/test/java/org/apache/camel/component/yql/configuration/YqlConfigurationValidatorTest.java
new file mode 100644
index 0000000..b7747a8
--- /dev/null
+++ b/components/camel-yql/src/test/java/org/apache/camel/component/yql/configuration/YqlConfigurationValidatorTest.java
@@ -0,0 +1,112 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.yql.configuration;
+
+import org.apache.camel.component.yql.exception.YqlException;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+public class YqlConfigurationValidatorTest {
+
+    @Rule
+    public final ExpectedException thrown = ExpectedException.none();
+
+    @Test
+    public void testGoodQuery() {
+        // given
+        final YqlConfiguration yqlConfiguration = new YqlConfiguration();
+        yqlConfiguration.setQuery("select * from ...");
+        yqlConfiguration.setFormat("json");
+
+        // when
+        YqlConfigurationValidator.validateProperties(yqlConfiguration);
+
+        // then
+        // no exception
+    }
+
+    @Test
+    public void testMissingQuery() {
+        // then
+        thrown.expect(YqlException.class);
+        thrown.expectMessage("<query> is not present or not valid!");
+
+        // given
+        final YqlConfiguration yqlConfiguration = new YqlConfiguration();
+
+        // when
+        YqlConfigurationValidator.validateProperties(yqlConfiguration);
+    }
+
+    @Test
+    public void testJsonFormat() {
+        // given
+        final YqlConfiguration yqlConfiguration = new YqlConfiguration();
+        yqlConfiguration.setQuery("query");
+        yqlConfiguration.setFormat("json");
+
+        // when
+        YqlConfigurationValidator.validateProperties(yqlConfiguration);
+
+        // then
+        // no exception
+    }
+
+    @Test
+    public void testXmlFormat() {
+        // given
+        final YqlConfiguration yqlConfiguration = new YqlConfiguration();
+        yqlConfiguration.setQuery("query");
+        yqlConfiguration.setFormat("xml");
+
+        // when
+        YqlConfigurationValidator.validateProperties(yqlConfiguration);
+
+        // then
+        // no exception
+    }
+
+    @Test
+    public void testEmptyFormat() {
+        // then
+        thrown.expect(YqlException.class);
+        thrown.expectMessage("<format> is not valid!");
+
+        // given
+        final YqlConfiguration yqlConfiguration = new YqlConfiguration();
+        yqlConfiguration.setQuery("query");
+
+        // when
+        YqlConfigurationValidator.validateProperties(yqlConfiguration);
+    }
+
+    @Test
+    public void testWrongFormat() {
+        // then
+        thrown.expect(YqlException.class);
+        thrown.expectMessage("<format> is not valid!");
+
+        // given
+        final YqlConfiguration yqlConfiguration = new YqlConfiguration();
+        yqlConfiguration.setQuery("query");
+        yqlConfiguration.setFormat("format");
+
+        // when
+        YqlConfigurationValidator.validateProperties(yqlConfiguration);
+    }
+}
diff --git a/components/camel-yql/src/test/resources/log4j2.properties b/components/camel-yql/src/test/resources/log4j2.properties
new file mode 100644
index 0000000..3b123ad
--- /dev/null
+++ b/components/camel-yql/src/test/resources/log4j2.properties
@@ -0,0 +1,33 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+appender.file.type = File
+appender.file.name = file
+appender.file.fileName = target/camel-sql-component-test.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+appender.out.type = Console
+appender.out.name = out
+appender.out.layout.type = PatternLayout
+appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# uncomment the following line to turn on Camel debugging
+#logger.camel.name = org.apache.camel
+#logger.camel.level =DEBUG
+
+rootLogger.level = INFO
+rootLogger.appenderRef.out.ref = out
diff --git a/components/pom.xml b/components/pom.xml
index 1be411f..00f4967 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -309,6 +309,7 @@
     <module>camel-xmpp</module>
     <module>camel-xstream</module>
     <module>camel-yammer</module>
+    <module>camel-yql</module>
     <module>camel-zendesk</module>
     <module>camel-zipfile</module>
     <module>camel-zipkin</module>
diff --git a/components/readme.adoc b/components/readme.adoc
index d3fd456..ca1a164 100644
--- a/components/readme.adoc
+++ b/components/readme.adoc
@@ -2,7 +2,7 @@ Components
 ^^^^^^^^^^
 
 // components: START
-Number of Components: 285 in 196 JAR artifacts (19 deprecated)
+Number of Components: 286 in 197 JAR artifacts (19 deprecated)
 
 [width="100%",cols="4,1,5",options="header"]
 |===
@@ -851,6 +851,9 @@ Number of Components: 285 in 196 JAR artifacts (19 deprecated)
 | link:../camel-core/src/main/docs/xslt-component.adoc[XSLT] (camel-core) +
 `xslt:resourceUri` | 1.3 | Transforms the message using a XSLT template.
 
+| link:camel-yql/src/main/docs/yql-component.adoc[Yahoo Query Language] (camel-yql) +
+`yql:query` | 2.21 | Camel Yahoo Query Language Component
+
 | link:camel-yammer/src/main/docs/yammer-component.adoc[Yammer] (camel-yammer) +
 `yammer:function` | 2.12 | The yammer component allows you to interact with the Yammer enterprise social network.
 
@@ -1041,7 +1044,7 @@ Miscellaneous Components
 ^^^^^^^^^^^^^^^^^^^^^^^^
 
 // others: START
-Number of Miscellaneous Components: 37 in 37 JAR artifacts (13 deprecated)
+Number of Miscellaneous Components: 38 in 38 JAR artifacts (14 deprecated)
 
 [width="100%",cols="4,1,5",options="header"]
 |===
@@ -1097,6 +1100,8 @@ Number of Miscellaneous Components: 37 in 37 JAR artifacts (13 deprecated)
 
 | link:camel-spring-cloud-netflix/src/main/docs/spring-cloud-netflix.adoc[Spring Cloud Netflix] (camel-spring-cloud-netflix) | 2.19 | Camel Cloud integration with Spring Cloud Netflix
 
+| link:camel-spring-dm/src/main/docs/spring-dm.adoc[Spring DM] (camel-spring-dm) | 2.18 | *deprecated* Camel SpringDM (OSGi) XML DSL
+
 | link:camel-spring-javaconfig/src/main/docs/spring-javaconfig.adoc[Spring Java Configuration] (camel-spring-javaconfig) | 2.0 | Using Camel with Spring Java Configuration
 
 | link:camel-spring-security/src/main/docs/spring-security.adoc[Spring Security] (camel-spring-security) | 2.3 | Security using Spring Security
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 7ff258f..b55a6a5 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -380,6 +380,7 @@
 	* [XML Security](xmlsecurity-component.adoc)
 	* [XMPP](xmpp-component.adoc)
 	* [XQuery](xquery-component.adoc)
+	* [Yahoo Query Language](yql-component.adoc)
 	* [Yammer](yammer-component.adoc)
 	* [Zendesk](zendesk-component.adoc)
 	* [ZooKeeper](zookeeper-component.adoc)
@@ -416,6 +417,7 @@
 	* [Spring Boot](spring-boot.adoc)
 	* [Spring Cloud](spring-cloud.adoc)
 	* [Spring Cloud Netflix](spring-cloud-netflix.adoc)
+	* [Spring DM](spring-dm.adoc)
 	* [Spring Java Configuration](spring-javaconfig.adoc)
 	* [Spring Security](spring-security.adoc)
 	* [Swagger](swagger.adoc)
diff --git a/parent/pom.xml b/parent/pom.xml
index de62823..d3c2b9e 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -2197,6 +2197,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-yql</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-zendesk</artifactId>
         <version>${project.version}</version>
       </dependency>
diff --git a/platforms/spring-boot/components-starter/camel-yql-starter/pom.xml b/platforms/spring-boot/components-starter/camel-yql-starter/pom.xml
new file mode 100644
index 0000000..ced5b4c
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-yql-starter/pom.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>components-starter</artifactId>
+    <version>2.21.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>camel-yql-starter</artifactId>
+  <packaging>jar</packaging>
+  <name>Spring-Boot Starter :: Camel :: Yql</name>
+  <description>Spring-Boot Starter for Camel Yahoo Query Language Component</description>
+  <dependencies>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter</artifactId>
+      <version>${spring-boot-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-yql</artifactId>
+      <version>${project.version}</version>
+      <!--START OF GENERATED CODE-->
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+      <!--END OF GENERATED CODE-->
+    </dependency>
+    <!--START OF GENERATED CODE-->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core-starter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring-boot-starter</artifactId>
+    </dependency>
+    <!--END OF GENERATED CODE-->
+  </dependencies>
+</project>
diff --git a/platforms/spring-boot/components-starter/camel-yql-starter/src/main/java/org/apache/camel/component/yql/springboot/YqlComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-yql-starter/src/main/java/org/apache/camel/component/yql/springboot/YqlComponentAutoConfiguration.java
new file mode 100644
index 0000000..7f86140
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-yql-starter/src/main/java/org/apache/camel/component/yql/springboot/YqlComponentAutoConfiguration.java
@@ -0,0 +1,128 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.yql.springboot;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Generated;
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.yql.YqlComponent;
+import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.spring.boot.ComponentConfigurationProperties;
+import org.apache.camel.spring.boot.util.CamelPropertiesHelper;
+import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
+import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
+import org.apache.camel.util.IntrospectionSupport;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Conditional;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Lazy;
+
+/**
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo")
+@Configuration
+@Conditional({ConditionalOnCamelContextAndAutoConfigurationBeans.class,
+        YqlComponentAutoConfiguration.GroupConditions.class})
+@AutoConfigureAfter(CamelAutoConfiguration.class)
+@EnableConfigurationProperties({ComponentConfigurationProperties.class,
+        YqlComponentConfiguration.class})
+public class YqlComponentAutoConfiguration {
+
+    private static final Logger LOGGER = LoggerFactory
+            .getLogger(YqlComponentAutoConfiguration.class);
+    @Autowired
+    private ApplicationContext applicationContext;
+    @Autowired
+    private CamelContext camelContext;
+    @Autowired
+    private YqlComponentConfiguration configuration;
+    @Autowired(required = false)
+    private List<ComponentCustomizer<YqlComponent>> customizers;
+
+    static class GroupConditions extends GroupCondition {
+        public GroupConditions() {
+            super("camel.component", "camel.component.yql");
+        }
+    }
+
+    @Lazy
+    @Bean(name = "yql-component")
+    @ConditionalOnMissingBean(YqlComponent.class)
+    public YqlComponent configureYqlComponent() throws Exception {
+        YqlComponent component = new YqlComponent();
+        component.setCamelContext(camelContext);
+        Map<String, Object> parameters = new HashMap<>();
+        IntrospectionSupport.getProperties(configuration, parameters, null,
+                false);
+        for (Map.Entry<String, Object> entry : parameters.entrySet()) {
+            Object value = entry.getValue();
+            Class<?> paramClass = value.getClass();
+            if (paramClass.getName().endsWith("NestedConfiguration")) {
+                Class nestedClass = null;
+                try {
+                    nestedClass = (Class) paramClass.getDeclaredField(
+                            "CAMEL_NESTED_CLASS").get(null);
+                    HashMap<String, Object> nestedParameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(value, nestedParameters,
+                            null, false);
+                    Object nestedProperty = nestedClass.newInstance();
+                    CamelPropertiesHelper.setCamelProperties(camelContext,
+                            nestedProperty, nestedParameters, false);
+                    entry.setValue(nestedProperty);
+                } catch (NoSuchFieldException e) {
+                }
+            }
+        }
+        CamelPropertiesHelper.setCamelProperties(camelContext, component,
+                parameters, false);
+        if (ObjectHelper.isNotEmpty(customizers)) {
+            for (ComponentCustomizer<YqlComponent> customizer : customizers) {
+                boolean useCustomizer = (customizer instanceof HasId)
+                        ? HierarchicalPropertiesEvaluator.evaluate(
+                                applicationContext.getEnvironment(),
+                                "camel.component.customizer",
+                                "camel.component.yql.customizer",
+                                ((HasId) customizer).getId())
+                        : HierarchicalPropertiesEvaluator.evaluate(
+                                applicationContext.getEnvironment(),
+                                "camel.component.customizer",
+                                "camel.component.yql.customizer");
+                if (useCustomizer) {
+                    LOGGER.debug("Configure component {}, with customizer {}",
+                            component, customizer);
+                    customizer.customize(component);
+                }
+            }
+        }
+        return component;
+    }
+}
\ No newline at end of file
diff --git a/platforms/spring-boot/components-starter/camel-yql-starter/src/main/java/org/apache/camel/component/yql/springboot/YqlComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-yql-starter/src/main/java/org/apache/camel/component/yql/springboot/YqlComponentConfiguration.java
new file mode 100644
index 0000000..9fccdf3
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-yql-starter/src/main/java/org/apache/camel/component/yql/springboot/YqlComponentConfiguration.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.yql.springboot;
+
+import javax.annotation.Generated;
+import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * Camel Yahoo Query Language Component
+ * 
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo")
+@ConfigurationProperties(prefix = "camel.component.yql")
+public class YqlComponentConfiguration
+        extends
+            ComponentConfigurationPropertiesCommon {
+
+    /**
+     * Whether the component should resolve property placeholders on itself when
+     * starting. Only properties which are of String type can use property
+     * placeholders.
+     */
+    private Boolean resolvePropertyPlaceholders = true;
+
+    public Boolean getResolvePropertyPlaceholders() {
+        return resolvePropertyPlaceholders;
+    }
+
+    public void setResolvePropertyPlaceholders(
+            Boolean resolvePropertyPlaceholders) {
+        this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+    }
+}
\ No newline at end of file
diff --git a/platforms/spring-boot/components-starter/camel-yql-starter/src/main/resources/META-INF/LICENSE.txt b/platforms/spring-boot/components-starter/camel-yql-starter/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-yql-starter/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
diff --git a/platforms/spring-boot/components-starter/camel-yql-starter/src/main/resources/META-INF/NOTICE.txt b/platforms/spring-boot/components-starter/camel-yql-starter/src/main/resources/META-INF/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-yql-starter/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache Camel distribution.                    ==
+   =========================================================================
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Please read the different LICENSE files present in the licenses directory of
+   this distribution.
diff --git a/platforms/spring-boot/components-starter/camel-yql-starter/src/main/resources/META-INF/spring.factories b/platforms/spring-boot/components-starter/camel-yql-starter/src/main/resources/META-INF/spring.factories
new file mode 100644
index 0000000..6418b38
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-yql-starter/src/main/resources/META-INF/spring.factories
@@ -0,0 +1,19 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
+org.apache.camel.component.yql.springboot.YqlComponentAutoConfiguration
diff --git a/platforms/spring-boot/components-starter/camel-yql-starter/src/main/resources/META-INF/spring.provides b/platforms/spring-boot/components-starter/camel-yql-starter/src/main/resources/META-INF/spring.provides
new file mode 100644
index 0000000..edc4c9d
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-yql-starter/src/main/resources/META-INF/spring.provides
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+provides: camel-yql
diff --git a/platforms/spring-boot/components-starter/pom.xml b/platforms/spring-boot/components-starter/pom.xml
index 1bea2af..e5f0a67 100644
--- a/platforms/spring-boot/components-starter/pom.xml
+++ b/platforms/spring-boot/components-starter/pom.xml
@@ -323,6 +323,7 @@
     <module>camel-xmpp-starter</module>
     <module>camel-xstream-starter</module>
     <module>camel-yammer-starter</module>
+    <module>camel-yql-starter</module>
     <module>camel-zendesk-starter</module>
     <module>camel-zipfile-starter</module>
     <module>camel-zipkin-starter</module>
diff --git a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
index 8cac9af..2e960d9 100644
--- a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
+++ b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
@@ -2916,6 +2916,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-yql</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-zendesk</artifactId>
         <version>${project.version}</version>
       </dependency>

-- 
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.

[camel] 08/12: Update endpoint label

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 1489b6a4218f89ae764642352b49ab85ca193453
Author: Carl-Philipp Harmant <cp...@gmail.com>
AuthorDate: Wed Nov 1 18:49:52 2017 -0500

    Update endpoint label
---
 .../src/main/java/org/apache/camel/component/yql/YqlEndpoint.java       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlEndpoint.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlEndpoint.java
index 90384c2..8c9bb05 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlEndpoint.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlEndpoint.java
@@ -28,7 +28,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
 
-@UriEndpoint(firstVersion = "2.21.0", scheme = "yql", title = "Yahoo Query Language", syntax = "yql:query", producerOnly = true, label = "api,http")
+@UriEndpoint(firstVersion = "2.21.0", scheme = "yql", title = "Yahoo Query Language", syntax = "yql:query", producerOnly = true, label = "yql")
 public class YqlEndpoint extends DefaultEndpoint {
 
     @UriParam

-- 
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.

[camel] 05/12: Add connection manager for http requests and improve yql config

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 709a67ce0d183f7a2b97433b207dacb78d7b1d55
Author: Carl-Philipp Harmant <cp...@gmail.com>
AuthorDate: Tue Oct 31 23:35:32 2017 -0500

    Add connection manager for http requests and improve yql config
---
 .../camel-yql/src/main/docs/yql-component.adoc     | 22 +++++++---
 .../apache/camel/component/yql/YqlComponent.java   |  3 ++
 .../apache/camel/component/yql/YqlProducer.java    |  5 +++
 .../yql/configuration/YqlConfiguration.java        | 34 +++++++++++----
 .../component/yql/exception/YqlHttpException.java  | 50 ++++++++++++++++++++++
 5 files changed, 100 insertions(+), 14 deletions(-)

diff --git a/components/camel-yql/src/main/docs/yql-component.adoc b/components/camel-yql/src/main/docs/yql-component.adoc
index e7b0951..efc13cb 100644
--- a/components/camel-yql/src/main/docs/yql-component.adoc
+++ b/components/camel-yql/src/main/docs/yql-component.adoc
@@ -29,7 +29,16 @@ Where *query* represents the YQL query.
 ### Options
 
 // component options: START
-The Yahoo Query Language component has no options.
+The Yahoo Query Language component supports 2 options which are listed below.
+
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *connectionManager* (producer) | Set the connection manager. |  | HttpClientConnection Manager
+| *resolveProperty Placeholders* (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean
+|===
 // component options: END
 
 // endpoint options: START
@@ -46,17 +55,18 @@ with the following path and query parameters:
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *query* | *Required* Set the YQL query |  | String
+| *query* | *Required* The YQL query to be sent. |  | String
 |===
 
-==== Query Parameters (4 parameters):
+==== Query Parameters (5 parameters):
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *callback* (producer) | Set the callback function |  | String
-| *diagnostics* (producer) | Set if diagnostics should be included in the query | false | boolean
-| *format* (producer) | Set the YQL format xml or json |  | String
+| *callback* (producer) | If specified the option will be included in the HTTP request to YQL. If the format is json then the response will contain a JSONP callback method. If the format is xml then the response will contain a JSONP-X callback method. More information: https://developer.yahoo.com/yql/guide/response.html |  | String
+| *diagnostics* (producer) | If true the option will be included in the HTTP request to YQL and the response will contain some diagnostics data. | false | boolean
+| *format* (producer) | The expected format. Can only be json or xml. | json | String
+| *throwExceptionOnFailure* (producer) | Option to disable throwing the YqlHttpException in case of failed responses from the remote server. This allows you to get all responses regardless of the HTTP status code. | true | boolean
 | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean
 |===
 // endpoint options: END
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
index 02b778f..fe02676 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
@@ -50,6 +50,9 @@ public class YqlComponent extends DefaultComponent {
       }
     }
 
+    /**
+     * Set the connection manager.
+     */
     public void setConnectionManager(final HttpClientConnectionManager connectionManager){
       this.localConnectionManager = connectionManager;
     }
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlProducer.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlProducer.java
index c429c85..f32a7a7 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlProducer.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlProducer.java
@@ -20,7 +20,9 @@ import org.apache.camel.Exchange;
 import org.apache.camel.component.yql.client.YqlClient;
 import org.apache.camel.component.yql.client.YqlResponse;
 import org.apache.camel.component.yql.configuration.YqlConfiguration;
+import org.apache.camel.component.yql.exception.YqlHttpException;
 import org.apache.camel.impl.DefaultProducer;
+import org.apache.http.HttpStatus;
 
 /**
  * A Producer that send messages to YQL
@@ -48,6 +50,9 @@ public class YqlProducer extends DefaultProducer {
                 configuration.isDiagnostics(),
                 configuration.getCallback()
         );
+        if (configuration.isThrowExceptionOnFailure() && yqlResponse.getStatus() != HttpStatus.SC_OK) {
+            throw YqlHttpException.failedWith(yqlResponse.getStatus(), yqlResponse.getBody(), yqlResponse.getHttpRequest());
+        }
         exchange.getIn().setHeader(CAMEL_YQL_HTTP_STATUS, yqlResponse.getStatus());
         exchange.getIn().setHeader(CAMEL_YQL_HTTP_REQUEST, yqlResponse.getHttpRequest());
         exchange.getIn().setBody(yqlResponse.getBody());
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java
index a3b1854..73ff453 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java
@@ -24,25 +24,30 @@ import org.apache.camel.spi.UriPath;
 @UriParams
 public class YqlConfiguration {
 
-    @UriPath
+    @UriPath(label="producer", description = "The YQL query to be sent.")
     @Metadata(required = "true")
     private String query;
 
-    @UriParam
+    @UriParam(label="producer", enums = "json,xml", defaultValue = "json", description = "The expected format. Can only be json or xml.")
     private String format = "json";
 
-    @UriParam
+    @UriParam(label="producer", defaultValue = "false", description = "If true, the option will be included in the HTTP request to YQL and the response will contain some diagnostics data.")
     private boolean diagnostics = false;
 
-    @UriParam
+    @UriParam(label="producer", description = "If specified, the option will be included in the HTTP request to YQL. If the format is json, then the response will contain a JSONP callback method. "
+            + "If the format is xml, then the response will contain a JSONP-X callback method. More information: https://developer.yahoo.com/yql/guide/response.html")
     private String callback = "";
 
+    @UriParam(label = "producer", defaultValue = "true", description = "Option to disable throwing the YqlHttpException in case of failed responses from the remote server. "
+            + "This allows you to get all responses regardless of the HTTP status code.")
+    private boolean throwExceptionOnFailure = true;
+
     public String getQuery() {
         return query;
     }
 
     /**
-     * Set the YQL query
+     * The YQL query to be sent.
      */
     public void setQuery(final String query) {
         this.query = query;
@@ -53,7 +58,7 @@ public class YqlConfiguration {
     }
 
     /**
-     * Set the YQL format, xml or json
+     * The expected format. Can only be json or xml.
      */
     public void setFormat(final String format) {
         this.format = format;
@@ -64,7 +69,7 @@ public class YqlConfiguration {
     }
 
     /**
-     * Set if diagnostics should be included in the query
+     * If true, the option will be included in the HTTP request to YQL and the response will contain some diagnostics data.
      */
     public void setDiagnostics(final boolean diagnostics) {
         this.diagnostics = diagnostics;
@@ -75,9 +80,22 @@ public class YqlConfiguration {
     }
 
     /**
-     * Set the callback function
+     * If specified, the option will be included in the HTTP request to YQL. If the format is json, then the response will contain a JSONP callback method.
+     * If the format is xml, then the response will contain a JSONP-X callback method. More information: https://developer.yahoo.com/yql/guide/response.html
      */
     public void setCallback(final String callback) {
         this.callback = callback;
     }
+
+    public boolean isThrowExceptionOnFailure() {
+        return throwExceptionOnFailure;
+    }
+
+    /**
+     * Option to disable throwing the YqlHttpException in case of failed responses from the remote server.
+     * This allows you to get all responses regardless of the HTTP status code.
+     */
+    public void setThrowExceptionOnFailure(final boolean throwExceptionOnFailure) {
+        this.throwExceptionOnFailure = throwExceptionOnFailure;
+    }
 }
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/exception/YqlHttpException.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/exception/YqlHttpException.java
new file mode 100644
index 0000000..3eea124
--- /dev/null
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/exception/YqlHttpException.java
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.yql.exception;
+
+/**
+ * Signal a non 200 HTTP response
+ */
+public class YqlHttpException extends YqlException {
+
+    private final int httpStatus;
+    private final String body;
+    private final String originalRequest;
+
+    private YqlHttpException(final int httpStatus, final String body, final String originalRequest) {
+        super("HTTP request to YQL failed");
+        this.httpStatus = httpStatus;
+        this.body = body;
+        this.originalRequest = originalRequest;
+    }
+
+    public static YqlHttpException failedWith(final int httpStatus, final String body, final String originalRequest) {
+        return new YqlHttpException(httpStatus, body, originalRequest);
+    }
+
+    public int getHttpStatus() {
+        return httpStatus;
+    }
+
+    public String body() {
+        return body;
+    }
+
+    public String getOriginalRequest() {
+        return originalRequest;
+    }
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.

[camel] 11/12: CAMEL-11959: Polished.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 17e61e48c74280592e0b48c04c0c5f225e79ec66
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Nov 6 11:51:54 2017 +0100

    CAMEL-11959: Polished.
---
 apache-camel/pom.xml                                     | 15 +++++++++++++++
 apache-camel/src/main/descriptors/common-bin.xml         |  1 +
 components/camel-yql/src/main/docs/yql-component.adoc    |  8 ++++++--
 .../org/apache/camel/component/yql/YqlComponent.java     |  8 +++++++-
 .../java/org/apache/camel/component/yql/YqlEndpoint.java | 16 ++++++++++------
 .../component/yql/configuration/YqlConfiguration.java    |  2 +-
 parent/pom.xml                                           |  5 +++++
 .../yql/springboot/YqlComponentConfiguration.java        |  5 +++--
 .../camel-spring-boot-dependencies/pom.xml               |  5 +++++
 9 files changed, 53 insertions(+), 12 deletions(-)

diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index 99439e3..ae1bd55 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -1189,6 +1189,16 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-asn1-starter</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-asterisk-starter</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-atmosphere-websocket-starter</artifactId>
       <version>${project.version}</version>
     </dependency>
@@ -2388,6 +2398,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-yql-starter</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-zendesk-starter</artifactId>
       <version>${project.version}</version>
     </dependency>
diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index d795394..237a75f 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -576,6 +576,7 @@
         <include>org.apache.camel:camel-xmpp-starter</include>
         <include>org.apache.camel:camel-xstream-starter</include>
         <include>org.apache.camel:camel-yammer-starter</include>
+        <include>org.apache.camel:camel-yql-starter</include>
         <include>org.apache.camel:camel-zendesk-starter</include>
         <include>org.apache.camel:camel-zipfile-starter</include>
         <include>org.apache.camel:camel-zipkin-starter</include>
diff --git a/components/camel-yql/src/main/docs/yql-component.adoc b/components/camel-yql/src/main/docs/yql-component.adoc
index 43780f8..a655c06 100644
--- a/components/camel-yql/src/main/docs/yql-component.adoc
+++ b/components/camel-yql/src/main/docs/yql-component.adoc
@@ -4,6 +4,10 @@
 
 The *yql* component is used for accessing the https://developer.yahoo.com/yql/[Yahoo Query Language platform].
 
+The YQL (Yahoo! Query Language) platform enables you to query, filter, and combine data across the web through
+a single interface. It exposes a SQL-like syntax that is both familiar to developers and expressive enough for
+getting the right data.
+
 Maven users will need to add the following dependency to their `pom.xml`
 for this component:
 
@@ -35,7 +39,7 @@ The Yahoo Query Language component supports 2 options which are listed below.
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *connectionManager* (producer) | Set the connection manager. |  | HttpClientConnection Manager
+| *connectionManager* (producer) | To use a custom configured HttpClientConnectionManager. |  | HttpClientConnection Manager
 | *resolveProperty Placeholders* (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean
 |===
 // component options: END
@@ -68,7 +72,7 @@ with the following path and query parameters:
 | *diagnostics* (producer) | If true diagnostic information is returned with the response. | false | boolean
 | *env* (producer) | Allows you to use multiple Open Data Tables through a YQL environment file. More information https://developer.yahoo.com/yql/guide/yql_storage.htmlusing-records-env-files= |  | String
 | *format* (producer) | The expected format. Allowed values: xml or json. | json | String
-| *jsonCompat* (producer) | Enables lossless JSON processing. The only allowed value is new. More information https://developer.yahoo.com/yql/guide/response.htmljson-to-json= |  | String
+| *jsonCompat* (producer) | Enables lossless JSON processing. The only allowed value is new. More information https://developer.yahoo.com/yql/guide/response.htmljson-to-json |  | String
 | *throwExceptionOnFailure* (producer) | Option to disable throwing the YqlHttpException in case of failed responses from the remote server. This allows you to get all responses regardless of the HTTP status code. | true | boolean
 | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean
 | *https* (security) | Option to use HTTPS to communicate with YQL. | true | boolean
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
index 59e39a8..6b7a92b 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
@@ -22,11 +22,13 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.component.yql.configuration.YqlConfiguration;
 import org.apache.camel.component.yql.configuration.YqlConfigurationValidator;
 import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.spi.Metadata;
 import org.apache.http.conn.HttpClientConnectionManager;
 import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
 
 public class YqlComponent extends DefaultComponent {
 
+    @Metadata(label = "advanced")
     private HttpClientConnectionManager localConnectionManager;
 
     @Override
@@ -48,8 +50,12 @@ public class YqlComponent extends DefaultComponent {
         }
     }
 
+    public HttpClientConnectionManager getLocalConnectionManager() {
+        return localConnectionManager;
+    }
+
     /**
-     * Set the connection manager.
+     * To use a custom configured HttpClientConnectionManager.
      */
     public void setConnectionManager(final HttpClientConnectionManager connectionManager) {
         this.localConnectionManager = connectionManager;
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlEndpoint.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlEndpoint.java
index 8c9bb05..1a08139 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlEndpoint.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlEndpoint.java
@@ -26,17 +26,20 @@ import org.apache.camel.spi.UriParam;
 import org.apache.http.conn.HttpClientConnectionManager;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
-import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
 
-@UriEndpoint(firstVersion = "2.21.0", scheme = "yql", title = "Yahoo Query Language", syntax = "yql:query", producerOnly = true, label = "yql")
+/**
+ * The YQL (Yahoo! Query Language) platform enables you to query, filter, and combine data across the web.
+ */
+@UriEndpoint(firstVersion = "2.21.0", scheme = "yql", title = "Yahoo Query Language", syntax = "yql:query", producerOnly = true, label = "cloud")
 public class YqlEndpoint extends DefaultEndpoint {
 
-    @UriParam
-    private final YqlConfiguration configuration;
     private final HttpClientConnectionManager connectionManager;
     private CloseableHttpClient httpClient;
 
-    YqlEndpoint(final String uri, final YqlComponent component, final YqlConfiguration configuration, final HttpClientConnectionManager connectionManager) {
+    @UriParam
+    private final YqlConfiguration configuration;
+
+    public YqlEndpoint(String uri, YqlComponent component, YqlConfiguration configuration, HttpClientConnectionManager connectionManager) {
         super(uri, component);
         this.configuration = configuration;
         this.connectionManager = connectionManager;
@@ -49,7 +52,7 @@ public class YqlEndpoint extends DefaultEndpoint {
 
     @Override
     public Consumer createConsumer(final Processor processor) throws Exception {
-        throw new UnsupportedOperationException("Consumer does not supported for YQL component: " + getEndpointUri());
+        throw new UnsupportedOperationException("Consumer is not supported for YQL component");
     }
 
     @Override
@@ -61,6 +64,7 @@ public class YqlEndpoint extends DefaultEndpoint {
     protected void doStop() throws Exception {
         if (httpClient != null) {
             httpClient.close();
+            httpClient = null;
         }
     }
 
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java
index a9b0555..d459d30 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java
@@ -145,7 +145,7 @@ public class YqlConfiguration {
 
     /**
      * Enables lossless JSON processing. The only allowed value is new.
-     * More information https://developer.yahoo.com/yql/guide/response.html#json-to-json=
+     * More information https://developer.yahoo.com/yql/guide/response.html#json-to-json
      */
     public void setJsonCompat(final String jsonCompat) {
         this.jsonCompat = jsonCompat;
diff --git a/parent/pom.xml b/parent/pom.xml
index d3c2b9e..110e776 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -3551,6 +3551,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-yql-starter</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-zendesk-starter</artifactId>
         <version>${project.version}</version>
       </dependency>
diff --git a/platforms/spring-boot/components-starter/camel-yql-starter/src/main/java/org/apache/camel/component/yql/springboot/YqlComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-yql-starter/src/main/java/org/apache/camel/component/yql/springboot/YqlComponentConfiguration.java
index 4b736b5..04aa63e 100644
--- a/platforms/spring-boot/components-starter/camel-yql-starter/src/main/java/org/apache/camel/component/yql/springboot/YqlComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-yql-starter/src/main/java/org/apache/camel/component/yql/springboot/YqlComponentConfiguration.java
@@ -23,7 +23,8 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.context.properties.NestedConfigurationProperty;
 
 /**
- * Camel Yahoo Query Language Component
+ * The YQL (Yahoo! Query Language) platform enables you to query filter and
+ * combine data across the web.
  * 
  * Generated by camel-package-maven-plugin - do not edit this file!
  */
@@ -34,7 +35,7 @@ public class YqlComponentConfiguration
             ComponentConfigurationPropertiesCommon {
 
     /**
-     * Set the connection manager.
+     * To use a custom configured HttpClientConnectionManager.
      */
     @NestedConfigurationProperty
     private HttpClientConnectionManager connectionManager;
diff --git a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
index 2e960d9..bcf877a 100644
--- a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
+++ b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
@@ -2921,6 +2921,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-yql-starter</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-zendesk</artifactId>
         <version>${project.version}</version>
       </dependency>

-- 
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.

[camel] 03/12: Change the way default configuration is setup

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 25995998940ae10285ddf63b7cb6ed7db88a239b
Author: Carl-Philipp Harmant <cp...@gmail.com>
AuthorDate: Tue Oct 31 09:55:38 2017 -0500

    Change the way default configuration is setup
---
 .../java/org/apache/camel/component/yql/YqlComponent.java  |  3 ---
 .../component/yql/configuration/YqlConfiguration.java      |  6 +++---
 .../yql/configuration/YqlConfigurationValidatorTest.java   | 14 --------------
 3 files changed, 3 insertions(+), 20 deletions(-)

diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
index 8f5d496..6c64a77 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/YqlComponent.java
@@ -28,9 +28,6 @@ public class YqlComponent extends DefaultComponent {
     protected Endpoint createEndpoint(final String uri, final String remaining, final Map<String, Object> parameters) throws Exception {
         final YqlConfiguration configuration = new YqlConfiguration();
         configuration.setQuery(remaining);
-        configuration.setFormat((String) parameters.getOrDefault("format", "json"));
-        configuration.setDiagnostics(Boolean.getBoolean((String) parameters.getOrDefault("diagnostics", "false")));
-        configuration.setCallback((String) parameters.getOrDefault("callback", ""));
 
         final Endpoint endpoint = new YqlEndpoint(uri, this, configuration);
 
diff --git a/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java b/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java
index 056327d..a3b1854 100644
--- a/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java
+++ b/components/camel-yql/src/main/java/org/apache/camel/component/yql/configuration/YqlConfiguration.java
@@ -29,13 +29,13 @@ public class YqlConfiguration {
     private String query;
 
     @UriParam
-    private String format;
+    private String format = "json";
 
     @UriParam
-    private boolean diagnostics;
+    private boolean diagnostics = false;
 
     @UriParam
-    private String callback;
+    private String callback = "";
 
     public String getQuery() {
         return query;
diff --git a/components/camel-yql/src/test/java/org/apache/camel/component/yql/configuration/YqlConfigurationValidatorTest.java b/components/camel-yql/src/test/java/org/apache/camel/component/yql/configuration/YqlConfigurationValidatorTest.java
index b7747a8..e7a6ce0 100644
--- a/components/camel-yql/src/test/java/org/apache/camel/component/yql/configuration/YqlConfigurationValidatorTest.java
+++ b/components/camel-yql/src/test/java/org/apache/camel/component/yql/configuration/YqlConfigurationValidatorTest.java
@@ -82,20 +82,6 @@ public class YqlConfigurationValidatorTest {
     }
 
     @Test
-    public void testEmptyFormat() {
-        // then
-        thrown.expect(YqlException.class);
-        thrown.expectMessage("<format> is not valid!");
-
-        // given
-        final YqlConfiguration yqlConfiguration = new YqlConfiguration();
-        yqlConfiguration.setQuery("query");
-
-        // when
-        YqlConfigurationValidator.validateProperties(yqlConfiguration);
-    }
-
-    @Test
     public void testWrongFormat() {
         // then
         thrown.expect(YqlException.class);

-- 
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.

[camel] 12/12: CAMEL-11959: Added itest and karaf feature

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 3172a417cc39a56299818bdb63378498d00e8997
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Nov 6 11:58:13 2017 +0100

    CAMEL-11959: Added itest and karaf feature
---
 .../karaf/features/src/main/resources/features.xml |  8 ++++
 .../org/apache/camel/itest/karaf/CamelYqlTest.java | 34 ++++++++++++++++
 .../camel/itest/springboot/CamelYqlTest.java       | 47 ++++++++++++++++++++++
 3 files changed, 89 insertions(+)

diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index b14d60e..dbd56f6 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -2381,6 +2381,14 @@
     <bundle dependency='true'>mvn:commons-codec/commons-codec/${commons-codec-version}</bundle>
     <bundle>mvn:org.apache.camel/camel-yammer/${project.version}</bundle>
   </feature>
+  <feature name='camel-yql' version='${project.version}' resolver='(obr)' start-level='50'>
+    <feature version='${project.version}'>camel-core</feature>
+    <bundle dependency='true'>mvn:org.apache.httpcomponents/httpcore-osgi/${httpcore4-version}</bundle>
+    <bundle dependency='true'>mvn:org.apache.httpcomponents/httpclient-osgi/${httpclient4-version}</bundle>
+    <bundle dependency='true'>mvn:commons-codec/commons-codec/${commons-codec-version}</bundle>
+    <bundle dependency='true'>mvn:org.apache.commons/commons-lang3/${commons-lang3-version}</bundle>
+    <bundle>mvn:org.apache.camel/camel-yql/${project.version}</bundle>
+  </feature>
   <feature name='camel-zendesk' version='${project.version}' resolver='(obr)' start-level='50'>
     <feature version='${project.version}'>camel-core</feature>
     <bundle dependency='true'>wrap:mvn:com.cloudbees.thirdparty/zendesk-java-client/${zendesk-client-version}</bundle>
diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelYqlTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelYqlTest.java
new file mode 100644
index 0000000..f3944c3
--- /dev/null
+++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelYqlTest.java
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.itest.karaf;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+
+@RunWith(PaxExam.class)
+public class CamelYqlTest extends BaseKarafTest {
+
+    public static final String COMPONENT = extractName(CamelYqlTest.class);
+
+    @Test
+    public void test() throws Exception {
+        testComponent(COMPONENT);
+    }
+
+
+}
\ No newline at end of file
diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelYqlTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelYqlTest.java
new file mode 100644
index 0000000..c553d41
--- /dev/null
+++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelYqlTest.java
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.itest.springboot;
+
+import org.apache.camel.itest.springboot.util.ArquillianPackager;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+@RunWith(Arquillian.class)
+public class CamelYqlTest extends AbstractSpringBootTestSupport {
+
+    @Deployment
+    public static Archive<?> createSpringBootPackage() throws Exception {
+        return ArquillianPackager.springBootPackage(createTestConfig());
+    }
+
+    public static ITestConfig createTestConfig() {
+        return new ITestConfigBuilder()
+                .module(inferModuleName(CamelYqlTest.class))
+                .build();
+    }
+
+    @Test
+    public void componentTests() throws Exception {
+        this.runComponentTest(config);
+        this.runModuleUnitTestsIfEnabled(config);
+    }
+
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.

[camel] 07/12: Improve tests

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 7d831032483f268429c3921e68ed47596c43b47a
Author: Carl-Philipp Harmant <cp...@gmail.com>
AuthorDate: Wed Nov 1 17:26:03 2017 -0500

    Improve tests
---
 .../java/org/apache/camel/component/yql/YqlComponentTest.java | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentTest.java b/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentTest.java
index dfa03e6..fe63ec2 100644
--- a/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentTest.java
+++ b/components/camel-yql/src/test/java/org/apache/camel/component/yql/YqlComponentTest.java
@@ -60,7 +60,7 @@ public class YqlComponentTest extends CamelTestSupport {
     @Test
     public void testConfigurationSetup() {
         // given
-        final YqlEndpoint yqlEndpoint = (YqlEndpoint) context.getEndpoint("yql://query?format=xml&callback=yqlCallback&diagnostics=true");
+        final YqlEndpoint yqlEndpoint = (YqlEndpoint) context.getEndpoint("yql://query?format=xml&callback=yqlCallback&diagnostics=true&debug=true&https=false&throwExceptionOnFailure=false&jsonCompat=new");
 
         // when
         final YqlConfiguration yqlConfiguration = yqlEndpoint.getConfiguration();
@@ -70,7 +70,10 @@ public class YqlComponentTest extends CamelTestSupport {
         assertEquals("query", yqlConfiguration.getQuery());
         assertEquals("xml", yqlConfiguration.getFormat());
         assertEquals("yqlCallback", yqlConfiguration.getCallback());
+        assertTrue(yqlConfiguration.isDebug());
         assertTrue(yqlConfiguration.isDiagnostics());
+        assertFalse(yqlConfiguration.isHttps());
+        assertFalse(yqlConfiguration.isThrowExceptionOnFailure());
     }
 
     @Test
@@ -86,7 +89,13 @@ public class YqlComponentTest extends CamelTestSupport {
         assertEquals("query", yqlConfiguration.getQuery());
         assertEquals("json", yqlConfiguration.getFormat());
         assertThat(yqlConfiguration.getCallback(), is(emptyString()));
+        assertNull(yqlConfiguration.getCrossProduct());
         assertFalse(yqlConfiguration.isDiagnostics());
+        assertFalse(yqlConfiguration.isDebug());
+        assertNull(yqlConfiguration.getEnv());
+        assertNull(yqlConfiguration.getJsonCompat());
+        assertTrue(yqlConfiguration.isThrowExceptionOnFailure());
+        assertTrue(yqlConfiguration.isHttps());
     }
 
     @Test

-- 
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.

[camel] 02/12: Fix log4j2 properties wrong file name

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 971bc32db2b1f4df0e27f19e529d8c1a081d3367
Author: Carl-Philipp Harmant <cp...@gmail.com>
AuthorDate: Tue Oct 31 09:54:18 2017 -0500

    Fix log4j2 properties wrong file name
---
 components/camel-yql/src/test/resources/log4j2.properties | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/components/camel-yql/src/test/resources/log4j2.properties b/components/camel-yql/src/test/resources/log4j2.properties
index 3b123ad..25d964b 100644
--- a/components/camel-yql/src/test/resources/log4j2.properties
+++ b/components/camel-yql/src/test/resources/log4j2.properties
@@ -17,7 +17,7 @@
 
 appender.file.type = File
 appender.file.name = file
-appender.file.fileName = target/camel-sql-component-test.log
+appender.file.fileName = target/camel-yql-component-test.log
 appender.file.layout.type = PatternLayout
 appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
 appender.out.type = Console

-- 
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.