camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject git commit: CAMEL-7134 camel-twitter supports to set if using SSL or not
Date Wed, 15 Jan 2014 03:26:11 GMT
Updated Branches:
  refs/heads/master 753885400 -> 8ac7e83fd


CAMEL-7134 camel-twitter supports to set if using SSL or not


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8ac7e83f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8ac7e83f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8ac7e83f

Branch: refs/heads/master
Commit: 8ac7e83fd17d578110e1d27a06bc3d6aa6101ce5
Parents: 7538854
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Wed Jan 15 11:23:44 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Wed Jan 15 11:25:04 2014 +0800

----------------------------------------------------------------------
 .../camel/component/twitter/TwitterConfiguration.java | 14 +++++++++++++-
 .../camel/component/twitter/UriConfigurationTest.java | 11 +++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8ac7e83f/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 0acb20d..19e6b20 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
@@ -97,7 +97,7 @@ public class TwitterConfiguration {
     private long sinceId  = 1;
 
     /**
-     * Used ot set the preferred language on which to search
+     * Used to set the preferred language on which to search
      */
     @UriParam
     private String lang;
@@ -128,6 +128,9 @@ public class TwitterConfiguration {
 
     @UriParam
     private Integer httpProxyPort;
+    
+    @UriParam
+    private boolean useSSL = true;
 
     /**
      * Singleton, on demand instances of Twitter4J's Twitter & TwitterStream.
@@ -161,6 +164,7 @@ public class TwitterConfiguration {
         confBuilder.setOAuthConsumerSecret(consumerSecret);
         confBuilder.setOAuthAccessToken(accessToken);
         confBuilder.setOAuthAccessTokenSecret(accessTokenSecret);
+        confBuilder.setUseSSL(useSSL);
         if (getHttpProxyHost() != null) {
             confBuilder.setHttpProxyHost(getHttpProxyHost());
         }
@@ -208,6 +212,14 @@ public class TwitterConfiguration {
     public void setAccessTokenSecret(String accessTokenSecret) {
         this.accessTokenSecret = accessTokenSecret;
     }
+    
+    public boolean getUseSSL() {
+        return useSSL;
+    }
+    
+    public void setUseSSL(boolean useSSL) {
+        this.useSSL = useSSL;
+    }
 
     public String getUser() {
         return user;

http://git-wip-us.apache.org/repos/asf/camel/blob/8ac7e83f/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UriConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UriConfigurationTest.java
b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UriConfigurationTest.java
index a003032..8f358e3 100644
--- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UriConfigurationTest.java
+++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UriConfigurationTest.java
@@ -37,6 +37,7 @@ public class UriConfigurationTest extends Assert {
         assertTrue(!twitterEndpoint.getProperties().getConsumerSecret().isEmpty());
         assertTrue(!twitterEndpoint.getProperties().getAccessToken().isEmpty());
         assertTrue(!twitterEndpoint.getProperties().getAccessTokenSecret().isEmpty());
+        assertTrue(twitterEndpoint.getProperties().getUseSSL());
     }
     
     @Test
@@ -60,4 +61,14 @@ public class UriConfigurationTest extends Assert {
         assertEquals("test", twitterEndpoint.getProperties().getHttpProxyUser());
         assertEquals("pwd", twitterEndpoint.getProperties().getHttpProxyPassword());
     }
+    
+    @Test
+    public void testUseSSLSetting() throws Exception {
+        Endpoint endpoint = context.getEndpoint("twitter:todo/todo?useSSL=false");
+        assertTrue("Endpoint not a TwitterEndpoint: " + endpoint, endpoint instanceof TwitterEndpoint);
+        TwitterEndpoint twitterEndpoint = (TwitterEndpoint) endpoint;
+        
+        assertFalse(twitterEndpoint.getProperties().getUseSSL());
+        
+    }
 }


Mime
View raw message