moved spaces to tabs for the twitter package

This commit is contained in:
Josh Long
2010-08-24 22:10:01 +00:00
parent d2f74acbfb
commit d2d4104d86
30 changed files with 1218 additions and 1271 deletions

View File

@@ -4,20 +4,15 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.twitter.oauth.OAuthConfiguration;
import org.springframework.test.context.ContextConfiguration;
import twitter4j.Status;
import twitter4j.Twitter;
import java.util.Collection;
/**
* This class is used to simply demonstrating correctly factory-ing a {@link twitter4j.Twitter} instance
*
@@ -25,21 +20,21 @@ import java.util.Collection;
*/
@ContextConfiguration(locations = "twitter_connection_using_ns.xml")
public class SimpleTwitterTestClient {
private Twitter twitter;
@Autowired
private volatile OAuthConfiguration oAuthConfiguration;
private Twitter twitter;
@Autowired
private volatile OAuthConfiguration oAuthConfiguration;
@Before
public void begin() throws Exception {
this.twitter = oAuthConfiguration.getTwitter();
}
@Before
public void begin() throws Exception {
this.twitter = oAuthConfiguration.getTwitter();
}
@Test
@Ignore
public void testConnectivity() throws Throwable {
Collection<Status> responses;
Assert.assertNotNull(this.twitter);
Assert.assertNotNull(responses = this.twitter.getFriendsTimeline());
Assert.assertTrue(responses.size() > 0);
}
@Test
@Ignore
public void testConnectivity() throws Throwable {
Collection<Status> responses;
Assert.assertNotNull(this.twitter);
Assert.assertNotNull(responses = this.twitter.getFriendsTimeline());
Assert.assertTrue(responses.size() > 0);
}
}

View File

@@ -17,9 +17,7 @@ package org.springframework.integration.twitter;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
@@ -27,22 +25,22 @@ import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
/**
* @author Josh Long
*/
@ContextConfiguration(locations = {
"/receiving_dms_using_ns.xml"}
@ContextConfiguration(locations = {
"/receiving_dms_using_ns.xml"}
)
public class TestRecievingUsingNamespace extends AbstractJUnit4SpringContextTests {
@Autowired
private TwitterAnnouncer twitterAnnouncer;
@Autowired
private TwitterAnnouncer twitterAnnouncer;
@Test
@Ignore
public void testIt() throws Throwable {
long ctr = 0;
long s = 1000;
@Test
@Ignore
public void testIt() throws Throwable {
long ctr = 0;
long s = 1000;
while (ctr < (s * 60 * 3)) {
Thread.sleep(s);
ctr += s;
}
}
while (ctr < (s * 60 * 3)) {
Thread.sleep(s);
ctr += s;
}
}
}

View File

@@ -17,48 +17,42 @@ package org.springframework.integration.twitter;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.integration.Message;
import org.springframework.integration.core.MessageBuilder;
import org.springframework.integration.core.MessageChannel;
import org.springframework.integration.core.MessagingTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
import org.springframework.util.StringUtils;
import twitter4j.GeoLocation;
/**
* @author Josh Long
*/
@ContextConfiguration(locations = {
"/sending_dms_using_ns.xml"}
@ContextConfiguration(locations = {
"/sending_dms_using_ns.xml"}
)
public class TestSendingDMsUsingNamespace extends AbstractJUnit4SpringContextTests {
private volatile MessagingTemplate messagingTemplate = new MessagingTemplate();
@Value("#{out}")
private MessageChannel channel;
private volatile MessagingTemplate messagingTemplate = new MessagingTemplate();
@Value("#{out}")
private MessageChannel channel;
@Test
@Ignore
public void testSendingATweet() throws Throwable {
String dmUsr = System.getProperties().getProperty("twitter.dm.user");
MessageBuilder<String> mb = MessageBuilder.withPayload("'Hello world!', from the Spring Integration outbound Twitter adapter")
.setHeader(TwitterHeaders.TWITTER_GEOLOCATION, new GeoLocation(-76.226823, 23.642465)) // antarctica
.setHeader(TwitterHeaders.TWITTER_DISPLAY_COORDINATES, true);
@Test
@Ignore
public void testSendingATweet() throws Throwable {
String dmUsr = System.getProperties().getProperty("twitter.dm.user");
MessageBuilder<String> mb = MessageBuilder.withPayload("'Hello world!', from the Spring Integration outbound Twitter adapter")
.setHeader(TwitterHeaders.TWITTER_GEOLOCATION, new GeoLocation(-76.226823, 23.642465)) // antarctica
.setHeader(TwitterHeaders.TWITTER_DISPLAY_COORDINATES, true);
if (StringUtils.hasText(dmUsr)) {
mb.setHeader(TwitterHeaders.TWITTER_DM_TARGET_USER_ID, dmUsr);
}
if (StringUtils.hasText(dmUsr)) {
mb.setHeader(TwitterHeaders.TWITTER_DM_TARGET_USER_ID, dmUsr);
}
Message<String> m = mb.build();
Message<String> m = mb.build();
this.messagingTemplate.send(this.channel, m);
}
this.messagingTemplate.send(this.channel, m);
}
}

View File

@@ -17,42 +17,35 @@ package org.springframework.integration.twitter;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.integration.Message;
import org.springframework.integration.core.MessageBuilder;
import org.springframework.integration.core.MessageChannel;
import org.springframework.integration.core.MessagingTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
import org.springframework.util.StringUtils;
import twitter4j.GeoLocation;
/**
* @author Josh Long
*/
@ContextConfiguration(locations = {
"/sending_updates_using_ns.xml"}
@ContextConfiguration(locations = {
"/sending_updates_using_ns.xml"}
)
public class TestSendingUpdatesUsingNamespace extends AbstractJUnit4SpringContextTests {
private MessagingTemplate messagingTemplate = new MessagingTemplate();
@Value("#{out}")
private MessageChannel channel;
private MessagingTemplate messagingTemplate = new MessagingTemplate();
@Value("#{out}")
private MessageChannel channel;
@Test
@Ignore
public void testSendingATweet() throws Throwable {
MessageBuilder<String> mb = MessageBuilder.withPayload("'Hello world!', from the Spring Integration outbound Twitter adapter")
.setHeader(TwitterHeaders.TWITTER_IN_REPLY_TO_STATUS_ID, 21927437001L)
.setHeader(TwitterHeaders.TWITTER_GEOLOCATION, new GeoLocation(-76.226823, 23.642465)) // antarctica
.setHeader(TwitterHeaders.TWITTER_DISPLAY_COORDINATES, true);
Message<String> m = mb.build();
this.messagingTemplate.send(this.channel, m);
}
@Test
@Ignore
public void testSendingATweet() throws Throwable {
MessageBuilder<String> mb = MessageBuilder.withPayload("'Hello world!', from the Spring Integration outbound Twitter adapter")
.setHeader(TwitterHeaders.TWITTER_IN_REPLY_TO_STATUS_ID, 21927437001L)
.setHeader(TwitterHeaders.TWITTER_GEOLOCATION, new GeoLocation(-76.226823, 23.642465)) // antarctica
.setHeader(TwitterHeaders.TWITTER_DISPLAY_COORDINATES, true);
Message<String> m = mb.build();
this.messagingTemplate.send(this.channel, m);
}
}

View File

@@ -1,22 +1,21 @@
package org.springframework.integration.twitter;
import org.springframework.stereotype.Component;
import twitter4j.DirectMessage;
import twitter4j.Status;
@Component
public class TwitterAnnouncer {
public void dm(DirectMessage directMessage) {
System.out.println("A direct message has been received from " + directMessage.getSenderScreenName() + " with text " + directMessage.getText());
}
public void dm(DirectMessage directMessage) {
System.out.println("A direct message has been received from " + directMessage.getSenderScreenName() + " with text " + directMessage.getText());
}
public void mention(Status s) {
System.out.println("A tweet mentioning (or replying) to " + "you was received having text " + s.getText() + " from " + s.getSource());
}
public void mention(Status s) {
System.out.println("A tweet mentioning (or replying) to " + "you was received having text " + s.getText() + " from " + s.getSource());
}
public void friendsTimelineUpdated(Status t) {
System.out.println("Received " + t.getText() + " from " + t.getSource());
}
public void friendsTimelineUpdated(Status t) {
System.out.println("Received " + t.getText() + " from " + t.getSource());
}
}