Remove System.out/.err Calls From All Tests
This commit is contained in:
@@ -18,6 +18,9 @@ package org.springframework.integration.twitter.ignored;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.integration.history.MessageHistory;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.social.twitter.api.DirectMessage;
|
||||
@@ -33,36 +36,37 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
public class TwitterAnnouncer {
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
public void dm(DirectMessage directMessage) {
|
||||
System.out.println("A direct message has been received from " +
|
||||
logger.info("A direct message has been received from " +
|
||||
directMessage.getSender().getScreenName() + " with text " + directMessage.getText());
|
||||
}
|
||||
|
||||
public void search(Message<?> search) {
|
||||
MessageHistory history = MessageHistory.read(search);
|
||||
System.out.println(history);
|
||||
Tweet tweet = (Tweet) search.getPayload();
|
||||
System.out.println("A search item was received " +
|
||||
logger.info("A search item was received " +
|
||||
tweet.getCreatedAt() + " with text " + tweet.getText());
|
||||
}
|
||||
|
||||
public void mention(Tweet s) {
|
||||
System.out.println("A tweet mentioning (or replying) to you was received having text "
|
||||
logger.info("A tweet mentioning (or replying) to you was received having text "
|
||||
+ s.getFromUser() + "-" + s.getText() + " from " + s.getSource());
|
||||
}
|
||||
|
||||
public void searchResult(Collection<Tweet> tweets) {
|
||||
if (tweets.size() == 0) {
|
||||
System.out.println("No results");
|
||||
logger.info("No results");
|
||||
}
|
||||
for (Tweet s : tweets) {
|
||||
System.out.println("Search result: "
|
||||
logger.info("Search result: "
|
||||
+ s.getFromUser() + "-" + s.getText() + " from " + s.getSource());
|
||||
}
|
||||
}
|
||||
|
||||
public void updates(Tweet t) {
|
||||
System.out.println("Received timeline update: " + t.getText() + " from " + t.getSource());
|
||||
logger.info("Received timeline update: " + t.getText() + " from " + t.getSource());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,8 +18,11 @@ package org.springframework.integration.twitter.inbound;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.config.PropertiesFactoryBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.messaging.Message;
|
||||
@@ -28,9 +31,11 @@ import org.springframework.social.twitter.api.impl.TwitterTemplate;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class DirectMessageReceivingMessageSourceTests {
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test @Ignore
|
||||
@@ -39,7 +44,6 @@ public class DirectMessageReceivingMessageSourceTests {
|
||||
pf.setLocation(new ClassPathResource("sample.properties"));
|
||||
pf.afterPropertiesSet();
|
||||
Properties prop = pf.getObject();
|
||||
System.out.println(prop);
|
||||
TwitterTemplate template = new TwitterTemplate(prop.getProperty("z_oleg.oauth.consumerKey"),
|
||||
prop.getProperty("z_oleg.oauth.consumerSecret"),
|
||||
prop.getProperty("z_oleg.oauth.accessToken"),
|
||||
@@ -50,8 +54,9 @@ public class DirectMessageReceivingMessageSourceTests {
|
||||
Message<DirectMessage> message = (Message<DirectMessage>) tSource.receive();
|
||||
if (message != null) {
|
||||
DirectMessage tweet = message.getPayload();
|
||||
System.out.println(tweet.getSender().getScreenName() + " - " + tweet.getText() + " - " + tweet.getCreatedAt());
|
||||
logger.info(tweet.getSender().getScreenName() + " - " + tweet.getText() + " - " + tweet.getCreatedAt());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -54,6 +56,8 @@ import org.springframework.social.twitter.api.impl.TwitterTemplate;
|
||||
*/
|
||||
public class SearchReceivingMessageSourceTests {
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private static final String SEARCH_QUERY = "#springsource";
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -63,7 +67,6 @@ public class SearchReceivingMessageSourceTests {
|
||||
pf.setLocation(new ClassPathResource("sample.properties"));
|
||||
pf.afterPropertiesSet();
|
||||
Properties prop = pf.getObject();
|
||||
System.out.println(prop);
|
||||
TwitterTemplate template = new TwitterTemplate(prop.getProperty("z_oleg.oauth.consumerKey"),
|
||||
prop.getProperty("z_oleg.oauth.consumerSecret"),
|
||||
prop.getProperty("z_oleg.oauth.accessToken"),
|
||||
@@ -75,7 +78,7 @@ public class SearchReceivingMessageSourceTests {
|
||||
Message<Tweet> message = (Message<Tweet>) tSource.receive();
|
||||
if (message != null) {
|
||||
Tweet tweet = message.getPayload();
|
||||
System.out.println(tweet.getFromUser() + " - " + tweet.getText() + " - " + tweet.getCreatedAt());
|
||||
logger.info(tweet.getFromUser() + " - " + tweet.getText() + " - " + tweet.getCreatedAt());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ import java.util.ArrayList;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -45,19 +47,22 @@ import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.social.twitter.api.SearchMetadata;
|
||||
import org.springframework.social.twitter.api.SearchOperations;
|
||||
import org.springframework.social.twitter.api.SearchParameters;
|
||||
import org.springframework.social.twitter.api.SearchResults;
|
||||
import org.springframework.social.twitter.api.Tweet;
|
||||
import org.springframework.social.twitter.api.UserOperations;
|
||||
import org.springframework.social.twitter.api.SearchParameters;
|
||||
import org.springframework.social.twitter.api.impl.TwitterTemplate;
|
||||
|
||||
/**
|
||||
* @author Gunnar Hillert
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
* @since 3.0
|
||||
*/
|
||||
public class SearchReceivingMessageSourceWithRedisTests extends RedisAvailableTests {
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private SourcePollingChannelAdapter twitterSearchAdapter;
|
||||
|
||||
private AbstractTwitterMessageSource<?> twitterMessageSource;
|
||||
@@ -86,6 +91,7 @@ public class SearchReceivingMessageSourceWithRedisTests extends RedisAvailableTe
|
||||
this.metadataStore.put(metadataKey, "-1");
|
||||
|
||||
this.twitterMessageSource.afterPropertiesSet();
|
||||
context.close();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,8 +18,11 @@ package org.springframework.integration.twitter.inbound;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.config.PropertiesFactoryBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.messaging.Message;
|
||||
@@ -29,9 +32,11 @@ import org.springframework.social.twitter.api.impl.TwitterTemplate;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class TimelineReceivingMessageSourceTests {
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test @Ignore
|
||||
@@ -40,7 +45,6 @@ public class TimelineReceivingMessageSourceTests {
|
||||
pf.setLocation(new ClassPathResource("sample.properties"));
|
||||
pf.afterPropertiesSet();
|
||||
Properties prop = pf.getObject();
|
||||
System.out.println(prop);
|
||||
TwitterTemplate template = new TwitterTemplate(prop.getProperty("z_oleg.oauth.consumerKey"),
|
||||
prop.getProperty("z_oleg.oauth.consumerSecret"),
|
||||
prop.getProperty("z_oleg.oauth.accessToken"),
|
||||
@@ -51,8 +55,9 @@ public class TimelineReceivingMessageSourceTests {
|
||||
Message<Tweet> message = (Message<Tweet>) tSource.receive();
|
||||
if (message != null) {
|
||||
Tweet tweet = message.getPayload();
|
||||
System.out.println(tweet.getFromUser() + " - " + tweet.getText() + " - " + tweet.getCreatedAt());
|
||||
logger.info(tweet.getFromUser() + " - " + tweet.getText() + " - " + tweet.getCreatedAt());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,16 +20,18 @@ import java.util.Properties;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.config.PropertiesFactoryBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.integration.twitter.core.TwitterHeaders;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.social.twitter.api.impl.TwitterTemplate;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Mark Fisher
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class DirectMessageSendingMessageHandlerTests {
|
||||
|
||||
@@ -39,7 +41,6 @@ public class DirectMessageSendingMessageHandlerTests {
|
||||
pf.setLocation(new ClassPathResource("sample.properties"));
|
||||
pf.afterPropertiesSet();
|
||||
Properties prop = pf.getObject();
|
||||
System.out.println(prop);
|
||||
TwitterTemplate template = new TwitterTemplate(prop.getProperty("spring_eip.oauth.consumerKey"),
|
||||
prop.getProperty("spring_eip.oauth.consumerSecret"),
|
||||
prop.getProperty("spring_eip.oauth.accessToken"),
|
||||
|
||||
Reference in New Issue
Block a user