INT-1603 fixed SearchReceivingMessageSource and tests

This commit is contained in:
Oleg Zhurakousky
2010-11-11 14:29:31 -05:00
parent fa135f9c6c
commit 6335dd44d7
9 changed files with 28 additions and 52 deletions

View File

@@ -73,6 +73,7 @@ public class Twitter4jTemplateTests {
@Test
public void testProfileId() throws Exception{
when(twitter.getScreenName()).thenReturn("kermit");
when(twitter.isOAuthEnabled()).thenReturn(true);
assertEquals("kermit", template.getProfileId());
}

View File

@@ -99,7 +99,7 @@ public class DirectMessageReceivingMessageSourceTests {
@Test
public void testSuccessfullInitialization() throws Exception{
when(tw.isOAuthEnabled()).thenReturn(true);
DirectMessageReceivingMessageSource source = new DirectMessageReceivingMessageSource(twitter);
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
scheduler.afterPropertiesSet();
@@ -107,7 +107,7 @@ public class DirectMessageReceivingMessageSourceTests {
source.setBeanName("twitterEndpoint");
source.afterPropertiesSet();
source.start();
assertEquals("twitter:inbound-dm-channel-adapter.twitterEndpoint.kermit", TestUtils.getPropertyValue(source, "metadataKey"));
assertEquals("twitter:dm-inbound-channel-adapter.twitterEndpoint.kermit", TestUtils.getPropertyValue(source, "metadataKey"));
assertTrue(source.isRunning());
source.stop();
}
@@ -127,7 +127,7 @@ public class DirectMessageReceivingMessageSourceTests {
Thread.sleep(1000);
Queue msg = (Queue) TestUtils.getPropertyValue(source, "tweets");
assertTrue(!CollectionUtils.isEmpty(msg));
assertEquals(1, msg.size()); // because the other message has a older timestamp and is assumed to be read by
assertEquals(1, msg.size());
Tweet message = (Tweet) msg.poll();
assertEquals(2000, message.getId());
Thread.sleep(1000);
@@ -164,7 +164,7 @@ public class DirectMessageReceivingMessageSourceTests {
Thread.sleep(1000);
Queue msg = (Queue) TestUtils.getPropertyValue(source, "tweets");
assertTrue(!CollectionUtils.isEmpty(msg));
assertEquals(1, msg.size()); // because the other message has a older timestamp and is assumed to be read by
assertEquals(1, msg.size());
Tweet message = (Tweet) msg.poll();
assertEquals(2000, message.getId());
source.stop();
@@ -201,7 +201,7 @@ public class DirectMessageReceivingMessageSourceTests {
@SuppressWarnings("unchecked")
private void setUpMockScenarioForMessagePolling() throws Exception{
RateLimitStatus rateLimitStatus = mock(RateLimitStatus.class);
when(tw.isOAuthEnabled()).thenReturn(true);
when(tw.getRateLimitStatus()).thenReturn(rateLimitStatus);
when(rateLimitStatus.getSecondsUntilReset()).thenReturn(1000);
when(rateLimitStatus.getRemainingHits()).thenReturn(1000);

View File

@@ -99,7 +99,7 @@ public class TimelineUpdateReceivingMessageSourceTests {
@Test
public void testSuccessfullInitialization() throws Exception{
when(tw.isOAuthEnabled()).thenReturn(true);
TimelineUpdateReceivingMessageSource source = new TimelineUpdateReceivingMessageSource(twitter);
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
scheduler.afterPropertiesSet();
@@ -107,7 +107,7 @@ public class TimelineUpdateReceivingMessageSourceTests {
source.setBeanName("twitterEndpoint");
source.afterPropertiesSet();
source.start();
assertEquals("twitter:inbound-update-channel-adapter.twitterEndpoint.kermit", TestUtils.getPropertyValue(source, "metadataKey"));
assertEquals("twitter:inbound-channel-adapter.twitterEndpoint.kermit", TestUtils.getPropertyValue(source, "metadataKey"));
assertTrue(source.isRunning());
source.stop();
}