changed a bunch of System.out.println() to log.info()

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@397249 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2006-04-26 17:25:42 +00:00
parent 09a3830fe0
commit 93dc39b130
53 changed files with 277 additions and 204 deletions

View File

@ -103,7 +103,6 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
} }
regexp.append("\\z"); // The end of the input regexp.append("\\z"); // The end of the input
System.out.println("regexp: " + like + ": " + regexp);
likePattern = Pattern.compile(regexp.toString(), Pattern.DOTALL); likePattern = Pattern.compile(regexp.toString(), Pattern.DOTALL);
} }

View File

@ -177,8 +177,8 @@ public class ForwardingBridge implements Bridge {
} }
protected void serviceRemoteException(IOException error) { protected void serviceRemoteException(IOException error) {
System.out.println("Unexpected remote exception: "+error); log.info("Unexpected remote exception: "+error);
error.printStackTrace(); log.debug("Exception trace: ", error);
} }
protected void serviceRemoteCommand(Command command) { protected void serviceRemoteCommand(Command command) {
@ -204,8 +204,8 @@ public class ForwardingBridge implements Bridge {
} }
protected void serviceLocalException(Throwable error) { protected void serviceLocalException(Throwable error) {
System.out.println("Unexpected local exception: "+error); log.info("Unexpected local exception: "+error);
error.printStackTrace(); log.debug("Exception trace: ", error);
} }
protected void serviceLocalCommand(Command command) { protected void serviceLocalCommand(Command command) {
try { try {
@ -283,7 +283,7 @@ public class ForwardingBridge implements Bridge {
} }
} }
} else { } else {
System.out.println("Unexpected local command: "+command); log.debug("Unexpected local command: "+command);
} }
} catch (IOException e) { } catch (IOException e) {
serviceLocalException(e); serviceLocalException(e);

View File

@ -168,13 +168,13 @@ public class UdpTransportServer extends TransportServerSupport {
public void start() throws Exception { public void start() throws Exception {
super.start(); super.start();
System.out.println("Starting a new server transport: " + this + " with command: " + command); log.debug("Starting a new server transport: " + this + " with command: " + command);
onCommand(command); onCommand(command);
} }
// lets use the specific addressing of wire format // lets use the specific addressing of wire format
protected void sendWireFormat(WireFormatInfo info) throws IOException { protected void sendWireFormat(WireFormatInfo info) throws IOException {
System.out.println("#### we have negotiated the wireformat; sending a wireformat to: " + address); log.debug("#### we have negotiated the wireformat; sending a wireformat to: " + address);
transport.oneway(info, address); transport.oneway(info, address);
} }
}; };

View File

@ -66,7 +66,7 @@ public class ActiveMQConnectionFactoryTest extends CombinationTestSupport {
connection.start(); connection.start();
String brokerName = connection.getBrokerName(); String brokerName = connection.getBrokerName();
System.out.println("Got broker name: " + brokerName); log.info("Got broker name: " + brokerName);
assertNotNull("No broker name available!", brokerName); assertNotNull("No broker name available!", brokerName);
connection.close(); connection.close();
@ -96,7 +96,7 @@ public class ActiveMQConnectionFactoryTest extends CombinationTestSupport {
URI connectURI = new URI(temp.getScheme(), temp.getUserInfo(), temp.getHost(), currentURI.getPort(), temp.getPath(), temp.getQuery(), temp.getFragment()); URI connectURI = new URI(temp.getScheme(), temp.getUserInfo(), temp.getHost(), currentURI.getPort(), temp.getPath(), temp.getQuery(), temp.getFragment());
System.out.println("connection URI is: " + connectURI); log.info("connection URI is: " + connectURI);
// This should create the connection. // This should create the connection.
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(connectURI); ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(connectURI);

View File

@ -72,7 +72,7 @@ public class ActiveMQXAConnectionFactoryTest extends CombinationTestSupport {
connection.start(); connection.start();
String brokerName = connection.getBrokerName(); String brokerName = connection.getBrokerName();
System.out.println("Got broker name: " + brokerName); log.info("Got broker name: " + brokerName);
assertNotNull("No broker name available!", brokerName); assertNotNull("No broker name available!", brokerName);
connection.close(); connection.close();
@ -102,7 +102,7 @@ public class ActiveMQXAConnectionFactoryTest extends CombinationTestSupport {
URI connectURI = new URI(temp.getScheme(), temp.getUserInfo(), temp.getHost(), currentURI.getPort(), temp.getPath(), temp.getQuery(), temp.getFragment()); URI connectURI = new URI(temp.getScheme(), temp.getUserInfo(), temp.getHost(), currentURI.getPort(), temp.getPath(), temp.getQuery(), temp.getFragment());
System.out.println("connection URI is: " + connectURI); log.info("connection URI is: " + connectURI);
// This should create the connection. // This should create the connection.
ActiveMQXAConnectionFactory cf = new ActiveMQXAConnectionFactory(connectURI); ActiveMQXAConnectionFactory cf = new ActiveMQXAConnectionFactory(connectURI);

View File

@ -29,7 +29,7 @@ import org.apache.commons.logging.LogFactory;
*/ */
public class AutoFailTestSupport extends TestCase { public class AutoFailTestSupport extends TestCase {
private static final Log log = LogFactory.getLog(AutoFailTestSupport.class); protected static final Log log = LogFactory.getLog(AutoFailTestSupport.class);
public static final int EXIT_SUCCESS = 0; public static final int EXIT_SUCCESS = 0;
public static final int EXIT_ERROR = 1; public static final int EXIT_ERROR = 1;
@ -83,7 +83,7 @@ public class AutoFailTestSupport extends TestCase {
}, "AutoFailThread"); }, "AutoFailThread");
if (verbose) { if (verbose) {
System.out.println("Starting auto fail thread..."); log.info("Starting auto fail thread...");
} }
log.info("Starting auto fail thread..."); log.info("Starting auto fail thread...");
@ -99,7 +99,7 @@ public class AutoFailTestSupport extends TestCase {
isTestSuccess.set(true); isTestSuccess.set(true);
if (verbose) { if (verbose) {
System.out.println("Stopping auto fail thread..."); log.info("Stopping auto fail thread...");
} }
log.info("Stopping auto fail thread..."); log.info("Stopping auto fail thread...");

View File

@ -32,6 +32,9 @@ import java.util.Map;
import junit.framework.Test; import junit.framework.Test;
import junit.framework.TestSuite; import junit.framework.TestSuite;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** /**
* Poor mans way of getting JUnit to run a test case through a few different * Poor mans way of getting JUnit to run a test case through a few different
* combinations of options. * combinations of options.
@ -64,8 +67,7 @@ import junit.framework.TestSuite;
*/ */
public class CombinationTestSupport extends AutoFailTestSupport { public class CombinationTestSupport extends AutoFailTestSupport {
private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory protected static final Log log = LogFactory.getLog(CombinationTestSupport.class);
.getLog(CombinationTestSupport.class);
private HashMap comboOptions = new HashMap(); private HashMap comboOptions = new HashMap();
private boolean combosEvaluated; private boolean combosEvaluated;

View File

@ -16,19 +16,20 @@
*/ */
package org.apache.activemq; package org.apache.activemq;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTopic;
import org.apache.activemq.pool.PooledConnectionFactory;
import org.springframework.jms.core.JmsTemplate;
import javax.jms.Connection; import javax.jms.Connection;
import javax.jms.ConnectionFactory; import javax.jms.ConnectionFactory;
import javax.jms.Destination; import javax.jms.Destination;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTopic;
import org.apache.activemq.pool.PooledConnectionFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.jms.core.JmsTemplate;
/** /**
* A useful base class which creates and closes an embedded broker * A useful base class which creates and closes an embedded broker
* *
@ -36,6 +37,8 @@ import junit.framework.TestCase;
*/ */
public class EmbeddedBrokerTestSupport extends TestCase { public class EmbeddedBrokerTestSupport extends TestCase {
protected static final Log log = LogFactory.getLog(EmbeddedBrokerTestSupport.class);
protected BrokerService broker; protected BrokerService broker;
//protected String bindAddress = "tcp://localhost:61616"; //protected String bindAddress = "tcp://localhost:61616";
protected String bindAddress = "vm://localhost"; protected String bindAddress = "vm://localhost";

View File

@ -34,7 +34,7 @@ public class JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest extends JmsQ
public void startBroker() { public void startBroker() {
// Initialize the broker // Initialize the broker
System.out.println("Lets wait: " + delayBeforeStartingBroker + " millis before creating the broker"); log.info("Lets wait: " + delayBeforeStartingBroker + " millis before creating the broker");
try { try {
Thread.sleep(delayBeforeStartingBroker); Thread.sleep(delayBeforeStartingBroker);
} }
@ -42,7 +42,7 @@ public class JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest extends JmsQ
e.printStackTrace(); e.printStackTrace();
} }
System.out.println("Now starting the broker"); log.info("Now starting the broker");
try { try {
broker = new BrokerService(); broker = new BrokerService();
broker.setPersistent(false); broker.setPersistent(false);
@ -50,7 +50,7 @@ public class JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest extends JmsQ
broker.start(); broker.start();
} }
catch (Exception e) { catch (Exception e) {
System.out.println("Caught: " + e); log.info("Caught: " + e);
errors.add(e); errors.add(e);
} }
} }

View File

@ -17,12 +17,16 @@
package org.apache.activemq; package org.apache.activemq;
import org.apache.activemq.test.JmsTopicSendReceiveWithTwoConnectionsTest; import org.apache.activemq.test.JmsTopicSendReceiveWithTwoConnectionsTest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** /**
* @version $Revision: 1.2 $ * @version $Revision: 1.2 $
*/ */
public class JmsQueueSendReceiveTwoConnectionsTest extends JmsTopicSendReceiveWithTwoConnectionsTest { public class JmsQueueSendReceiveTwoConnectionsTest extends JmsTopicSendReceiveWithTwoConnectionsTest {
protected static final Log log = LogFactory.getLog(JmsQueueSendReceiveTwoConnectionsTest.class);
/** /**
* Set up the test with a queue and using two connections. * Set up the test with a queue and using two connections.
* *

View File

@ -45,7 +45,7 @@ public class ReconnectWithSameClientIDTest extends EmbeddedBrokerTestSupport {
} }
catch (InvalidClientIDException e) { catch (InvalidClientIDException e) {
connection2.close(); connection2.close();
System.out.println("Caught expected: " + e); log.info("Caught expected: " + e);
} }
} }

View File

@ -117,13 +117,13 @@ public class ConsumerListenerTest extends EmbeddedBrokerTestSupport implements C
protected Session createConsumer() throws JMSException { protected Session createConsumer() throws JMSException {
final String consumerText = "Consumer: " + (++consumerCounter); final String consumerText = "Consumer: " + (++consumerCounter);
System.out.println("Creating consumer: " + consumerText + " on destination: " + destination); log.info("Creating consumer: " + consumerText + " on destination: " + destination);
Session answer = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Session answer = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageConsumer consumer = answer.createConsumer(destination); MessageConsumer consumer = answer.createConsumer(destination);
consumer.setMessageListener(new MessageListener() { consumer.setMessageListener(new MessageListener() {
public void onMessage(Message message) { public void onMessage(Message message) {
System.out.println("Received message by: " + consumerText + " message: " + message); log.info("Received message by: " + consumerText + " message: " + message);
} }
}); });
return answer; return answer;

View File

@ -118,7 +118,7 @@ public class ProducerListenerTest extends EmbeddedBrokerTestSupport implements P
protected Session createProducer() throws JMSException { protected Session createProducer() throws JMSException {
final String consumerText = "Consumer: " + (++consumerCounter); final String consumerText = "Consumer: " + (++consumerCounter);
System.out.println("Creating consumer: " + consumerText + " on destination: " + destination); log.info("Creating consumer: " + consumerText + " on destination: " + destination);
Session answer = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Session answer = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = answer.createProducer(destination); MessageProducer producer = answer.createProducer(destination);

View File

@ -16,8 +16,6 @@
*/ */
package org.apache.activemq.broker; package org.apache.activemq.broker;
import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.File; import java.io.File;
@ -30,8 +28,6 @@ import javax.jms.DeliveryMode;
import javax.jms.MessageNotWriteableException; import javax.jms.MessageNotWriteableException;
import org.apache.activemq.CombinationTestSupport; import org.apache.activemq.CombinationTestSupport;
import org.apache.activemq.broker.BrokerFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.region.RegionBroker; import org.apache.activemq.broker.region.RegionBroker;
import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQTextMessage; import org.apache.activemq.command.ActiveMQTextMessage;
@ -55,8 +51,11 @@ import org.apache.activemq.store.PersistenceAdapter;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
public class BrokerTestSupport extends CombinationTestSupport { public class BrokerTestSupport extends CombinationTestSupport {
private static final Log log = LogFactory.getLog(BrokerTestSupport.class);
protected static final Log log = LogFactory.getLog(BrokerTestSupport.class);
/** /**
* Setting this to false makes the test run faster but they may be less accurate. * Setting this to false makes the test run faster but they may be less accurate.
@ -153,7 +152,7 @@ public class BrokerTestSupport extends CombinationTestSupport {
System.out.println(prompt+"> Press enter to continue: "); System.out.println(prompt+"> Press enter to continue: ");
while( System.in.read()!='\n' ) { while( System.in.read()!='\n' ) {
} }
log.info(prompt+"> Done."); System.out.println(prompt+"> Done.");
} }
} }

View File

@ -146,7 +146,7 @@ public class MBeanTest extends EmbeddedBrokerTestSupport {
assertNotNull("Should have created an mbean name for the durable subscriber!", name1); assertNotNull("Should have created an mbean name for the durable subscriber!", name1);
System.out.println("Created durable subscriber with name: " + name1); log.info("Created durable subscriber with name: " + name1);
// now lets try destroy it // now lets try destroy it
broker.destroyDurableSubscriber(clientID, "subscriber1"); broker.destroyDurableSubscriber(clientID, "subscriber1");
@ -211,6 +211,6 @@ public class MBeanTest extends EmbeddedBrokerTestSupport {
} }
protected void echo(String text) { protected void echo(String text) {
System.out.println(text); log.info(text);
} }
} }

View File

@ -37,7 +37,7 @@ public class DeadLetterTest extends DeadLetterTestSupport {
ActiveMQConnection amqConnection = (ActiveMQConnection) connection; ActiveMQConnection amqConnection = (ActiveMQConnection) connection;
rollbackCount = amqConnection.getRedeliveryPolicy().getMaximumRedeliveries() + 1; rollbackCount = amqConnection.getRedeliveryPolicy().getMaximumRedeliveries() + 1;
System.out.println("Will redeliver messages: " + rollbackCount + " times"); log.info("Will redeliver messages: " + rollbackCount + " times");
makeConsumer(); makeConsumer();
makeDlqConsumer(); makeDlqConsumer();
@ -64,7 +64,7 @@ public class DeadLetterTest extends DeadLetterTestSupport {
session.rollback(); session.rollback();
} }
System.out.println("Rolled back: " + rollbackCount + " times"); log.info("Rolled back: " + rollbackCount + " times");
} }
protected void setUp() throws Exception { protected void setUp() throws Exception {

View File

@ -80,7 +80,7 @@ public abstract class DeadLetterTestSupport extends TestSupport {
protected void makeConsumer() throws JMSException { protected void makeConsumer() throws JMSException {
Destination destination = getDestination(); Destination destination = getDestination();
System.out.println("Consuming from: " + destination); log.info("Consuming from: " + destination);
if (durableSubscriber) { if (durableSubscriber) {
consumer = session.createDurableSubscriber((Topic) destination, destination.toString()); consumer = session.createDurableSubscriber((Topic) destination, destination.toString());
} }
@ -92,7 +92,7 @@ public abstract class DeadLetterTestSupport extends TestSupport {
protected void makeDlqConsumer() throws JMSException { protected void makeDlqConsumer() throws JMSException {
dlqDestination = createDlqDestination(); dlqDestination = createDlqDestination();
System.out.println("Consuming from dead letter on: " + dlqDestination); log.info("Consuming from dead letter on: " + dlqDestination);
dlqConsumer = session.createConsumer(dlqDestination); dlqConsumer = session.createConsumer(dlqDestination);
} }
@ -102,7 +102,7 @@ public abstract class DeadLetterTestSupport extends TestSupport {
producer.setDeliveryMode(deliveryMode); producer.setDeliveryMode(deliveryMode);
producer.setTimeToLive(timeToLive); producer.setTimeToLive(timeToLive);
System.out.println("Sending " + messageCount + " messages to: " + getDestination()); log.info("Sending " + messageCount + " messages to: " + getDestination());
for (int i = 0; i < messageCount; i++) { for (int i = 0; i < messageCount; i++) {
Message message = createMessage(session, i); Message message = createMessage(session, i);
producer.send(message); producer.send(message);
@ -118,7 +118,7 @@ public abstract class DeadLetterTestSupport extends TestSupport {
} }
protected void assertMessage(Message message, int i) throws Exception { protected void assertMessage(Message message, int i) throws Exception {
System.out.println("Received message: " + message); log.info("Received message: " + message);
assertNotNull("No message received for index: " + i, message); assertNotNull("No message received for index: " + i, message);
assertTrue("Should be a TextMessage not: " + message, message instanceof TextMessage); assertTrue("Should be a TextMessage not: " + message, message instanceof TextMessage);
TextMessage textMessage = (TextMessage) message; TextMessage textMessage = (TextMessage) message;

View File

@ -39,7 +39,7 @@ public class IndividualDeadLetterViaXmlTest extends DeadLetterTest {
protected Destination createDlqDestination() { protected Destination createDlqDestination() {
String queueName = "Test.DLQ." + getClass().getName() + "." + getName(); String queueName = "Test.DLQ." + getClass().getName() + "." + getName();
System.out.println("Using queue name: " + queueName); log.info("Using queue name: " + queueName);
return new ActiveMQQueue(queueName); return new ActiveMQQueue(queueName);
} }
} }

View File

@ -68,7 +68,7 @@ public class LoadTester extends JmsTestSupport {
MessageProducer producer = session.createProducer(destination); MessageProducer producer = session.createProducer(destination);
producer.setDeliveryMode(DeliveryMode.PERSISTENT); producer.setDeliveryMode(DeliveryMode.PERSISTENT);
System.out.println("Sending "+ PRODUCE_COUNT+" messages that are "+(MESSAGE_SIZE/1024.0)+"k large, for a total of "+(PRODUCE_COUNT*MESSAGE_SIZE/(1024.0*1024.0))+" megs of data."); log.info("Sending "+ PRODUCE_COUNT+" messages that are "+(MESSAGE_SIZE/1024.0)+"k large, for a total of "+(PRODUCE_COUNT*MESSAGE_SIZE/(1024.0*1024.0))+" megs of data.");
// Send a message to the broker. // Send a message to the broker.
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
for( int i=0; i < PRODUCE_COUNT; i++) { for( int i=0; i < PRODUCE_COUNT; i++) {
@ -79,7 +79,7 @@ public class LoadTester extends JmsTestSupport {
} }
long end1 = System.currentTimeMillis(); long end1 = System.currentTimeMillis();
System.out.println("Produced messages/sec: "+ (PRODUCE_COUNT*1000.0/(end1-start))); log.info("Produced messages/sec: "+ (PRODUCE_COUNT*1000.0/(end1-start)));
printer = new ProgressPrinter(PRODUCE_COUNT, 10); printer = new ProgressPrinter(PRODUCE_COUNT, 10);
start = System.currentTimeMillis(); start = System.currentTimeMillis();
@ -89,7 +89,7 @@ public class LoadTester extends JmsTestSupport {
assertNotNull("Getting message: "+i,consumer.receive(20000)); assertNotNull("Getting message: "+i,consumer.receive(20000));
} }
end1 = System.currentTimeMillis(); end1 = System.currentTimeMillis();
System.out.println("Consumed messages/sec: "+ (PRODUCE_COUNT*1000.0/(end1-start))); log.info("Consumed messages/sec: "+ (PRODUCE_COUNT*1000.0/(end1-start)));
} }

View File

@ -184,7 +184,7 @@ public class ActiveMQMessageTest extends TestCase {
assertTrue(msg1.getJMSPriority() == msg2.getJMSPriority()); assertTrue(msg1.getJMSPriority() == msg2.getJMSPriority());
assertTrue(msg1.getJMSTimestamp() == msg2.getJMSTimestamp()); assertTrue(msg1.getJMSTimestamp() == msg2.getJMSTimestamp());
System.out.println("Message is: " + msg1); log.info("Message is: " + msg1);
} }
public void testGetAndSetJMSMessageID() throws Exception { public void testGetAndSetJMSMessageID() throws Exception {

View File

@ -70,6 +70,6 @@ public class MessageSendTest extends DataStructureTestSupport {
} }
long end = System.currentTimeMillis(); long end = System.currentTimeMillis();
System.out.println("marshaled/unmarshaled: " + p + " msgs at " + (p * 1000f / (end - start)) + " msgs/sec"); log.info("marshaled/unmarshaled: " + p + " msgs at " + (p * 1000f / (end - start)) + " msgs/sec");
} }
} }

View File

@ -69,8 +69,8 @@ public class DefaultQueueSender {
idx += 2; idx += 2;
} }
String queueName = args[idx]; String queueName = args[idx];
System.out.println("Connecting to: " + uri); log.info("Connecting to: " + uri);
System.out.println("Queue name is " + queueName); log.info("Queue name is " + queueName);
if (++idx < args.length) { if (++idx < args.length) {
text = args[idx]; text = args[idx];

View File

@ -16,6 +16,9 @@
*/ */
package org.apache.activemq.filter; package org.apache.activemq.filter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import junit.framework.TestCase; import junit.framework.TestCase;
/** /**
@ -24,6 +27,7 @@ import junit.framework.TestCase;
*/ */
public class BadDummyPolicyConfigTest extends TestCase { public class BadDummyPolicyConfigTest extends TestCase {
protected static final Log log = LogFactory.getLog(BadDummyPolicyConfigTest.class);
protected DummyPolicy policy = new DummyPolicy(); protected DummyPolicy policy = new DummyPolicy();
public void testNoDestinationSpecified() throws Exception { public void testNoDestinationSpecified() throws Exception {
@ -53,7 +57,7 @@ public class BadDummyPolicyConfigTest extends TestCase {
entry.afterPropertiesSet(); entry.afterPropertiesSet();
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
System.out.println("Worked! Caught expected exception: " + e); log.info("Worked! Caught expected exception: " + e);
} }
} }
} }

View File

@ -13,22 +13,22 @@
*/ */
package org.apache.activemq.kaha; package org.apache.activemq.kaha;
import java.io.IOException;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set; import java.util.Set;
import org.apache.activemq.kaha.BytesMarshaller;
import org.apache.activemq.kaha.MapContainer; import org.apache.commons.logging.Log;
import org.apache.activemq.kaha.Marshaller; import org.apache.commons.logging.LogFactory;
import org.apache.activemq.kaha.Store;
import org.apache.activemq.kaha.StringMarshaller;
import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch;
import junit.framework.TestCase;
/** /**
* Store test * Store test
* *
* @version $Revision: 1.2 $ * @version $Revision: 1.2 $
*/ */
class Loader extends Thread{ class Loader extends Thread{
protected static final Log log = LogFactory.getLog(Loader.class);
private String name; private String name;
private Store store; private Store store;
private int count; private int count;
@ -64,7 +64,7 @@ class Loader extends Thread{
} }
long finishLoad=System.currentTimeMillis(); long finishLoad=System.currentTimeMillis();
long totalLoadTime=finishLoad-startLoad; long totalLoadTime=finishLoad-startLoad;
System.out.println("name "+name+" load time = "+totalLoadTime+"(ms)"); log.info("name "+name+" load time = "+totalLoadTime+"(ms)");
Set keys=container.keySet(); Set keys=container.keySet();
long startExtract=System.currentTimeMillis(); long startExtract=System.currentTimeMillis();
@ -74,7 +74,7 @@ class Loader extends Thread{
} }
long finishExtract=System.currentTimeMillis(); long finishExtract=System.currentTimeMillis();
long totalExtractTime=finishExtract-startExtract; long totalExtractTime=finishExtract-startExtract;
System.out.println("name "+name+" extract time = "+totalExtractTime+"(ms)"); log.info("name "+name+" extract time = "+totalExtractTime+"(ms)");
long startRemove=System.currentTimeMillis(); long startRemove=System.currentTimeMillis();
for(Iterator i=keys.iterator();i.hasNext();){ for(Iterator i=keys.iterator();i.hasNext();){
@ -82,7 +82,7 @@ class Loader extends Thread{
} }
long finishRemove = System.currentTimeMillis(); long finishRemove = System.currentTimeMillis();
long totalRemoveTime = finishRemove-startRemove; long totalRemoveTime = finishRemove-startRemove;
System.out.println("name "+name+" remove time = "+totalRemoveTime+"(ms)"); log.info("name "+name+" remove time = "+totalRemoveTime+"(ms)");
//re-insert data of longer length //re-insert data of longer length
startLoad=System.currentTimeMillis(); startLoad=System.currentTimeMillis();
value = getData(2048); value = getData(2048);
@ -92,7 +92,7 @@ class Loader extends Thread{
} }
finishLoad=System.currentTimeMillis(); finishLoad=System.currentTimeMillis();
totalLoadTime=finishLoad-startLoad; totalLoadTime=finishLoad-startLoad;
System.out.println("name "+name+" 2nd load time = "+totalLoadTime+"(ms)"); log.info("name "+name+" 2nd load time = "+totalLoadTime+"(ms)");
}catch(Exception e){ }catch(Exception e){

View File

@ -16,17 +16,18 @@
*/ */
package org.apache.activemq.memory.buffer; package org.apache.activemq.memory.buffer;
import org.apache.activemq.command.ActiveMQMessage;
import org.apache.activemq.memory.buffer.MessageBuffer;
import org.apache.activemq.memory.buffer.MessageQueue;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.activemq.command.ActiveMQMessage;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** /**
* *
* @version $Revision: 1.1 $ * @version $Revision: 1.1 $
*/ */
public abstract class MemoryBufferTestSupport extends TestCase { public abstract class MemoryBufferTestSupport extends TestCase {
protected static final Log log = LogFactory.getLog(MemoryBufferTestSupport.class);
protected abstract MessageBuffer createMessageBuffer(); protected abstract MessageBuffer createMessageBuffer();
@ -44,15 +45,14 @@ public abstract class MemoryBufferTestSupport extends TestCase {
} }
protected void dump() { protected void dump() {
System.out.println("Dumping current state"); log.info("Dumping current state");
dumpQueue(qA, "A"); dumpQueue(qA, "A");
dumpQueue(qB, "B"); dumpQueue(qB, "B");
dumpQueue(qC, "C"); dumpQueue(qC, "C");
System.out.println();
} }
protected void dumpQueue(MessageQueue queue, String name) { protected void dumpQueue(MessageQueue queue, String name) {
System.out.println(" " + name + " = " + queue.getList()); log.info(" " + name + " = " + queue.getList());
} }
protected ActiveMQMessage createMessage(int size) throws Exception { protected ActiveMQMessage createMessage(int size) throws Exception {

View File

@ -14,6 +14,7 @@
package org.apache.activemq.network; package org.apache.activemq.network;
import java.net.URI; import java.net.URI;
import javax.jms.Connection; import javax.jms.Connection;
import javax.jms.DeliveryMode; import javax.jms.DeliveryMode;
import javax.jms.Destination; import javax.jms.Destination;
@ -26,15 +27,22 @@ import javax.jms.Session;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import javax.jms.TopicRequestor; import javax.jms.TopicRequestor;
import javax.jms.TopicSession; import javax.jms.TopicSession;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.command.ActiveMQTopic; import org.apache.activemq.command.ActiveMQTopic;
import org.apache.activemq.xbean.BrokerFactoryBean; import org.apache.activemq.xbean.BrokerFactoryBean;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
public class SimpleNetworkTest extends TestCase{ public class SimpleNetworkTest extends TestCase{
protected static final Log log = LogFactory.getLog(SimpleNetworkTest.class);
protected static final int MESSAGE_COUNT=10; protected static final int MESSAGE_COUNT=10;
protected AbstractApplicationContext context; protected AbstractApplicationContext context;
protected Connection localConnection; protected Connection localConnection;
@ -74,7 +82,7 @@ public class SimpleNetworkTest extends TestCase{
TextMessage msg = localSession.createTextMessage("test msg: " +i); TextMessage msg = localSession.createTextMessage("test msg: " +i);
TextMessage result = (TextMessage) requestor.request(msg); TextMessage result = (TextMessage) requestor.request(msg);
assertNotNull(result); assertNotNull(result);
System.out.println(result.getText()); log.info(result.getText());
} }
} }

View File

@ -16,29 +16,31 @@
*/ */
package org.apache.activemq.network.jms; package org.apache.activemq.network.jms;
import java.net.URI; import javax.jms.Destination;
import java.util.ArrayList; import javax.jms.JMSException;
import java.util.Iterator; import javax.jms.Message;
import javax.jms.*; import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueRequestor;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TextMessage;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerRegistry; import org.apache.commons.logging.Log;
import org.apache.activemq.broker.BrokerService; import org.apache.commons.logging.LogFactory;
import org.apache.activemq.broker.BrokerTestSupport;
import org.apache.activemq.broker.StubConnection;
import org.apache.activemq.broker.TransportConnector;
import org.apache.activemq.broker.region.QueueRegion;
import org.apache.activemq.memory.UsageManager;
import org.apache.activemq.store.PersistenceAdapter;
import org.apache.activemq.store.memory.MemoryPersistenceAdapter;
import org.apache.activemq.transport.Transport;
import org.apache.activemq.transport.TransportFactory;
import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;
public class QueueBridgeTest extends TestCase implements MessageListener { public class QueueBridgeTest extends TestCase implements MessageListener {
protected static final Log log = LogFactory.getLog(QueueBridgeTest.class);
protected static final int MESSAGE_COUNT = 10; protected static final int MESSAGE_COUNT = 10;
protected AbstractApplicationContext context; protected AbstractApplicationContext context;
protected QueueConnection localConnection; protected QueueConnection localConnection;
@ -79,7 +81,7 @@ public class QueueBridgeTest extends TestCase implements MessageListener {
TextMessage msg = requestServerSession.createTextMessage("test msg: " +i); TextMessage msg = requestServerSession.createTextMessage("test msg: " +i);
TextMessage result = (TextMessage) requestor.request(msg); TextMessage result = (TextMessage) requestor.request(msg);
assertNotNull(result); assertNotNull(result);
System.out.println(result.getText()); log.info(result.getText());
} }
} }

View File

@ -31,11 +31,15 @@ import javax.jms.TopicSession;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;
public class TopicBridgeSpringTest extends TestCase implements MessageListener { public class TopicBridgeSpringTest extends TestCase implements MessageListener {
protected static final Log log = LogFactory.getLog(TopicBridgeSpringTest.class);
protected static final int MESSAGE_COUNT = 10; protected static final int MESSAGE_COUNT = 10;
protected AbstractApplicationContext context; protected AbstractApplicationContext context;
protected TopicConnection localConnection; protected TopicConnection localConnection;
@ -79,10 +83,10 @@ public class TopicBridgeSpringTest extends TestCase implements MessageListener {
public void testTopicRequestorOverBridge() throws JMSException{ public void testTopicRequestorOverBridge() throws JMSException{
for (int i =0;i < MESSAGE_COUNT; i++){ for (int i =0;i < MESSAGE_COUNT; i++){
TextMessage msg = requestServerSession.createTextMessage("test msg: " +i); TextMessage msg = requestServerSession.createTextMessage("test msg: " +i);
System.out.println("Making request: " + msg); log.info("Making request: " + msg);
TextMessage result = (TextMessage) requestor.request(msg); TextMessage result = (TextMessage) requestor.request(msg);
assertNotNull(result); assertNotNull(result);
System.out.println("Received result: " + result.getText()); log.info("Received result: " + result.getText());
} }
} }
@ -94,7 +98,7 @@ public class TopicBridgeSpringTest extends TestCase implements MessageListener {
replyTo=msg.getJMSReplyTo(); replyTo=msg.getJMSReplyTo();
textMsg.clearBody(); textMsg.clearBody();
textMsg.setText(payload); textMsg.setText(payload);
System.out.println("Sending response: " + textMsg); log.info("Sending response: " + textMsg);
requestServerProducer.send(replyTo,textMsg); requestServerProducer.send(replyTo,textMsg);
}catch(JMSException e){ }catch(JMSException e){
// TODO Auto-generated catch block // TODO Auto-generated catch block

View File

@ -23,13 +23,20 @@ import javax.jms.MessageProducer;
import javax.jms.Session; import javax.jms.Session;
import javax.jms.TemporaryQueue; import javax.jms.TemporaryQueue;
import javax.jms.TemporaryTopic; import javax.jms.TemporaryTopic;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.BrokerService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** /**
* @version $Revision: 1.3 $ * @version $Revision: 1.3 $
*/ */
public class MemoryAllocationTest extends TestCase{ public class MemoryAllocationTest extends TestCase{
protected static final Log log = LogFactory.getLog(MemoryAllocationTest.class);
protected static final int MESSAGE_COUNT=2000; protected static final int MESSAGE_COUNT=2000;
protected BrokerService broker; protected BrokerService broker;
protected String bindAddress="vm://localhost"; protected String bindAddress="vm://localhost";
@ -48,7 +55,7 @@ public class MemoryAllocationTest extends TestCase{
mp.send(msg); mp.send(msg);
session.close(); session.close();
releaseDestination(dest); releaseDestination(dest);
if (i%500==0)System.out.println("Iterator "+i); if (i%500==0)log.info("Iterator "+i);
} }
connection.close(); connection.close();
} }

View File

@ -56,7 +56,7 @@ public class SimpleSecurityBrokerSystemTest extends SecurityTestSupport {
System.setProperty("java.security.auth.login.config", path); System.setProperty("java.security.auth.login.config", path);
} }
} }
System.out.println("Path to login config: " + path); log.info("Path to login config: " + path);
} }
public static Test suite() { public static Test suite() {

View File

@ -16,6 +16,13 @@
*/ */
package org.apache.activemq.test; package org.apache.activemq.test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import javax.jms.DeliveryMode; import javax.jms.DeliveryMode;
import javax.jms.Destination; import javax.jms.Destination;
import javax.jms.JMSException; import javax.jms.JMSException;
@ -25,19 +32,15 @@ import javax.jms.MessageListener;
import javax.jms.MessageProducer; import javax.jms.MessageProducer;
import javax.jms.Session; import javax.jms.Session;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import java.util.ArrayList;
import java.util.Arrays; import org.apache.commons.logging.Log;
import java.util.Collections; import org.apache.commons.logging.LogFactory;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
/** /**
* @version $Revision: 1.2 $ * @version $Revision: 1.2 $
*/ */
public class JmsSendReceiveTestSupport extends TestSupport implements MessageListener { public class JmsSendReceiveTestSupport extends TestSupport implements MessageListener {
private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory protected static final Log log = LogFactory.getLog(JmsSendReceiveTestSupport.class);
.getLog(JmsSendReceiveTestSupport.class);
protected int messageCount = 100; protected int messageCount = 100;
protected String[] data; protected String[] data;

View File

@ -53,7 +53,7 @@ public class JmsTopicSendReceiveWithEmbeddedBrokerAndUserIDTest extends
Message message = (Message) iter.next(); Message message = (Message) iter.next();
String userID = message.getStringProperty("JMSXUserID"); String userID = message.getStringProperty("JMSXUserID");
System.out.println("Received message with userID: " + userID); log.info("Received message with userID: " + userID);
assertEquals("JMSXUserID header", userName, userID); assertEquals("JMSXUserID header", userName, userID);
} }

View File

@ -21,14 +21,15 @@ import javax.jms.DeliveryMode;
import javax.jms.Session; import javax.jms.Session;
import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** /**
* @version $Revision: 1.3 $ * @version $Revision: 1.3 $
*/ */
public class JmsTopicSendReceiveWithTwoConnectionsTest extends JmsSendReceiveTestSupport { public class JmsTopicSendReceiveWithTwoConnectionsTest extends JmsSendReceiveTestSupport {
private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory protected static final Log log = LogFactory.getLog(JmsTopicSendReceiveWithTwoConnectionsTest.class);
.getLog(JmsTopicSendReceiveWithTwoConnectionsTest.class);
protected Connection sendConnection; protected Connection sendConnection;
protected Connection receiveConnection; protected Connection receiveConnection;

View File

@ -16,6 +16,14 @@
*/ */
package org.apache.activemq.test; package org.apache.activemq.test;
import java.lang.reflect.Array;
import javax.jms.Connection;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.TextMessage;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQConnectionFactory;
@ -25,15 +33,6 @@ import org.apache.activemq.command.ActiveMQTopic;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import javax.jms.Connection;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.TextMessage;
import java.lang.reflect.Array;
import java.util.Arrays;
/** /**
* Useful base class for unit test cases * Useful base class for unit test cases
@ -41,7 +40,7 @@ import java.util.Arrays;
* @version $Revision: 1.4 $ * @version $Revision: 1.4 $
*/ */
public class TestSupport extends TestCase { public class TestSupport extends TestCase {
protected Log log = LogFactory.getLog(getClass()); final static protected Log log = LogFactory.getLog(TestSupport.class);
protected ActiveMQConnectionFactory connectionFactory; protected ActiveMQConnectionFactory connectionFactory;
protected boolean topic = true; protected boolean topic = true;

View File

@ -16,12 +16,14 @@
*/ */
package org.apache.activemq.test.retroactive; package org.apache.activemq.test.retroactive;
import javax.jms.MessageListener;
import org.apache.activemq.broker.region.policy.MessageQuery; import org.apache.activemq.broker.region.policy.MessageQuery;
import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQTextMessage; import org.apache.activemq.command.ActiveMQTextMessage;
import org.apache.activemq.command.Message; import org.apache.activemq.command.Message;
import org.apache.commons.logging.Log;
import javax.jms.MessageListener; import org.apache.commons.logging.LogFactory;
/** /**
* *
@ -29,10 +31,12 @@ import javax.jms.MessageListener;
*/ */
public class DummyMessageQuery implements MessageQuery { public class DummyMessageQuery implements MessageQuery {
protected static final Log log = LogFactory.getLog(DummyMessageQuery.class);
public static int messageCount = 10; public static int messageCount = 10;
public void execute(ActiveMQDestination destination, MessageListener listener) throws Exception { public void execute(ActiveMQDestination destination, MessageListener listener) throws Exception {
System.out.println("Initial query is creating: " + messageCount + " messages"); log.info("Initial query is creating: " + messageCount + " messages");
for (int i = 0; i < messageCount; i++) { for (int i = 0; i < messageCount; i++) {
ActiveMQTextMessage message = new ActiveMQTextMessage(); ActiveMQTextMessage message = new ActiveMQTextMessage();
message.setText("Initial message: " + i + " loaded from query"); message.setText("Initial message: " + i + " loaded from query");

View File

@ -92,7 +92,7 @@ public class RetroactiveConsumerTestWithSimpleMessageListTest extends EmbeddedBr
protected BrokerService createBroker() throws Exception { protected BrokerService createBroker() throws Exception {
String uri = getBrokerXml(); String uri = getBrokerXml();
System.out.println("Loading broker configuration from the classpath with URI: " + uri); log.info("Loading broker configuration from the classpath with URI: " + uri);
return BrokerFactory.createBroker(new URI("xbean:"+uri)); return BrokerFactory.createBroker(new URI("xbean:"+uri));
} }

View File

@ -62,7 +62,7 @@ public class RetroactiveConsumerWithMessageQueryTest extends EmbeddedBrokerTestS
producer.send(message); producer.send(message);
} }
producer.close(); producer.close();
System.out.println("Sent: " + updateMessageCount + " update messages"); log.info("Sent: " + updateMessageCount + " update messages");
listener.assertMessagesReceived(messageCount); listener.assertMessagesReceived(messageCount);
} }
@ -92,7 +92,7 @@ public class RetroactiveConsumerWithMessageQueryTest extends EmbeddedBrokerTestS
protected BrokerService createBroker() throws Exception { protected BrokerService createBroker() throws Exception {
String uri = getBrokerXml(); String uri = getBrokerXml();
System.out.println("Loading broker configuration from the classpath with URI: " + uri); log.info("Loading broker configuration from the classpath with URI: " + uri);
return BrokerFactory.createBroker(new URI("xbean:"+uri)); return BrokerFactory.createBroker(new URI("xbean:"+uri));
} }

View File

@ -16,16 +16,18 @@
*/ */
package org.apache.activemq.transport.failover; package org.apache.activemq.transport.failover;
import java.io.IOException;
import java.net.URI;
import junit.framework.TestCase;
import org.apache.activemq.command.ActiveMQMessage; import org.apache.activemq.command.ActiveMQMessage;
import org.apache.activemq.command.Command; import org.apache.activemq.command.Command;
import org.apache.activemq.transport.Transport; import org.apache.activemq.transport.Transport;
import org.apache.activemq.transport.TransportFactory; import org.apache.activemq.transport.TransportFactory;
import org.apache.activemq.transport.TransportListener; import org.apache.activemq.transport.TransportListener;
import org.apache.commons.logging.Log;
import java.io.IOException; import org.apache.commons.logging.LogFactory;
import java.net.URI;
import junit.framework.TestCase;
/** /**
* *
@ -33,6 +35,8 @@ import junit.framework.TestCase;
*/ */
public class BadConnectionTest extends TestCase { public class BadConnectionTest extends TestCase {
protected static final Log log = LogFactory.getLog(BadConnectionTest.class);
protected Transport transport; protected Transport transport;
public void testConnectingToUnavailableServer() throws Exception { public void testConnectingToUnavailableServer() throws Exception {
@ -41,7 +45,7 @@ public class BadConnectionTest extends TestCase {
fail("This should never succeed"); fail("This should never succeed");
} }
catch (IOException e) { catch (IOException e) {
System.out.println("Caught expected exception: " + e); log.info("Caught expected exception: " + e);
e.printStackTrace(); e.printStackTrace();
} }
} }

View File

@ -159,7 +159,7 @@ public class FanoutTransportBrokerTest extends NetworkTestSupport {
MockTransport mt = (MockTransport) connection3.getTransport().narrow(MockTransport.class); MockTransport mt = (MockTransport) connection3.getTransport().narrow(MockTransport.class);
mt.install(new TransportFilter(mt.getNext()) { mt.install(new TransportFilter(mt.getNext()) {
public void oneway(Command command) throws IOException { public void oneway(Command command) throws IOException {
System.out.println("Dropping: "+command); log.info("Dropping: "+command);
// just eat it! to simulate a recent failure. // just eat it! to simulate a recent failure.
} }
}); });

View File

@ -16,13 +16,15 @@
*/ */
package org.apache.activemq.transport.multicast; package org.apache.activemq.transport.multicast;
import java.net.URI;
import org.apache.activemq.openwire.OpenWireFormat; import org.apache.activemq.openwire.OpenWireFormat;
import org.apache.activemq.transport.CommandJoiner; import org.apache.activemq.transport.CommandJoiner;
import org.apache.activemq.transport.Transport; import org.apache.activemq.transport.Transport;
import org.apache.activemq.transport.udp.UdpTransportTest; import org.apache.activemq.transport.udp.UdpTransportTest;
import org.apache.activemq.util.IntSequenceGenerator; import org.apache.activemq.util.IntSequenceGenerator;
import org.apache.commons.logging.Log;
import java.net.URI; import org.apache.commons.logging.LogFactory;
/** /**
* *
@ -30,11 +32,13 @@ import java.net.URI;
*/ */
public class MulticastTransportTest extends UdpTransportTest { public class MulticastTransportTest extends UdpTransportTest {
protected static final Log log = LogFactory.getLog(MulticastTransportTest.class);
private String multicastURI = "multicast://224.1.2.3:6255"; private String multicastURI = "multicast://224.1.2.3:6255";
protected Transport createProducer() throws Exception { protected Transport createProducer() throws Exception {
System.out.println("Producer using URI: " + multicastURI); log.info("Producer using URI: " + multicastURI);
// we are not using the TransportFactory as this assumes that // we are not using the TransportFactory as this assumes that
// transports talk to a server using a WireFormat Negotiation step // transports talk to a server using a WireFormat Negotiation step

View File

@ -77,7 +77,7 @@ public class PeerTransportTest extends TestCase {
consumer.setMessageListener(messageIdList[i]); consumer.setMessageListener(messageIdList[i]);
} }
System.out.println("Waiting for cluster to be fully connected"); log.info("Waiting for cluster to be fully connected");
// Each connection should see that NUMBER_IN_CLUSTER consumers get registered on the destination. // Each connection should see that NUMBER_IN_CLUSTER consumers get registered on the destination.
ActiveMQDestination advisoryDest = AdvisorySupport.getConsumerAdvisoryTopic(destination); ActiveMQDestination advisoryDest = AdvisorySupport.getConsumerAdvisoryTopic(destination);
@ -99,7 +99,7 @@ public class PeerTransportTest extends TestCase {
session.close(); session.close();
} }
System.out.println("Cluster is online."); log.info("Cluster is online.");
} }
protected void tearDown() throws Exception { protected void tearDown() throws Exception {

View File

@ -16,16 +16,15 @@
*/ */
package org.apache.activemq.transport.reliable; package org.apache.activemq.transport.reliable;
import edu.emory.mathcs.backport.java.util.Queue; import junit.framework.TestCase;
import org.apache.activemq.command.ConsumerInfo; import org.apache.activemq.command.ConsumerInfo;
import org.apache.activemq.transport.StubTransport; import org.apache.activemq.transport.StubTransport;
import org.apache.activemq.transport.StubTransportListener; import org.apache.activemq.transport.StubTransportListener;
import org.apache.activemq.transport.reliable.ExceptionIfDroppedReplayStrategy; import org.apache.commons.logging.Log;
import org.apache.activemq.transport.reliable.ReliableTransport; import org.apache.commons.logging.LogFactory;
import org.apache.activemq.transport.reliable.ReplayStrategy;
import junit.framework.TestCase; import edu.emory.mathcs.backport.java.util.Queue;
/** /**
* *
@ -33,6 +32,8 @@ import junit.framework.TestCase;
*/ */
public class ReliableTransportTest extends TestCase { public class ReliableTransportTest extends TestCase {
protected static final Log log = LogFactory.getLog(ReliableTransportTest.class);
protected ReliableTransport transport; protected ReliableTransport transport;
protected StubTransportListener listener = new StubTransportListener(); protected StubTransportListener listener = new StubTransportListener();
protected ReplayStrategy replayStrategy; protected ReplayStrategy replayStrategy;
@ -50,7 +51,7 @@ public class ReliableTransportTest extends TestCase {
transport.setExpectedCounter(value); transport.setExpectedCounter(value);
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
System.out.println("command: " + i + " = " + value); log.info("command: " + i + " = " + value);
sequenceNumbers[i] = value++; sequenceNumbers[i] = value++;
} }
@ -119,7 +120,7 @@ public class ReliableTransportTest extends TestCase {
else { else {
assertTrue("Should have received an exception!", exceptions.size() > 0); assertTrue("Should have received an exception!", exceptions.size() > 0);
Exception e = (Exception) exceptions.remove(); Exception e = (Exception) exceptions.remove();
System.out.println("Caught expected response: " + e); log.info("Caught expected response: " + e);
} }
} }

View File

@ -44,7 +44,7 @@ public class UnreliableUdpTransportTest extends UdpTransportTest {
}; };
protected Transport createProducer() throws Exception { protected Transport createProducer() throws Exception {
System.out.println("Producer using URI: " + producerURI); log.info("Producer using URI: " + producerURI);
OpenWireFormat wireFormat = createWireFormat(); OpenWireFormat wireFormat = createWireFormat();
UnreliableUdpTransport transport = new UnreliableUdpTransport(wireFormat, new URI(producerURI)); UnreliableUdpTransport transport = new UnreliableUdpTransport(wireFormat, new URI(producerURI));
@ -58,7 +58,7 @@ public class UnreliableUdpTransportTest extends UdpTransportTest {
} }
protected Transport createConsumer() throws Exception { protected Transport createConsumer() throws Exception {
System.out.println("Consumer on port: " + consumerPort); log.info("Consumer on port: " + consumerPort);
OpenWireFormat wireFormat = createWireFormat(); OpenWireFormat wireFormat = createWireFormat();
UdpTransport transport = new UdpTransport(wireFormat, consumerPort); UdpTransport transport = new UdpTransport(wireFormat, consumerPort);

View File

@ -462,7 +462,7 @@ public class StompTest extends CombinationTestSupport {
try { try {
frame = receiveFrame(1000); frame = receiveFrame(1000);
System.out.println("Received frame: " + frame); log.info("Received frame: " + frame);
fail("No message should have been received since subscription was removed"); fail("No message should have been received since subscription was removed");
}catch (SocketTimeoutException e){ }catch (SocketTimeoutException e){

View File

@ -21,6 +21,8 @@ import org.apache.activemq.command.Command;
import org.apache.activemq.command.*; import org.apache.activemq.command.*;
import org.apache.activemq.transport.stomp.Stomp; import org.apache.activemq.transport.stomp.Stomp;
import org.apache.activemq.transport.stomp.StompWireFormat; import org.apache.activemq.transport.stomp.StompWireFormat;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.jms.JMSException; import javax.jms.JMSException;
@ -33,6 +35,9 @@ import java.io.IOException;
import junit.framework.TestCase; import junit.framework.TestCase;
public class StompWireFormatTest extends TestCase { public class StompWireFormatTest extends TestCase {
protected static final Log log = LogFactory.getLog(StompWireFormatTest.class);
private StompWireFormat wire; private StompWireFormat wire;
public void setUp() throws Exception { public void setUp() throws Exception {
@ -51,7 +56,7 @@ public class StompWireFormatTest extends TestCase {
cr.setCorrelationId(ci.getCommandId()); cr.setCorrelationId(ci.getCommandId());
String response = writeCommand(cr); String response = writeCommand(cr);
System.out.println("Received: " + response); log.info("Received: " + response);
SessionInfo si = (SessionInfo) wire.readCommand(null); SessionInfo si = (SessionInfo) wire.readCommand(null);
assertNotNull(si); assertNotNull(si);
@ -64,7 +69,7 @@ public class StompWireFormatTest extends TestCase {
Response sr = new Response(); Response sr = new Response();
sr.setCorrelationId(pi.getCommandId()); sr.setCorrelationId(pi.getCommandId());
response = writeCommand(sr); response = writeCommand(sr);
System.out.println("Received: " + response); log.info("Received: " + response);
assertTrue("Response should start with CONNECTED: " + response, response.startsWith("CONNECTED")); assertTrue("Response should start with CONNECTED: " + response, response.startsWith("CONNECTED"));
// now lets test subscribe // now lets test subscribe
@ -77,7 +82,7 @@ public class StompWireFormatTest extends TestCase {
cr = new Response(); cr = new Response();
cr.setCorrelationId(consumerInfo.getCommandId()); cr.setCorrelationId(consumerInfo.getCommandId());
response = writeCommand(cr); response = writeCommand(cr);
System.out.println("Received: " + response); log.info("Received: " + response);
} }
public void _testFakeServer() throws Exception { public void _testFakeServer() throws Exception {

View File

@ -72,7 +72,7 @@ public class InactivityMonitorTest extends CombinationTestSupport implements Tra
} }
public void onException(IOException error) { public void onException(IOException error) {
if( !ignoreClientError.get() ) { if( !ignoreClientError.get() ) {
System.out.println("Client transport error:"); log.info("Client transport error:");
error.printStackTrace(); error.printStackTrace();
clientErrorCount.incrementAndGet(); clientErrorCount.incrementAndGet();
} }
@ -113,7 +113,7 @@ public class InactivityMonitorTest extends CombinationTestSupport implements Tra
public void onAccept(Transport transport) { public void onAccept(Transport transport) {
try { try {
System.out.println("["+getName()+"] Server Accepted a Connection"); log.info("["+getName()+"] Server Accepted a Connection");
serverTransport = transport; serverTransport = transport;
serverTransport.setTransportListener(new TransportListener() { serverTransport.setTransportListener(new TransportListener() {
public void onCommand(Command command) { public void onCommand(Command command) {
@ -124,7 +124,7 @@ public class InactivityMonitorTest extends CombinationTestSupport implements Tra
} }
public void onException(IOException error) { public void onException(IOException error) {
if( !ignoreClientError.get() ) { if( !ignoreClientError.get() ) {
System.out.println("Server transport error:"); log.info("Server transport error:");
error.printStackTrace(); error.printStackTrace();
serverErrorCount.incrementAndGet(); serverErrorCount.incrementAndGet();
} }
@ -158,7 +158,7 @@ public class InactivityMonitorTest extends CombinationTestSupport implements Tra
} }
public void onException(IOException error) { public void onException(IOException error) {
if( !ignoreClientError.get() ) { if( !ignoreClientError.get() ) {
System.out.println("Client transport error:"); log.info("Client transport error:");
error.printStackTrace(); error.printStackTrace();
clientErrorCount.incrementAndGet(); clientErrorCount.incrementAndGet();
} }
@ -209,7 +209,7 @@ public class InactivityMonitorTest extends CombinationTestSupport implements Tra
addCombinationValues("serverRunOnCommand", new Object[] { new Runnable() { addCombinationValues("serverRunOnCommand", new Object[] { new Runnable() {
public void run() { public void run() {
try { try {
System.out.println("Sleeping"); log.info("Sleeping");
Thread.sleep(4000); Thread.sleep(4000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
} }

View File

@ -16,12 +16,17 @@
*/ */
package org.apache.activemq.transport.udp; package org.apache.activemq.transport.udp;
import java.io.IOException;
import javax.jms.MessageNotWriteableException;
import junit.framework.TestCase;
import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQQueue; import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTextMessage; import org.apache.activemq.command.ActiveMQTextMessage;
import org.apache.activemq.command.Command; import org.apache.activemq.command.Command;
import org.apache.activemq.command.ConsumerInfo; import org.apache.activemq.command.ConsumerInfo;
import org.apache.activemq.command.KeepAliveInfo;
import org.apache.activemq.command.ProducerInfo; import org.apache.activemq.command.ProducerInfo;
import org.apache.activemq.command.Response; import org.apache.activemq.command.Response;
import org.apache.activemq.command.WireFormatInfo; import org.apache.activemq.command.WireFormatInfo;
@ -29,12 +34,8 @@ import org.apache.activemq.transport.Transport;
import org.apache.activemq.transport.TransportAcceptListener; import org.apache.activemq.transport.TransportAcceptListener;
import org.apache.activemq.transport.TransportListener; import org.apache.activemq.transport.TransportListener;
import org.apache.activemq.transport.TransportServer; import org.apache.activemq.transport.TransportServer;
import org.apache.commons.logging.Log;
import javax.jms.MessageNotWriteableException; import org.apache.commons.logging.LogFactory;
import java.io.IOException;
import junit.framework.TestCase;
/** /**
* *
@ -42,6 +43,8 @@ import junit.framework.TestCase;
*/ */
public abstract class UdpTestSupport extends TestCase implements TransportListener { public abstract class UdpTestSupport extends TestCase implements TransportListener {
protected static final Log log = LogFactory.getLog(UdpTestSupport.class);
protected Transport producer; protected Transport producer;
protected Transport consumer; protected Transport consumer;
@ -61,7 +64,7 @@ public abstract class UdpTestSupport extends TestCase implements TransportListen
expected.setPrefetchSize(3456); expected.setPrefetchSize(3456);
try { try {
System.out.println("About to send: " + expected); log.info("About to send: " + expected);
producer.oneway(expected); producer.oneway(expected);
Command received = assertCommandReceived(); Command received = assertCommandReceived();
@ -72,7 +75,7 @@ public abstract class UdpTestSupport extends TestCase implements TransportListen
assertEquals("getPrefetchSize", expected.getPrefetchSize(), actual.getPrefetchSize()); assertEquals("getPrefetchSize", expected.getPrefetchSize(), actual.getPrefetchSize());
} }
catch (Exception e) { catch (Exception e) {
System.out.println("Caught: " + e); log.info("Caught: " + e);
e.printStackTrace(); e.printStackTrace();
fail("Failed to send to transport: " + e); fail("Failed to send to transport: " + e);
} }
@ -100,7 +103,7 @@ public abstract class UdpTestSupport extends TestCase implements TransportListen
expected.setDestination(destination); expected.setDestination(destination);
try { try {
System.out.println("About to send message of type: " + expected.getClass()); log.info("About to send message of type: " + expected.getClass());
producer.oneway(expected); producer.oneway(expected);
// lets send a dummy command to ensure things don't block if we // lets send a dummy command to ensure things don't block if we
@ -118,10 +121,10 @@ public abstract class UdpTestSupport extends TestCase implements TransportListen
assertEquals("getDestination", expected.getDestination(), actual.getDestination()); assertEquals("getDestination", expected.getDestination(), actual.getDestination());
assertEquals("getText", expected.getText(), actual.getText()); assertEquals("getText", expected.getText(), actual.getText());
System.out.println("Received text message with: " + actual.getText().length() + " character(s)"); log.info("Received text message with: " + actual.getText().length() + " character(s)");
} }
catch (Exception e) { catch (Exception e) {
System.out.println("Caught: " + e); log.info("Caught: " + e);
e.printStackTrace(); e.printStackTrace();
fail("Failed to send to transport: " + e); fail("Failed to send to transport: " + e);
} }
@ -166,11 +169,11 @@ public abstract class UdpTestSupport extends TestCase implements TransportListen
producer = createProducer(); producer = createProducer();
producer.setTransportListener(new TransportListener() { producer.setTransportListener(new TransportListener() {
public void onCommand(Command command) { public void onCommand(Command command) {
System.out.println("Producer received: " + command); log.info("Producer received: " + command);
} }
public void onException(IOException error) { public void onException(IOException error) {
System.out.println("Producer exception: " + error); log.info("Producer exception: " + error);
error.printStackTrace(); error.printStackTrace();
} }
@ -198,7 +201,7 @@ public abstract class UdpTestSupport extends TestCase implements TransportListen
public void onCommand(Command command) { public void onCommand(Command command) {
if (command instanceof WireFormatInfo) { if (command instanceof WireFormatInfo) {
System.out.println("Got WireFormatInfo: " + command); log.info("Got WireFormatInfo: " + command);
} }
else { else {
if (command.isResponseRequired()) { if (command.isResponseRequired()) {
@ -207,11 +210,11 @@ public abstract class UdpTestSupport extends TestCase implements TransportListen
} }
if (large) { if (large) {
System.out.println("### Received command: " + command.getClass() + " with id: " log.info("### Received command: " + command.getClass() + " with id: "
+ command.getCommandId()); + command.getCommandId());
} }
else { else {
System.out.println("### Received command: " + command); log.info("### Received command: " + command);
} }
synchronized (lock) { synchronized (lock) {
@ -219,7 +222,7 @@ public abstract class UdpTestSupport extends TestCase implements TransportListen
receivedCommand = command; receivedCommand = command;
} }
else { else {
System.out.println("Ignoring superfluous command: " + command); log.info("Ignoring superfluous command: " + command);
} }
lock.notifyAll(); lock.notifyAll();
} }
@ -233,23 +236,23 @@ public abstract class UdpTestSupport extends TestCase implements TransportListen
consumer.oneway(response); consumer.oneway(response);
} }
catch (IOException e) { catch (IOException e) {
System.out.println("Caught: " + e); log.info("Caught: " + e);
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
public void onException(IOException error) { public void onException(IOException error) {
System.out.println("### Received error: " + error); log.info("### Received error: " + error);
error.printStackTrace(); error.printStackTrace();
} }
public void transportInterupted() { public void transportInterupted() {
System.out.println("### Transport interrupted"); log.info("### Transport interrupted");
} }
public void transportResumed() { public void transportResumed() {
System.out.println("### Transport resumed"); log.info("### Transport resumed");
} }
protected Command assertCommandReceived() throws InterruptedException { protected Command assertCommandReceived() throws InterruptedException {

View File

@ -16,12 +16,14 @@
*/ */
package org.apache.activemq.transport.udp; package org.apache.activemq.transport.udp;
import java.net.URI;
import org.apache.activemq.openwire.OpenWireFormat; import org.apache.activemq.openwire.OpenWireFormat;
import org.apache.activemq.transport.CommandJoiner; import org.apache.activemq.transport.CommandJoiner;
import org.apache.activemq.transport.Transport; import org.apache.activemq.transport.Transport;
import org.apache.activemq.util.IntSequenceGenerator; import org.apache.activemq.util.IntSequenceGenerator;
import org.apache.commons.logging.Log;
import java.net.URI; import org.apache.commons.logging.LogFactory;
/** /**
* *
@ -29,11 +31,13 @@ import java.net.URI;
*/ */
public class UdpTransportTest extends UdpTestSupport { public class UdpTransportTest extends UdpTestSupport {
protected static final Log log = LogFactory.getLog(UdpTransportTest.class);
protected int consumerPort = 9123; protected int consumerPort = 9123;
protected String producerURI = "udp://localhost:" + consumerPort; protected String producerURI = "udp://localhost:" + consumerPort;
protected Transport createProducer() throws Exception { protected Transport createProducer() throws Exception {
System.out.println("Producer using URI: " + producerURI); log.info("Producer using URI: " + producerURI);
// we are not using the TransportFactory as this assumes that // we are not using the TransportFactory as this assumes that
// UDP transports talk to a server using a WireFormat Negotiation step // UDP transports talk to a server using a WireFormat Negotiation step
@ -46,7 +50,7 @@ public class UdpTransportTest extends UdpTestSupport {
} }
protected Transport createConsumer() throws Exception { protected Transport createConsumer() throws Exception {
System.out.println("Consumer on port: " + consumerPort); log.info("Consumer on port: " + consumerPort);
OpenWireFormat wireFormat = createWireFormat(); OpenWireFormat wireFormat = createWireFormat();
UdpTransport transport = new UdpTransport(wireFormat, consumerPort); UdpTransport transport = new UdpTransport(wireFormat, consumerPort);
transport.setSequenceGenerator(new IntSequenceGenerator()); transport.setSequenceGenerator(new IntSequenceGenerator());

View File

@ -38,16 +38,16 @@ public class UdpTransportUsingServerTest extends UdpTestSupport {
ConsumerInfo expected = new ConsumerInfo(); ConsumerInfo expected = new ConsumerInfo();
expected.setSelector("Edam"); expected.setSelector("Edam");
expected.setResponseRequired(true); expected.setResponseRequired(true);
System.out.println("About to send: " + expected); log.info("About to send: " + expected);
Response response = producer.request(expected, 2000); Response response = producer.request(expected, 2000);
System.out.println("Received: " + response); log.info("Received: " + response);
assertNotNull("Received a response", response); assertNotNull("Received a response", response);
assertTrue("Should not be an exception", !response.isException()); assertTrue("Should not be an exception", !response.isException());
} }
protected Transport createProducer() throws Exception { protected Transport createProducer() throws Exception {
System.out.println("Producer using URI: " + producerURI); log.info("Producer using URI: " + producerURI);
URI uri = new URI(producerURI); URI uri = new URI(producerURI);
return TransportFactory.connect(uri); return TransportFactory.connect(uri);
} }

View File

@ -25,6 +25,9 @@ import javax.jms.MessageListener;
import junit.framework.Assert; import junit.framework.Assert;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** /**
* A simple container of messages for performing testing and rendezvous style * A simple container of messages for performing testing and rendezvous style
* code. You can use this class a {@link MessageListener} and then make * code. You can use this class a {@link MessageListener} and then make
@ -38,6 +41,9 @@ import junit.framework.Assert;
* @version $Revision: 1.6 $ * @version $Revision: 1.6 $
*/ */
public class MessageIdList extends Assert implements MessageListener { public class MessageIdList extends Assert implements MessageListener {
protected static final Log log = LogFactory.getLog(MessageIdList.class);
private List messageIds = new ArrayList(); private List messageIds = new ArrayList();
private Object semaphore; private Object semaphore;
private boolean verbose; private boolean verbose;
@ -98,7 +104,7 @@ public class MessageIdList extends Assert implements MessageListener {
semaphore.notifyAll(); semaphore.notifyAll();
} }
if (verbose) { if (verbose) {
System.out.println("Received message: " + message); log.info("Received message: " + message);
} }
} catch (JMSException e) { } catch (JMSException e) {
e.printStackTrace(); e.printStackTrace();
@ -115,7 +121,7 @@ public class MessageIdList extends Assert implements MessageListener {
} }
public void waitForMessagesToArrive(int messageCount) { public void waitForMessagesToArrive(int messageCount) {
System.out.println("Waiting for " + messageCount + " message(s) to arrive"); log.info("Waiting for " + messageCount + " message(s) to arrive");
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
@ -133,12 +139,12 @@ public class MessageIdList extends Assert implements MessageListener {
} }
} }
catch (InterruptedException e) { catch (InterruptedException e) {
System.out.println("Caught: " + e); log.info("Caught: " + e);
} }
} }
long end = System.currentTimeMillis() - start; long end = System.currentTimeMillis() - start;
System.out.println("End of wait for " + end + " millis and received: " + getMessageCount() + " messages"); log.info("End of wait for " + end + " millis and received: " + getMessageCount() + " messages");
} }
/** /**

View File

@ -35,12 +35,12 @@ public class MultipleTestsWithEmbeddedBrokerTest extends EmbeddedBrokerTestSuppo
} }
protected void setUp() throws Exception { protected void setUp() throws Exception {
System.out.println("### starting up the test case: " + getName()); log.info("### starting up the test case: " + getName());
super.setUp(); super.setUp();
connection = connectionFactory.createConnection(); connection = connectionFactory.createConnection();
connection.start(); connection.start();
System.out.println("### started up the test case: " + getName()); log.info("### started up the test case: " + getName());
} }
protected void tearDown() throws Exception { protected void tearDown() throws Exception {
@ -48,7 +48,6 @@ public class MultipleTestsWithEmbeddedBrokerTest extends EmbeddedBrokerTestSuppo
super.tearDown(); super.tearDown();
System.out.println("### closed down the test case: " + getName()); log.info("### closed down the test case: " + getName());
System.out.println();
} }
} }

View File

@ -16,22 +16,27 @@
*/ */
package org.apache.activemq.xbean; package org.apache.activemq.xbean;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerService;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import javax.jms.Connection; import javax.jms.Connection;
import javax.jms.ConnectionFactory; import javax.jms.ConnectionFactory;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/** /**
* *
* @author Neil Clayton * @author Neil Clayton
* @version $Revision$ * @version $Revision$
*/ */
public class MultipleTestsWithSpringFactoryBeanTest extends TestCase { public class MultipleTestsWithSpringFactoryBeanTest extends TestCase {
protected static final Log log = LogFactory.getLog(MultipleTestsWithSpringFactoryBeanTest.class);
protected AbstractApplicationContext context; protected AbstractApplicationContext context;
protected BrokerService service; protected BrokerService service;
private Connection connection; private Connection connection;
@ -43,7 +48,7 @@ public class MultipleTestsWithSpringFactoryBeanTest extends TestCase {
} }
protected void setUp() throws Exception { protected void setUp() throws Exception {
System.out.println("### starting up the test case: " + getName()); log.info("### starting up the test case: " + getName());
super.setUp(); super.setUp();
context = new ClassPathXmlApplicationContext("org/apache/activemq/xbean/spring2.xml"); context = new ClassPathXmlApplicationContext("org/apache/activemq/xbean/spring2.xml");
@ -54,7 +59,7 @@ public class MultipleTestsWithSpringFactoryBeanTest extends TestCase {
connection = createConnectionFactory().createConnection(); connection = createConnectionFactory().createConnection();
connection.start(); connection.start();
System.out.println("### started up the test case: " + getName()); log.info("### started up the test case: " + getName());
} }
protected void tearDown() throws Exception { protected void tearDown() throws Exception {
@ -65,8 +70,7 @@ public class MultipleTestsWithSpringFactoryBeanTest extends TestCase {
context.close(); context.close();
super.tearDown(); super.tearDown();
System.out.println("### closed down the test case: " + getName()); log.info("### closed down the test case: " + getName());
System.out.println();
} }
protected ConnectionFactory createConnectionFactory() { protected ConnectionFactory createConnectionFactory() {

View File

@ -34,6 +34,8 @@ import org.apache.activemq.broker.region.policy.TimedSubscriptionRecoveryPolicy;
import org.apache.activemq.command.ActiveMQTopic; import org.apache.activemq.command.ActiveMQTopic;
import org.apache.activemq.command.ConnectionId; import org.apache.activemq.command.ConnectionId;
import org.apache.activemq.command.ConnectionInfo; import org.apache.activemq.command.ConnectionInfo;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** /**
* *
@ -41,6 +43,8 @@ import org.apache.activemq.command.ConnectionInfo;
*/ */
public class XBeanConfigTest extends TestCase { public class XBeanConfigTest extends TestCase {
protected static final Log log = LogFactory.getLog(XBeanConfigTest.class);
protected BrokerService brokerService; protected BrokerService brokerService;
protected Broker broker; protected Broker broker;
protected ConnectionContext context; protected ConnectionContext context;
@ -59,9 +63,9 @@ public class XBeanConfigTest extends TestCase {
assertTrue("subscriptionRecoveryPolicy should be LastImageSubscriptionRecoveryPolicy: " + subscriptionRecoveryPolicy, assertTrue("subscriptionRecoveryPolicy should be LastImageSubscriptionRecoveryPolicy: " + subscriptionRecoveryPolicy,
subscriptionRecoveryPolicy instanceof LastImageSubscriptionRecoveryPolicy); subscriptionRecoveryPolicy instanceof LastImageSubscriptionRecoveryPolicy);
System.out.println("destination: " + topic); log.info("destination: " + topic);
System.out.println("dispatchPolicy: " + dispatchPolicy); log.info("dispatchPolicy: " + dispatchPolicy);
System.out.println("subscriptionRecoveryPolicy: " + subscriptionRecoveryPolicy); log.info("subscriptionRecoveryPolicy: " + subscriptionRecoveryPolicy);
topic = (Topic) broker.addDestination(context, new ActiveMQTopic("ORDERS.BOOKS")); topic = (Topic) broker.addDestination(context, new ActiveMQTopic("ORDERS.BOOKS"));
dispatchPolicy = topic.getDispatchPolicy(); dispatchPolicy = topic.getDispatchPolicy();
@ -73,9 +77,9 @@ public class XBeanConfigTest extends TestCase {
TimedSubscriptionRecoveryPolicy timedSubcriptionPolicy = (TimedSubscriptionRecoveryPolicy) subscriptionRecoveryPolicy; TimedSubscriptionRecoveryPolicy timedSubcriptionPolicy = (TimedSubscriptionRecoveryPolicy) subscriptionRecoveryPolicy;
assertEquals("getRecoverDuration()", 60000, timedSubcriptionPolicy.getRecoverDuration()); assertEquals("getRecoverDuration()", 60000, timedSubcriptionPolicy.getRecoverDuration());
System.out.println("destination: " + topic); log.info("destination: " + topic);
System.out.println("dispatchPolicy: " + dispatchPolicy); log.info("dispatchPolicy: " + dispatchPolicy);
System.out.println("subscriptionRecoveryPolicy: " + subscriptionRecoveryPolicy); log.info("subscriptionRecoveryPolicy: " + subscriptionRecoveryPolicy);
} }
protected void setUp() throws Exception { protected void setUp() throws Exception {
@ -112,7 +116,7 @@ public class XBeanConfigTest extends TestCase {
protected BrokerService createBroker() throws Exception { protected BrokerService createBroker() throws Exception {
String uri = "org/apache/activemq/xbean/activemq-policy.xml"; String uri = "org/apache/activemq/xbean/activemq-policy.xml";
System.out.println("Loading broker configuration from the classpath with URI: " + uri); log.info("Loading broker configuration from the classpath with URI: " + uri);
return BrokerFactory.createBroker(new URI("xbean:"+uri)); return BrokerFactory.createBroker(new URI("xbean:"+uri));
} }