Skip to content

Commit

Permalink
Merge pull request hornetq#84 from andytaylor/i18n_logging
Browse files Browse the repository at this point in the history
migrated jms tests to jboss logging
  • Loading branch information
FranciscoBorges committed Apr 18, 2012
2 parents ba54a2d + e10b71d commit 1790645
Show file tree
Hide file tree
Showing 157 changed files with 397 additions and 466 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
import org.hornetq.core.client.impl.Topology;
import org.hornetq.core.client.impl.TopologyMember;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.remoting.impl.invm.InVMRegistry;
import org.hornetq.core.remoting.impl.invm.TransportConstants;
import org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory;
import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
import org.hornetq.core.server.HornetQComponent;
import org.hornetq.core.server.HornetQLogger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
import org.hornetq.core.server.NodeManager;
Expand Down Expand Up @@ -104,7 +104,7 @@ protected Topology waitForTopology(final HornetQServer server, final int nodes,

protected Topology waitForTopology(final HornetQServer server, final int liveNodes, final int backupNodes, final long timeout) throws Exception
{
log.debug("waiting for " + liveNodes + " on the topology for server = " + server);
HornetQLogger.LOGGER.debug("waiting for " + liveNodes + " on the topology for server = " + server);

long start = System.currentTimeMillis();

Expand Down Expand Up @@ -155,15 +155,15 @@ protected Topology waitForTopology(final HornetQServer server, final int liveNod
topology.describe() +
")";

log.error(msg);
HornetQLogger.LOGGER.error(msg);

throw new Exception(msg);
}


protected void waitForTopology(final HornetQServer server, String clusterConnectionName, final int nodes, final long timeout) throws Exception
{
log.debug("waiting for " + nodes + " on the topology for server = " + server);
HornetQLogger.LOGGER.debug("waiting for " + nodes + " on the topology for server = " + server);

long start = System.currentTimeMillis();

Expand All @@ -190,7 +190,7 @@ protected void waitForTopology(final HornetQServer server, String clusterConnect
topology +
")";

log.error(msg);
HornetQLogger.LOGGER.error(msg);

throw new Exception(msg);
}
Expand Down Expand Up @@ -294,7 +294,7 @@ protected static final TransportConfiguration createTransportConfiguration(boole
}

// Static --------------------------------------------------------
private final Logger log = Logger.getLogger(this.getClass());
private final HornetQLogger log = HornetQLogger.LOGGER;

// Constructors --------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
import org.hornetq.core.journal.impl.AIOSequentialFileFactory;
import org.hornetq.core.journal.impl.JournalImpl;
import org.hornetq.core.journal.impl.NIOSequentialFileFactory;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.persistence.impl.journal.JournalStorageManager;
import org.hornetq.core.persistence.impl.journal.JournalStorageManager.ReferenceDescribe;
import org.hornetq.core.persistence.impl.journal.OperationContextImpl;
Expand All @@ -88,6 +87,7 @@
import org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory;
import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
import org.hornetq.core.server.HornetQComponent;
import org.hornetq.core.server.HornetQLogger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.JournalType;
import org.hornetq.core.server.MessageReference;
Expand All @@ -111,7 +111,7 @@ public abstract class UnitTestCase extends TestCase
{
// Constants -----------------------------------------------------

private static final Logger log = Logger.getLogger(UnitTestCase.class);
private static final HornetQLogger log = HornetQLogger.LOGGER;

public static final String INVM_ACCEPTOR_FACTORY = InVMAcceptorFactory.class.getCanonicalName();

Expand Down Expand Up @@ -419,7 +419,7 @@ public static String threadDump(final String msg)
/** Sends the message to both logger and System.out (for unit report) */
public void logAndSystemOut(String message, Exception e)
{
Logger log = Logger.getLogger(this.getClass());
HornetQLogger log = HornetQLogger.LOGGER;
log.info(message, e);
System.out.println(message);
e.printStackTrace(System.out);
Expand All @@ -428,7 +428,7 @@ public void logAndSystemOut(String message, Exception e)
/** Sends the message to both logger and System.out (for unit report) */
public void logAndSystemOut(String message)
{
Logger log = Logger.getLogger(this.getClass());
HornetQLogger log = HornetQLogger.LOGGER;
log.info(message);
System.out.println(this.getClass().getName() + "::" + message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
import java.util.List;

import org.hornetq.api.core.SimpleString;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HandleStatus;
import org.hornetq.core.server.MessageReference;
import org.hornetq.core.server.Queue;
import org.hornetq.core.server.ServerMessage;
import org.hornetq.core.server.impl.QueueImpl;
import org.hornetq.tests.unit.UnitTestLogger;
import org.hornetq.tests.unit.core.server.impl.fakes.FakeConsumer;
import org.hornetq.tests.unit.core.server.impl.fakes.FakeQueueFactory;
import org.hornetq.tests.util.UnitTestCase;
Expand All @@ -38,7 +38,7 @@
*/
public class QueueTest extends UnitTestCase
{
private static final Logger log = Logger.getLogger(QueueTest.class);
private static final UnitTestLogger log = UnitTestLogger.LOGGER;

private FakeQueueFactory queueFactory = new FakeQueueFactory();

Expand Down
8 changes: 8 additions & 0 deletions tests/integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-processor</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.transaction.impl.XidImpl;
import org.hornetq.tests.util.ServiceTestBase;
Expand All @@ -48,7 +47,7 @@
*/
public class DuplicateDetectionTest extends ServiceTestBase
{
private static final Logger log = Logger.getLogger(DuplicateDetectionTest.class);
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

private HornetQServer messagingService;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2010, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.hornetq.tests.integration;

import org.jboss.logging.BasicLogger;
import org.jboss.logging.Logger;
import org.jboss.logging.MessageLogger;

/**
* @author <a href="mailto:[email protected]">Andy Taylor</a>
* 4/18/12
*/
@MessageLogger(projectCode = "HQTEST")
public interface IntegrationTestLogger extends BasicLogger
{
/**
* The integration test logger.
*/
IntegrationTestLogger LOGGER = Logger.getMessageLogger(IntegrationTestLogger.class, IntegrationTestLogger.class.getPackage().getName());
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@
import org.hornetq.api.core.client.MessageHandler;
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.Queue;
import org.hornetq.tests.integration.IntegrationTestLogger;
import org.hornetq.tests.util.ServiceTestBase;

/**
* @author <a href="mailto:[email protected]">Andy Taylor</a>
*/
public class AcknowledgeTest extends ServiceTestBase
{
private static final Logger log = Logger.getLogger(AcknowledgeTest.class);
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

public final SimpleString addressA = new SimpleString("addressA");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.api.core.client.MessageHandler;
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.integration.IntegrationTestLogger;
import org.hornetq.tests.util.ServiceTestBase;

/**
* @author <a href="mailto:[email protected]">Andy Taylor</a>
*/
public class AutogroupIdTest extends ServiceTestBase
{
private static final Logger log = Logger.getLogger(AutogroupIdTest.class);
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

public final SimpleString addressA = new SimpleString("addressA");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.impl.QueueImpl;
import org.hornetq.tests.integration.IntegrationTestLogger;
import org.hornetq.tests.util.ServiceTestBase;

/**
Expand All @@ -33,7 +33,7 @@
*/
public class ConsumerFilterTest extends ServiceTestBase
{
private static final Logger log = Logger.getLogger(ConsumerFilterTest.class);
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

private HornetQServer server;
private ClientSession session;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.integration.IntegrationTestLogger;
import org.hornetq.tests.util.ServiceTestBase;

/**
* @author <a href="mailto:[email protected]">Andy Taylor</a>
*/
public class ConsumerRoundRobinTest extends ServiceTestBase
{
private static final Logger log = Logger.getLogger(QueueBrowserTest.class);
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

public final SimpleString addressA = new SimpleString("addressA");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
import org.hornetq.api.core.client.MessageHandler;
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.client.impl.ClientConsumerInternal;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.postoffice.Binding;
import org.hornetq.core.postoffice.Bindings;
import org.hornetq.core.postoffice.QueueBinding;
import org.hornetq.core.server.Consumer;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.impl.ServerConsumerImpl;
import org.hornetq.core.settings.impl.AddressSettings;
import org.hornetq.tests.integration.IntegrationTestLogger;
import org.hornetq.tests.util.ServiceTestBase;

/**
Expand All @@ -52,7 +52,7 @@ public class ConsumerWindowSizeTest extends ServiceTestBase

private final int TIMEOUT = 5;

private static final Logger log = Logger.getLogger(ConsumerWindowSizeTest.class);
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

private static final boolean isTrace = ConsumerWindowSizeTest.log.isTraceEnabled();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
import org.hornetq.jms.client.HornetQTextMessage;
import org.hornetq.tests.integration.IntegrationTestLogger;
import org.hornetq.tests.util.ServiceTestBase;

public class CoreClientTest extends ServiceTestBase
{
private static final Logger log = Logger.getLogger(CoreClientTest.class);
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

// Constants -----------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
import org.hornetq.api.core.client.MessageHandler;
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
import org.hornetq.core.server.Queue;
import org.hornetq.core.settings.impl.AddressSettings;
import org.hornetq.tests.integration.IntegrationTestLogger;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.ServiceTestBase;
import org.hornetq.tests.util.UnitTestCase;
Expand All @@ -46,7 +46,7 @@
*/
public class DeadLetterAddressTest extends ServiceTestBase
{
private static final Logger log = Logger.getLogger(DeadLetterAddressTest.class);
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

private HornetQServer server;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
import org.hornetq.core.settings.impl.AddressSettings;
import org.hornetq.tests.integration.IntegrationTestLogger;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.ServiceTestBase;
import org.hornetq.tests.util.UnitTestCase;
Expand All @@ -38,7 +38,7 @@
*/
public class ExpiryAddressTest extends ServiceTestBase
{
private static final Logger log = Logger.getLogger(ExpiryAddressTest.class);
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

private HornetQServer server;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.Queue;
import org.hornetq.core.settings.impl.AddressFullMessagePolicy;
import org.hornetq.core.settings.impl.AddressSettings;
import org.hornetq.tests.integration.IntegrationTestLogger;
import org.hornetq.tests.util.ServiceTestBase;

/**
Expand All @@ -40,7 +40,7 @@
public class ExpiryLargeMessageTest extends ServiceTestBase
{

private static final Logger log = Logger.getLogger(ExpiryLargeMessageTest.class);
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

// Constants -----------------------------------------------------
final SimpleString EXPIRY = new SimpleString("my-expiry");
Expand Down
Loading

0 comments on commit 1790645

Please sign in to comment.