You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2017/03/13 10:00:11 UTC
camel git commit: Add custom valiation logic for twitter credential
Repository: camel
Updated Branches:
refs/heads/master 27cf87dc7 -> a5c55feb2
Add custom valiation logic for twitter credential
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a5c55feb
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a5c55feb
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a5c55feb
Branch: refs/heads/master
Commit: a5c55feb2f1288da808028e6da3d1b643d96a72a
Parents: 27cf87d
Author: lburgazzoli <lb...@gmail.com>
Authored: Mon Mar 13 10:59:42 2017 +0100
Committer: lburgazzoli <lb...@gmail.com>
Committed: Mon Mar 13 10:59:42 2017 +0100
----------------------------------------------------------------------
.../camel-twitter/src/main/docs/twitter-component.adoc | 8 ++++----
.../camel/component/twitter/TwitterComponentVerifier.java | 7 ++++++-
.../apache/camel/component/twitter/TwitterConfiguration.java | 4 ----
3 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/a5c55feb/components/camel-twitter/src/main/docs/twitter-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-twitter/src/main/docs/twitter-component.adoc b/components/camel-twitter/src/main/docs/twitter-component.adoc
index 3cf2c25..2987fb7 100644
--- a/components/camel-twitter/src/main/docs/twitter-component.adoc
+++ b/components/camel-twitter/src/main/docs/twitter-component.adoc
@@ -187,10 +187,10 @@ with the following path and query parameters:
| httpProxyPassword | proxy | | String | The http proxy password which can be used for the camel-twitter. Can also be configured on the TwitterComponent level instead.
| httpProxyPort | proxy | | Integer | The http proxy port which can be used for the camel-twitter. Can also be configured on the TwitterComponent level instead.
| httpProxyUser | proxy | | String | The http proxy user which can be used for the camel-twitter. Can also be configured on the TwitterComponent level instead.
-| accessToken | security | | String | *Required* The access token. Can also be configured on the TwitterComponent level instead.
-| accessTokenSecret | security | | String | *Required* The access secret. Can also be configured on the TwitterComponent level instead.
-| consumerKey | security | | String | *Required* The consumer key. Can also be configured on the TwitterComponent level instead.
-| consumerSecret | security | | String | *Required* The consumer secret. Can also be configured on the TwitterComponent level instead.
+| accessToken | security | | String | The access token. Can also be configured on the TwitterComponent level instead.
+| accessTokenSecret | security | | String | The access secret. Can also be configured on the TwitterComponent level instead.
+| consumerKey | security | | String | The consumer key. Can also be configured on the TwitterComponent level instead.
+| consumerSecret | security | | String | The consumer secret. Can also be configured on the TwitterComponent level instead.
|=======================================================================
// endpoint options: END
http://git-wip-us.apache.org/repos/asf/camel/blob/a5c55feb/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterComponentVerifier.java
----------------------------------------------------------------------
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterComponentVerifier.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterComponentVerifier.java
index c00d078..05a5846 100644
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterComponentVerifier.java
+++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterComponentVerifier.java
@@ -21,6 +21,7 @@ import java.util.Map;
import org.apache.camel.impl.verifier.DefaultComponentVerifier;
import org.apache.camel.impl.verifier.ResultBuilder;
import org.apache.camel.impl.verifier.ResultErrorBuilder;
+import org.apache.camel.impl.verifier.ResultErrorHelper;
import twitter4j.Twitter;
import twitter4j.TwitterException;
@@ -35,7 +36,11 @@ final class TwitterComponentVerifier extends DefaultComponentVerifier {
@Override
protected Result verifyParameters(Map<String, Object> parameters) {
- ResultBuilder builder = ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.PARAMETERS);
+ ResultBuilder builder = ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.PARAMETERS)
+ .error(ResultErrorHelper.requiresOption("accessToken", parameters))
+ .error(ResultErrorHelper.requiresOption("accessTokenSecret", parameters))
+ .error(ResultErrorHelper.requiresOption("consumerKey", parameters))
+ .error(ResultErrorHelper.requiresOption("consumerSecret", parameters));
// Validate using the catalog
super.verifyParametersAgainstCatalog(builder, parameters);
http://git-wip-us.apache.org/repos/asf/camel/blob/a5c55feb/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java
index 72ab7de..336fc65 100644
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java
+++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java
@@ -38,16 +38,12 @@ public class TwitterConfiguration {
@UriParam(label = "consumer", defaultValue = "polling", enums = "polling,direct,event")
private EndpointType type = EndpointType.POLLING;
@UriParam(label = "security", secret = true)
- @Metadata(required = "true")
private String accessToken;
@UriParam(label = "security", secret = true)
- @Metadata(required = "true")
private String accessTokenSecret;
@UriParam(label = "security", secret = true)
- @Metadata(required = "true")
private String consumerKey;
@UriParam(label = "security", secret = true)
- @Metadata(required = "true")
private String consumerSecret;
@UriParam
private String user;