refactored the twitter package to use interface types for the domain model, which gives us wiggle room to move to Spring Social
This commit is contained in:
@@ -37,14 +37,17 @@ import twitter4j.GeoLocation;
|
||||
"/org/springframework/integration/twitter/sending_dms_using_ns.xml"}
|
||||
)
|
||||
public class TestSendingDMsUsingNamespace extends AbstractJUnit4SpringContextTests {
|
||||
|
||||
private volatile MessagingTemplate messagingTemplate = new MessagingTemplate();
|
||||
@Value("#{out}")
|
||||
private MessageChannel channel;
|
||||
|
||||
@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);
|
||||
@@ -53,8 +56,6 @@ public class TestSendingDMsUsingNamespace extends AbstractJUnit4SpringContextTes
|
||||
mb.setHeader(TwitterHeaders.TWITTER_DM_TARGET_USER_ID, dmUsr);
|
||||
}
|
||||
|
||||
Message<String> m = mb.build();
|
||||
|
||||
this.messagingTemplate.send(this.channel, m);
|
||||
this.messagingTemplate.send(this.channel, mb.build());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,9 +36,10 @@ import twitter4j.GeoLocation;
|
||||
"/org/springframework/integration/twitter/sending_updates_using_ns.xml"}
|
||||
)
|
||||
public class TestSendingUpdatesUsingNamespace extends AbstractJUnit4SpringContextTests {
|
||||
|
||||
private MessagingTemplate messagingTemplate = new MessagingTemplate();
|
||||
@Value("#{out}")
|
||||
private MessageChannel channel;
|
||||
|
||||
@Value("#{out}") private MessageChannel channel;
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package org.springframework.integration.twitter;
|
||||
|
||||
import org.springframework.integration.twitter.model.DirectMessage;
|
||||
import org.springframework.integration.twitter.model.Status;
|
||||
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());
|
||||
System.out.println("A direct message has been received from " +
|
||||
directMessage.getSender().getScreenName() + " with text " + directMessage.getText());
|
||||
}
|
||||
|
||||
public void mention(Status s) {
|
||||
|
||||
Reference in New Issue
Block a user