You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/01/15 07:17:05 UTC

[2/2] git commit: CAMEL-7134 camel-twitter supports to set if using SSL or not

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

Conflicts:
	components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UriConfigurationTest.java


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

Branch: refs/heads/camel-2.11.x
Commit: 2305d89530b6834ee352dd186650505ee3cf2ad3
Parents: 2f490aa
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed Jan 15 11:23:44 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed Jan 15 14:16:31 2014 +0800

----------------------------------------------------------------------
 .../component/twitter/TwitterConfiguration.java | 13 ++++++++++-
 .../component/twitter/UriConfigurationTest.java | 23 +++++++++++++++-----
 2 files changed, 29 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2305d895/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 934473b..e14b459 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
@@ -83,7 +83,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
      */
     private String lang;
 
@@ -103,6 +103,8 @@ public class TwitterConfiguration {
     private String httpProxyPassword;
 
     private Integer httpProxyPort;
+    
+    private boolean useSSL = true;
 
     /**
      * Singleton, on demand instances of Twitter4J's Twitter & TwitterStream.
@@ -141,6 +143,7 @@ public class TwitterConfiguration {
         confBuilder.setOAuthConsumerSecret(consumerSecret);
         confBuilder.setOAuthAccessToken(accessToken);
         confBuilder.setOAuthAccessTokenSecret(accessTokenSecret);
+        confBuilder.setUseSSL(useSSL);
         if (getHttpProxyHost() != null) {
             confBuilder.setHttpProxyHost(getHttpProxyHost());
         }
@@ -188,6 +191,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/2305d895/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 b59acc8..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
@@ -33,10 +33,11 @@ public class UriConfigurationTest extends Assert {
         assertTrue("Endpoint not a TwitterEndpoint: " + endpoint, endpoint instanceof TwitterEndpoint);
         TwitterEndpoint twitterEndpoint = (TwitterEndpoint) endpoint;
 
-        Assert.assertTrue(!twitterEndpoint.getProperties().getConsumerKey().isEmpty());
-        Assert.assertTrue(!twitterEndpoint.getProperties().getConsumerSecret().isEmpty());
-        Assert.assertTrue(!twitterEndpoint.getProperties().getAccessToken().isEmpty());
-        Assert.assertTrue(!twitterEndpoint.getProperties().getAccessTokenSecret().isEmpty());
+        assertTrue(!twitterEndpoint.getProperties().getConsumerKey().isEmpty());
+        assertTrue(!twitterEndpoint.getProperties().getConsumerSecret().isEmpty());
+        assertTrue(!twitterEndpoint.getProperties().getAccessToken().isEmpty());
+        assertTrue(!twitterEndpoint.getProperties().getAccessTokenSecret().isEmpty());
+        assertTrue(twitterEndpoint.getProperties().getUseSSL());
     }
     
     @Test
@@ -45,8 +46,8 @@ public class UriConfigurationTest extends Assert {
         assertTrue("Endpoint not a TwitterEndpoint: " + endpoint, endpoint instanceof TwitterEndpoint);
         TwitterEndpoint twitterEndpoint = (TwitterEndpoint) endpoint;
 
-        Assert.assertEquals(new Integer(50), twitterEndpoint.getProperties().getCount());
-        Assert.assertEquals(new Integer(2), twitterEndpoint.getProperties().getNumberOfPages());
+        assertEquals(new Integer(50), twitterEndpoint.getProperties().getCount());
+        assertEquals(new Integer(2), twitterEndpoint.getProperties().getNumberOfPages());
     }
     
     @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());
+        
+    }
 }