INT-1603 renamed components and methods to be more consistent
This commit is contained in:
@@ -41,13 +41,13 @@ public class TwitterReceivingMessageSourceParser extends AbstractPollingInboundC
|
||||
String elementName = element.getLocalName().trim();
|
||||
String className = null;
|
||||
if ("inbound-channel-adapter".equals(elementName)) {
|
||||
className = BASE_PACKAGE + ".inbound.TimelineUpdateReceivingMessageSource";
|
||||
className = BASE_PACKAGE + ".inbound.TimelineReceivingMessageSource";
|
||||
}
|
||||
else if ("dm-inbound-channel-adapter".equals(elementName)) {
|
||||
className = BASE_PACKAGE + ".inbound.DirectMessageReceivingMessageSource";
|
||||
}
|
||||
else if ("mentions-inbound-channel-adapter".equals(elementName)) {
|
||||
className = BASE_PACKAGE + ".inbound.MentionReceivingMessageSource";
|
||||
className = BASE_PACKAGE + ".inbound.MentionsReceivingMessageSource";
|
||||
}
|
||||
else {
|
||||
parserContext.getReaderContext().error("element '" + elementName + "' is not supported by this parser.", element);
|
||||
|
||||
@@ -38,7 +38,7 @@ public class TwitterSendingMessageHandlerParser extends AbstractOutboundChannelA
|
||||
String elementName = element.getLocalName().trim();
|
||||
String className = null;
|
||||
if ("outbound-channel-adapter".equals(elementName)) {
|
||||
className = BASE_PACKAGE + ".outbound.TimelineUpdateSendingMessageHandler";
|
||||
className = BASE_PACKAGE + ".outbound.TimelineSendingMessageHandler";
|
||||
}
|
||||
else if ("dm-outbound-channel-adapter".equals(elementName)) {
|
||||
className = BASE_PACKAGE + ".outbound.DirectMessageSendingMessageHandler";
|
||||
|
||||
@@ -124,7 +124,7 @@ public class Twitter4jTemplate implements TwitterOperations{
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public List<Tweet> getHomeTimeline() {
|
||||
public List<Tweet> getTimeline() {
|
||||
try {
|
||||
ResponseList<Status> timelines = twitter.getHomeTimeline();
|
||||
return this.buildTweetsFromTwitterResponses(timelines);
|
||||
@@ -134,7 +134,7 @@ public class Twitter4jTemplate implements TwitterOperations{
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public List<Tweet> getHomeTimeline(long sinceId) {
|
||||
public List<Tweet> getTimeline(long sinceId) {
|
||||
try {
|
||||
ResponseList<Status> timelines = twitter.getHomeTimeline(new Paging(sinceId));
|
||||
return this.buildTweetsFromTwitterResponses(timelines);
|
||||
|
||||
@@ -118,9 +118,9 @@ public interface TwitterOperations {
|
||||
|
||||
List<Tweet> getMentions(long sinceId);
|
||||
|
||||
List<Tweet> getHomeTimeline();
|
||||
List<Tweet> getTimeline();
|
||||
|
||||
List<Tweet> getHomeTimeline(long sinceId);
|
||||
List<Tweet> getTimeline(long sinceId);
|
||||
|
||||
void sendDirectMessage(String userName, String text);
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ public abstract class AbstractTwitterMessageSource<T> extends AbstractEndpoint
|
||||
synchronized (this.markerGuard) {
|
||||
|
||||
long id = tweet.getId();
|
||||
|
||||
|
||||
if (id > this.markerId) {
|
||||
this.markerId = id;
|
||||
tweets.add(tweet);
|
||||
|
||||
@@ -27,9 +27,9 @@ import org.springframework.integration.twitter.core.TwitterOperations;
|
||||
* @author Josh Long
|
||||
* @author Oleg Zhurakousky
|
||||
*/
|
||||
public class MentionReceivingMessageSource extends AbstractTwitterMessageSource<Tweet> {
|
||||
public class MentionsReceivingMessageSource extends AbstractTwitterMessageSource<Tweet> {
|
||||
|
||||
public MentionReceivingMessageSource(TwitterOperations twitter){
|
||||
public MentionsReceivingMessageSource(TwitterOperations twitter){
|
||||
super(twitter);
|
||||
}
|
||||
@Override
|
||||
@@ -30,9 +30,9 @@ import org.springframework.integration.twitter.core.TwitterOperations;
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class TimelineUpdateReceivingMessageSource extends AbstractTwitterMessageSource<Tweet> {
|
||||
public class TimelineReceivingMessageSource extends AbstractTwitterMessageSource<Tweet> {
|
||||
|
||||
public TimelineUpdateReceivingMessageSource(TwitterOperations twitter){
|
||||
public TimelineReceivingMessageSource(TwitterOperations twitter){
|
||||
super(twitter);
|
||||
}
|
||||
@Override
|
||||
@@ -48,8 +48,8 @@ public class TimelineUpdateReceivingMessageSource extends AbstractTwitterMessage
|
||||
long sinceId = getMarkerId();
|
||||
if (tweets.size() <= prefetchThreshold){
|
||||
List<Tweet> tweets = !hasMarkedStatus()
|
||||
? twitter.getHomeTimeline()
|
||||
: twitter.getHomeTimeline(sinceId);
|
||||
? twitter.getTimeline()
|
||||
: twitter.getTimeline(sinceId);
|
||||
forwardAll(tweets);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -28,9 +28,9 @@ import org.springframework.integration.twitter.core.TwitterOperations;
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class TimelineUpdateSendingMessageHandler extends AbstractOutboundTwitterEndpointSupport {
|
||||
public class TimelineSendingMessageHandler extends AbstractOutboundTwitterEndpointSupport {
|
||||
|
||||
public TimelineUpdateSendingMessageHandler(TwitterOperations twitter){
|
||||
public TimelineSendingMessageHandler(TwitterOperations twitter){
|
||||
super(twitter);
|
||||
}
|
||||
|
||||
@@ -95,8 +95,8 @@ public class Twitter4jTemplateTests {
|
||||
|
||||
@Test
|
||||
public void testGetFriendsTimeline() throws Exception{
|
||||
template.getHomeTimeline();
|
||||
template.getHomeTimeline(123);
|
||||
template.getTimeline();
|
||||
template.getTimeline(123);
|
||||
verify(twitter, times(1)).getHomeTimeline();
|
||||
verify(twitter, times(1)).getHomeTimeline(Mockito.any(Paging.class));
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class TimelineUpdateReceivingMessageSourceTests {
|
||||
@Test
|
||||
public void testSuccessfullInitialization() throws Exception{
|
||||
when(tw.isOAuthEnabled()).thenReturn(true);
|
||||
TimelineUpdateReceivingMessageSource source = new TimelineUpdateReceivingMessageSource(twitter);
|
||||
TimelineReceivingMessageSource source = new TimelineReceivingMessageSource(twitter);
|
||||
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
|
||||
scheduler.afterPropertiesSet();
|
||||
source.setTaskScheduler(scheduler);
|
||||
@@ -118,7 +118,7 @@ public class TimelineUpdateReceivingMessageSourceTests {
|
||||
public void testSuccessfullInitializationWithMessages() throws Exception{
|
||||
this.setUpMockScenarioForMessagePolling();
|
||||
|
||||
TimelineUpdateReceivingMessageSource source = new TimelineUpdateReceivingMessageSource(twitter);
|
||||
TimelineReceivingMessageSource source = new TimelineReceivingMessageSource(twitter);
|
||||
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
|
||||
scheduler.afterPropertiesSet();
|
||||
source.setTaskScheduler(scheduler);
|
||||
@@ -132,7 +132,7 @@ public class TimelineUpdateReceivingMessageSourceTests {
|
||||
Tweet message = (Tweet) msg.poll();
|
||||
assertEquals(2000, message.getId());
|
||||
Thread.sleep(1000);
|
||||
verify(twitter, times(1)).getHomeTimeline(2000);
|
||||
verify(twitter, times(1)).getTimeline(2000);
|
||||
// based on the Mock, the Queue shoud now have 2 mopre messages third and fourth
|
||||
assertTrue(((Queue)TestUtils.getPropertyValue(source, "tweets")).size() == 2);
|
||||
source.stop();
|
||||
@@ -154,7 +154,7 @@ public class TimelineUpdateReceivingMessageSourceTests {
|
||||
PropertiesPersistingMetadataStore store = new PropertiesPersistingMetadataStore();
|
||||
store.afterPropertiesSet();
|
||||
bf.registerSingleton(IntegrationContextUtils.METADATA_STORE_BEAN_NAME, store);
|
||||
TimelineUpdateReceivingMessageSource source = new TimelineUpdateReceivingMessageSource(twitter);
|
||||
TimelineReceivingMessageSource source = new TimelineReceivingMessageSource(twitter);
|
||||
source.setBeanFactory(bf);
|
||||
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
|
||||
scheduler.afterPropertiesSet();
|
||||
@@ -181,7 +181,7 @@ public class TimelineUpdateReceivingMessageSourceTests {
|
||||
store = new PropertiesPersistingMetadataStore();
|
||||
store.afterPropertiesSet();
|
||||
bf.registerSingleton(IntegrationContextUtils.METADATA_STORE_BEAN_NAME, store);
|
||||
source = new TimelineUpdateReceivingMessageSource(twitter);
|
||||
source = new TimelineReceivingMessageSource(twitter);
|
||||
source.setBeanFactory(bf);
|
||||
scheduler = new ThreadPoolTaskScheduler();
|
||||
scheduler.afterPropertiesSet();
|
||||
|
||||
@@ -58,7 +58,7 @@ public class TimelineUpdateSendingMessageHandlerTests {
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Test
|
||||
public void testSendingStatusUpdate() throws Exception{
|
||||
TimelineUpdateSendingMessageHandler handler = new TimelineUpdateSendingMessageHandler(twitterOperations);
|
||||
TimelineSendingMessageHandler handler = new TimelineSendingMessageHandler(twitterOperations);
|
||||
Tweet tweet = new Tweet();
|
||||
tweet.setText("writing twitter tests");
|
||||
handler.handleMessage(new GenericMessage(tweet));
|
||||
@@ -67,7 +67,7 @@ public class TimelineUpdateSendingMessageHandlerTests {
|
||||
}
|
||||
@Test
|
||||
public void testSendingStatusUpdateWithHeaders() throws Exception{
|
||||
TimelineUpdateSendingMessageHandler handler = new TimelineUpdateSendingMessageHandler(twitterOperations);
|
||||
TimelineSendingMessageHandler handler = new TimelineSendingMessageHandler(twitterOperations);
|
||||
Message<?> message = MessageBuilder.withPayload("writing twitter tests")
|
||||
.setHeader(TwitterHeaders.IN_REPLY_TO_STATUS_ID, new Long(123))
|
||||
.setHeader(TwitterHeaders.PLACE_ID, "123")
|
||||
|
||||
Reference in New Issue
Block a user