From e8d23f31445e392a207b552371f93a4225dff639 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Thu, 23 Apr 2020 12:51:33 -0400 Subject: [PATCH] NO-JIRA Retry test on intermittent failure --- .../amqp/JMSNonDestructiveTest.java | 5 ++ .../journal/impl/AlignedJournalImplTest.java | 7 ++- .../journal/impl/JournalImplTestBase.java | 26 ++++---- .../journal/impl/JournalImplTestUnit.java | 59 ++++++++++--------- .../core/journal/impl/TimedBufferTest.java | 9 +-- .../core/message/impl/MessageImplTest.java | 4 +- .../core/paging/impl/PagingStoreImplTest.java | 6 +- .../impl/WildcardAddressManagerUnitTest.java | 4 +- .../unit/core/server/impl/QueueImplTest.java | 5 +- .../core/util/RandomUtilDistributionTest.java | 6 +- .../ra/ActiveMQResourceAdapterConfigTest.java | 4 +- .../tests/unit/util/MemorySizeTest.java | 6 +- .../ObjectInputStreamWithClassLoaderTest.java | 5 +- .../tests/unit/util/SoftValueMapTest.java | 11 ++-- 14 files changed, 93 insertions(+), 64 deletions(-) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSNonDestructiveTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSNonDestructiveTest.java index 006fdfd7a4..8b54045140 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSNonDestructiveTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSNonDestructiveTest.java @@ -39,6 +39,8 @@ import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.core.server.impl.LastValueQueue; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.tests.util.Wait; +import org.apache.activemq.artemis.utils.RetryRule; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -46,6 +48,9 @@ import org.junit.runners.Parameterized; @RunWith(Parameterized.class) public class JMSNonDestructiveTest extends JMSClientTestSupport { + @Rule + public RetryRule retryRule = new RetryRule(2); + private static final String NON_DESTRUCTIVE_QUEUE_NAME = "NON_DESTRUCTIVE_QUEUE"; private static final String NON_DESTRUCTIVE_EXPIRY_QUEUE_NAME = "NON_DESTRUCTIVE_EXPIRY_QUEUE"; private static final String NON_DESTRUCTIVE_LVQ_QUEUE_NAME = "NON_DESTRUCTIVE_LVQ_QUEUE"; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/AlignedJournalImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/AlignedJournalImplTest.java index f9e75af81c..0732e26618 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/AlignedJournalImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/AlignedJournalImplTest.java @@ -38,13 +38,14 @@ import org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.FakeSequen import org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.SimpleEncoding; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.utils.Wait; +import org.jboss.logging.Logger; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; public class AlignedJournalImplTest extends ActiveMQTestBase { - + private static final Logger log = Logger.getLogger(AlignedJournalImplTest.class); // Constants ----------------------------------------------------- private static final LoaderCallback dummyLoader = new LoaderCallback() { @@ -532,7 +533,7 @@ public class AlignedJournalImplTest extends ActiveMQTestBase { journalImpl.debugWait(); - System.out.println("Files = " + factory.listFiles("tt")); + log.debug("Files = " + factory.listFiles("tt")); SequentialFile file = factory.createSequentialFile("tt-1.tt"); @@ -1332,7 +1333,7 @@ public class AlignedJournalImplTest extends ActiveMQTestBase { public void failedTransaction(final long transactionID, final List records, final List recordsToDelete) { - System.out.println("records.length = " + records.size()); + log.debug("records.length = " + records.size()); incompleteTransactions.add(transactionID); } diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java index d8dc8fcfad..c33f98fcd4 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java @@ -48,7 +48,7 @@ import org.junit.Before; public abstract class JournalImplTestBase extends ActiveMQTestBase { - private static final Logger logger = Logger.getLogger(JournalImplTestBase.class); + private static final Logger log = Logger.getLogger(JournalImplTestBase.class); protected List records = new LinkedList<>(); @@ -223,7 +223,7 @@ public abstract class JournalImplTestBase extends ActiveMQTestBase { * @throws Exception */ protected void exportImportJournal() throws Exception { - System.out.println("Exporting to " + getTestDir() + "/output.log"); + log.debug("Exporting to " + getTestDir() + "/output.log"); EncodeJournal.exportJournal(getTestDir(), this.filePrefix, this.fileExtension, this.minFiles, this.fileSize, getTestDir() + "/output.log"); @@ -236,12 +236,12 @@ public abstract class JournalImplTestBase extends ActiveMQTestBase { } }; - System.out.println("file = " + dir); + log.debug("file = " + dir); File[] files = dir.listFiles(fnf); for (File file : files) { - System.out.println("Deleting " + file); + log.debug("Deleting " + file); file.delete(); } @@ -643,7 +643,7 @@ public abstract class JournalImplTestBase extends ActiveMQTestBase { expectedSet.removeAll(actualSet); for (RecordInfo info : expectedSet) { - logger.warn("The following record is missing:: " + info); + log.warn("The following record is missing:: " + info); } Assert.assertEquals("There are duplicates on the actual list", actualSet.size(), actualSet.size()); @@ -659,29 +659,29 @@ public abstract class JournalImplTestBase extends ActiveMQTestBase { HashSet hashExpected = new HashSet<>(); hashExpected.addAll(expected); - System.out.println("#Summary **********************************************************************************************************************"); + log.debug("#Summary **********************************************************************************************************************"); for (RecordInfo r : hashActual) { if (!hashExpected.contains(r)) { - System.out.println("Record " + r + " was supposed to be removed and it exists"); + log.debug("Record " + r + " was supposed to be removed and it exists"); } } for (RecordInfo r : hashExpected) { if (!hashActual.contains(r)) { - System.out.println("Record " + r + " was not found on actual list"); + log.debug("Record " + r + " was not found on actual list"); } } - System.out.println("#expected **********************************************************************************************************************"); + log.debug("#expected **********************************************************************************************************************"); for (RecordInfo recordInfo : expected) { - System.out.println("Record::" + recordInfo); + log.debug("Record::" + recordInfo); } - System.out.println("#actual ************************************************************************************************************************"); + log.debug("#actual ************************************************************************************************************************"); for (RecordInfo recordInfo : actual) { - System.out.println("Record::" + recordInfo); + log.debug("Record::" + recordInfo); } - System.out.println("#records ***********************************************************************************************************************"); + log.debug("#records ***********************************************************************************************************************"); try { describeJournal(journal.getFileFactory(), (JournalImpl) journal, journal.getFileFactory().getDirectory(), System.out); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestUnit.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestUnit.java index 838f334231..c6e0173591 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestUnit.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestUnit.java @@ -33,12 +33,15 @@ import org.apache.activemq.artemis.logs.AssertionLoggerHandler; import org.apache.activemq.artemis.tests.unit.UnitTestLogger; import org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.SimpleEncoding; import org.apache.activemq.artemis.utils.RandomUtil; +import org.jboss.logging.Logger; import org.junit.After; import org.junit.Assert; import org.junit.Test; public abstract class JournalImplTestUnit extends JournalImplTestBase { + private static final Logger log = Logger.getLogger(JournalImplTestUnit.class); + @Override @After public void tearDown() throws Exception { @@ -677,7 +680,7 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase { int addRecordsPerFile = calculateRecordsPerFile(10 * 1024, journal.getAlignment(), JournalImpl.SIZE_ADD_RECORD + 1 + recordLength); - System.out.println(JournalImpl.SIZE_ADD_RECORD + 1 + recordLength); + log.debug(JournalImpl.SIZE_ADD_RECORD + 1 + recordLength); // Fills exactly 10 files int initialNumberOfAddRecords = addRecordsPerFile * 10; @@ -1013,7 +1016,7 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase { journal.debugWait(); - System.out.println("journal tmp :" + journal.debug()); + log.debug("journal tmp :" + journal.debug()); List files2 = fileFactory.listFiles(fileExtension); @@ -1030,7 +1033,7 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase { journal.debugWait(); - System.out.println("journal tmp2 :" + journal.debug()); + log.debug("journal tmp2 :" + journal.debug()); List files3 = fileFactory.listFiles(fileExtension); @@ -1085,7 +1088,7 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase { journal.checkReclaimStatus(); - System.out.println("journal:" + journal.debug()); + log.debug("journal:" + journal.debug()); stopJournal(false); createJournal(); @@ -2983,18 +2986,18 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase { * Enable System.outs again if test fails and needs to be debugged */ - // System.out.println("Before stop ****************************"); - // System.out.println(journal.debug()); - // System.out.println("*****************************************"); + // log.debug("Before stop ****************************"); + // log.debug(journal.debug()); + // log.debug("*****************************************"); stopJournal(); createJournal(); startJournal(); loadAndCheck(); - // System.out.println("After start ****************************"); - // System.out.println(journal.debug()); - // System.out.println("*****************************************"); + // log.debug("After start ****************************"); + // log.debug(journal.debug()); + // log.debug("*****************************************"); journal.forceMoveNextFile(); @@ -3002,49 +3005,49 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase { delete(i); } - // System.out.println("After delete ****************************"); - // System.out.println(journal.debug()); - // System.out.println("*****************************************"); + // log.debug("After delete ****************************"); + // log.debug(journal.debug()); + // log.debug("*****************************************"); for (int i = 100; i < 200; i++) { updateTx(transactionID, i); } - // System.out.println("After updatetx ****************************"); - // System.out.println(journal.debug()); - // System.out.println("*****************************************"); + // log.debug("After updatetx ****************************"); + // log.debug(journal.debug()); + // log.debug("*****************************************"); journal.forceMoveNextFile(); commit(transactionID++); - // System.out.println("After commit ****************************"); - // System.out.println(journal.debug()); - // System.out.println("*****************************************"); + // log.debug("After commit ****************************"); + // log.debug(journal.debug()); + // log.debug("*****************************************"); for (int i = 100; i < 200; i++) { updateTx(transactionID, i); deleteTx(transactionID, i); } - // System.out.println("After delete ****************************"); - // System.out.println(journal.debug()); - // System.out.println("*****************************************"); + // log.debug("After delete ****************************"); + // log.debug(journal.debug()); + // log.debug("*****************************************"); commit(transactionID++); - // System.out.println("Before reclaim/after commit ****************************"); - // System.out.println(journal.debug()); - // System.out.println("*****************************************"); + // log.debug("Before reclaim/after commit ****************************"); + // log.debug(journal.debug()); + // log.debug("*****************************************"); stopJournal(); createJournal(); startJournal(); loadAndCheck(); - // System.out.println("After reclaim ****************************"); - // System.out.println(journal.debug()); - // System.out.println("*****************************************"); + // log.debug("After reclaim ****************************"); + // log.debug(journal.debug()); + // log.debug("*****************************************"); journal.forceMoveNextFile(); checkAndReclaimFiles(); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/TimedBufferTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/TimedBufferTest.java index 318cd533cb..b65e4c150c 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/TimedBufferTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/TimedBufferTest.java @@ -34,11 +34,12 @@ import org.apache.activemq.artemis.core.journal.EncodingSupport; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.utils.Env; import org.apache.activemq.artemis.utils.ReusableLatch; +import org.jboss.logging.Logger; import org.junit.Assert; import org.junit.Test; public class TimedBufferTest extends ActiveMQTestBase { - + private static final Logger log = Logger.getLogger(TimedBufferTest.class); // Constants ----------------------------------------------------- // Attributes ---------------------------------------------------- @@ -167,7 +168,7 @@ public class TimedBufferTest extends ActiveMQTestBase { IOCallback callback = new IOCallback() { @Override public void done() { - System.out.println("done"); + log.debug("done"); latchFlushed.countDown(); } @@ -388,7 +389,7 @@ public class TimedBufferTest extends ActiveMQTestBase { assert observer.flushesDone() == 2; //it is much more than what is expected!!if it will fail it means that the timed IOPS = 1/(timeout + blockingDeviceFlushTime)!!!!!! //while it has to be IOPS = 1/timeout - System.out.println("elapsed time: " + elapsedTime + " with timeout: " + timeout); + log.debug("elapsed time: " + elapsedTime + " with timeout: " + timeout); final long maxExpected = timeout + deviceTime; Assert.assertTrue("elapsed = " + elapsedTime + " max expected = " + maxExpected, elapsedTime <= maxExpected); } finally { @@ -429,7 +430,7 @@ public class TimedBufferTest extends ActiveMQTestBase { assert observer.flushesDone() == 2; //it is much more than what is expected!!if it will fail it means that the timed IOPS = 1/(timeout + blockingDeviceFlushTime)!!!!!! //while it has to be IOPS = 1/timeout - System.out.println("elapsed time: " + elapsedTime + " with timeout: " + timeout); + log.debug("elapsed time: " + elapsedTime + " with timeout: " + timeout); final long maxExpected = timeout + deviceTime; Assert.assertTrue("elapsed = " + elapsedTime + " max expected = " + maxExpected, elapsedTime <= maxExpected); } finally { diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/message/impl/MessageImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/message/impl/MessageImplTest.java index 5bec653ed2..04dcbf3fe1 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/message/impl/MessageImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/message/impl/MessageImplTest.java @@ -41,10 +41,12 @@ import org.apache.activemq.artemis.utils.RandomUtil; import org.apache.activemq.artemis.utils.UUID; import org.apache.activemq.artemis.utils.UUIDGenerator; import org.apache.activemq.artemis.utils.Wait; +import org.jboss.logging.Logger; import org.junit.Assert; import org.junit.Test; public class MessageImplTest extends ActiveMQTestBase { + private static final Logger log = Logger.getLogger(MessageImplTest.class); @Test public void getSetAttributes() { @@ -238,7 +240,7 @@ public class MessageImplTest extends ActiveMQTestBase { public void testMessageCopyIssue() throws Exception { for (long i = 0; i < 300; i++) { if (i % 10 == 0) - System.out.println("#test " + i); + log.debug("#test " + i); internalMessageCopy(); } } diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingStoreImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingStoreImplTest.java index 70ab16e6a4..f1808beb57 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingStoreImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingStoreImplTest.java @@ -65,12 +65,14 @@ import org.apache.activemq.artemis.utils.ActiveMQThreadFactory; import org.apache.activemq.artemis.utils.ExecutorFactory; import org.apache.activemq.artemis.utils.RandomUtil; import org.apache.activemq.artemis.utils.actors.ArtemisExecutor; +import org.jboss.logging.Logger; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; public class PagingStoreImplTest extends ActiveMQTestBase { + private static final Logger log = Logger.getLogger(PagingStoreImplTest.class); static { MessagePersister.registerPersister(CoreMessagePersister.getInstance()); @@ -286,7 +288,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { for (int pageNr = 0; pageNr < 2; pageNr++) { Page page = store.depage(); - System.out.println("numberOfPages = " + store.getNumberOfPages()); + log.debug("numberOfPages = " + store.getNumberOfPages()); page.open(); @@ -699,7 +701,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { page.close(false, false); page.delete(null); } else { - System.out.println("Depaged!!!! numerOfMessages = " + msgsRead + " of " + NUMBER_OF_MESSAGES); + log.debug("Depaged!!!! numerOfMessages = " + msgsRead + " of " + NUMBER_OF_MESSAGES); Thread.sleep(500); } } diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java index a809eb5dde..ecd02f5116 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java @@ -39,12 +39,14 @@ import org.apache.activemq.artemis.core.server.RoutingContext; import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType; import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; +import org.jboss.logging.Logger; import org.junit.Test; /** * This test is replicating the behaviour from https://issues.jboss.org/browse/HORNETQ-988. */ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase { + private static final Logger log = Logger.getLogger(WildcardAddressManagerUnitTest.class); @Test public void testUnitOnWildCardFailingScenario() throws Exception { @@ -348,7 +350,7 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase { @Override public void route(Message message, RoutingContext context) throws Exception { - System.out.println("routing message: " + message); + log.debug("routing message: " + message); } @Override diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java index 0ff9e0d7dc..88bf7d89c2 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java @@ -55,12 +55,15 @@ import org.apache.activemq.artemis.utils.ActiveMQThreadFactory; import org.apache.activemq.artemis.utils.FutureLatch; import org.apache.activemq.artemis.utils.actors.ArtemisExecutor; import org.apache.activemq.artemis.utils.collections.LinkedListIterator; +import org.jboss.logging.Logger; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; public class QueueImplTest extends ActiveMQTestBase { + private static final Logger log = Logger.getLogger(QueueImplTest.class); + // The tests ---------------------------------------------------------------- private ScheduledExecutorService scheduledExecutor; @@ -222,7 +225,7 @@ public class QueueImplTest extends ActiveMQTestBase { float rate = queue.getRate(); Assert.assertTrue(rate <= 10.0f); - System.out.println("Rate: " + rate); + log.debug("Rate: " + rate); } @Test diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/util/RandomUtilDistributionTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/util/RandomUtilDistributionTest.java index e324545f49..2dcca826b2 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/util/RandomUtilDistributionTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/util/RandomUtilDistributionTest.java @@ -22,6 +22,7 @@ import java.util.HashSet; import org.apache.activemq.artemis.tests.util.SpawnedVMCheck; import org.apache.activemq.artemis.utils.RandomUtil; import org.apache.activemq.artemis.utils.SpawnedVMSupport; +import org.jboss.logging.Logger; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; @@ -30,6 +31,7 @@ import org.junit.Test; * This test will start many parallel VMs, to make sure each VM would generate a good distribution of random numbers */ public class RandomUtilDistributionTest { + private static final Logger log = Logger.getLogger(RandomUtilDistributionTest.class); @Rule public SpawnedVMCheck check = new SpawnedVMCheck(); @@ -67,7 +69,7 @@ public class RandomUtilDistributionTest { // Be careful removing it (make sure you know what you're doing in case you do so) int minimumExpected = (int) ((iterations * numberOfStarts) * 0.80); - System.out.println("value=" + value + ", minimum expected = " + minimumExpected); + log.debug("value=" + value + ", minimum expected = " + minimumExpected); Assert.assertTrue("The Random distribution is pretty bad. All tries have returned duplicated randoms. value=" + value + ", minimum expected = " + minimumExpected, value > minimumExpected); } @@ -89,7 +91,7 @@ public class RandomUtilDistributionTest { valueSet.add(process[i].exitValue()); } - System.out.println("Generated " + valueSet.size() + " randoms out of " + numberOfTries + " tries"); + log.debug("Generated " + valueSet.size() + " randoms out of " + numberOfTries + " tries"); return valueSet.size(); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java index 8d923b7ecd..1d20c1628a 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java @@ -26,6 +26,7 @@ import java.util.Map; import org.apache.activemq.artemis.ra.ActiveMQResourceAdapter; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; +import org.jboss.logging.Logger; import org.junit.Test; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -39,6 +40,7 @@ import org.xml.sax.InputSource; * add a description for each new property added and try and put it in the config some where appropriate. */ public class ActiveMQResourceAdapterConfigTest extends ActiveMQTestBase { + private static final Logger log = Logger.getLogger(ActiveMQResourceAdapterConfigTest.class); private static String config = "" + "\n" + @@ -474,7 +476,7 @@ public class ActiveMQResourceAdapterConfigTest extends ActiveMQTestBase { newConfig.append(" \" \" + \n"); newConfig.append(" \" \" + \n"); } - System.out.println(newConfig); + log.debug(newConfig); fail("methods not shown please see previous and add"); } } diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/MemorySizeTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/MemorySizeTest.java index 2b5205ed5d..64ca352f4f 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/MemorySizeTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/MemorySizeTest.java @@ -20,21 +20,23 @@ import org.apache.activemq.artemis.core.message.impl.CoreMessage; import org.apache.activemq.artemis.core.server.impl.MessageReferenceImpl; import org.apache.activemq.artemis.tests.unit.UnitTestLogger; import org.apache.activemq.artemis.utils.MemorySize; +import org.jboss.logging.Logger; import org.junit.Assert; import org.junit.Test; public class MemorySizeTest extends Assert { + private static final Logger log = Logger.getLogger(MemorySizeTest.class); @Test public void testObjectSizes() throws Exception { - UnitTestLogger.LOGGER.info("Server message size is " + MemorySize.calculateSize(new MemorySize.ObjectFactory() { + log.info("Server message size is " + MemorySize.calculateSize(new MemorySize.ObjectFactory() { @Override public Object createObject() { return new CoreMessage(1, 1000); } })); - UnitTestLogger.LOGGER.info("Message reference size is " + MemorySize.calculateSize(new MemorySize.ObjectFactory() { + log.info("Message reference size is " + MemorySize.calculateSize(new MemorySize.ObjectFactory() { @Override public Object createObject() { return new MessageReferenceImpl(); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/ObjectInputStreamWithClassLoaderTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/ObjectInputStreamWithClassLoaderTest.java index 7caa46a7f5..ebceca1126 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/ObjectInputStreamWithClassLoaderTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/ObjectInputStreamWithClassLoaderTest.java @@ -44,10 +44,13 @@ import org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.TestClas import org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.TestClass2; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.utils.ObjectInputStreamWithClassLoader; +import org.jboss.logging.Logger; import org.junit.Assert; import org.junit.Test; public class ObjectInputStreamWithClassLoaderTest extends ActiveMQTestBase { + private static final Logger log = Logger.getLogger(ObjectInputStreamWithClassLoaderTest.class); + // Constants ----------------------------------------------------- // Attributes ---------------------------------------------------- @@ -506,7 +509,7 @@ public class ObjectInputStreamWithClassLoaderTest extends ActiveMQTestBase { try { Object deserializedObj = ois.readObject(); - System.out.println("Deserialized Object " + deserializedObj); + log.debug("Deserialized Object " + deserializedObj); myAssertNotSame(originalProxy, deserializedObj); myAssertNotSame(originalProxy.getClass(), deserializedObj.getClass()); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/SoftValueMapTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/SoftValueMapTest.java index c3cdd1e190..d18218e0cb 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/SoftValueMapTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/SoftValueMapTest.java @@ -18,10 +18,11 @@ package org.apache.activemq.artemis.tests.unit.util; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.utils.SoftValueLongObjectHashMap; +import org.jboss.logging.Logger; import org.junit.Test; public class SoftValueMapTest extends ActiveMQTestBase { - + private static final Logger log = Logger.getLogger(SoftValueMapTest.class); // Constants ----------------------------------------------------- // Attributes ---------------------------------------------------- @@ -50,9 +51,9 @@ public class SoftValueMapTest extends ActiveMQTestBase { assertTrue(softCache.size() < MAX_ELEMENTS); - System.out.println("SoftCache.size " + softCache.size()); + log.debug("SoftCache.size " + softCache.size()); - System.out.println("Soft cache has " + softCache.size() + " elements"); + log.debug("Soft cache has " + softCache.size() + " elements"); } @Test @@ -88,9 +89,9 @@ public class SoftValueMapTest extends ActiveMQTestBase { // this is the next one, so it should go assertNull(softCache.get(101L)); - System.out.println("SoftCache.size " + softCache.size()); + log.debug("SoftCache.size " + softCache.size()); - System.out.println("Soft cache has " + softCache.size() + " elements"); + log.debug("Soft cache has " + softCache.size() + " elements"); } @Test