http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/HomeTimeLinePollingTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/HomeTimeLinePollingTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/HomeTimeLinePollingTest.java index c8cf9af..182806b 100644 --- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/HomeTimeLinePollingTest.java +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/HomeTimeLinePollingTest.java @@ -25,7 +25,7 @@ import org.slf4j.LoggerFactory; public class HomeTimeLinePollingTest extends CamelTwitterConsumerTestSupport { @Override protected String getUri() { - return "twitter://timeline/home?type=polling&"; + return "twitter-timeline://home?type=polling&"; } @Override
http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchByExchangeDirectTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchByExchangeDirectTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchByExchangeDirectTest.java index 4bfdad6..644fb87 100644 --- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchByExchangeDirectTest.java +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchByExchangeDirectTest.java @@ -120,17 +120,17 @@ public class SearchByExchangeDirectTest extends CamelTwitterTestSupport { return new RouteBuilder() { public void configure() { from("direct:start") - .toF("twitter://search?%s&keywords=java", getUriTokens()) + .toF("twitter-search://foo?%s&keywords=java", getUriTokens()) .split().body() .to("mock:result"); from("direct:header") - .toF("twitter://search?%s", getUriTokens()) + .toF("twitter-search://foo?%s", getUriTokens()) .split().body() .to("mock:result"); from("direct:double") - .toF("twitter://search?filterOld=false&%s", getUriTokens()) + .toF("twitter-search://foo?filterOld=false&%s", getUriTokens()) .split().body() .to("mock:result"); } http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchDirectCustomComponentTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchDirectCustomComponentTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchDirectCustomComponentTest.java index ab8dc04..5d01a48 100644 --- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchDirectCustomComponentTest.java +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchDirectCustomComponentTest.java @@ -16,6 +16,7 @@ */ package org.apache.camel.component.twitter; +import org.apache.camel.component.twitter.search.TwitterSearchComponent; import org.apache.camel.impl.JndiRegistry; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,14 +29,14 @@ public class SearchDirectCustomComponentTest extends CamelTwitterConsumerTestSup @Override protected JndiRegistry createRegistry() throws Exception { JndiRegistry registry = super.createRegistry(); - registry.bind("my-twitter", new TwitterComponent()); + registry.bind("my-twitter", new TwitterSearchComponent()); return registry; } @Override protected String getUri() { - return "my-twitter://search?type=direct&keywords=java&"; + return "my-twitter://foo?type=direct&keywords=java&"; } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchDirectTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchDirectTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchDirectTest.java index 8a2f652..59b6128 100644 --- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchDirectTest.java +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchDirectTest.java @@ -26,7 +26,7 @@ public class SearchDirectTest extends CamelTwitterConsumerTestSupport { @Override protected String getUri() { - return "twitter://search?type=direct&keywords=java&"; + return "twitter-search://foo?type=direct&keywords=java&"; } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchEventTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchEventTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchEventTest.java index b1cdb1e..8974db9 100644 --- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchEventTest.java +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchEventTest.java @@ -53,7 +53,7 @@ public class SearchEventTest extends CamelTwitterTestSupport { protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { - from("twitter://streaming/filter?type=event&twitterStream=#twitterStream&keywords=#cameltest") + from("twitter-streaming://filter?type=event&twitterStream=#twitterStream&keywords=#cameltest") .transform(body().convertToString()).to("mock:result"); } }; http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchPollingTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchPollingTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchPollingTest.java index 15ee335..2cd7f73 100644 --- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchPollingTest.java +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchPollingTest.java @@ -25,7 +25,7 @@ import org.slf4j.LoggerFactory; public class SearchPollingTest extends CamelTwitterConsumerTestSupport { @Override protected String getUri() { - return "twitter://search?type=polling&keywords=java&delay=5000&"; + return "twitter-search://foo?type=polling&keywords=java&delay=5000&"; } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/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 a660dd8..57143aa 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,12 @@ package org.apache.camel.component.twitter; import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; +import org.apache.camel.component.twitter.data.StreamingType; +import org.apache.camel.component.twitter.data.TimelineType; +import org.apache.camel.component.twitter.directmessage.TwitterDirectMessageEndpoint; +import org.apache.camel.component.twitter.search.TwitterSearchEndpoint; +import org.apache.camel.component.twitter.streaming.TwitterStreamingEndpoint; +import org.apache.camel.component.twitter.timeline.TwitterTimelineEndpoint; import org.apache.camel.impl.DefaultCamelContext; import org.junit.Assert; import org.junit.Test; @@ -27,11 +33,18 @@ public class UriConfigurationTest extends Assert { private CamelContext context = new DefaultCamelContext(); private CamelTwitterTestSupport support = new CamelTwitterTestSupport(); + @Deprecated @Test - public void testBasicAuthentication() throws Exception { + public void testDeprecatedUri() throws Exception { Endpoint endpoint = context.getEndpoint("twitter:search?" + support.getUriTokens()); assertTrue("Endpoint not a TwitterEndpoint: " + endpoint, endpoint instanceof TwitterEndpoint); - TwitterEndpoint twitterEndpoint = (TwitterEndpoint) endpoint; + } + + @Test + public void testBasicAuthentication() throws Exception { + Endpoint endpoint = context.getEndpoint("twitter-search:foo?" + support.getUriTokens()); + assertTrue("Endpoint not a TwitterSearchEndpoint: " + endpoint, endpoint instanceof TwitterSearchEndpoint); + TwitterSearchEndpoint twitterEndpoint = (TwitterSearchEndpoint) endpoint; assertTrue(!twitterEndpoint.getProperties().getConsumerKey().isEmpty()); assertTrue(!twitterEndpoint.getProperties().getConsumerSecret().isEmpty()); @@ -41,9 +54,9 @@ public class UriConfigurationTest extends Assert { @Test public void testPageSetting() throws Exception { - Endpoint endpoint = context.getEndpoint("twitter:search?count=50&numberOfPages=2"); - assertTrue("Endpoint not a TwitterEndpoint: " + endpoint, endpoint instanceof TwitterEndpoint); - TwitterEndpoint twitterEndpoint = (TwitterEndpoint) endpoint; + Endpoint endpoint = context.getEndpoint("twitter-search:foo?count=50&numberOfPages=2"); + assertTrue("Endpoint not a TwitterSearchEndpoint: " + endpoint, endpoint instanceof TwitterSearchEndpoint); + TwitterSearchEndpoint twitterEndpoint = (TwitterSearchEndpoint) endpoint; assertEquals(new Integer(50), twitterEndpoint.getProperties().getCount()); assertEquals(new Integer(2), twitterEndpoint.getProperties().getNumberOfPages()); @@ -51,9 +64,9 @@ public class UriConfigurationTest extends Assert { @Test public void testHttpProxySetting() throws Exception { - Endpoint endpoint = context.getEndpoint("twitter:search?httpProxyHost=example.com&httpProxyPort=3338&httpProxyUser=test&httpProxyPassword=pwd"); - assertTrue("Endpoint not a TwitterEndpoint: " + endpoint, endpoint instanceof TwitterEndpoint); - TwitterEndpoint twitterEndpoint = (TwitterEndpoint) endpoint; + Endpoint endpoint = context.getEndpoint("twitter-search:foo?httpProxyHost=example.com&httpProxyPort=3338&httpProxyUser=test&httpProxyPassword=pwd"); + assertTrue("Endpoint not a TwitterSearchEndpoint: " + endpoint, endpoint instanceof TwitterSearchEndpoint); + TwitterSearchEndpoint twitterEndpoint = (TwitterSearchEndpoint) endpoint; assertEquals("example.com", twitterEndpoint.getProperties().getHttpProxyHost()); assertEquals(Integer.valueOf(3338), twitterEndpoint.getProperties().getHttpProxyPort()); @@ -61,4 +74,51 @@ public class UriConfigurationTest extends Assert { assertEquals("pwd", twitterEndpoint.getProperties().getHttpProxyPassword()); } + @Test + public void testDirectMessageEndpoint() throws Exception { + Endpoint endpoint = context.getEndpoint("twitter-directmessage:foo"); + assertTrue("Endpoint not a TwitterDirectMessageEndpoint: " + endpoint, endpoint instanceof TwitterDirectMessageEndpoint); + } + + @Test + public void testSearchEndpoint() throws Exception { + Endpoint endpoint = context.getEndpoint("twitter-search:foo"); + assertTrue("Endpoint not a TwitterSearchEndpoint: " + endpoint, endpoint instanceof TwitterSearchEndpoint); + } + + @Test + public void testStreamingEndpoint() throws Exception { + Endpoint endpoint = context.getEndpoint("twitter-streaming:filter"); + assertTrue("Endpoint not a TwitterStreamingEndpoint: " + endpoint, endpoint instanceof TwitterStreamingEndpoint); + TwitterStreamingEndpoint streamingEndpoint = (TwitterStreamingEndpoint)endpoint; + assertEquals(StreamingType.FILTER, streamingEndpoint.getStreamingType()); + endpoint = context.getEndpoint("twitter-streaming:sample"); + assertTrue("Endpoint not a TwitterStreamingEndpoint: " + endpoint, endpoint instanceof TwitterStreamingEndpoint); + streamingEndpoint = (TwitterStreamingEndpoint)endpoint; + assertEquals(StreamingType.SAMPLE, streamingEndpoint.getStreamingType()); + endpoint = context.getEndpoint("twitter-streaming:user"); + assertTrue("Endpoint not a TwitterStreamingEndpoint: " + endpoint, endpoint instanceof TwitterStreamingEndpoint); + streamingEndpoint = (TwitterStreamingEndpoint)endpoint; + assertEquals(StreamingType.USER, streamingEndpoint.getStreamingType()); + } + + @Test + public void testTimelineEndpoint() throws Exception { + Endpoint endpoint = context.getEndpoint("twitter-timeline:home"); + assertTrue("Endpoint not a TwitterTimelineEndpoint: " + endpoint, endpoint instanceof TwitterTimelineEndpoint); + TwitterTimelineEndpoint timelineEndpoint = (TwitterTimelineEndpoint)endpoint; + assertEquals(TimelineType.HOME, timelineEndpoint.getTimelineType()); + endpoint = context.getEndpoint("twitter-timeline:mentions"); + assertTrue("Endpoint not a TwitterTimelineEndpoint: " + endpoint, endpoint instanceof TwitterTimelineEndpoint); + timelineEndpoint = (TwitterTimelineEndpoint)endpoint; + assertEquals(TimelineType.MENTIONS, timelineEndpoint.getTimelineType()); + endpoint = context.getEndpoint("twitter-timeline:retweetsofme"); + assertTrue("Endpoint not a TwitterTimelineEndpoint: " + endpoint, endpoint instanceof TwitterTimelineEndpoint); + timelineEndpoint = (TwitterTimelineEndpoint)endpoint; + assertEquals(TimelineType.RETWEETSOFME, timelineEndpoint.getTimelineType()); + endpoint = context.getEndpoint("twitter-timeline:user"); + assertTrue("Endpoint not a TwitterTimelineEndpoint: " + endpoint, endpoint instanceof TwitterTimelineEndpoint); + timelineEndpoint = (TwitterTimelineEndpoint)endpoint; + assertEquals(TimelineType.USER, timelineEndpoint.getTimelineType()); + } } http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserProducerInOnlyTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserProducerInOnlyTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserProducerInOnlyTest.java index a31ef61..1358835 100644 --- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserProducerInOnlyTest.java +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserProducerInOnlyTest.java @@ -16,6 +16,8 @@ */ package org.apache.camel.component.twitter; +import static org.hamcrest.core.Is.is; + import java.util.Date; import java.util.List; @@ -28,8 +30,6 @@ import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static org.hamcrest.core.Is.is; - /** * Tests posting a twitter update with the default In Message Exchange Pattern */ @@ -67,7 +67,7 @@ public class UserProducerInOnlyTest extends CamelTwitterTestSupport { public void configure() { from("direct:tweets") //.to("log:org.apache.camel.component.twitter?level=INFO&showAll=true&multiline=true") - .to("twitter://timeline/user?" + getUriTokens()) + .to("twitter-timeline://user?" + getUriTokens()) //.to("log:org.apache.camel.component.twitter?level=INFO&showAll=true&multiline=true") .to("mock:result"); } http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserProducerInOutTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserProducerInOutTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserProducerInOutTest.java index 680c688..049c1f1 100644 --- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserProducerInOutTest.java +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserProducerInOutTest.java @@ -16,6 +16,8 @@ */ package org.apache.camel.component.twitter; +import static org.hamcrest.core.Is.is; + import java.util.Date; import java.util.List; @@ -30,8 +32,6 @@ import org.slf4j.LoggerFactory; import twitter4j.Status; -import static org.hamcrest.core.Is.is; - /** * Tests posting a twitter update and getting the status update id from the Twitter API response */ @@ -71,7 +71,7 @@ public class UserProducerInOutTest extends CamelTwitterTestSupport { public void configure() { from("direct:tweets") //.to("log:org.apache.camel.component.twitter?level=INFO&showAll=true&multiline=true") - .inOut("twitter://timeline/user?" + getUriTokens()) + .inOut("twitter-timeline://user?" + getUriTokens()) //.to("log:org.apache.camel.component.twitter?level=INFO&showAll=true&multiline=true") //.transform().simple("The tweet '${body.text}' was published with the id '${body.id}'") //.to("log:org.apache.camel.component.twitter?level=INFO&showAll=true&multiline=true") http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserStreamingTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserStreamingTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserStreamingTest.java index 82c12a9..b3a663e 100644 --- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserStreamingTest.java +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserStreamingTest.java @@ -40,7 +40,7 @@ public class UserStreamingTest extends CamelTwitterTestSupport { return new RouteBuilder() { @Override public void configure() { - from("twitter://streaming/user?type=event&" + getUriTokens()) + from("twitter-streaming://user?type=event&" + getUriTokens()) .to("log:org.apache.camel.component.twitter?level=INFO&showHeaders=true") .to("mock:user-streaming"); } http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserTimeLineDirectTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserTimeLineDirectTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserTimeLineDirectTest.java index ff035d7..fe5983f 100644 --- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserTimeLineDirectTest.java +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserTimeLineDirectTest.java @@ -26,7 +26,7 @@ public class UserTimeLineDirectTest extends CamelTwitterConsumerTestSupport { @Override protected String getUri() { - return "twitter://timeline/user?type=direct&user=brettemeyer&"; + return "twitter-timeline://user?type=direct&user=brettemeyer&"; } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserTimeLinePollingTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserTimeLinePollingTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserTimeLinePollingTest.java index 4ff0d02..ceaeadf 100644 --- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserTimeLinePollingTest.java +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserTimeLinePollingTest.java @@ -26,7 +26,7 @@ public class UserTimeLinePollingTest extends CamelTwitterConsumerTestSupport { @Override protected String getUri() { - return "twitter://timeline/user?type=polling&user=brettemeyer&"; + return "twitter-timeline://user?type=polling&user=brettemeyer&"; } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/DirectMessageDirectTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/DirectMessageDirectTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/DirectMessageDirectTest.java new file mode 100644 index 0000000..ab41012 --- /dev/null +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/DirectMessageDirectTest.java @@ -0,0 +1,58 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.twitter.deprecated; + +import java.util.Date; + +import org.apache.camel.component.twitter.CamelTwitterConsumerTestSupport; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import twitter4j.Twitter; +import twitter4j.TwitterFactory; + +/** + * consumes tweets + */ +@Deprecated +public class DirectMessageDirectTest extends CamelTwitterConsumerTestSupport { + + @Override + public void setUp() throws Exception { + super.setUp(); + /* Uncomment when you need a test direct message + TwitterConfiguration properties = new TwitterConfiguration(); + properties.setConsumerKey(consumerKey); + properties.setConsumerSecret(consumerSecret); + properties.setAccessToken(accessToken); + properties.setAccessTokenSecret(accessTokenSecret); + Twitter twitter = properties.getTwitter(); + twitter.sendDirectMessage(twitter.getScreenName(), "Test Direct Message: " + new Date().toString()); + */ + } + + @Override + protected String getUri() { + return "twitter://directmessage?type=direct&"; + } + + @Override + protected Logger getLogger() { + return LoggerFactory.getLogger(DirectMessageDirectTest.class); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/DirectMessagePollingTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/DirectMessagePollingTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/DirectMessagePollingTest.java new file mode 100644 index 0000000..51e95a0 --- /dev/null +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/DirectMessagePollingTest.java @@ -0,0 +1,55 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.twitter.deprecated; + +import java.util.Date; + +import org.apache.camel.component.twitter.CamelTwitterConsumerTestSupport; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import twitter4j.Twitter; + +/** + * consumes tweets + */ +@Deprecated +public class DirectMessagePollingTest extends CamelTwitterConsumerTestSupport { + @Override + public void setUp() throws Exception { + super.setUp(); + /* Uncomment when you need a test direct message + TwitterConfiguration properties = new TwitterConfiguration(); + properties.setConsumerKey(consumerKey); + properties.setConsumerSecret(consumerSecret); + properties.setAccessToken(accessToken); + properties.setAccessTokenSecret(accessTokenSecret); + Twitter twitter = properties.getTwitter(); + twitter.sendDirectMessage(twitter.getScreenName(), "Test Direct Message: " + new Date().toString()); + */ + } + + @Override + protected String getUri() { + return "twitter://directmessage?type=polling&"; + } + + @Override + protected Logger getLogger() { + return LoggerFactory.getLogger(DirectMessagePollingTest.class); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/HomeTimeLineDirectTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/HomeTimeLineDirectTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/HomeTimeLineDirectTest.java new file mode 100644 index 0000000..8061f27 --- /dev/null +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/HomeTimeLineDirectTest.java @@ -0,0 +1,38 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.twitter.deprecated; + +import org.apache.camel.component.twitter.CamelTwitterConsumerTestSupport; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * consumes tweets + */ +@Deprecated +public class HomeTimeLineDirectTest extends CamelTwitterConsumerTestSupport { + + @Override + protected String getUri() { + return "twitter://timeline/home?type=direct&"; + } + + @Override + protected Logger getLogger() { + return LoggerFactory.getLogger(HomeTimeLineDirectTest.class); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/HomeTimeLinePollingTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/HomeTimeLinePollingTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/HomeTimeLinePollingTest.java new file mode 100644 index 0000000..1451cab --- /dev/null +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/HomeTimeLinePollingTest.java @@ -0,0 +1,37 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.twitter.deprecated; + +import org.apache.camel.component.twitter.CamelTwitterConsumerTestSupport; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * consumes tweets + */ +@Deprecated +public class HomeTimeLinePollingTest extends CamelTwitterConsumerTestSupport { + @Override + protected String getUri() { + return "twitter://timeline/home?type=polling&"; + } + + @Override + protected Logger getLogger() { + return LoggerFactory.getLogger(HomeTimeLinePollingTest.class); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchByExchangeDirectTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchByExchangeDirectTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchByExchangeDirectTest.java new file mode 100644 index 0000000..dcf4ae6 --- /dev/null +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchByExchangeDirectTest.java @@ -0,0 +1,139 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.twitter.deprecated; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.camel.Exchange; +import org.apache.camel.Produce; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.component.twitter.CamelTwitterTestSupport; +import org.apache.camel.component.twitter.TwitterConstants; +import org.junit.Test; + +@Deprecated +public class SearchByExchangeDirectTest extends CamelTwitterTestSupport { + + @Produce(uri = "direct:start") + protected ProducerTemplate template; + + @Produce(uri = "direct:header") + protected ProducerTemplate templateHeader; + + @Produce(uri = "direct:double") + protected ProducerTemplate templateDouble; + + @Test + public void testSearchTimelineWithStaticQuery() throws Exception { + template.sendBody(null); + + MockEndpoint mock = getMockEndpoint("mock:result"); + mock.expectedMinimumMessageCount(1); + mock.assertIsSatisfied(); + List<Exchange> tweets = mock.getExchanges(); + for (Exchange e : tweets) { + log.info("Tweet: " + e.getIn().getBody(String.class)); + } + } + + @Test + public void testSearchTimelineWithDynamicQuery() throws Exception { + templateHeader.sendBodyAndHeader(null, TwitterConstants.TWITTER_KEYWORDS, "java"); + + MockEndpoint mock = getMockEndpoint("mock:result"); + mock.expectedMinimumMessageCount(1); + mock.assertIsSatisfied(); + List<Exchange> tweets = mock.getExchanges(); + for (Exchange e : tweets) { + log.info("Tweet: " + e.getIn().getBody(String.class)); + } + } + + @Test + public void testSearchTimelineWithDynamicQuerySinceId() throws Exception { + Map<String, Object> headers = new HashMap<String, Object>(); + headers.put(TwitterConstants.TWITTER_KEYWORDS, "java"); + headers.put(TwitterConstants.TWITTER_SINCEID, new Long(258347905419730944L)); + templateHeader.sendBodyAndHeaders(null, headers); + + MockEndpoint mock = getMockEndpoint("mock:result"); + mock.expectedMinimumMessageCount(1); + mock.assertIsSatisfied(); + List<Exchange> tweets = mock.getExchanges(); + for (Exchange e : tweets) { + log.info("Tweet: " + e.getIn().getBody(String.class)); + } + } + + @Test + public void testSearchTimelineWithDynamicQuerySinceIdAndMaxId() throws Exception { + Map<String, Object> headers = new HashMap<String, Object>(); + headers.put(TwitterConstants.TWITTER_KEYWORDS, "java"); + headers.put(TwitterConstants.TWITTER_SINCEID, new Long(258347905419730944L)); + headers.put(TwitterConstants.TWITTER_MAXID, new Long(258348815243960320L)); + templateHeader.sendBodyAndHeaders(null, headers); + + MockEndpoint mock = getMockEndpoint("mock:result"); + mock.expectedMinimumMessageCount(0); + } + + @Test + public void testDoubleSearchKeepingOld() throws Exception { + templateDouble.sendBodyAndHeader(null, TwitterConstants.TWITTER_KEYWORDS, "java"); + + MockEndpoint mock = getMockEndpoint("mock:result"); + mock.expectedMinimumMessageCount(1); + mock.assertIsSatisfied(); + List<Exchange> tweets = mock.getExchanges(); + for (Exchange e : tweets) { + log.info("Tweet: " + e.getIn().getBody(String.class)); + } + + // calls the same query again, expecting to receive the same amount of + // tweets, because we told this route to not filter old(consumed) tweets + int total = mock.getReceivedCounter(); + templateDouble.sendBodyAndHeader(null, TwitterConstants.TWITTER_KEYWORDS, "java"); + + // due race condition + assertTrue(mock.getReceivedCounter() >= total); + } + + protected RouteBuilder createRouteBuilder() { + return new RouteBuilder() { + public void configure() { + from("direct:start") + .toF("twitter://search?%s&keywords=java", getUriTokens()) + .split().body() + .to("mock:result"); + + from("direct:header") + .toF("twitter://search?%s", getUriTokens()) + .split().body() + .to("mock:result"); + + from("direct:double") + .toF("twitter://search?filterOld=false&%s", getUriTokens()) + .split().body() + .to("mock:result"); + } + }; + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchDirectCustomComponentTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchDirectCustomComponentTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchDirectCustomComponentTest.java new file mode 100644 index 0000000..69078b8 --- /dev/null +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchDirectCustomComponentTest.java @@ -0,0 +1,48 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.twitter.deprecated; + +import org.apache.camel.component.twitter.CamelTwitterConsumerTestSupport; +import org.apache.camel.component.twitter.TwitterComponent; +import org.apache.camel.impl.JndiRegistry; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * consumes tweets + */ +@Deprecated +public class SearchDirectCustomComponentTest extends CamelTwitterConsumerTestSupport { + + @Override + protected JndiRegistry createRegistry() throws Exception { + JndiRegistry registry = super.createRegistry(); + registry.bind("my-twitter", new TwitterComponent()); + + return registry; + } + + @Override + protected String getUri() { + return "my-twitter://search?type=direct&keywords=java&"; + } + + @Override + protected Logger getLogger() { + return LoggerFactory.getLogger(SearchDirectCustomComponentTest.class); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchDirectTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchDirectTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchDirectTest.java new file mode 100644 index 0000000..e5c5fe6 --- /dev/null +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchDirectTest.java @@ -0,0 +1,38 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.twitter.deprecated; + +import org.apache.camel.component.twitter.CamelTwitterConsumerTestSupport; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * consumes tweets + */ +@Deprecated +public class SearchDirectTest extends CamelTwitterConsumerTestSupport { + + @Override + protected String getUri() { + return "twitter://search?type=direct&keywords=java&"; + } + + @Override + protected Logger getLogger() { + return LoggerFactory.getLogger(SearchDirectTest.class); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchEventTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchEventTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchEventTest.java new file mode 100644 index 0000000..6f2fa98 --- /dev/null +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchEventTest.java @@ -0,0 +1,91 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.twitter.deprecated; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; + +import org.apache.camel.EndpointInject; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.component.twitter.CamelTwitterTestSupport; +import org.apache.camel.impl.JndiRegistry; +import org.junit.Test; + +import twitter4j.Status; +import twitter4j.StatusListener; +import twitter4j.TwitterStream; + +@Deprecated +public class SearchEventTest extends CamelTwitterTestSupport { + + @EndpointInject(uri = "mock:result") + protected MockEndpoint resultEndpoint; + + private TwitterStream twitterStream; + private StatusListener listener; + + @Test + public void testSearchTimeline() throws Exception { + resultEndpoint.expectedMinimumMessageCount(1); + Status status = (Status) Proxy.newProxyInstance(getClass().getClassLoader(), + new Class[]{Status.class}, + new TwitterHandler()); + + listener.onStatus(status); + //"#cameltest tweet"); + resultEndpoint.assertIsSatisfied(); + } + + protected RouteBuilder createRouteBuilder() { + return new RouteBuilder() { + public void configure() { + from("twitter://streaming/filter?type=event&twitterStream=#twitterStream&keywords=#cameltest") + .transform(body().convertToString()).to("mock:result"); + } + }; + } + + @Override + protected JndiRegistry createRegistry() throws Exception { + twitterStream = (TwitterStream) Proxy.newProxyInstance(getClass().getClassLoader(), + new Class[]{TwitterStream.class}, + new TwitterHandler()); + JndiRegistry registry = super.createRegistry(); + registry.bind("twitterStream", twitterStream); + return registry; + } + + public class TwitterHandler implements InvocationHandler { + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + //mock some methods + if ("addListener".equals(method.getName())) { + listener = (StatusListener) args[0]; + } else if ("toString".equals(method.getName())) { + return this.toString(); + } else if ("getText".equals(method.getName())) { + return "#cameltest tweet"; + } else if ("getUser".equals(method.getName())) { + return Proxy.newProxyInstance(getClass().getClassLoader(), + new Class[]{twitter4j.User.class}, + new TwitterHandler()); + } + return null; + } + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchPollingTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchPollingTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchPollingTest.java new file mode 100644 index 0000000..ffbd5c2 --- /dev/null +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchPollingTest.java @@ -0,0 +1,37 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.twitter.deprecated; + +import org.apache.camel.component.twitter.CamelTwitterConsumerTestSupport; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * consumes tweets + */ +@Deprecated +public class SearchPollingTest extends CamelTwitterConsumerTestSupport { + @Override + protected String getUri() { + return "twitter://search?type=polling&keywords=java&delay=5000&"; + } + + @Override + protected Logger getLogger() { + return LoggerFactory.getLogger(SearchPollingTest.class); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/UserProducerInOnlyTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/UserProducerInOnlyTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/UserProducerInOnlyTest.java new file mode 100644 index 0000000..3468fd9 --- /dev/null +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/UserProducerInOnlyTest.java @@ -0,0 +1,78 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.twitter.deprecated; + +import java.util.Date; +import java.util.List; + +import org.apache.camel.EndpointInject; +import org.apache.camel.Exchange; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.component.twitter.CamelTwitterTestSupport; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static org.hamcrest.core.Is.is; + +/** + * Tests posting a twitter update with the default In Message Exchange Pattern + */ +@Deprecated +public class UserProducerInOnlyTest extends CamelTwitterTestSupport { + private static final Logger LOG = LoggerFactory.getLogger(UserProducerInOnlyTest.class); + + @EndpointInject(uri = "mock:result") + protected MockEndpoint resultEndpoint; + + @Test + public void testPostStatusUpdateRequestResponse() throws Exception { + Date now = new Date(); + String tweet = "UserProducerInOnlyTest: This is a tweet posted on " + now.toString(); + LOG.info("Tweet: " + tweet); + ProducerTemplate producerTemplate = context.createProducerTemplate(); + // send tweet to the twitter endpoint + producerTemplate.sendBodyAndHeader("direct:tweets", tweet, "customHeader", 12312); + + + resultEndpoint.expectedMessageCount(1); + resultEndpoint.expectedBodyReceived().body(String.class); + // Message headers should be preserved + resultEndpoint.expectedHeaderReceived("customHeader", 12312); + resultEndpoint.assertIsSatisfied(); + + List<Exchange> tweets = resultEndpoint.getExchanges(); + assertNotNull(tweets); + assertThat(tweets.size(), is(1)); + String receivedTweet = tweets.get(0).getIn().getBody(String.class); + assertThat(receivedTweet, is(tweet)); + } + + protected RouteBuilder createRouteBuilder() { + return new RouteBuilder() { + public void configure() { + from("direct:tweets") + //.to("log:org.apache.camel.component.twitter?level=INFO&showAll=true&multiline=true") + .to("twitter://timeline/user?" + getUriTokens()) + //.to("log:org.apache.camel.component.twitter?level=INFO&showAll=true&multiline=true") + .to("mock:result"); + } + }; + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/UserProducerInOutTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/UserProducerInOutTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/UserProducerInOutTest.java new file mode 100644 index 0000000..613ace2 --- /dev/null +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/UserProducerInOutTest.java @@ -0,0 +1,84 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.twitter.deprecated; + +import java.util.Date; +import java.util.List; + +import org.apache.camel.EndpointInject; +import org.apache.camel.Exchange; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.component.twitter.CamelTwitterTestSupport; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import twitter4j.Status; + +import static org.hamcrest.core.Is.is; + +/** + * Tests posting a twitter update and getting the status update id from the Twitter API response + */ +@Deprecated +public class UserProducerInOutTest extends CamelTwitterTestSupport { + private static final Logger LOG = LoggerFactory.getLogger(UserProducerInOutTest.class); + + @EndpointInject(uri = "mock:result") + protected MockEndpoint resultEndpoint; + + @Test + public void testPostStatusUpdateRequestResponse() throws Exception { + Date now = new Date(); + String tweet = "UserProducerInOutTest: This is a tweet posted on " + now.toString(); + LOG.info("Tweet: " + tweet); + ProducerTemplate producerTemplate = context.createProducerTemplate(); + // send tweet to the twitter endpoint + producerTemplate.sendBodyAndHeader("direct:tweets", tweet, "customHeader", 12312); + + + resultEndpoint.expectedMessageCount(1); + resultEndpoint.expectedBodyReceived().body(Status.class); + // Message headers should be preserved + resultEndpoint.expectedHeaderReceived("customHeader", 12312); + resultEndpoint.assertIsSatisfied(); + + List<Exchange> tweets = resultEndpoint.getExchanges(); + assertNotNull(tweets); + assertThat(tweets.size(), is(1)); + Status receivedTweet = tweets.get(0).getIn().getBody(Status.class); + assertNotNull(receivedTweet); + // The identifier for the published tweet should be there + assertNotNull(receivedTweet.getId()); + } + + protected RouteBuilder createRouteBuilder() { + return new RouteBuilder() { + public void configure() { + from("direct:tweets") + //.to("log:org.apache.camel.component.twitter?level=INFO&showAll=true&multiline=true") + .inOut("twitter://timeline/user?" + getUriTokens()) + //.to("log:org.apache.camel.component.twitter?level=INFO&showAll=true&multiline=true") + //.transform().simple("The tweet '${body.text}' was published with the id '${body.id}'") + //.to("log:org.apache.camel.component.twitter?level=INFO&showAll=true&multiline=true") + .to("mock:result"); + } + }; + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/UserStreamingTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/UserStreamingTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/UserStreamingTest.java new file mode 100644 index 0000000..0c91722 --- /dev/null +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/UserStreamingTest.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.twitter.deprecated; + +import java.util.concurrent.TimeUnit; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.component.twitter.CamelTwitterTestSupport; +import org.junit.Ignore; +import org.junit.Test; + +@Deprecated +@Ignore +public class UserStreamingTest extends CamelTwitterTestSupport { + + @Test + public void testUserStreaming() throws Exception { + MockEndpoint mock = getMockEndpoint("mock:user-streaming"); + mock.setResultWaitTime(TimeUnit.MILLISECONDS.convert(1, TimeUnit.MINUTES)); + mock.expectedMessageCount(1); + mock.assertIsSatisfied(); + } + + + @Override + protected RouteBuilder createRouteBuilder() { + return new RouteBuilder() { + @Override + public void configure() { + from("twitter://streaming/user?type=event&" + getUriTokens()) + .to("log:org.apache.camel.component.twitter?level=INFO&showHeaders=true") + .to("mock:user-streaming"); + } + }; + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/UserTimeLineDirectTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/UserTimeLineDirectTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/UserTimeLineDirectTest.java new file mode 100644 index 0000000..791aee3 --- /dev/null +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/UserTimeLineDirectTest.java @@ -0,0 +1,38 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.twitter.deprecated; + +import org.apache.camel.component.twitter.CamelTwitterConsumerTestSupport; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * consumes tweets + */ +@Deprecated +public class UserTimeLineDirectTest extends CamelTwitterConsumerTestSupport { + + @Override + protected String getUri() { + return "twitter://timeline/user?type=direct&user=brettemeyer&"; + } + + @Override + protected Logger getLogger() { + return LoggerFactory.getLogger(UserTimeLineDirectTest.class); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/UserTimeLinePollingTest.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/UserTimeLinePollingTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/UserTimeLinePollingTest.java new file mode 100644 index 0000000..3c2cfe8 --- /dev/null +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/UserTimeLinePollingTest.java @@ -0,0 +1,38 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.twitter.deprecated; + +import org.apache.camel.component.twitter.CamelTwitterConsumerTestSupport; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * consumes tweets + */ +@Deprecated +public class UserTimeLinePollingTest extends CamelTwitterConsumerTestSupport { + + @Override + protected String getUri() { + return "twitter://timeline/user?type=polling&user=brettemeyer&"; + } + + @Override + protected Logger getLogger() { + return LoggerFactory.getLogger(UserTimeLinePollingTest.class); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/components/readme.adoc ---------------------------------------------------------------------- diff --git a/components/readme.adoc b/components/readme.adoc index 8c92719..f2b2930 100644 --- a/components/readme.adoc +++ b/components/readme.adoc @@ -2,7 +2,7 @@ Components ^^^^^^^^^^ // components: START -Number of Components: 248 in 185 JAR artifacts (14 deprecated) +Number of Components: 252 in 185 JAR artifacts (15 deprecated) [width="100%",cols="4,1,5",options="header"] |======================================================================= @@ -705,7 +705,19 @@ Number of Components: 248 in 185 JAR artifacts (14 deprecated) `timer:timerName` | 1.0 | The timer component is used for generating message exchanges when a timer fires. | link:camel-twitter/src/main/docs/twitter-component.adoc[Twitter] (camel-twitter) + -`twitter:kind` | 2.10 | This component integrates with Twitter to send tweets or search for tweets and more. +`twitter:kind` | 2.10 | *deprecated* Use twitter-directmessage twitter-search twitter-streaming and twitter-timeline instead of this component. + +| link:camel-twitter/src/main/docs/twitter-directmessage-component.adoc[Twitter Direct Message] (camel-twitter) + +`twitter-directmessage:endpointId` | 2.10 | The Twitter Direct Message Component consumes/produces user's direct messages. + +| link:camel-twitter/src/main/docs/twitter-search-component.adoc[Twitter Search] (camel-twitter) + +`twitter-search:endpointId` | 2.10 | The Twitter Search component consumes search results. + +| link:camel-twitter/src/main/docs/twitter-streaming-component.adoc[Twitter Streaming] (camel-twitter) + +`twitter-streaming:streamingType` | 2.10 | The Twitter Streaming component consumes twitter statuses using Streaming API. + +| link:camel-twitter/src/main/docs/twitter-timeline-component.adoc[Twitter Timeline] (camel-twitter) + +`twitter-timeline:timelineType` | 2.10 | The Twitter Timeline component consumes twitter timeline or update the status of specific user. | link:camel-undertow/src/main/docs/undertow-component.adoc[Undertow] (camel-undertow) + `undertow:httpURI` | 2.16 | The undertow component provides HTTP-based endpoints for consuming and producing HTTP requests. http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/docs/user-manual/en/SUMMARY.md ---------------------------------------------------------------------- diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md index c4302f4..6061f4a 100644 --- a/docs/user-manual/en/SUMMARY.md +++ b/docs/user-manual/en/SUMMARY.md @@ -335,6 +335,10 @@ * [Telegram](telegram-component.adoc) * [Tika](tika-component.adoc) * [Twitter](twitter-component.adoc) + * [Twitter Direct Message](twitter-directmessage-component.adoc) + * [Twitter Search](twitter-search-component.adoc) + * [Twitter Streaming](twitter-streaming-component.adoc) + * [Twitter Timeline](twitter-timeline-component.adoc) * [Undertow](undertow-component.adoc) * [Velocity](velocity-component.adoc) * [Vert.x](vertx-component.adoc) http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/examples/camel-example-twitter-salesforce/src/main/java/org/apache/camel/example/mention/TwitterSalesforceRoute.java ---------------------------------------------------------------------- diff --git a/examples/camel-example-twitter-salesforce/src/main/java/org/apache/camel/example/mention/TwitterSalesforceRoute.java b/examples/camel-example-twitter-salesforce/src/main/java/org/apache/camel/example/mention/TwitterSalesforceRoute.java index ec12e38..6027f15 100644 --- a/examples/camel-example-twitter-salesforce/src/main/java/org/apache/camel/example/mention/TwitterSalesforceRoute.java +++ b/examples/camel-example-twitter-salesforce/src/main/java/org/apache/camel/example/mention/TwitterSalesforceRoute.java @@ -26,7 +26,7 @@ public class TwitterSalesforceRoute extends RouteBuilder { @Override public void configure() throws Exception { - from("twitter:timeline/mentions") + from("twitter-timeline:mentions") .log("Mention ${body}") .process(exchange -> { Status status = exchange.getIn().getBody(Status.class); http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/examples/camel-example-twitter-websocket-blueprint/src/main/resources/OSGI-INF/blueprint/camel-twitter.xml ---------------------------------------------------------------------- diff --git a/examples/camel-example-twitter-websocket-blueprint/src/main/resources/OSGI-INF/blueprint/camel-twitter.xml b/examples/camel-example-twitter-websocket-blueprint/src/main/resources/OSGI-INF/blueprint/camel-twitter.xml index cf88a53..ae0ea8e 100644 --- a/examples/camel-example-twitter-websocket-blueprint/src/main/resources/OSGI-INF/blueprint/camel-twitter.xml +++ b/examples/camel-example-twitter-websocket-blueprint/src/main/resources/OSGI-INF/blueprint/camel-twitter.xml @@ -30,7 +30,7 @@ <route id="twitter-route"> <!-- consume from twitter search to get new tweets about gaga every 5th second --> - <from uri="twitter://search?type=polling&delay=6000&keywords=gaga + <from uri="twitter-search://foo?type=polling&delay=6000&keywords=gaga &accessToken={{access.token}}&accessTokenSecret={{access.token-secret}}&consumerKey={{consumer.key}}&consumerSecret={{consumer.secret}}"/> <!-- log tweet to the log --> @@ -42,4 +42,4 @@ </camelContext> -</blueprint> \ No newline at end of file +</blueprint> http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/examples/camel-example-twitter-websocket/src/main/java/org/apache/camel/example/websocket/TwitterWebSocketRoute.java ---------------------------------------------------------------------- diff --git a/examples/camel-example-twitter-websocket/src/main/java/org/apache/camel/example/websocket/TwitterWebSocketRoute.java b/examples/camel-example-twitter-websocket/src/main/java/org/apache/camel/example/websocket/TwitterWebSocketRoute.java index bcb9ae5..1173d0e 100644 --- a/examples/camel-example-twitter-websocket/src/main/java/org/apache/camel/example/websocket/TwitterWebSocketRoute.java +++ b/examples/camel-example-twitter-websocket/src/main/java/org/apache/camel/example/websocket/TwitterWebSocketRoute.java @@ -106,7 +106,7 @@ public class TwitterWebSocketRoute extends RouteBuilder { tc.setConsumerSecret(consumerSecret); // poll twitter search for new tweets - fromF("twitter://search?delay=%s&keywords=%s", delay, searchTerm) + fromF("twitter-search://foo?delay=%s&keywords=%s", delay, searchTerm) .to("log:tweet") // and push tweets to all web socket subscribers on camel-tweet .to("websocket:camel-tweet?sendToAll=true"); http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/platforms/spring-boot/components-starter/camel-twitter-starter/src/main/java/org/apache/camel/component/twitter/directmessage/springboot/TwitterDirectMessageComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-twitter-starter/src/main/java/org/apache/camel/component/twitter/directmessage/springboot/TwitterDirectMessageComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-twitter-starter/src/main/java/org/apache/camel/component/twitter/directmessage/springboot/TwitterDirectMessageComponentAutoConfiguration.java new file mode 100644 index 0000000..0dc17a1 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-twitter-starter/src/main/java/org/apache/camel/component/twitter/directmessage/springboot/TwitterDirectMessageComponentAutoConfiguration.java @@ -0,0 +1,130 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.twitter.directmessage.springboot; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.camel.CamelContext; +import org.apache.camel.component.twitter.directmessage.TwitterDirectMessageComponent; +import org.apache.camel.spi.ComponentCustomizer; +import org.apache.camel.spi.HasId; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.ComponentConfigurationProperties; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.GroupCondition; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.apache.camel.util.IntrospectionSupport; +import org.apache.camel.util.ObjectHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@Configuration +@Conditional({ConditionalOnCamelContextAndAutoConfigurationBeans.class, + TwitterDirectMessageComponentAutoConfiguration.GroupConditions.class}) +@AutoConfigureAfter(CamelAutoConfiguration.class) +@EnableConfigurationProperties({ComponentConfigurationProperties.class, + TwitterDirectMessageComponentConfiguration.class}) +public class TwitterDirectMessageComponentAutoConfiguration { + + private static final Logger LOGGER = LoggerFactory + .getLogger(TwitterDirectMessageComponentAutoConfiguration.class); + @Autowired + private ApplicationContext applicationContext; + @Autowired + private CamelContext camelContext; + @Autowired + private TwitterDirectMessageComponentConfiguration configuration; + @Autowired(required = false) + private List<ComponentCustomizer<TwitterDirectMessageComponent>> customizers; + + static class GroupConditions extends GroupCondition { + public GroupConditions() { + super("camel.component", "camel.component.twitter-directmessage"); + } + } + + @Lazy + @Bean(name = "twitter-directmessage-component") + @ConditionalOnMissingBean(TwitterDirectMessageComponent.class) + public TwitterDirectMessageComponent configureTwitterDirectMessageComponent() + throws Exception { + TwitterDirectMessageComponent component = new TwitterDirectMessageComponent(); + component.setCamelContext(camelContext); + Map<String, Object> parameters = new HashMap<>(); + IntrospectionSupport.getProperties(configuration, parameters, null, + false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), nestedProperty, + nestedParameters); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), component, parameters); + if (ObjectHelper.isNotEmpty(customizers)) { + for (ComponentCustomizer<TwitterDirectMessageComponent> customizer : customizers) { + boolean useCustomizer = (customizer instanceof HasId) + ? HierarchicalPropertiesEvaluator + .evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.twitter-directmessage.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator + .evaluate(applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.twitter-directmessage.customizer"); + if (useCustomizer) { + LOGGER.debug("Configure component {}, with customizer {}", + component, customizer); + customizer.customize(component); + } + } + } + return component; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/bb64dca0/platforms/spring-boot/components-starter/camel-twitter-starter/src/main/java/org/apache/camel/component/twitter/directmessage/springboot/TwitterDirectMessageComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-twitter-starter/src/main/java/org/apache/camel/component/twitter/directmessage/springboot/TwitterDirectMessageComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-twitter-starter/src/main/java/org/apache/camel/component/twitter/directmessage/springboot/TwitterDirectMessageComponentConfiguration.java new file mode 100644 index 0000000..028fbfa --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-twitter-starter/src/main/java/org/apache/camel/component/twitter/directmessage/springboot/TwitterDirectMessageComponentConfiguration.java @@ -0,0 +1,146 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.twitter.directmessage.springboot; + +import javax.annotation.Generated; +import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The Twitter Direct Message Component consumes/produces user's direct + * messages. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@ConfigurationProperties(prefix = "camel.component.twitter-directmessage") +public class TwitterDirectMessageComponentConfiguration + extends + ComponentConfigurationPropertiesCommon { + + /** + * The access token + */ + private String accessToken; + /** + * The access token secret + */ + private String accessTokenSecret; + /** + * The consumer key + */ + private String consumerKey; + /** + * The consumer secret + */ + private String consumerSecret; + /** + * The http proxy host which can be used for the camel-twitter. + */ + private String httpProxyHost; + /** + * The http proxy user which can be used for the camel-twitter. + */ + private String httpProxyUser; + /** + * The http proxy password which can be used for the camel-twitter. + */ + private String httpProxyPassword; + /** + * The http proxy port which can be used for the camel-twitter. + */ + private Integer httpProxyPort; + /** + * Whether the component should resolve property placeholders on itself when + * starting. Only properties which are of String type can use property + * placeholders. + */ + private Boolean resolvePropertyPlaceholders = true; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + public String getAccessTokenSecret() { + return accessTokenSecret; + } + + public void setAccessTokenSecret(String accessTokenSecret) { + this.accessTokenSecret = accessTokenSecret; + } + + public String getConsumerKey() { + return consumerKey; + } + + public void setConsumerKey(String consumerKey) { + this.consumerKey = consumerKey; + } + + public String getConsumerSecret() { + return consumerSecret; + } + + public void setConsumerSecret(String consumerSecret) { + this.consumerSecret = consumerSecret; + } + + public String getHttpProxyHost() { + return httpProxyHost; + } + + public void setHttpProxyHost(String httpProxyHost) { + this.httpProxyHost = httpProxyHost; + } + + public String getHttpProxyUser() { + return httpProxyUser; + } + + public void setHttpProxyUser(String httpProxyUser) { + this.httpProxyUser = httpProxyUser; + } + + public String getHttpProxyPassword() { + return httpProxyPassword; + } + + public void setHttpProxyPassword(String httpProxyPassword) { + this.httpProxyPassword = httpProxyPassword; + } + + public Integer getHttpProxyPort() { + return httpProxyPort; + } + + public void setHttpProxyPort(Integer httpProxyPort) { + this.httpProxyPort = httpProxyPort; + } + + public Boolean getResolvePropertyPlaceholders() { + return resolvePropertyPlaceholders; + } + + public void setResolvePropertyPlaceholders( + Boolean resolvePropertyPlaceholders) { + this.resolvePropertyPlaceholders = resolvePropertyPlaceholders; + } +} \ No newline at end of file