From 9f9fe90d8531af6559362b590d80f3066395211b Mon Sep 17 00:00:00 2001 From: James Strachan Date: Wed, 3 May 2006 10:50:49 +0000 Subject: [PATCH] removed some system.out logging git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@399249 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/activemq/openwire/DataFileGenerator.java | 13 ++++++++----- .../openwire/DataFileGeneratorTestSupport.java | 10 +++++++--- .../openwire/NumberRangesWhileMarshallingTest.java | 6 +++++- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGenerator.java b/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGenerator.java index b382794269..136223bb95 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGenerator.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGenerator.java @@ -30,11 +30,15 @@ import java.util.ArrayList; import java.util.Iterator; import org.apache.activemq.openwire.OpenWireFormat; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import junit.framework.Assert; abstract public class DataFileGenerator extends Assert { + private static final Log log = LogFactory.getLog(DataFileGenerator.class); + static final File moduleBaseDir; static final File controlDir; static final File classFileDir; @@ -65,7 +69,7 @@ abstract public class DataFileGenerator extends Assert { * @throws IllegalAccessException */ public static ArrayList getAllDataFileGenerators() throws Exception{ - System.out.println("Looking for generators in : "+classFileDir); + log.info("Looking for generators in : "+classFileDir); ArrayList l = new ArrayList(); File[] files = classFileDir.listFiles(); for (int i = 0; files!=null && i < files.length; i++) { @@ -85,11 +89,10 @@ abstract public class DataFileGenerator extends Assert { for (Iterator iter = generators.iterator(); iter.hasNext();) { DataFileGenerator object = (DataFileGenerator) iter.next(); try { - System.out.println("Processing: "+object.getClass()); + log.info("Processing: "+object.getClass()); object.generateControlFile(); } catch (Exception e) { - System.out.println("Error while processing: "+object.getClass()); - e.printStackTrace(System.out); + log.error("Error while processing: "+object.getClass() + ". Reason: " + e, e); } } } @@ -127,7 +130,7 @@ abstract public class DataFileGenerator extends Assert { ArrayList generators = getAllDataFileGenerators(); for (Iterator iter = generators.iterator(); iter.hasNext();) { DataFileGenerator object = (DataFileGenerator) iter.next(); - System.out.println("Processing: "+object.getClass()); + log.info("Processing: "+object.getClass()); object.assertControlFileIsEqual(); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java index 29ea26024c..3ac525ec4f 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java @@ -56,9 +56,13 @@ import org.apache.activemq.openwire.v1.ActiveMQTextMessageTest; import org.apache.activemq.openwire.v1.BrokerInfoTest; import org.apache.activemq.openwire.v1.MessageAckTest; import org.apache.activemq.test.TestSupport; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; public abstract class DataFileGeneratorTestSupport extends TestSupport { + private static final Log log = LogFactory.getLog(DataFileGeneratorTestSupport.class); + protected static final Object[] EMPTY_ARGUMENTS = {}; private static Throwable singletonException = new Exception("shared exception"); @@ -93,7 +97,7 @@ public abstract class DataFileGeneratorTestSupport extends TestSupport { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); DataOutputStream ds = new DataOutputStream(buffer); Object expected = createObject(); - System.out.println("Created: " + expected); + log.info("Created: " + expected); openWireformat.marshal(expected, ds); ds.close(); @@ -102,7 +106,7 @@ public abstract class DataFileGeneratorTestSupport extends TestSupport { DataInputStream dis = new DataInputStream(in); Object actual = openWireformat.unmarshal(dis); - System.out.println("Parsed: " + actual); + log.info("Parsed: " + actual); assertBeansEqual("", new HashSet(), expected, actual); } @@ -129,7 +133,7 @@ public abstract class DataFileGeneratorTestSupport extends TestSupport { actualValue = method.invoke(actual, EMPTY_ARGUMENTS); } catch (Exception e) { - System.out.println("Failed to access property: " + name); + log.info("Failed to access property: " + name); } assertPropertyValuesEqual(message + name, comparedObjects, expectedValue, actualValue); } diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/NumberRangesWhileMarshallingTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/NumberRangesWhileMarshallingTest.java index 66ddde212c..b17dbc3ca9 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/NumberRangesWhileMarshallingTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/NumberRangesWhileMarshallingTest.java @@ -17,6 +17,8 @@ package org.apache.activemq.openwire; import org.apache.activemq.command.SessionId; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -32,6 +34,8 @@ import junit.framework.TestCase; */ public class NumberRangesWhileMarshallingTest extends TestCase { + private static final Log log = LogFactory.getLog(NumberRangesWhileMarshallingTest.class); + protected String connectionId = "Cheese"; protected ByteArrayOutputStream buffer = new ByteArrayOutputStream(); protected DataOutputStream ds = new DataOutputStream(buffer); @@ -97,7 +101,7 @@ public class NumberRangesWhileMarshallingTest extends TestCase { for (int i = 0; i < numberValues.length; i++) { long value = numberValues[i]; String expected = Long.toHexString(value); - System.out.println("Unmarshaling value: " + i + " = " + expected); + log.info("Unmarshaling value: " + i + " = " + expected); SessionId command = (SessionId) openWireformat.unmarshal(dis); assertEquals("connection ID in object: "+ i, connectionId, command.getConnectionId());