NO-JIRA Retry test on intermittent failure

This commit is contained in:
Clebert Suconic 2020-04-23 12:51:33 -04:00
parent 7a0b0fd8a6
commit e8d23f3144
14 changed files with 93 additions and 64 deletions

View File

@ -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.server.impl.LastValueQueue;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.util.Wait; 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.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
@ -46,6 +48,9 @@ import org.junit.runners.Parameterized;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class JMSNonDestructiveTest extends JMSClientTestSupport { 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_QUEUE_NAME = "NON_DESTRUCTIVE_QUEUE";
private static final String NON_DESTRUCTIVE_EXPIRY_QUEUE_NAME = "NON_DESTRUCTIVE_EXPIRY_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"; private static final String NON_DESTRUCTIVE_LVQ_QUEUE_NAME = "NON_DESTRUCTIVE_LVQ_QUEUE";

View File

@ -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.unit.core.journal.impl.fakes.SimpleEncoding;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.Wait; import org.apache.activemq.artemis.utils.Wait;
import org.jboss.logging.Logger;
import org.junit.After; import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class AlignedJournalImplTest extends ActiveMQTestBase { public class AlignedJournalImplTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(AlignedJournalImplTest.class);
// Constants ----------------------------------------------------- // Constants -----------------------------------------------------
private static final LoaderCallback dummyLoader = new LoaderCallback() { private static final LoaderCallback dummyLoader = new LoaderCallback() {
@ -532,7 +533,7 @@ public class AlignedJournalImplTest extends ActiveMQTestBase {
journalImpl.debugWait(); journalImpl.debugWait();
System.out.println("Files = " + factory.listFiles("tt")); log.debug("Files = " + factory.listFiles("tt"));
SequentialFile file = factory.createSequentialFile("tt-1.tt"); SequentialFile file = factory.createSequentialFile("tt-1.tt");
@ -1332,7 +1333,7 @@ public class AlignedJournalImplTest extends ActiveMQTestBase {
public void failedTransaction(final long transactionID, public void failedTransaction(final long transactionID,
final List<RecordInfo> records, final List<RecordInfo> records,
final List<RecordInfo> recordsToDelete) { final List<RecordInfo> recordsToDelete) {
System.out.println("records.length = " + records.size()); log.debug("records.length = " + records.size());
incompleteTransactions.add(transactionID); incompleteTransactions.add(transactionID);
} }

View File

@ -48,7 +48,7 @@ import org.junit.Before;
public abstract class JournalImplTestBase extends ActiveMQTestBase { 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<RecordInfo> records = new LinkedList<>(); protected List<RecordInfo> records = new LinkedList<>();
@ -223,7 +223,7 @@ public abstract class JournalImplTestBase extends ActiveMQTestBase {
* @throws Exception * @throws Exception
*/ */
protected void exportImportJournal() 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"); 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); File[] files = dir.listFiles(fnf);
for (File file : files) { for (File file : files) {
System.out.println("Deleting " + file); log.debug("Deleting " + file);
file.delete(); file.delete();
} }
@ -643,7 +643,7 @@ public abstract class JournalImplTestBase extends ActiveMQTestBase {
expectedSet.removeAll(actualSet); expectedSet.removeAll(actualSet);
for (RecordInfo info : expectedSet) { 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()); Assert.assertEquals("There are duplicates on the actual list", actualSet.size(), actualSet.size());
@ -659,29 +659,29 @@ public abstract class JournalImplTestBase extends ActiveMQTestBase {
HashSet<RecordInfo> hashExpected = new HashSet<>(); HashSet<RecordInfo> hashExpected = new HashSet<>();
hashExpected.addAll(expected); hashExpected.addAll(expected);
System.out.println("#Summary **********************************************************************************************************************"); log.debug("#Summary **********************************************************************************************************************");
for (RecordInfo r : hashActual) { for (RecordInfo r : hashActual) {
if (!hashExpected.contains(r)) { 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) { for (RecordInfo r : hashExpected) {
if (!hashActual.contains(r)) { 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) { for (RecordInfo recordInfo : expected) {
System.out.println("Record::" + recordInfo); log.debug("Record::" + recordInfo);
} }
System.out.println("#actual ************************************************************************************************************************"); log.debug("#actual ************************************************************************************************************************");
for (RecordInfo recordInfo : actual) { for (RecordInfo recordInfo : actual) {
System.out.println("Record::" + recordInfo); log.debug("Record::" + recordInfo);
} }
System.out.println("#records ***********************************************************************************************************************"); log.debug("#records ***********************************************************************************************************************");
try { try {
describeJournal(journal.getFileFactory(), (JournalImpl) journal, journal.getFileFactory().getDirectory(), System.out); describeJournal(journal.getFileFactory(), (JournalImpl) journal, journal.getFileFactory().getDirectory(), System.out);

View File

@ -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.UnitTestLogger;
import org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.SimpleEncoding; import org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.SimpleEncoding;
import org.apache.activemq.artemis.utils.RandomUtil; import org.apache.activemq.artemis.utils.RandomUtil;
import org.jboss.logging.Logger;
import org.junit.After; import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
public abstract class JournalImplTestUnit extends JournalImplTestBase { public abstract class JournalImplTestUnit extends JournalImplTestBase {
private static final Logger log = Logger.getLogger(JournalImplTestUnit.class);
@Override @Override
@After @After
public void tearDown() throws Exception { 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); 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 // Fills exactly 10 files
int initialNumberOfAddRecords = addRecordsPerFile * 10; int initialNumberOfAddRecords = addRecordsPerFile * 10;
@ -1013,7 +1016,7 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase {
journal.debugWait(); journal.debugWait();
System.out.println("journal tmp :" + journal.debug()); log.debug("journal tmp :" + journal.debug());
List<String> files2 = fileFactory.listFiles(fileExtension); List<String> files2 = fileFactory.listFiles(fileExtension);
@ -1030,7 +1033,7 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase {
journal.debugWait(); journal.debugWait();
System.out.println("journal tmp2 :" + journal.debug()); log.debug("journal tmp2 :" + journal.debug());
List<String> files3 = fileFactory.listFiles(fileExtension); List<String> files3 = fileFactory.listFiles(fileExtension);
@ -1085,7 +1088,7 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase {
journal.checkReclaimStatus(); journal.checkReclaimStatus();
System.out.println("journal:" + journal.debug()); log.debug("journal:" + journal.debug());
stopJournal(false); stopJournal(false);
createJournal(); createJournal();
@ -2983,18 +2986,18 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase {
* Enable System.outs again if test fails and needs to be debugged * Enable System.outs again if test fails and needs to be debugged
*/ */
// System.out.println("Before stop ****************************"); // log.debug("Before stop ****************************");
// System.out.println(journal.debug()); // log.debug(journal.debug());
// System.out.println("*****************************************"); // log.debug("*****************************************");
stopJournal(); stopJournal();
createJournal(); createJournal();
startJournal(); startJournal();
loadAndCheck(); loadAndCheck();
// System.out.println("After start ****************************"); // log.debug("After start ****************************");
// System.out.println(journal.debug()); // log.debug(journal.debug());
// System.out.println("*****************************************"); // log.debug("*****************************************");
journal.forceMoveNextFile(); journal.forceMoveNextFile();
@ -3002,49 +3005,49 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase {
delete(i); delete(i);
} }
// System.out.println("After delete ****************************"); // log.debug("After delete ****************************");
// System.out.println(journal.debug()); // log.debug(journal.debug());
// System.out.println("*****************************************"); // log.debug("*****************************************");
for (int i = 100; i < 200; i++) { for (int i = 100; i < 200; i++) {
updateTx(transactionID, i); updateTx(transactionID, i);
} }
// System.out.println("After updatetx ****************************"); // log.debug("After updatetx ****************************");
// System.out.println(journal.debug()); // log.debug(journal.debug());
// System.out.println("*****************************************"); // log.debug("*****************************************");
journal.forceMoveNextFile(); journal.forceMoveNextFile();
commit(transactionID++); commit(transactionID++);
// System.out.println("After commit ****************************"); // log.debug("After commit ****************************");
// System.out.println(journal.debug()); // log.debug(journal.debug());
// System.out.println("*****************************************"); // log.debug("*****************************************");
for (int i = 100; i < 200; i++) { for (int i = 100; i < 200; i++) {
updateTx(transactionID, i); updateTx(transactionID, i);
deleteTx(transactionID, i); deleteTx(transactionID, i);
} }
// System.out.println("After delete ****************************"); // log.debug("After delete ****************************");
// System.out.println(journal.debug()); // log.debug(journal.debug());
// System.out.println("*****************************************"); // log.debug("*****************************************");
commit(transactionID++); commit(transactionID++);
// System.out.println("Before reclaim/after commit ****************************"); // log.debug("Before reclaim/after commit ****************************");
// System.out.println(journal.debug()); // log.debug(journal.debug());
// System.out.println("*****************************************"); // log.debug("*****************************************");
stopJournal(); stopJournal();
createJournal(); createJournal();
startJournal(); startJournal();
loadAndCheck(); loadAndCheck();
// System.out.println("After reclaim ****************************"); // log.debug("After reclaim ****************************");
// System.out.println(journal.debug()); // log.debug(journal.debug());
// System.out.println("*****************************************"); // log.debug("*****************************************");
journal.forceMoveNextFile(); journal.forceMoveNextFile();
checkAndReclaimFiles(); checkAndReclaimFiles();

View File

@ -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.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.Env; import org.apache.activemq.artemis.utils.Env;
import org.apache.activemq.artemis.utils.ReusableLatch; import org.apache.activemq.artemis.utils.ReusableLatch;
import org.jboss.logging.Logger;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
public class TimedBufferTest extends ActiveMQTestBase { public class TimedBufferTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(TimedBufferTest.class);
// Constants ----------------------------------------------------- // Constants -----------------------------------------------------
// Attributes ---------------------------------------------------- // Attributes ----------------------------------------------------
@ -167,7 +168,7 @@ public class TimedBufferTest extends ActiveMQTestBase {
IOCallback callback = new IOCallback() { IOCallback callback = new IOCallback() {
@Override @Override
public void done() { public void done() {
System.out.println("done"); log.debug("done");
latchFlushed.countDown(); latchFlushed.countDown();
} }
@ -388,7 +389,7 @@ public class TimedBufferTest extends ActiveMQTestBase {
assert observer.flushesDone() == 2; 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)!!!!!! //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 //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; final long maxExpected = timeout + deviceTime;
Assert.assertTrue("elapsed = " + elapsedTime + " max expected = " + maxExpected, elapsedTime <= maxExpected); Assert.assertTrue("elapsed = " + elapsedTime + " max expected = " + maxExpected, elapsedTime <= maxExpected);
} finally { } finally {
@ -429,7 +430,7 @@ public class TimedBufferTest extends ActiveMQTestBase {
assert observer.flushesDone() == 2; 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)!!!!!! //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 //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; final long maxExpected = timeout + deviceTime;
Assert.assertTrue("elapsed = " + elapsedTime + " max expected = " + maxExpected, elapsedTime <= maxExpected); Assert.assertTrue("elapsed = " + elapsedTime + " max expected = " + maxExpected, elapsedTime <= maxExpected);
} finally { } finally {

View File

@ -41,10 +41,12 @@ import org.apache.activemq.artemis.utils.RandomUtil;
import org.apache.activemq.artemis.utils.UUID; import org.apache.activemq.artemis.utils.UUID;
import org.apache.activemq.artemis.utils.UUIDGenerator; import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.apache.activemq.artemis.utils.Wait; import org.apache.activemq.artemis.utils.Wait;
import org.jboss.logging.Logger;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
public class MessageImplTest extends ActiveMQTestBase { public class MessageImplTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(MessageImplTest.class);
@Test @Test
public void getSetAttributes() { public void getSetAttributes() {
@ -238,7 +240,7 @@ public class MessageImplTest extends ActiveMQTestBase {
public void testMessageCopyIssue() throws Exception { public void testMessageCopyIssue() throws Exception {
for (long i = 0; i < 300; i++) { for (long i = 0; i < 300; i++) {
if (i % 10 == 0) if (i % 10 == 0)
System.out.println("#test " + i); log.debug("#test " + i);
internalMessageCopy(); internalMessageCopy();
} }
} }

View File

@ -65,12 +65,14 @@ import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
import org.apache.activemq.artemis.utils.ExecutorFactory; import org.apache.activemq.artemis.utils.ExecutorFactory;
import org.apache.activemq.artemis.utils.RandomUtil; import org.apache.activemq.artemis.utils.RandomUtil;
import org.apache.activemq.artemis.utils.actors.ArtemisExecutor; import org.apache.activemq.artemis.utils.actors.ArtemisExecutor;
import org.jboss.logging.Logger;
import org.junit.After; import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class PagingStoreImplTest extends ActiveMQTestBase { public class PagingStoreImplTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(PagingStoreImplTest.class);
static { static {
MessagePersister.registerPersister(CoreMessagePersister.getInstance()); MessagePersister.registerPersister(CoreMessagePersister.getInstance());
@ -286,7 +288,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
for (int pageNr = 0; pageNr < 2; pageNr++) { for (int pageNr = 0; pageNr < 2; pageNr++) {
Page page = store.depage(); Page page = store.depage();
System.out.println("numberOfPages = " + store.getNumberOfPages()); log.debug("numberOfPages = " + store.getNumberOfPages());
page.open(); page.open();
@ -699,7 +701,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
page.close(false, false); page.close(false, false);
page.delete(null); page.delete(null);
} else { } else {
System.out.println("Depaged!!!! numerOfMessages = " + msgsRead + " of " + NUMBER_OF_MESSAGES); log.debug("Depaged!!!! numerOfMessages = " + msgsRead + " of " + NUMBER_OF_MESSAGES);
Thread.sleep(500); Thread.sleep(500);
} }
} }

View File

@ -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.cluster.impl.MessageLoadBalancingType;
import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.core.server.impl.AddressInfo;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.jboss.logging.Logger;
import org.junit.Test; import org.junit.Test;
/** /**
* This test is replicating the behaviour from https://issues.jboss.org/browse/HORNETQ-988. * This test is replicating the behaviour from https://issues.jboss.org/browse/HORNETQ-988.
*/ */
public class WildcardAddressManagerUnitTest extends ActiveMQTestBase { public class WildcardAddressManagerUnitTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(WildcardAddressManagerUnitTest.class);
@Test @Test
public void testUnitOnWildCardFailingScenario() throws Exception { public void testUnitOnWildCardFailingScenario() throws Exception {
@ -348,7 +350,7 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase {
@Override @Override
public void route(Message message, RoutingContext context) throws Exception { public void route(Message message, RoutingContext context) throws Exception {
System.out.println("routing message: " + message); log.debug("routing message: " + message);
} }
@Override @Override

View File

@ -55,12 +55,15 @@ import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
import org.apache.activemq.artemis.utils.FutureLatch; import org.apache.activemq.artemis.utils.FutureLatch;
import org.apache.activemq.artemis.utils.actors.ArtemisExecutor; import org.apache.activemq.artemis.utils.actors.ArtemisExecutor;
import org.apache.activemq.artemis.utils.collections.LinkedListIterator; import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
import org.jboss.logging.Logger;
import org.junit.After; import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class QueueImplTest extends ActiveMQTestBase { public class QueueImplTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(QueueImplTest.class);
// The tests ---------------------------------------------------------------- // The tests ----------------------------------------------------------------
private ScheduledExecutorService scheduledExecutor; private ScheduledExecutorService scheduledExecutor;
@ -222,7 +225,7 @@ public class QueueImplTest extends ActiveMQTestBase {
float rate = queue.getRate(); float rate = queue.getRate();
Assert.assertTrue(rate <= 10.0f); Assert.assertTrue(rate <= 10.0f);
System.out.println("Rate: " + rate); log.debug("Rate: " + rate);
} }
@Test @Test

View File

@ -22,6 +22,7 @@ import java.util.HashSet;
import org.apache.activemq.artemis.tests.util.SpawnedVMCheck; import org.apache.activemq.artemis.tests.util.SpawnedVMCheck;
import org.apache.activemq.artemis.utils.RandomUtil; import org.apache.activemq.artemis.utils.RandomUtil;
import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.apache.activemq.artemis.utils.SpawnedVMSupport;
import org.jboss.logging.Logger;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; 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 * This test will start many parallel VMs, to make sure each VM would generate a good distribution of random numbers
*/ */
public class RandomUtilDistributionTest { public class RandomUtilDistributionTest {
private static final Logger log = Logger.getLogger(RandomUtilDistributionTest.class);
@Rule @Rule
public SpawnedVMCheck check = new SpawnedVMCheck(); 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) // Be careful removing it (make sure you know what you're doing in case you do so)
int minimumExpected = (int) ((iterations * numberOfStarts) * 0.80); 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); 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()); 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(); return valueSet.size();

View File

@ -26,6 +26,7 @@ import java.util.Map;
import org.apache.activemq.artemis.ra.ActiveMQResourceAdapter; import org.apache.activemq.artemis.ra.ActiveMQResourceAdapter;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.jboss.logging.Logger;
import org.junit.Test; import org.junit.Test;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; 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. * add a description for each new property added and try and put it in the config some where appropriate.
*/ */
public class ActiveMQResourceAdapterConfigTest extends ActiveMQTestBase { public class ActiveMQResourceAdapterConfigTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(ActiveMQResourceAdapterConfigTest.class);
private static String config = "" + private static String config = "" +
"<config-property>\n" + "<config-property>\n" +
@ -474,7 +476,7 @@ public class ActiveMQResourceAdapterConfigTest extends ActiveMQTestBase {
newConfig.append(" \" <config-property-value></config-property-value>\" + \n"); newConfig.append(" \" <config-property-value></config-property-value>\" + \n");
newConfig.append(" \" </config-property>\" + \n"); newConfig.append(" \" </config-property>\" + \n");
} }
System.out.println(newConfig); log.debug(newConfig);
fail("methods not shown please see previous and add"); fail("methods not shown please see previous and add");
} }
} }

View File

@ -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.core.server.impl.MessageReferenceImpl;
import org.apache.activemq.artemis.tests.unit.UnitTestLogger; import org.apache.activemq.artemis.tests.unit.UnitTestLogger;
import org.apache.activemq.artemis.utils.MemorySize; import org.apache.activemq.artemis.utils.MemorySize;
import org.jboss.logging.Logger;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
public class MemorySizeTest extends Assert { public class MemorySizeTest extends Assert {
private static final Logger log = Logger.getLogger(MemorySizeTest.class);
@Test @Test
public void testObjectSizes() throws Exception { 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 @Override
public Object createObject() { public Object createObject() {
return new CoreMessage(1, 1000); 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 @Override
public Object createObject() { public Object createObject() {
return new MessageReferenceImpl(); return new MessageReferenceImpl();

View File

@ -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.unit.util.deserialization.pkg1.TestClass2;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.ObjectInputStreamWithClassLoader; import org.apache.activemq.artemis.utils.ObjectInputStreamWithClassLoader;
import org.jboss.logging.Logger;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
public class ObjectInputStreamWithClassLoaderTest extends ActiveMQTestBase { public class ObjectInputStreamWithClassLoaderTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(ObjectInputStreamWithClassLoaderTest.class);
// Constants ----------------------------------------------------- // Constants -----------------------------------------------------
// Attributes ---------------------------------------------------- // Attributes ----------------------------------------------------
@ -506,7 +509,7 @@ public class ObjectInputStreamWithClassLoaderTest extends ActiveMQTestBase {
try { try {
Object deserializedObj = ois.readObject(); Object deserializedObj = ois.readObject();
System.out.println("Deserialized Object " + deserializedObj); log.debug("Deserialized Object " + deserializedObj);
myAssertNotSame(originalProxy, deserializedObj); myAssertNotSame(originalProxy, deserializedObj);
myAssertNotSame(originalProxy.getClass(), deserializedObj.getClass()); myAssertNotSame(originalProxy.getClass(), deserializedObj.getClass());

View File

@ -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.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.SoftValueLongObjectHashMap; import org.apache.activemq.artemis.utils.SoftValueLongObjectHashMap;
import org.jboss.logging.Logger;
import org.junit.Test; import org.junit.Test;
public class SoftValueMapTest extends ActiveMQTestBase { public class SoftValueMapTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(SoftValueMapTest.class);
// Constants ----------------------------------------------------- // Constants -----------------------------------------------------
// Attributes ---------------------------------------------------- // Attributes ----------------------------------------------------
@ -50,9 +51,9 @@ public class SoftValueMapTest extends ActiveMQTestBase {
assertTrue(softCache.size() < MAX_ELEMENTS); 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 @Test
@ -88,9 +89,9 @@ public class SoftValueMapTest extends ActiveMQTestBase {
// this is the next one, so it should go // this is the next one, so it should go
assertNull(softCache.get(101L)); 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 @Test