diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/MessagingAnnotationsWithBeanAnnotationTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/MessagingAnnotationsWithBeanAnnotationTests.java index f2cbd6f057..60adf2bdb9 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/MessagingAnnotationsWithBeanAnnotationTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/MessagingAnnotationsWithBeanAnnotationTests.java @@ -277,7 +277,7 @@ public class MessagingAnnotationsWithBeanAnnotationTests { @Filter(inputChannel = "skippedChannel5") @Profile("foo") public MessageHandler skippedMessageHandler() { - return System.out::println; + return m -> { }; } @Bean diff --git a/spring-integration-core/src/test/java/org/springframework/integration/core/MessageIdGenerationTests.java b/spring-integration-core/src/test/java/org/springframework/integration/core/MessageIdGenerationTests.java index 97ee900332..af1c34bde7 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/core/MessageIdGenerationTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/core/MessageIdGenerationTests.java @@ -23,6 +23,8 @@ import static org.mockito.Mockito.verify; import java.lang.reflect.Field; import java.util.UUID; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.junit.Ignore; import org.junit.Test; import org.mockito.Mockito; @@ -43,6 +45,8 @@ import org.springframework.util.StopWatch; */ public class MessageIdGenerationTests { + private final Log logger = LogFactory.getLog(getClass()); + @Test public void testCustomIdGenerationWithParentRegistrar() throws Exception { ClassPathXmlApplicationContext parent = new ClassPathXmlApplicationContext("MessageIdGenerationTests-context-withGenerator.xml", this.getClass()); @@ -155,6 +159,7 @@ public class MessageIdGenerationTests { Field idGeneratorField = ReflectionUtils.findField(MessageHeaders.class, "idGenerator"); ReflectionUtils.makeAccessible(idGeneratorField); ReflectionUtils.setField(idGeneratorField, null, new IdGenerator() { + @Override public UUID generateId() { return TimeBasedUUIDGenerator.generateId(); } @@ -167,12 +172,12 @@ public class MessageIdGenerationTests { watch.stop(); double timebasedGeneratorElapsedTime = watch.getTotalTimeSeconds(); - System.out.println("Generated " + times + " messages using default UUID generator " + + logger.info("Generated " + times + " messages using default UUID generator " + "in " + defaultGeneratorElapsedTime + " seconds"); - System.out.println("Generated " + times + " messages using Timebased UUID generator " + + logger.info("Generated " + times + " messages using Timebased UUID generator " + "in " + timebasedGeneratorElapsedTime + " seconds"); - System.out.println("Time-based ID generator is " + defaultGeneratorElapsedTime / timebasedGeneratorElapsedTime + " times faster"); + logger.info("Time-based ID generator is " + defaultGeneratorElapsedTime / timebasedGeneratorElapsedTime + " times faster"); } private void assertDestroy() throws Exception { @@ -183,6 +188,7 @@ public class MessageIdGenerationTests { public static class SampleIdGenerator implements IdGenerator { + @Override public UUID generateId() { return UUID.nameUUIDFromBytes(((System.currentTimeMillis() - System.nanoTime()) + "").getBytes()); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/history/MessageHistoryIntegrationTests.java b/spring-integration-core/src/test/java/org/springframework/integration/history/MessageHistoryIntegrationTests.java index b570e556c7..aaec6d2bdd 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/history/MessageHistoryIntegrationTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/history/MessageHistoryIntegrationTests.java @@ -26,13 +26,15 @@ import java.util.Iterator; import java.util.Map; 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.mockito.Mockito; import org.springframework.beans.DirectFieldAccessor; import org.springframework.beans.factory.BeanCreationException; -import org.springframework.context.ApplicationContext; +import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.MessageRejectedException; import org.springframework.integration.channel.DirectChannel; @@ -48,26 +50,33 @@ import org.springframework.util.StopWatch; * @author Oleg Zhurakousky * @author Gunnar Hillert * @author Artem Bilan + * @author Gary Russell */ public class MessageHistoryIntegrationTests { + private final Log logger = LogFactory.getLog(getClass()); + @Test public void testNoHistoryAwareMessageHandler() { - ApplicationContext ac = new ClassPathXmlApplicationContext("messageHistoryWithoutHistoryWriter.xml", MessageHistoryIntegrationTests.class); + ConfigurableApplicationContext ac = new ClassPathXmlApplicationContext("messageHistoryWithoutHistoryWriter.xml", + MessageHistoryIntegrationTests.class); Map cefBeans = ac.getBeansOfType(ConsumerEndpointFactoryBean.class); for (ConsumerEndpointFactoryBean cefBean : cefBeans.values()) { DirectFieldAccessor bridgeAccessor = new DirectFieldAccessor(cefBean); String handlerClassName = bridgeAccessor.getPropertyValue("handler").getClass().getName(); assertFalse("org.springframework.integration.config.MessageHistoryWritingMessageHandler".equals(handlerClassName)); } + ac.close(); } @Test public void testMessageHistoryWithHistoryWriter() { - ApplicationContext ac = new ClassPathXmlApplicationContext("messageHistoryWithHistoryWriter.xml", MessageHistoryIntegrationTests.class); + ConfigurableApplicationContext ac = new ClassPathXmlApplicationContext("messageHistoryWithHistoryWriter.xml", + MessageHistoryIntegrationTests.class); SampleGateway gateway = ac.getBean("sampleGateway", SampleGateway.class); DirectChannel endOfThePipeChannel = ac.getBean("endOfThePipeChannel", DirectChannel.class); MessageHandler handler = Mockito.spy(new MessageHandler() { + @Override public void handleMessage(Message message) { Iterator historyIterator = message.getHeaders().get(MessageHistory.HEADER_NAME, MessageHistory.class).iterator(); @@ -140,14 +149,17 @@ public class MessageHistoryIntegrationTests { Mockito.verify(handler, Mockito.times(1)).handleMessage(Mockito.any(Message.class)); assertNotNull(result); //assertEquals("hello", result); + ac.close(); } @Test public void testMessageHistoryWithoutHistoryWriter() { - ApplicationContext ac = new ClassPathXmlApplicationContext("messageHistoryWithoutHistoryWriter.xml", MessageHistoryIntegrationTests.class); + ConfigurableApplicationContext ac = new ClassPathXmlApplicationContext("messageHistoryWithoutHistoryWriter.xml", + MessageHistoryIntegrationTests.class); SampleGateway gateway = ac.getBean("sampleGateway", SampleGateway.class); DirectChannel endOfThePipeChannel = ac.getBean("endOfThePipeChannel", DirectChannel.class); MessageHandler handler = Mockito.spy(new MessageHandler() { + @Override public void handleMessage(Message message) { assertNull(message.getHeaders().get(MessageHistory.HEADER_NAME, MessageHistory.class)); MessageChannel replyChannel = (MessageChannel) message.getHeaders().getReplyChannel(); @@ -157,16 +169,20 @@ public class MessageHistoryIntegrationTests { endOfThePipeChannel.subscribe(handler); gateway.echo("hello"); Mockito.verify(handler, Mockito.times(1)).handleMessage(Mockito.any(Message.class)); + ac.close(); } @Test public void testMessageHistoryParser() { - ApplicationContext ac = new ClassPathXmlApplicationContext("messageHistoryWithHistoryWriterNamespace.xml", MessageHistoryIntegrationTests.class); + ConfigurableApplicationContext ac = new ClassPathXmlApplicationContext( + "messageHistoryWithHistoryWriterNamespace.xml", MessageHistoryIntegrationTests.class); SampleGateway gateway = ac.getBean("sampleGateway", SampleGateway.class); DirectChannel endOfThePipeChannel = ac.getBean("endOfThePipeChannel", DirectChannel.class); MessageHandler handler = Mockito.spy(new MessageHandler() { + @Override public void handleMessage(Message message) { - Iterator historyIterator = message.getHeaders().get(MessageHistory.HEADER_NAME, MessageHistory.class).iterator(); + Iterator historyIterator = message.getHeaders() + .get(MessageHistory.HEADER_NAME, MessageHistory.class).iterator(); assertTrue(historyIterator.hasNext()); MessageChannel replyChannel = (MessageChannel) message.getHeaders().getReplyChannel(); replyChannel.send(message); @@ -175,14 +191,17 @@ public class MessageHistoryIntegrationTests { endOfThePipeChannel.subscribe(handler); gateway.echo("hello"); Mockito.verify(handler, Mockito.times(1)).handleMessage(Mockito.any(Message.class)); + ac.close(); } @Test public void testMessageHistoryParserWithNamePatterns() { - ApplicationContext ac = new ClassPathXmlApplicationContext("messageHistoryWithHistoryWriterNamespaceAndPatterns.xml", MessageHistoryIntegrationTests.class); + ConfigurableApplicationContext ac = new ClassPathXmlApplicationContext( + "messageHistoryWithHistoryWriterNamespaceAndPatterns.xml", MessageHistoryIntegrationTests.class); SampleGateway gateway = ac.getBean("sampleGateway", SampleGateway.class); DirectChannel endOfThePipeChannel = ac.getBean("endOfThePipeChannel", DirectChannel.class); MessageHandler handler = Mockito.spy(new MessageHandler() { + @Override public void handleMessage(Message message) { Iterator historyIterator = message.getHeaders().get(MessageHistory.HEADER_NAME, MessageHistory.class).iterator(); assertTrue(historyIterator.hasNext()); @@ -199,21 +218,26 @@ public class MessageHistoryIntegrationTests { endOfThePipeChannel.subscribe(handler); gateway.echo("hello"); Mockito.verify(handler, Mockito.times(1)).handleMessage(Mockito.any(Message.class)); + ac.close(); } @Test(expected = BeanCreationException.class) public void testMessageHistoryMoreThanOneNamespaceFail() { - new ClassPathXmlApplicationContext("messageHistoryWithHistoryWriterNamespace-fail.xml", MessageHistoryIntegrationTests.class); + new ClassPathXmlApplicationContext("messageHistoryWithHistoryWriterNamespace-fail.xml", + MessageHistoryIntegrationTests.class).close(); } @Test @Ignore public void testMessageHistoryWithHistoryPerformance() { - ApplicationContext acWithHistory = new ClassPathXmlApplicationContext("perfWithMessageHistory.xml", MessageHistoryIntegrationTests.class); - ApplicationContext acWithoutHistory = new ClassPathXmlApplicationContext("perfWithoutMessageHistory.xml", MessageHistoryIntegrationTests.class); + ConfigurableApplicationContext acWithHistory = new ClassPathXmlApplicationContext("perfWithMessageHistory.xml", + MessageHistoryIntegrationTests.class); + ConfigurableApplicationContext acWithoutHistory = new ClassPathXmlApplicationContext( + "perfWithoutMessageHistory.xml", MessageHistoryIntegrationTests.class); SampleGateway gatewayHistory = acWithHistory.getBean("sampleGateway", SampleGateway.class); DirectChannel endOfThePipeChannelHistory = acWithHistory.getBean("endOfThePipeChannel", DirectChannel.class); endOfThePipeChannelHistory.subscribe(new MessageHandler() { + @Override public void handleMessage(Message message) throws MessageRejectedException, MessageHandlingException, MessageDeliveryException { @@ -225,6 +249,7 @@ public class MessageHistoryIntegrationTests { SampleGateway gateway = acWithoutHistory.getBean("sampleGateway", SampleGateway.class); DirectChannel endOfThePipeChannel = acWithoutHistory.getBean("endOfThePipeChannel", DirectChannel.class); endOfThePipeChannel.subscribe(new MessageHandler() { + @Override public void handleMessage(Message message) throws MessageRejectedException, MessageHandlingException, MessageDeliveryException { @@ -239,14 +264,16 @@ public class MessageHistoryIntegrationTests { gatewayHistory.echo("hello"); } stopWatch.stop(); - System.out.println("Elapsed time with history 10000 calls: " + stopWatch.getTotalTimeSeconds()); + logger.info("Elapsed time with history 10000 calls: " + stopWatch.getTotalTimeSeconds()); stopWatch = new StopWatch(); stopWatch.start(); for (int i = 0; i < 10000; i++) { gateway.echo("hello"); } stopWatch.stop(); - System.out.println("Elapsed time without history 10000 calls: " + stopWatch.getTotalTimeSeconds()); + logger.info("Elapsed time without history 10000 calls: " + stopWatch.getTotalTimeSeconds()); + acWithHistory.close(); + acWithoutHistory.close(); } public interface SampleGateway { diff --git a/spring-integration-core/src/test/java/org/springframework/integration/support/management/ExponentialMovingAverageRateTests.java b/spring-integration-core/src/test/java/org/springframework/integration/support/management/ExponentialMovingAverageRateTests.java index 91207723bb..823e0cba46 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/support/management/ExponentialMovingAverageRateTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/support/management/ExponentialMovingAverageRateTests.java @@ -131,7 +131,6 @@ public class ExponentialMovingAverageRateTests { Thread.sleep(22L); history.increment(); Thread.sleep(18L); - // System.err.println(history); assertTrue("Standard deviation should be non-zero: " + history, history.getStandardDeviation() > 0); } diff --git a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/fork/CacheServerProcess.java b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/fork/CacheServerProcess.java index 8b764a00c5..c746c23e6a 100644 --- a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/fork/CacheServerProcess.java +++ b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/fork/CacheServerProcess.java @@ -20,6 +20,9 @@ import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Properties; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.cache.Region; @@ -39,6 +42,8 @@ import com.gemstone.gemfire.cache.server.CacheServer; */ public class CacheServerProcess { + private static final Log logger = LogFactory.getLog(CacheServerProcess.class); + private CacheServerProcess() { super(); } @@ -49,7 +54,7 @@ public class CacheServerProcess { props.setProperty("name", "CacheServer"); props.setProperty("log-level", "info"); - System.out.println("\nConnecting to the distributed system and creating the cache."); + logger.info("Connecting to the distributed system and creating the cache."); Cache cache = new CacheFactory(props).create(); @@ -58,15 +63,15 @@ public class CacheServerProcess { .setScope(Scope.DISTRIBUTED_ACK) .create("test"); - System.out.println("Test region, " + region.getFullPath() + ", created in cache."); + logger.info("Test region, " + region.getFullPath() + ", created in cache."); // Start Cache Server. CacheServer server = cache.addCacheServer(); server.setPort(40404); - System.out.println("Starting server"); + logger.info("Starting server"); server.start(); ForkUtil.createControlFile(CacheServerProcess.class.getName()); - System.out.println("Waiting for shutdown"); + logger.info("Waiting for shutdown"); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); bufferedReader.readLine(); diff --git a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/fork/ForkUtil.java b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/fork/ForkUtil.java index d93a56535e..d5efb1f17d 100644 --- a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/fork/ForkUtil.java +++ b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/fork/ForkUtil.java @@ -24,6 +24,9 @@ import java.io.OutputStream; import java.io.PrintStream; import java.util.concurrent.atomic.AtomicBoolean; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + /** * Utility for forking Java processes. Modified from the SGF version for SI * @@ -35,6 +38,8 @@ import java.util.concurrent.atomic.AtomicBoolean; */ public class ForkUtil { + private static final Log logger = LogFactory.getLog(ForkUtil.class); + private static String TEMP_DIR = System.getProperty("java.io.tmpdir"); private ForkUtil() { @@ -61,7 +66,7 @@ public class ForkUtil { throw new IllegalStateException("Cannot start command " + cmdArray, ioe); } - System.out.println("Started fork"); + logger.info("Started fork"); final Process p = proc; final BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); @@ -77,7 +82,7 @@ public class ForkUtil { Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { - System.out.println("Stopping fork..."); + logger.info("Stopping fork..."); run.set(false); if (p != null) { p.destroy(); @@ -89,7 +94,7 @@ public class ForkUtil { catch (InterruptedException e) { // ignore } - System.out.println("Fork stopped"); + logger.info("Fork stopped"); } }); @@ -144,7 +149,7 @@ public class ForkUtil { } } if (controlFileExists(className)) { - System.out.println("Started cache server"); + logger.info("Started cache server"); } else { throw new RuntimeException("could not fork cache server"); diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/support/DefaultHttpHeaderMapperFromMessageOutboundTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/support/DefaultHttpHeaderMapperFromMessageOutboundTests.java index 1d7dd4dce6..cb13880884 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/support/DefaultHttpHeaderMapperFromMessageOutboundTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/support/DefaultHttpHeaderMapperFromMessageOutboundTests.java @@ -547,7 +547,6 @@ public class DefaultHttpHeaderMapperFromMessageOutboundTests { mapper.toHeaders(httpHeaders); } watch.stop(); - System.out.println(watch.getTotalTimeMillis()); } diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/SyslogdTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/SyslogdTests.java index 2e0137f23d..c4f7771a6c 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/SyslogdTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/SyslogdTests.java @@ -32,7 +32,7 @@ public class SyslogdTests { public static void main(String[] args) throws Exception { AbstractApplicationContext ctx = new ClassPathXmlApplicationContext("SyslogdTests-context.xml", SyslogdTests.class); - System.out.println("Hit enter to terminate"); + // System . out . println("Hit enter to terminate"); System.in.read(); ctx.close(); } diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/SocketSupportTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/SocketSupportTests.java index 69158da309..019b841737 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/SocketSupportTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/SocketSupportTests.java @@ -375,7 +375,6 @@ Certificate fingerprints: @Override public boolean onMessage(Message message) { -// System.out.println("Server" + message); messages.add(message); latch.countDown(); return false; @@ -392,7 +391,6 @@ Certificate fingerprints: @Override public boolean onMessage(Message message) { -// System.out.println("Client" + message); return false; } @@ -424,7 +422,6 @@ Certificate fingerprints: @Override public boolean onMessage(Message message) { -// System.out.println("Server:" + message); messages.add(message); try { replier.send(message); @@ -454,7 +451,6 @@ Certificate fingerprints: @Override public boolean onMessage(Message message) { -// System.out.println("Client:" + message); messages.add(message); latch.countDown(); return false; diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/SyslogdTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/SyslogdTests.java index 8deefadd8b..54edcc61cb 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/SyslogdTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/SyslogdTests.java @@ -32,7 +32,7 @@ public class SyslogdTests { public static void main(String[] args) throws Exception { AbstractApplicationContext ctx = new ClassPathXmlApplicationContext("SyslogdTests-context.xml", SyslogdTests.class); - System.out.println("Hit enter to terminate"); + // System . out . println("Hit enter to terminate"); System.in.read(); ctx.close(); } diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/MessageGroupQueueTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/MessageGroupQueueTests.java index 2abf264a14..1ccee966db 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/MessageGroupQueueTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/MessageGroupQueueTests.java @@ -254,7 +254,6 @@ public class MessageGroupQueueTests { public void run() { try { boolean offered = queue.offer(new GenericMessage("Hi-2"), 2, TimeUnit.SECONDS); - System.out.println(offered); booleanHolder2.set(offered); } catch (Exception e) { @@ -269,7 +268,6 @@ public class MessageGroupQueueTests { public void run() { try { boolean offered = queue.offer(new GenericMessage("Hi-3"), 2, TimeUnit.SECONDS); - System.out.println(offered); booleanHolder3.set(offered); } catch (Exception e) { diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcMessageHandlerParserTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcMessageHandlerParserTests.java index 217c402dbf..9f08f077ef 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcMessageHandlerParserTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcMessageHandlerParserTests.java @@ -84,7 +84,6 @@ public class JdbcMessageHandlerParserTests { public void testMapPayloadOutboundChannelAdapter() { setUp("handlingMapPayloadJdbcOutboundChannelAdapterTest.xml", getClass()); assertTrue(context.containsBean("jdbcAdapter")); - System.out.println(context.getBean("jdbcAdapter").getClass().getName()); Message message = MessageBuilder.withPayload(Collections.singletonMap("foo", "bar")).build(); channel.send(message); Map map = this.jdbcTemplate.queryForMap("SELECT * from FOOS"); diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/mysql/MySqlJdbcMessageStoreMultipleChannelTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/mysql/MySqlJdbcMessageStoreMultipleChannelTests.java index 4a153bdb74..7356a83dab 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/mysql/MySqlJdbcMessageStoreMultipleChannelTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/mysql/MySqlJdbcMessageStoreMultipleChannelTests.java @@ -34,14 +34,15 @@ import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.messaging.Message; -import org.springframework.messaging.MessageChannel; import org.springframework.integration.IntegrationMessageHeaderAccessor; import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.support.MessageBuilder; import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.messaging.Message; +import org.springframework.messaging.MessageChannel; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; import org.springframework.test.context.ContextConfiguration; @@ -94,6 +95,7 @@ public class MySqlJdbcMessageStoreMultipleChannelTests { @After public void afterTest() { new TransactionTemplate(this.transactionManager).execute(new TransactionCallback() { + @Override public Void doInTransaction(TransactionStatus status) { final int deletedGroupToMessageRows = jdbcTemplate.update("delete from INT_GROUP_TO_MESSAGE"); final int deletedMessages = jdbcTemplate.update("delete from INT_MESSAGE"); @@ -112,6 +114,7 @@ public class MySqlJdbcMessageStoreMultipleChannelTests { public void testSendAndActivateTransactionalSend() throws Exception { new TransactionTemplate(this.transactionManager).execute(new TransactionCallback() { + @Override public Void doInTransaction(TransactionStatus status) { requestChannel.send(MessageBuilder.withPayload("Hello ").build()); return null; @@ -135,9 +138,6 @@ public class MySqlJdbcMessageStoreMultipleChannelTests { ArrayList res = new ArrayList(); res.add(message); res.add(message); - - System.out.println("Split Complete"); - return res; } } diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithTempReplyQueuesTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithTempReplyQueuesTests.java index fee610f5af..95f28bc12a 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithTempReplyQueuesTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithTempReplyQueuesTests.java @@ -37,6 +37,8 @@ import javax.jms.TextMessage; import org.apache.activemq.broker.BrokerService; import org.apache.activemq.command.ActiveMQDestination; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.junit.Rule; import org.junit.Test; @@ -44,7 +46,6 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.gateway.RequestReplyExchanger; import org.springframework.integration.jms.ActiveMQMultiContextTests; import org.springframework.integration.jms.config.ActiveMqTestUtils; -import org.springframework.messaging.support.GenericMessage; import org.springframework.integration.test.support.LongRunningIntegrationTest; import org.springframework.integration.test.util.TestUtils; import org.springframework.jms.connection.CachingConnectionFactory; @@ -54,12 +55,15 @@ import org.springframework.jms.listener.DefaultMessageListenerContainer; import org.springframework.jms.listener.SessionAwareMessageListener; import org.springframework.jms.support.converter.SimpleMessageConverter; import org.springframework.messaging.MessageDeliveryException; +import org.springframework.messaging.support.GenericMessage; /** * @author Oleg Zhurakousky * @author Gary Russell */ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMultiContextTests { + private final Log logger = LogFactory.getLog(getClass()); + private final SimpleMessageConverter converter = new SimpleMessageConverter(); @Rule @@ -78,6 +82,7 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti new Thread(new Runnable() { + @Override public void run() { final Message requestMessage = jmsTemplate.receive(requestDestination); Destination replyTo = null; @@ -89,6 +94,7 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti } jmsTemplate.send(replyTo, new MessageCreator() { + @Override public Message createMessage(Session session) throws JMSException { try { TextMessage message = session.createTextMessage(); @@ -123,6 +129,7 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti dmlc.setDestination(requestDestination); dmlc.setMessageListener(new SessionAwareMessageListener() { + @Override public void onMessage(Message message, Session session) { Destination replyTo = null; try { @@ -224,6 +231,7 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti for (int i = 0; i < testNumbers; i++) { final int y = i; executor.execute(new Runnable() { + @Override public void run() { try { @@ -259,12 +267,12 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti } private void print(AtomicInteger failures, AtomicInteger timeouts, AtomicInteger missmatches, long echangesProcessed) { - System.out.println("============================"); - System.out.println(echangesProcessed + " exchanges processed"); - System.out.println("Failures: " + failures.get()); - System.out.println("Timeouts: " + timeouts.get()); - System.out.println("Missmatches: " + missmatches.get()); - System.out.println("============================"); + logger.info("============================"); + logger.info(echangesProcessed + " exchanges processed"); + logger.info("Failures: " + failures.get()); + logger.info("Timeouts: " + timeouts.get()); + logger.info("Missmatches: " + missmatches.get()); + logger.info("============================"); } public static class MyRandomlySlowService { @@ -272,9 +280,6 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti List list = new ArrayList(); public String secho(String value) throws Exception { int i = random.nextInt(2000); -// if (i >= 2000){ -// System.out.println("SLEEPIING: " + i); -// } Thread.sleep(i); return value; } diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/DynamicRouterTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/DynamicRouterTests.java index c79d223eee..f09d5db163 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/DynamicRouterTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/DynamicRouterTests.java @@ -121,7 +121,6 @@ public class DynamicRouterTests { for (int i = 0; i < 1000000000; i++) { this.nullChannel.send(null); } - System.out.println(this.nullChannel.getSendRate()); } } diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanAutoDetectTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanAutoDetectTests.java index 14f9282714..aa76c9b6d0 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanAutoDetectTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanAutoDetectTests.java @@ -26,6 +26,7 @@ import javax.management.ObjectName; import org.junit.After; import org.junit.Ignore; import org.junit.Test; + import org.springframework.context.support.ClassPathXmlApplicationContext; /** @@ -49,7 +50,7 @@ public class MBeanAutoDetectTests { public void testRouterMBeanExistsWhenDefinedFirst() throws Exception { context = new ClassPathXmlApplicationContext("MBeanAutoDetectFirstTests-context.xml", getClass()); server = context.getBean(MBeanServer.class); - // System.err.println(server.queryNames(new ObjectName("test.MBeanAutoDetectFirst:*"), null)); + // System . err.println(server.queryNames(new ObjectName("test.MBeanAutoDetectFirst:*"), null)); Set names = server.queryNames( new ObjectName("test.MBeanAutoDetectFirst:type=ExpressionEvaluatingRouter,*"), null); assertEquals(1, names.size()); @@ -60,7 +61,7 @@ public class MBeanAutoDetectTests { public void testRouterMBeanExistsWhenDefinedSecond() throws Exception { context = new ClassPathXmlApplicationContext("MBeanAutoDetectSecondTests-context.xml", getClass()); server = context.getBean(MBeanServer.class); - // System.err.println(server.queryNames(new ObjectName("test.MBeanAutoDetectFirst:*"), null)); + // System . err.println(server.queryNames(new ObjectName("test.MBeanAutoDetectFirst:*"), null)); Set names = server.queryNames( new ObjectName("test.MBeanAutoDetectFirst:type=ExpressionEvaluatingRouter,*"), null); assertEquals(1, names.size()); diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanRegistrationTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanRegistrationTests.java index b73bdd7cf4..411704746b 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanRegistrationTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanRegistrationTests.java @@ -62,8 +62,8 @@ public class MBeanRegistrationTests { @Test public void testExporterMBeanRegistration() throws Exception { - // System.err.println(server.queryNames(new ObjectName("*:type=*MBeanExporter,*"), null)); - // System.err.println(Arrays.asList(server.getMBeanInfo(server.queryNames(new ObjectName("*:type=*Handler,*"), null).iterator().next()).getAttributes())); + // System . err.println(server.queryNames(new ObjectName("*:type=*MBeanExporter,*"), null)); + // System . err.println(Arrays.asList(server.getMBeanInfo(server.queryNames(new ObjectName("*:type=*Handler,*"), null).iterator().next()).getAttributes())); Set names = server.queryNames(new ObjectName("test.MBeanRegistration:type=IntegrationMBeanExporter,name=integrationMbeanExporter,*"), null); assertEquals(1, names.size()); names = server.queryNames(new ObjectName("test.MBeanRegistration:*,name=org.springframework.integration.MyGateway"), null); @@ -73,13 +73,11 @@ public class MBeanRegistrationTests { @Test @Ignore // re-instate this if Spring decides to look for @ManagedResource on super classes public void testServiceActivatorMBeanHasTrackableComponent() throws Exception { - System.err.println(server.queryNames(new ObjectName("test.MBeanRegistration:*"), null)); Set names = server.queryNames(new ObjectName("test.MBeanRegistration:type=ServiceActivatingHandler,name=service,*"), null); Map infos = new HashMap(); for (MBeanOperationInfo info : server.getMBeanInfo(names.iterator().next()).getOperations()) { infos.put(info.getName(), info); } - System.err.println(infos); assertNotNull(infos.get("setShouldTrack")); } diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MethodInvokerTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MethodInvokerTests.java index f8c96657ab..3c9c6d0dfe 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MethodInvokerTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MethodInvokerTests.java @@ -59,7 +59,7 @@ public class MethodInvokerTests { @Test public void testHandlerMBeanRegistration() throws Exception { Set names = server.queryNames(new ObjectName("test.MethodInvoker:type=MessageHandler,*"), null); - // System.err.println(names); + // System . err.println(names); // the router and the error handler... assertEquals(2, names.size()); underscores.subscribe(new MessageHandler() { diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/PollingAdapterMBeanTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/PollingAdapterMBeanTests.java index f41fbce5b6..53d587ff48 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/PollingAdapterMBeanTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/PollingAdapterMBeanTests.java @@ -46,7 +46,7 @@ public class PollingAdapterMBeanTests { @Test public void testMessageSourceMBeanExists() throws Exception { - // System.err.println(server.queryNames(new ObjectName("*:type=MessageSource,*"), null)); + // System . err.println(server.queryNames(new ObjectName("*:type=MessageSource,*"), null)); Set names = server.queryNames(new ObjectName("test.PollingAdapterMBean:type=MessageSource,*"), null); assertEquals(1, names.size()); } diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/RouterMBeanTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/RouterMBeanTests.java index 5b443f9b9c..718458d14e 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/RouterMBeanTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/RouterMBeanTests.java @@ -67,7 +67,7 @@ public class RouterMBeanTests { @Test public void testRouterMBeanExists() throws Exception { - // System.err.println(server.queryNames(new ObjectName("test.RouterMBean:*"), null)); + // System . err.println(server.queryNames(new ObjectName("test.RouterMBean:*"), null)); Set names = server.queryNames( new ObjectName("test.RouterMBean:type=MessageHandler,name=ptRouter,*"), null); assertEquals(1, names.size()); @@ -75,7 +75,7 @@ public class RouterMBeanTests { @Test public void testInputChannelMBeanExists() throws Exception { - // System.err.println(server.queryNames(new ObjectName("test.RouterMBean:type=MessageChannel,*"), null)); + // System . err.println(server.queryNames(new ObjectName("test.RouterMBean:type=MessageChannel,*"), null)); Set names = server.queryNames( new ObjectName("test.RouterMBean:type=MessageChannel,name=testChannel,*"), null); assertEquals(1, names.size()); @@ -90,7 +90,7 @@ public class RouterMBeanTests { @Test public void testRouterMBeanOnlyRegisteredOnce() throws Exception { - // System.err.println(server.queryNames(new ObjectName("*:type=MessageHandler,*"), null)); + // System . err.println(server.queryNames(new ObjectName("*:type=MessageHandler,*"), null)); Set names = server.queryNames(new ObjectName("test.RouterMBean:type=MessageHandler,name=ptRouter,*"), null); assertEquals(1, names.size()); // INT-3896 diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/RouterMBeanVanillaTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/RouterMBeanVanillaTests.java index 4952e6a5f1..4d8e404279 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/RouterMBeanVanillaTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/RouterMBeanVanillaTests.java @@ -46,7 +46,7 @@ public class RouterMBeanVanillaTests { @Test public void testHandlerMBeanRegistration() throws Exception { - // System.err.println(server.queryNames(new ObjectName("test.RouterMBeanVanilla:*"), null)); + // System . err.println(server.queryNames(new ObjectName("test.RouterMBeanVanilla:*"), null)); Set names = server.queryNames(new ObjectName("test.RouterMBeanVanilla:type=ExpressionEvaluatingRouter,*"), null); // The router is exposed... assertEquals(1, names.size()); diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/SftpFileAnnouncer.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/SftpFileAnnouncer.java index fa4bca3ff5..205a2f9f1c 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/SftpFileAnnouncer.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/SftpFileAnnouncer.java @@ -16,20 +16,26 @@ package org.springframework.integration.sftp; +import java.io.File; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import org.springframework.integration.annotation.ServiceActivator; import org.springframework.stereotype.Component; -import java.io.File; - /** * @author Josh Long + * @author Gary Russell */ @Component("sftpAnnouncer") public class SftpFileAnnouncer { + private final Log logger = LogFactory.getLog(getClass()); + @ServiceActivator public void announceFile(File file) { - System.out.println("New file from the remote host has arrived: " + file.getAbsolutePath()); + logger.info("New file from the remote host has arrived: " + file.getAbsolutePath()); } } diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundTransferSample.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundTransferSample.java index 7cba632c54..22ddf26e54 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundTransferSample.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundTransferSample.java @@ -22,9 +22,9 @@ import org.junit.Ignore; import org.junit.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.integration.support.MessageBuilder; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; -import org.springframework.integration.support.MessageBuilder; /** * @author Oleg Zhurakousky @@ -45,9 +45,7 @@ public class SftpOutboundTransferSample { inputChannel.send(message); Thread.sleep(2000); } - System.out.println("Done"); - ac.stop(); - + ac.close(); } } diff --git a/spring-integration-stream/src/test/java/org/springframework/integration/stream/config/ConsoleInboundChannelAdapterParserTests.java b/spring-integration-stream/src/test/java/org/springframework/integration/stream/config/ConsoleInboundChannelAdapterParserTests.java index 6b2baa07fe..cb0fcb9b97 100644 --- a/spring-integration-stream/src/test/java/org/springframework/integration/stream/config/ConsoleInboundChannelAdapterParserTests.java +++ b/spring-integration-stream/src/test/java/org/springframework/integration/stream/config/ConsoleInboundChannelAdapterParserTests.java @@ -70,7 +70,6 @@ public class ConsoleInboundChannelAdapterParserTests { Charset readerCharset = Charset.forName(((InputStreamReader) reader).getEncoding()); assertEquals(Charset.defaultCharset(), readerCharset); Message message = source.receive(); - System.out.println(message); assertNotNull(message); assertEquals("foo", message.getPayload()); } diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/ignored/TwitterAnnouncer.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/ignored/TwitterAnnouncer.java index a808938898..549ac191e7 100644 --- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/ignored/TwitterAnnouncer.java +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/ignored/TwitterAnnouncer.java @@ -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 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()); } } diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/DirectMessageReceivingMessageSourceTests.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/DirectMessageReceivingMessageSourceTests.java index f5fd2f30b5..59154c88c7 100644 --- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/DirectMessageReceivingMessageSourceTests.java +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/DirectMessageReceivingMessageSourceTests.java @@ -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 message = (Message) 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()); } } } + } diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/SearchReceivingMessageSourceTests.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/SearchReceivingMessageSourceTests.java index 002af95df6..99e66eb7fc 100644 --- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/SearchReceivingMessageSourceTests.java +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/SearchReceivingMessageSourceTests.java @@ -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 message = (Message) 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()); } } } diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/SearchReceivingMessageSourceWithRedisTests.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/SearchReceivingMessageSourceWithRedisTests.java index 8f4f4b209d..ad25b16c1e 100644 --- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/SearchReceivingMessageSourceWithRedisTests.java +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/SearchReceivingMessageSourceWithRedisTests.java @@ -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(); } /** diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/TimelineReceivingMessageSourceTests.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/TimelineReceivingMessageSourceTests.java index df6c0dae1b..b497a9ec6c 100644 --- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/TimelineReceivingMessageSourceTests.java +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/TimelineReceivingMessageSourceTests.java @@ -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 message = (Message) 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()); } } } + } diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/outbound/DirectMessageSendingMessageHandlerTests.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/outbound/DirectMessageSendingMessageHandlerTests.java index 2a70d22604..410c0c1bac 100644 --- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/outbound/DirectMessageSendingMessageHandlerTests.java +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/outbound/DirectMessageSendingMessageHandlerTests.java @@ -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"), diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/ignore/XmppMessageConsumer.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/ignore/XmppMessageConsumer.java index bbd49eb5ec..a2f5d20102 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/ignore/XmppMessageConsumer.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/ignore/XmppMessageConsumer.java @@ -16,7 +16,10 @@ package org.springframework.integration.xmpp.ignore; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.jivesoftware.smack.packet.Message; + import org.springframework.integration.annotation.ServiceActivator; import org.springframework.stereotype.Component; @@ -25,11 +28,14 @@ import org.springframework.stereotype.Component; * * @author Josh Long * @author Mark Fisher + * @author Gary Russell * @since 2.0 */ @Component public class XmppMessageConsumer { + private final Log logger = LogFactory.getLog(getClass()); + @ServiceActivator public void consume(Object input) throws Throwable { String text = null; @@ -43,8 +49,8 @@ public class XmppMessageConsumer { throw new IllegalArgumentException( "expected either a Smack Message or a String, but received: " + input); } - System.out.println("================================================================================"); - System.out.println("message: " + text); + logger.info("================================================================================"); + logger.info("message: " + text); } } diff --git a/src/checkstyle/checkstyle.xml b/src/checkstyle/checkstyle.xml index da15001050..838c963bda 100644 --- a/src/checkstyle/checkstyle.xml +++ b/src/checkstyle/checkstyle.xml @@ -150,6 +150,11 @@ + + + + +