camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] git commit: Added @UriParams for camel-twitter
Date Mon, 10 Feb 2014 09:59:04 GMT
Added @UriParams for camel-twitter


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

Branch: refs/heads/master
Commit: 8d3c20956fb343e0e9209bb1585ce951ba408665
Parents: d7bc164
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Mon Feb 10 10:59:21 2014 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Mon Feb 10 11:00:20 2014 +0100

----------------------------------------------------------------------
 .../camel/component/twitter/TwitterEndpointDirect.java   |  5 +++++
 .../camel/component/twitter/TwitterEndpointEvent.java    |  4 ++++
 .../camel/component/twitter/TwitterEndpointPolling.java  |  4 ++++
 .../camel/component/twitter/UriConfigurationTest.java    | 11 ++++++++++-
 4 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8d3c2095/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointDirect.java
----------------------------------------------------------------------
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointDirect.java
b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointDirect.java
index e1be501..423758b 100644
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointDirect.java
+++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointDirect.java
@@ -24,12 +24,17 @@ import org.apache.camel.component.direct.DirectEndpoint;
 import org.apache.camel.component.twitter.consumer.Twitter4JConsumer;
 import org.apache.camel.component.twitter.consumer.TwitterConsumerDirect;
 import org.apache.camel.component.twitter.data.EndpointType;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
 
 /**
  * Twitter direct endpoint
  */
+@UriEndpoint(scheme = "twitter", consumerClass = Twitter4JConsumer.class)
 public class TwitterEndpointDirect extends DirectEndpoint implements TwitterEndpoint {
 
+    @UriParam
     private TwitterConfiguration properties;
 
     public TwitterEndpointDirect(String uri, TwitterComponent component, TwitterConfiguration
properties) {

http://git-wip-us.apache.org/repos/asf/camel/blob/8d3c2095/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointEvent.java
----------------------------------------------------------------------
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointEvent.java
b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointEvent.java
index 6d7d009..c51e7c6 100644
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointEvent.java
+++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointEvent.java
@@ -23,9 +23,13 @@ import org.apache.camel.component.direct.DirectEndpoint;
 import org.apache.camel.component.twitter.consumer.Twitter4JConsumer;
 import org.apache.camel.component.twitter.consumer.TwitterConsumerEvent;
 import org.apache.camel.component.twitter.data.EndpointType;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
 
+@UriEndpoint(scheme = "twitter", consumerClass = Twitter4JConsumer.class)
 public class TwitterEndpointEvent extends DirectEndpoint implements TwitterEndpoint {
 
+    @UriParam
     private TwitterConfiguration properties;
 
     public TwitterEndpointEvent(String uri, TwitterComponent component, TwitterConfiguration
properties) {

http://git-wip-us.apache.org/repos/asf/camel/blob/8d3c2095/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointPolling.java
----------------------------------------------------------------------
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointPolling.java
b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointPolling.java
index 7fec7b6..61fd7bf 100644
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointPolling.java
+++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointPolling.java
@@ -23,12 +23,16 @@ import org.apache.camel.component.twitter.consumer.Twitter4JConsumer;
 import org.apache.camel.component.twitter.consumer.TwitterConsumerPolling;
 import org.apache.camel.component.twitter.data.EndpointType;
 import org.apache.camel.impl.DefaultPollingEndpoint;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
 
 /**
  * Twitter polling endpoint
  */
+@UriEndpoint(scheme = "twitter", consumerClass = Twitter4JConsumer.class)
 public class TwitterEndpointPolling extends DefaultPollingEndpoint implements TwitterEndpoint
{
 
+    @UriParam
     private TwitterConfiguration properties;
 
     public TwitterEndpointPolling(String uri, TwitterComponent component, TwitterConfiguration
properties) {

http://git-wip-us.apache.org/repos/asf/camel/blob/8d3c2095/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 8f358e3..84744f2 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
@@ -18,6 +18,7 @@ package org.apache.camel.component.twitter;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
+import org.apache.camel.EndpointConfiguration;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.junit.Assert;
 import org.junit.Test;
@@ -69,6 +70,14 @@ public class UriConfigurationTest extends Assert {
         TwitterEndpoint twitterEndpoint = (TwitterEndpoint) endpoint;
         
         assertFalse(twitterEndpoint.getProperties().getUseSSL());
-        
     }
+
+    @Test
+    public void testComponentConfiguration() throws Exception {
+        TwitterComponent comp = context.getComponent("twitter", TwitterComponent.class);
+        EndpointConfiguration conf = comp.createConfiguration("twitter:search?keywords=camel");
+
+        assertEquals("camel", conf.getParameter("keywords"));
+    }
+
 }


Mime
View raw message