INTSAMPLES-85 - Upgrade Twitter Sample Spring Integration version

* Upgrade Twitter sample to latest Spring Integration version
* Twitter search test does not run with authentication by default
* Twitter search test will run every time the project builds
This commit is contained in:
Gunnar Hillert
2012-08-06 12:52:05 -04:00
parent abe1010092
commit e70696f4f7
4 changed files with 36 additions and 19 deletions

View File

@@ -23,12 +23,12 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
* @author Oleg Zhurakousky
*
*/
public class TwitterSearchSample {
public class TwitterSearchSampleTest {
@Test
public void runDemo() throws Exception{
new ClassPathXmlApplicationContext("META-INF/spring/integration/TwitterSearch-context.xml");
Thread.sleep(20000);
Thread.sleep(5000);
}
}

View File

@@ -8,9 +8,13 @@
xmlns:context="http://www.springframework.org/schema/context"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-twitter="http://www.springframework.org/schema/integration/twitter">
<context:property-placeholder location="classpath:oauth.properties"/>
<!-- While authentication is certainly support for executing Twitter searches,
authentication is not required. -->
<!--
<bean id="twitterTemplate"
class="org.springframework.social.twitter.api.impl.TwitterTemplate">
<constructor-arg value="${twitter.oauth.consumerKey}" />
@@ -18,13 +22,21 @@
<constructor-arg value="${twitter.oauth.accessToken}" />
<constructor-arg value="${twitter.oauth.accessTokenSecret}" />
</bean>
<int-twitter:search-inbound-channel-adapter id="searchAdapter" channel="sourceExtractor"
query="#springintegration" twitter-template="twitterTemplate">
<int:poller fixed-rate="3000" max-messages-per-poll="5" />
</int-twitter:search-inbound-channel-adapter>
<int-twitter:search-inbound-channel-adapter id="searchAdapter" channel="sourceExtractor"
query="#springintegration" twitter-template="twitterTemplate">
<int:poller fixed-rate="3000" max-messages-per-poll="5" />
</int-twitter:search-inbound-channel-adapter>
-->
<!-- Search Twitter without authentication -->
<int-twitter:search-inbound-channel-adapter id="searchAdapter" channel="sourceExtractor"
query="springintegration OR springframework OR #grails">
<int:poller fixed-rate="3000" max-messages-per-poll="5" />
</int-twitter:search-inbound-channel-adapter>
<int:transformer input-channel="sourceExtractor" output-channel="twitterOut" expression="payload.getText()"/>
<int:logging-channel-adapter id="twitterOut"/>
<int:logging-channel-adapter id="twitterOut" level="INFO"/>
</beans>

View File

@@ -12,7 +12,7 @@
<!-- Loggers -->
<logger name="org.springframework.integration">
<level value="warn" />
<level value="info" />
</logger>
<logger name="org.springframework.integration.samples">