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:43 UTC
[camel] 09/12: Fixed CS. This closes #2070
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>.