From 8ad8c9d3859c02c7b9984b89e620448b3dde453d Mon Sep 17 00:00:00 2001 From: Robbie Gemmell Date: Tue, 30 Jan 2024 16:05:25 +0000 Subject: [PATCH] ARTEMIS-4589: consolidate utility code and remove the remaining test-jar creations in tests/ tree --- artemis-cli/pom.xml | 6 - tests/artemis-test-support/pom.xml | 26 ++++- .../MultiThreadRandomReattachTestBase.java | 106 ++++++++++-------- .../MultiThreadReattachSupportTestBase.java | 0 .../reattach/RandomReattachTestBase.java} | 90 +++++++-------- .../largemessage/LargeMessageTestBase.java | 0 .../integration/ra/DummyTransaction.java | 0 .../ra/DummyTransactionManager.java | 0 .../artemis/tests/rules}/SpawnedVMCheck.java | 2 +- .../impl/fakes/FakeConnectorService.java | 0 .../fakes/FakeConnectorServiceFactory.java | 0 .../journal/impl/JournalImplTestBase.java | 0 .../journal/impl/JournalImplTestUnit.java | 0 .../impl/SequentialFileFactoryTestBase.java | 0 .../impl/fakes/FakeSequentialFileFactory.java | 0 .../journal/impl/fakes/SimpleEncoding.java | 0 .../postoffice/impl/fakes}/FakeQueue.java | 2 +- .../core/server/impl/fakes/FakeConsumer.java | 0 .../core/server/impl/fakes/FakeFilter.java | 0 .../server/impl/fakes/FakeJournalLoader.java | 0 .../server/impl/fakes/FakePostOffice.java | 0 .../server/impl/fakes/FakeQueueFactory.java | 0 .../tests/unit/ra/BootstrapContext.java | 0 .../tests/unit/ra/MessageEndpointFactory.java | 0 .../artemis/tests/unit/util/InVMContext.java | 0 .../tests/unit/util/InVMNameParser.java | 0 .../tests/unit/util/InVMNamingContext.java | 0 .../unit/util/NonSerializableFactory.java | 0 .../artemis/tests/util/JMSTestBase.java | 0 .../artemis/tests/util/RandomUtil.java | 0 tests/compatibility-tests/pom.xml | 6 - tests/integration-tests/pom.xml | 19 ---- .../integration/amqp/AmqpTestSupport.java | 16 --- .../clientcrash/ClientCrashTest.java | 2 +- .../MultiThreadRandomReattachTest.java | 28 +---- .../RandomReattachIntegrationTest.java} | 22 +--- .../tests/integration/jms/RedeployTest.java | 2 +- .../management/ManagementServiceImplTest.java | 2 +- .../DeleteMessagesOnStartupTest.java | 2 +- .../integration/security/SecurityTest.java | 16 ++- .../artemis/tests/util/SpawnedTestBase.java | 1 + tests/jms-tests/pom.xml | 5 - tests/joram-tests/pom.xml | 14 +-- .../amqpJMS/JoramAMQPAggregationTest.java | 2 +- .../artemis/jms/JoramCoreAggregationTest.java | 2 +- tests/performance-tests/pom.xml | 14 --- tests/soak-tests/pom.xml | 8 -- .../mirror/IdempotentACKTest.java | 2 +- .../mirror/InterruptedLargeMessageTest.java | 2 +- .../mirror/MirroredTopicSoakTest.java | 2 +- .../clientFailure/ClientFailureSoakTest.java | 2 +- .../soak/failover/RandomFailoverSoakTest.java | 4 +- .../interrupt/JournalFlushInterruptTest.java | 2 +- .../ClusteredLargeMessageInterruptTest.java | 2 +- .../interruptlm/LargeMessageFrozenTest.java | 2 +- .../LargeMessageInterruptTest.java | 2 +- .../soak/paging/MegaCleanerPagingTest.java | 2 +- tests/stress-tests/pom.xml | 14 --- .../MultiThreadRandomReattachStressTest.java | 4 +- .../failover/RandomReattachStressTest.java | 4 +- .../stress/paging/PageCursorStressTest.java | 2 +- tests/timing-tests/pom.xml | 22 ++-- tests/unit-tests/pom.xml | 14 --- .../unit/core/paging/impl}/AmqpPageTest.java | 20 +++- .../core/paging/impl/PagingStoreImplTest.java | 2 +- .../postoffice/impl/BindingsImplTest.java | 1 + .../postoffice/impl/QueueComparatorTest.java | 1 + .../cluster/impl/RemoteQueueBindImplTest.java | 2 +- .../core/util/RandomUtilDistributionTest.java | 2 +- .../artemis/tests/util/CreateMessage.java | 48 -------- 70 files changed, 200 insertions(+), 351 deletions(-) rename tests/{integration-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java (90%) rename tests/{integration-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadReattachSupportTestBase.java (100%) rename tests/{integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachTest.java => artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachTestBase.java} (91%) rename tests/{integration-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/integration/largemessage/LargeMessageTestBase.java (100%) rename tests/{integration-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/integration/ra/DummyTransaction.java (100%) rename tests/{integration-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/integration/ra/DummyTransactionManager.java (100%) rename tests/{unit-tests/src/test/java/org/apache/activemq/artemis/tests/util => artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/rules}/SpawnedVMCheck.java (96%) rename tests/{unit-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/unit/core/config/impl/fakes/FakeConnectorService.java (100%) rename tests/{unit-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/unit/core/config/impl/fakes/FakeConnectorServiceFactory.java (100%) rename tests/{unit-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java (100%) rename tests/{unit-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestUnit.java (100%) rename tests/{unit-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java (100%) rename tests/{unit-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java (100%) rename tests/{unit-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/fakes/SimpleEncoding.java (100%) rename tests/{unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl => artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/fakes}/FakeQueue.java (99%) rename tests/{unit-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeConsumer.java (100%) rename tests/{unit-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeFilter.java (100%) rename tests/{unit-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeJournalLoader.java (100%) rename tests/{unit-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakePostOffice.java (100%) rename tests/{unit-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeQueueFactory.java (100%) rename tests/{unit-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/unit/ra/BootstrapContext.java (100%) rename tests/{unit-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/unit/ra/MessageEndpointFactory.java (100%) rename tests/{unit-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/unit/util/InVMContext.java (100%) rename tests/{unit-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/unit/util/InVMNameParser.java (100%) rename tests/{unit-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/unit/util/InVMNamingContext.java (100%) rename tests/{unit-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/unit/util/NonSerializableFactory.java (100%) rename tests/{integration-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/util/JMSTestBase.java (100%) rename tests/{integration-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/util/RandomUtil.java (100%) rename tests/{timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/util/UUIDTest.java => integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachIntegrationTest.java} (53%) rename tests/{integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/paging => unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl}/AmqpPageTest.java (82%) delete mode 100644 tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/CreateMessage.java diff --git a/artemis-cli/pom.xml b/artemis-cli/pom.xml index d90d420354..b73c57bc90 100644 --- a/artemis-cli/pom.xml +++ b/artemis-cli/pom.xml @@ -167,12 +167,6 @@ junit test - - org.apache.activemq - artemis-junit - ${project.version} - test - diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java similarity index 90% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java index d80318c310..dda3645c21 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java +++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java @@ -25,6 +25,7 @@ import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.QueueConfiguration; +import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -33,6 +34,8 @@ import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.MessageHandler; import org.apache.activemq.artemis.api.core.client.ServerLocator; +import org.apache.activemq.artemis.core.config.Configuration; +import org.apache.activemq.artemis.core.config.CoreAddressConfiguration; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMRegistry; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.jms.client.ActiveMQBytesMessage; @@ -60,7 +63,25 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt protected ActiveMQServer server; + protected abstract int getNumIterations(); + @Override + protected void start() throws Exception { + Configuration primaryConf = createDefaultInVMConfig(); + server = createServer(false, primaryConf); + server.getConfiguration().getAddressConfigurations().add(new CoreAddressConfiguration().setName(ADDRESS.toString()).addRoutingType(RoutingType.MULTICAST)); + server.start(); + waitForServerToStart(server); + } + + protected void setBody(final ClientMessage message) throws Exception { + // Give each msg a body + message.getBodyBuffer().writeBytes(new byte[250]); + } + + protected boolean checkSize(final ClientMessage message) { + return message.getBodyBuffer().readableBytes() == 250; + } @Test public void testA() throws Exception { @@ -215,15 +236,6 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt }, NUM_THREADS, false); } - - - @Override - protected abstract void start() throws Exception; - - protected abstract void setBody(ClientMessage message) throws Exception; - - protected abstract boolean checkSize(ClientMessage message); - protected ClientSession createAutoCommitSession(final ClientSessionFactory sf) throws Exception { ClientSession session = sf.createSession(false, true, true); session.addMetaData("someData", RandomUtil.randomString()); @@ -246,9 +258,9 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession session = addClientSession(sf.createSession(false, true, true)); - session.createQueue(new QueueConfiguration(subName).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); + session.createQueue(new QueueConfiguration(subName).setAddress(ADDRESS).setDurable(false)); - ClientProducer producer = session.createProducer(MultiThreadRandomReattachTestBase.ADDRESS); + ClientProducer producer = session.createProducer(ADDRESS); ClientConsumer consumer = session.createConsumer(subName); @@ -302,7 +314,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt sessConsume.start(); - sessConsume.createQueue(new QueueConfiguration(subName).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -314,7 +326,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessSend = sf.createSession(false, true, true); - ClientProducer producer = sessSend.createProducer(MultiThreadRandomReattachTestBase.ADDRESS); + ClientProducer producer = sessSend.createProducer(ADDRESS); sendMessages(sessSend, producer, numMessages, threadNum); @@ -378,7 +390,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessConsume = createAutoCommitSession(sf); - sessConsume.createQueue(new QueueConfiguration(subName).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -390,7 +402,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessSend = sf.createSession(false, true, true); sessSend.addMetaData("some-data", RandomUtil.randomString()); - ClientProducer producer = sessSend.createProducer(MultiThreadRandomReattachTestBase.ADDRESS); + ClientProducer producer = sessSend.createProducer(ADDRESS); sendMessages(sessSend, producer, numMessages, threadNum); @@ -462,7 +474,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt sessConsume.start(); - sessConsume.createQueue(new QueueConfiguration(subName).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -474,7 +486,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessSend = sf.createSession(false, false, false); sessSend.addMetaData("some-data", RandomUtil.randomString()); - ClientProducer producer = sessSend.createProducer(MultiThreadRandomReattachTestBase.ADDRESS); + ClientProducer producer = sessSend.createProducer(ADDRESS); sendMessages(sessSend, producer, numMessages, threadNum); @@ -561,7 +573,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessConsume = sf.createSession(false, false, false); sessConsume.addMetaData("data", RandomUtil.randomString()); - sessConsume.createQueue(new QueueConfiguration(subName).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -573,7 +585,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessSend = sf.createSession(false, false, false); sessSend.addMetaData("some-data", RandomUtil.randomString()); - ClientProducer producer = sessSend.createProducer(MultiThreadRandomReattachTestBase.ADDRESS); + ClientProducer producer = sessSend.createProducer(ADDRESS); sendMessages(sessSend, producer, numMessages, threadNum); @@ -690,7 +702,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt sessConsume.start(); - sessConsume.createQueue(new QueueConfiguration(subName).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -702,7 +714,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessSend = sf.createSession(false, true, true); sessSend.addMetaData("some-data", RandomUtil.randomString()); - ClientProducer producer = sessSend.createProducer(MultiThreadRandomReattachTestBase.ADDRESS); + ClientProducer producer = sessSend.createProducer(ADDRESS); sendMessages(sessSend, producer, numMessages, threadNum); @@ -745,7 +757,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessConsume = sf.createSession(false, true, true); sessConsume.addMetaData("data", RandomUtil.randomString()); - sessConsume.createQueue(new QueueConfiguration(subName).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -757,7 +769,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessSend = sf.createSession(false, true, true); sessSend.addMetaData("data", RandomUtil.randomString()); - ClientProducer producer = sessSend.createProducer(MultiThreadRandomReattachTestBase.ADDRESS); + ClientProducer producer = sessSend.createProducer(ADDRESS); sendMessages(sessSend, producer, numMessages, threadNum); @@ -806,7 +818,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt sessConsume.start(); - sessConsume.createQueue(new QueueConfiguration(subName).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -818,7 +830,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessSend = sf.createSession(false, false, false); sessSend.addMetaData("data", RandomUtil.randomString()); - ClientProducer producer = sessSend.createProducer(MultiThreadRandomReattachTestBase.ADDRESS); + ClientProducer producer = sessSend.createProducer(ADDRESS); sendMessages(sessSend, producer, numMessages, threadNum); @@ -877,7 +889,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessConsume = sf.createSession(false, false, false); sessConsume.addMetaData("data", RandomUtil.randomString()); - sessConsume.createQueue(new QueueConfiguration(subName).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -889,7 +901,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessSend = sf.createSession(false, false, false); sessSend.addMetaData("data", RandomUtil.randomString()); - ClientProducer producer = sessSend.createProducer(MultiThreadRandomReattachTestBase.ADDRESS); + ClientProducer producer = sessSend.createProducer(ADDRESS); sendMessages(sessSend, producer, numMessages, threadNum); @@ -937,16 +949,16 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessCreate = sf.createSession(false, true, true); sessCreate.addMetaData("data", RandomUtil.randomString()); - sessCreate.createQueue(new QueueConfiguration(new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString())).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); + sessCreate.createQueue(new QueueConfiguration(new SimpleString(threadNum + ADDRESS.toString())).setAddress(ADDRESS).setDurable(false)); ClientSession sess = sf.createSession(false, true, true); sess.addMetaData("data", RandomUtil.randomString()); sess.start(); - ClientConsumer consumer = sess.createConsumer(new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString())); + ClientConsumer consumer = sess.createConsumer(new SimpleString(threadNum + ADDRESS.toString())); - ClientProducer producer = sess.createProducer(MultiThreadRandomReattachTestBase.ADDRESS); + ClientProducer producer = sess.createProducer(ADDRESS); ClientMessage message = sess.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); producer.send(message); @@ -959,7 +971,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt sess.close(); - sessCreate.deleteQueue(new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString())); + sessCreate.deleteQueue(new SimpleString(threadNum + ADDRESS.toString())); sessCreate.close(); } @@ -968,16 +980,16 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessCreate = sf.createSession(false, true, true); sessCreate.addMetaData("data", RandomUtil.randomString()); - sessCreate.createQueue(new QueueConfiguration(new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString())).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); + sessCreate.createQueue(new QueueConfiguration(new SimpleString(threadNum + ADDRESS.toString())).setAddress(ADDRESS).setDurable(false)); ClientSession sess = sf.createSession(false, true, true); sess.addMetaData("data", RandomUtil.randomString()); sess.start(); - ClientConsumer consumer = sess.createConsumer(new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString())); + ClientConsumer consumer = sess.createConsumer(new SimpleString(threadNum + ADDRESS.toString())); - ClientProducer producer = sess.createProducer(MultiThreadRandomReattachTestBase.ADDRESS); + ClientProducer producer = sess.createProducer(ADDRESS); ClientMessage message = sess.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); producer.send(message); @@ -990,7 +1002,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt sess.close(); - sessCreate.deleteQueue(new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString())); + sessCreate.deleteQueue(new SimpleString(threadNum + ADDRESS.toString())); sessCreate.close(); } @@ -999,17 +1011,17 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession s = sf.createSession(false, false, false); s.addMetaData("data", RandomUtil.randomString()); - s.createQueue(new QueueConfiguration(new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString())).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); + s.createQueue(new QueueConfiguration(new SimpleString(threadNum + ADDRESS.toString())).setAddress(ADDRESS).setDurable(false)); final int numConsumers = 100; for (int i = 0; i < numConsumers; i++) { - ClientConsumer consumer = s.createConsumer(new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString())); + ClientConsumer consumer = s.createConsumer(new SimpleString(threadNum + ADDRESS.toString())); consumer.close(); } - s.deleteQueue(new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString())); + s.deleteQueue(new SimpleString(threadNum + ADDRESS.toString())); s.close(); } @@ -1032,7 +1044,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt protected void doTestN(final ClientSessionFactory sf, final int threadNum) throws Exception { ClientSession sessCreate = sf.createSession(false, true, true); - sessCreate.createQueue(new QueueConfiguration(new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString())).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); + sessCreate.createQueue(new QueueConfiguration(new SimpleString(threadNum + ADDRESS.toString())).setAddress(ADDRESS).setDurable(false)); ClientSession sess = sf.createSession(false, true, true); sess.addMetaData("data", RandomUtil.randomString()); @@ -1043,9 +1055,9 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt sess.stop(); - ClientConsumer consumer = sess.createConsumer(new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString())); + ClientConsumer consumer = sess.createConsumer(new SimpleString(threadNum + ADDRESS.toString())); - ClientProducer producer = sess.createProducer(MultiThreadRandomReattachTestBase.ADDRESS); + ClientProducer producer = sess.createProducer(ADDRESS); ClientMessage message = sess.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); producer.send(message); @@ -1064,7 +1076,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt sess.close(); - sessCreate.deleteQueue(new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString())); + sessCreate.deleteQueue(new SimpleString(threadNum + ADDRESS.toString())); sessCreate.close(); } @@ -1072,13 +1084,13 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt protected void doTestO(final ClientSessionFactory sf, final int threadNum) throws Exception { ClientSession sessCreate = sf.createSession(false, true, true); - sessCreate.createQueue(new QueueConfiguration(new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString())).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); + sessCreate.createQueue(new QueueConfiguration(new SimpleString(threadNum + ADDRESS.toString())).setAddress(ADDRESS).setDurable(false)); ClientSession sess = sf.createSession(false, true, true); sess.start(); - ClientConsumer consumer = sess.createConsumer(new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString())); + ClientConsumer consumer = sess.createConsumer(new SimpleString(threadNum + ADDRESS.toString())); for (int i = 0; i < 100; i++) { Assert.assertNull(consumer.receiveImmediate()); @@ -1086,7 +1098,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt sess.close(); - sessCreate.deleteQueue(new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString())); + sessCreate.deleteQueue(new SimpleString(threadNum + ADDRESS.toString())); sessCreate.close(); } @@ -1095,10 +1107,6 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt return 60000; } - protected int getNumIterations() { - return 2; - } - protected int getNumThreads() { return 10; } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadReattachSupportTestBase.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadReattachSupportTestBase.java similarity index 100% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadReattachSupportTestBase.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadReattachSupportTestBase.java diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachTest.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachTestBase.java similarity index 91% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachTest.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachTestBase.java index 256deda15f..7c04706f17 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachTest.java +++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachTestBase.java @@ -52,7 +52,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.invoke.MethodHandles; -public class RandomReattachTest extends ActiveMQTestBase { +public abstract class RandomReattachTestBase extends ActiveMQTestBase { @Rule public RetryRule retryRule = new RetryRule(2); @@ -69,7 +69,7 @@ public class RandomReattachTest extends ActiveMQTestBase { private Timer timer; - + protected abstract int getNumIterations(); @Test public void testA() throws Exception { @@ -243,7 +243,7 @@ public class RandomReattachTest extends ActiveMQTestBase { sessConsume.start(); - sessConsume.createQueue(new QueueConfiguration(subName).setAddress(RandomReattachTest.ADDRESS).setDurable(false)); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -254,7 +254,7 @@ public class RandomReattachTest extends ActiveMQTestBase { ClientSession sessSend = sf.createSession(false, true, true); - ClientProducer producer = sessSend.createProducer(RandomReattachTest.ADDRESS); + ClientProducer producer = sessSend.createProducer(ADDRESS); for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); @@ -281,7 +281,7 @@ public class RandomReattachTest extends ActiveMQTestBase { try { message.acknowledge(); } catch (ActiveMQException me) { - RandomReattachTest.logger.error("Failed to process", me); + logger.error("Failed to process", me); } if (count == numMessages) { @@ -343,7 +343,7 @@ public class RandomReattachTest extends ActiveMQTestBase { ClientSession sessConsume = sf.createSession(false, true, true); - sessConsume.createQueue(new QueueConfiguration(subName).setAddress(RandomReattachTest.ADDRESS).setDurable(false)); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -354,7 +354,7 @@ public class RandomReattachTest extends ActiveMQTestBase { ClientSession sessSend = sf.createSession(false, true, true); - ClientProducer producer = sessSend.createProducer(RandomReattachTest.ADDRESS); + ClientProducer producer = sessSend.createProducer(ADDRESS); for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); @@ -445,7 +445,7 @@ public class RandomReattachTest extends ActiveMQTestBase { sessConsume.start(); - sessConsume.createQueue(new QueueConfiguration(subName).setAddress(RandomReattachTest.ADDRESS).setDurable(false)); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -456,7 +456,7 @@ public class RandomReattachTest extends ActiveMQTestBase { ClientSession sessSend = sf.createSession(false, false, true); - ClientProducer producer = sessSend.createProducer(RandomReattachTest.ADDRESS); + ClientProducer producer = sessSend.createProducer(ADDRESS); for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); @@ -583,7 +583,7 @@ public class RandomReattachTest extends ActiveMQTestBase { ClientSession sessConsume = sf.createSession(false, false, false); - sessConsume.createQueue(new QueueConfiguration(subName).setAddress(RandomReattachTest.ADDRESS).setDurable(false)); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -594,7 +594,7 @@ public class RandomReattachTest extends ActiveMQTestBase { ClientSession sessSend = sf.createSession(false, false, true); - ClientProducer producer = sessSend.createProducer(RandomReattachTest.ADDRESS); + ClientProducer producer = sessSend.createProducer(ADDRESS); for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); @@ -722,7 +722,7 @@ public class RandomReattachTest extends ActiveMQTestBase { sessConsume.start(); - sessConsume.createQueue(new QueueConfiguration(subName).setAddress(RandomReattachTest.ADDRESS).setDurable(false)); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -733,7 +733,7 @@ public class RandomReattachTest extends ActiveMQTestBase { ClientSession sessSend = sf.createSession(false, true, true); - ClientProducer producer = sessSend.createProducer(RandomReattachTest.ADDRESS); + ClientProducer producer = sessSend.createProducer(ADDRESS); for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); @@ -743,7 +743,7 @@ public class RandomReattachTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { for (ClientConsumer consumer : consumers) { - ClientMessage msg = consumer.receive(RandomReattachTest.RECEIVE_TIMEOUT); + ClientMessage msg = consumer.receive(RECEIVE_TIMEOUT); Assert.assertNotNull(msg); @@ -796,7 +796,7 @@ public class RandomReattachTest extends ActiveMQTestBase { ClientSession sessConsume = sf.createSession(false, true, true); - sessConsume.createQueue(new QueueConfiguration(subName).setAddress(RandomReattachTest.ADDRESS).setDurable(false)); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -807,7 +807,7 @@ public class RandomReattachTest extends ActiveMQTestBase { ClientSession sessSend = sf.createSession(false, true, true); - ClientProducer producer = sessSend.createProducer(RandomReattachTest.ADDRESS); + ClientProducer producer = sessSend.createProducer(ADDRESS); for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); @@ -821,7 +821,7 @@ public class RandomReattachTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { for (ClientConsumer consumer : consumers) { - ClientMessage msg = consumer.receive(RandomReattachTest.RECEIVE_TIMEOUT); + ClientMessage msg = consumer.receive(RECEIVE_TIMEOUT); if (msg == null) { throw new IllegalStateException("Failed to receive message " + i); @@ -882,7 +882,7 @@ public class RandomReattachTest extends ActiveMQTestBase { sessConsume.start(); - sessConsume.createQueue(new QueueConfiguration(subName).setAddress(RandomReattachTest.ADDRESS).setDurable(false)); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -893,7 +893,7 @@ public class RandomReattachTest extends ActiveMQTestBase { ClientSession sessSend = sf.createSession(false, false, false); - ClientProducer producer = sessSend.createProducer(RandomReattachTest.ADDRESS); + ClientProducer producer = sessSend.createProducer(ADDRESS); for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); @@ -913,7 +913,7 @@ public class RandomReattachTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { for (ClientConsumer consumer : consumers) { - ClientMessage msg = consumer.receive(RandomReattachTest.RECEIVE_TIMEOUT); + ClientMessage msg = consumer.receive(RECEIVE_TIMEOUT); Assert.assertNotNull(msg); @@ -935,7 +935,7 @@ public class RandomReattachTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { for (ClientConsumer consumer : consumers) { - ClientMessage msg = consumer.receive(RandomReattachTest.RECEIVE_TIMEOUT); + ClientMessage msg = consumer.receive(RECEIVE_TIMEOUT); Assert.assertNotNull(msg); @@ -992,7 +992,7 @@ public class RandomReattachTest extends ActiveMQTestBase { ClientSession sessConsume = sf.createSession(false, false, false); - sessConsume.createQueue(new QueueConfiguration(subName).setAddress(RandomReattachTest.ADDRESS).setDurable(false)); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -1003,7 +1003,7 @@ public class RandomReattachTest extends ActiveMQTestBase { ClientSession sessSend = sf.createSession(false, false, false); - ClientProducer producer = sessSend.createProducer(RandomReattachTest.ADDRESS); + ClientProducer producer = sessSend.createProducer(ADDRESS); for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); @@ -1027,7 +1027,7 @@ public class RandomReattachTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { for (ClientConsumer consumer : consumers) { - ClientMessage msg = consumer.receive(RandomReattachTest.RECEIVE_TIMEOUT); + ClientMessage msg = consumer.receive(RECEIVE_TIMEOUT); Assert.assertNotNull(msg); @@ -1051,7 +1051,7 @@ public class RandomReattachTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { for (ClientConsumer consumer : consumers) { - ClientMessage msg = consumer.receive(RandomReattachTest.RECEIVE_TIMEOUT); + ClientMessage msg = consumer.receive(RECEIVE_TIMEOUT); Assert.assertNotNull(msg); @@ -1094,20 +1094,20 @@ public class RandomReattachTest extends ActiveMQTestBase { protected void doTestI(final ClientSessionFactory sf) throws Exception { ClientSession sessCreate = sf.createSession(false, true, true); - sessCreate.createQueue(new QueueConfiguration(RandomReattachTest.ADDRESS).setDurable(false)); + sessCreate.createQueue(new QueueConfiguration(ADDRESS).setDurable(false)); ClientSession sess = sf.createSession(false, true, true); sess.start(); - ClientConsumer consumer = sess.createConsumer(RandomReattachTest.ADDRESS); + ClientConsumer consumer = sess.createConsumer(ADDRESS); - ClientProducer producer = sess.createProducer(RandomReattachTest.ADDRESS); + ClientProducer producer = sess.createProducer(ADDRESS); ClientMessage message = sess.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); producer.send(message); - ClientMessage message2 = consumer.receive(RandomReattachTest.RECEIVE_TIMEOUT); + ClientMessage message2 = consumer.receive(RECEIVE_TIMEOUT); Assert.assertNotNull(message2); @@ -1115,7 +1115,7 @@ public class RandomReattachTest extends ActiveMQTestBase { sess.close(); - sessCreate.deleteQueue(RandomReattachTest.ADDRESS); + sessCreate.deleteQueue(ADDRESS); sessCreate.close(); } @@ -1123,20 +1123,20 @@ public class RandomReattachTest extends ActiveMQTestBase { protected void doTestJ(final ClientSessionFactory sf) throws Exception { ClientSession sessCreate = sf.createSession(false, true, true); - sessCreate.createQueue(new QueueConfiguration(RandomReattachTest.ADDRESS).setDurable(false)); + sessCreate.createQueue(new QueueConfiguration(ADDRESS).setDurable(false)); ClientSession sess = sf.createSession(false, true, true); sess.start(); - ClientConsumer consumer = sess.createConsumer(RandomReattachTest.ADDRESS); + ClientConsumer consumer = sess.createConsumer(ADDRESS); - ClientProducer producer = sess.createProducer(RandomReattachTest.ADDRESS); + ClientProducer producer = sess.createProducer(ADDRESS); ClientMessage message = sess.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); producer.send(message); - ClientMessage message2 = consumer.receive(RandomReattachTest.RECEIVE_TIMEOUT); + ClientMessage message2 = consumer.receive(RECEIVE_TIMEOUT); Assert.assertNotNull(message2); @@ -1144,7 +1144,7 @@ public class RandomReattachTest extends ActiveMQTestBase { sess.close(); - sessCreate.deleteQueue(RandomReattachTest.ADDRESS); + sessCreate.deleteQueue(ADDRESS); sessCreate.close(); } @@ -1152,17 +1152,17 @@ public class RandomReattachTest extends ActiveMQTestBase { protected void doTestK(final ClientSessionFactory sf) throws Exception { ClientSession s = sf.createSession(false, false, false); - s.createQueue(new QueueConfiguration(RandomReattachTest.ADDRESS).setDurable(false)); + s.createQueue(new QueueConfiguration(ADDRESS).setDurable(false)); final int numConsumers = 100; for (int i = 0; i < numConsumers; i++) { - ClientConsumer consumer = s.createConsumer(RandomReattachTest.ADDRESS); + ClientConsumer consumer = s.createConsumer(ADDRESS); consumer.close(); } - s.deleteQueue(RandomReattachTest.ADDRESS); + s.deleteQueue(ADDRESS); s.close(); } @@ -1180,7 +1180,7 @@ public class RandomReattachTest extends ActiveMQTestBase { protected void doTestN(final ClientSessionFactory sf) throws Exception { ClientSession sessCreate = sf.createSession(false, true, true); - sessCreate.createQueue(new QueueConfiguration(new SimpleString(RandomReattachTest.ADDRESS.toString())).setAddress(RandomReattachTest.ADDRESS).setDurable(false)); + sessCreate.createQueue(new QueueConfiguration(new SimpleString(ADDRESS.toString())).setAddress(ADDRESS).setDurable(false)); ClientSession sess = sf.createSession(false, true, true); @@ -1190,16 +1190,16 @@ public class RandomReattachTest extends ActiveMQTestBase { sess.stop(); - ClientConsumer consumer = sess.createConsumer(new SimpleString(RandomReattachTest.ADDRESS.toString())); + ClientConsumer consumer = sess.createConsumer(new SimpleString(ADDRESS.toString())); - ClientProducer producer = sess.createProducer(RandomReattachTest.ADDRESS); + ClientProducer producer = sess.createProducer(ADDRESS); ClientMessage message = sess.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); producer.send(message); sess.start(); - ClientMessage message2 = consumer.receive(RandomReattachTest.RECEIVE_TIMEOUT); + ClientMessage message2 = consumer.receive(RECEIVE_TIMEOUT); Assert.assertNotNull(message2); @@ -1211,15 +1211,11 @@ public class RandomReattachTest extends ActiveMQTestBase { sess.close(); - sessCreate.deleteQueue(new SimpleString(RandomReattachTest.ADDRESS.toString())); + sessCreate.deleteQueue(new SimpleString(ADDRESS.toString())); sessCreate.close(); } - protected int getNumIterations() { - return 2; - } - @Override @Before public void setUp() throws Exception { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/largemessage/LargeMessageTestBase.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/largemessage/LargeMessageTestBase.java similarity index 100% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/largemessage/LargeMessageTestBase.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/largemessage/LargeMessageTestBase.java diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/DummyTransaction.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/ra/DummyTransaction.java similarity index 100% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/DummyTransaction.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/ra/DummyTransaction.java diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/DummyTransactionManager.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/ra/DummyTransactionManager.java similarity index 100% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/DummyTransactionManager.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/ra/DummyTransactionManager.java diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedVMCheck.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/rules/SpawnedVMCheck.java similarity index 96% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedVMCheck.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/rules/SpawnedVMCheck.java index 0cfe20fdfb..90731ae729 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedVMCheck.java +++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/rules/SpawnedVMCheck.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.activemq.artemis.tests.util; +package org.apache.activemq.artemis.tests.rules; import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.junit.rules.ExternalResource; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/fakes/FakeConnectorService.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/config/impl/fakes/FakeConnectorService.java similarity index 100% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/fakes/FakeConnectorService.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/config/impl/fakes/FakeConnectorService.java diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/fakes/FakeConnectorServiceFactory.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/config/impl/fakes/FakeConnectorServiceFactory.java similarity index 100% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/fakes/FakeConnectorServiceFactory.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/config/impl/fakes/FakeConnectorServiceFactory.java diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java similarity index 100% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestUnit.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestUnit.java similarity index 100% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestUnit.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestUnit.java diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java similarity index 100% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java similarity index 100% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/fakes/SimpleEncoding.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/fakes/SimpleEncoding.java similarity index 100% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/fakes/SimpleEncoding.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/fakes/SimpleEncoding.java diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/FakeQueue.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/fakes/FakeQueue.java similarity index 99% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/FakeQueue.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/fakes/FakeQueue.java index 839ecd5740..580d9e8ed9 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/FakeQueue.java +++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/fakes/FakeQueue.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.tests.unit.core.postoffice.impl; +package org.apache.activemq.artemis.tests.unit.core.postoffice.impl.fakes; import java.util.List; import java.util.Map; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeConsumer.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeConsumer.java similarity index 100% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeConsumer.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeConsumer.java diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeFilter.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeFilter.java similarity index 100% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeFilter.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeFilter.java diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeJournalLoader.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeJournalLoader.java similarity index 100% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeJournalLoader.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeJournalLoader.java diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakePostOffice.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakePostOffice.java similarity index 100% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakePostOffice.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakePostOffice.java diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeQueueFactory.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeQueueFactory.java similarity index 100% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeQueueFactory.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeQueueFactory.java diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/BootstrapContext.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/ra/BootstrapContext.java similarity index 100% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/BootstrapContext.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/ra/BootstrapContext.java diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/MessageEndpointFactory.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/ra/MessageEndpointFactory.java similarity index 100% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/MessageEndpointFactory.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/ra/MessageEndpointFactory.java diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/InVMContext.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/util/InVMContext.java similarity index 100% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/InVMContext.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/util/InVMContext.java diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/InVMNameParser.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/util/InVMNameParser.java similarity index 100% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/InVMNameParser.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/util/InVMNameParser.java diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/InVMNamingContext.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/util/InVMNamingContext.java similarity index 100% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/InVMNamingContext.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/util/InVMNamingContext.java diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/NonSerializableFactory.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/util/NonSerializableFactory.java similarity index 100% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/NonSerializableFactory.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/util/NonSerializableFactory.java diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSTestBase.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/JMSTestBase.java similarity index 100% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSTestBase.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/JMSTestBase.java diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/RandomUtil.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/RandomUtil.java similarity index 100% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/RandomUtil.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/RandomUtil.java diff --git a/tests/compatibility-tests/pom.xml b/tests/compatibility-tests/pom.xml index 2cde05ffa0..108e885af6 100644 --- a/tests/compatibility-tests/pom.xml +++ b/tests/compatibility-tests/pom.xml @@ -142,12 +142,6 @@ - - org.apache.activemq - artemis-junit - ${project.version} - test - org.apache.activemq activemq-client diff --git a/tests/integration-tests/pom.xml b/tests/integration-tests/pom.xml index 614d0d422e..0cf512d1ef 100644 --- a/tests/integration-tests/pom.xml +++ b/tests/integration-tests/pom.xml @@ -45,13 +45,6 @@ ${project.version} test - - org.apache.activemq.tests - unit-tests - ${project.version} - test - test-jar - org.apache.activemq artemis-jms-client @@ -475,18 +468,6 @@ - - org.apache.maven.plugins - maven-jar-plugin - - - test - - test-jar - - - - org.apache.maven.plugins maven-surefire-plugin diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpTestSupport.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpTestSupport.java index c06a2ab0ea..7d665f3f0b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpTestSupport.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpTestSupport.java @@ -22,17 +22,12 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.Map; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants; import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.protocol.amqp.broker.AMQPStandardMessage; -import org.apache.activemq.artemis.protocol.amqp.util.NettyWritable; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.transport.amqp.client.AmqpClient; import org.apache.activemq.transport.amqp.client.AmqpConnection; -import org.apache.qpid.proton.message.impl.MessageImpl; import org.junit.After; /** @@ -163,17 +158,6 @@ public class AmqpTestSupport extends ActiveMQTestBase { return new AmqpClient(brokerURI, username, password); } - public static AMQPStandardMessage encodeAndDecodeMessage(int messageFormat, MessageImpl message, int expectedSize) { - ByteBuf nettyBuffer = Unpooled.buffer(expectedSize); - - message.encode(new NettyWritable(nettyBuffer)); - byte[] bytes = new byte[nettyBuffer.writerIndex()]; - nettyBuffer.readBytes(bytes); - - return new AMQPStandardMessage(messageFormat, bytes, null); - } - - protected ActiveMQServer createServer(int port, boolean start) throws Exception { final ActiveMQServer server = this.createServer(true, true); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientCrashTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientCrashTest.java index 3e544921cf..35b5513246 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientCrashTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientCrashTest.java @@ -29,7 +29,7 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage; -import org.apache.activemq.artemis.tests.util.SpawnedVMCheck; +import org.apache.activemq.artemis.tests.rules.SpawnedVMCheck; import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.junit.After; import org.junit.Assert; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTest.java index d316e9ff01..0ad7fee283 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTest.java @@ -16,34 +16,10 @@ */ package org.apache.activemq.artemis.tests.integration.cluster.reattach; -import org.apache.activemq.artemis.api.core.RoutingType; -import org.apache.activemq.artemis.api.core.client.ClientMessage; -import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.CoreAddressConfiguration; - -/** - * A MultiThreadRandomReattachTest - */ public class MultiThreadRandomReattachTest extends MultiThreadRandomReattachTestBase { @Override - protected void start() throws Exception { - Configuration primaryConf = createDefaultInVMConfig(); - server = createServer(false, primaryConf); - server.getConfiguration().getAddressConfigurations().add(new CoreAddressConfiguration().setName(ADDRESS.toString()).addRoutingType(RoutingType.MULTICAST)); - server.start(); - waitForServerToStart(server); + protected int getNumIterations() { + return 2; } - - @Override - protected void setBody(final ClientMessage message) throws Exception { - // Give each msg a body - message.getBodyBuffer().writeBytes(new byte[250]); - } - - @Override - protected boolean checkSize(final ClientMessage message) { - return message.getBodyBuffer().readableBytes() == 250; - } - } diff --git a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/util/UUIDTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachIntegrationTest.java similarity index 53% rename from tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/util/UUIDTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachIntegrationTest.java index 4d140ed937..a466f43a39 100644 --- a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/util/UUIDTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachIntegrationTest.java @@ -14,26 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.tests.timing.util; +package org.apache.activemq.artemis.tests.integration.cluster.reattach; -import org.apache.activemq.artemis.utils.UUIDGenerator; - -public class UUIDTest extends org.apache.activemq.artemis.tests.unit.util.UUIDTest { - - - public static void main(String[] args) { - long start = System.currentTimeMillis(); - int count = 10000; - for (int i = 0; i < count; i++) { - // System.out.println(i + " " + UUIDGenerator.asString(UUIDGenerator.getHardwareAddress())); - byte[] address = UUIDGenerator.getHardwareAddress(); - } - long end = System.currentTimeMillis(); - System.out.println("getHardwareAddress() => " + 1.0 * (end - start) / count + " ms"); - } +public class RandomReattachIntegrationTest extends RandomReattachTestBase { @Override - protected int getTimes() { - return 1000000; + protected int getNumIterations() { + return 2; } } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTest.java index 494cf97fe8..7f3d7493f4 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTest.java @@ -58,8 +58,8 @@ import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; import org.apache.activemq.artemis.jms.client.ActiveMQDestination; -import org.apache.activemq.artemis.tests.unit.core.postoffice.impl.FakeQueue; import org.apache.activemq.artemis.tests.util.Wait; +import org.apache.activemq.artemis.tests.unit.core.postoffice.impl.fakes.FakeQueue; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.utils.ReusableLatch; import org.junit.Assert; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementServiceImplTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementServiceImplTest.java index d7640c9735..83a284cfa1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementServiceImplTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementServiceImplTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.core.server.management.impl.ManagementServiceImpl; import org.apache.activemq.artemis.reader.MessageUtil; import org.apache.activemq.artemis.tests.integration.server.FakeStorageManager; -import org.apache.activemq.artemis.tests.unit.core.postoffice.impl.FakeQueue; +import org.apache.activemq.artemis.tests.unit.core.postoffice.impl.fakes.FakeQueue; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.utils.RandomUtil; import org.apache.activemq.artemis.utils.UUID; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java index 6dee0eb7dd..db1e62ed6e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java @@ -32,7 +32,7 @@ import org.apache.activemq.artemis.core.persistence.QueueBindingInfo; import org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager; import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.impl.PostOfficeJournalLoader; -import org.apache.activemq.artemis.tests.unit.core.postoffice.impl.FakeQueue; +import org.apache.activemq.artemis.tests.unit.core.postoffice.impl.fakes.FakeQueue; import org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakePostOffice; import org.apache.activemq.artemis.utils.critical.EmptyCriticalAnalyzer; import org.junit.Assert; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityTest.java index 3526c3cec8..863005bf41 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityTest.java @@ -63,6 +63,7 @@ import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.core.settings.HierarchicalRepository; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; +import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager; import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager; @@ -72,7 +73,6 @@ import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager4; import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager5; import org.apache.activemq.artemis.spi.core.security.jaas.NoCacheLoginException; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; -import org.apache.activemq.artemis.tests.util.CreateMessage; import org.apache.activemq.artemis.utils.CompositeAddress; import org.apache.activemq.artemis.utils.SensitiveDataCodec; import org.apache.activemq.artemis.utils.Wait; @@ -1749,8 +1749,8 @@ public class SecurityTest extends ActiveMQTestBase { ClientSession sendingSession = cf.createSession("auser", "pass", false, false, false, false, 0); ClientProducer prod = sendingSession.createProducer(SecurityTest.addressA); - prod.send(CreateMessage.createTextMessage(sendingSession, "Test", true)); - prod.send(CreateMessage.createTextMessage(sendingSession, "Test", true)); + prod.send(createClientMessage(sendingSession, "Test", true)); + prod.send(createClientMessage(sendingSession, "Test", true)); try { sendingSession.commit(); Assert.fail("Expected exception"); @@ -1766,8 +1766,8 @@ public class SecurityTest extends ActiveMQTestBase { sendingSession.start(xid, XAResource.TMNOFLAGS); prod = sendingSession.createProducer(SecurityTest.addressA); - prod.send(CreateMessage.createTextMessage(sendingSession, "Test", true)); - prod.send(CreateMessage.createTextMessage(sendingSession, "Test", true)); + prod.send(createClientMessage(sendingSession, "Test", true)); + prod.send(createClientMessage(sendingSession, "Test", true)); sendingSession.end(xid, XAResource.TMSUCCESS); try { @@ -1788,6 +1788,12 @@ public class SecurityTest extends ActiveMQTestBase { sendingSession.close(); } + private static ClientMessage createClientMessage(final ClientSession session, final String s, final boolean durable) { + ClientMessage message = session.createMessage(ActiveMQTextMessage.TYPE, durable, 0, System.currentTimeMillis(), (byte) 1); + message.getBodyBuffer().writeString(s); + return message; + } + @Test public void testSendManagementWithRole() throws Exception { ActiveMQServer server = createServer(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedTestBase.java index d8a96c0f3e..334a371b73 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedTestBase.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.util; +import org.apache.activemq.artemis.tests.rules.SpawnedVMCheck; import org.junit.Rule; public class SpawnedTestBase extends ActiveMQTestBase { diff --git a/tests/jms-tests/pom.xml b/tests/jms-tests/pom.xml index ce5f7dd4df..f5a2e631de 100644 --- a/tests/jms-tests/pom.xml +++ b/tests/jms-tests/pom.xml @@ -57,11 +57,6 @@ artemis-server ${project.version} - - org.apache.activemq - artemis-junit - ${project.version} - junit junit diff --git a/tests/joram-tests/pom.xml b/tests/joram-tests/pom.xml index 2a9560d532..76c18d6ad2 100644 --- a/tests/joram-tests/pom.xml +++ b/tests/joram-tests/pom.xml @@ -32,14 +32,6 @@ - - org.apache.activemq.tests - unit-tests - ${project.version} - test - test-jar - - org.apache.activemq artemis-amqp-protocol @@ -114,6 +106,12 @@ ${project.version} test + + org.apache.activemq.tests + artemis-test-support + ${project.version} + test + diff --git a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/amqpJMS/JoramAMQPAggregationTest.java b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/amqpJMS/JoramAMQPAggregationTest.java index 2d1e95b55f..a703e75b59 100644 --- a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/amqpJMS/JoramAMQPAggregationTest.java +++ b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/amqpJMS/JoramAMQPAggregationTest.java @@ -19,7 +19,7 @@ package org.apache.activemq.artemis.amqpJMS; import java.io.IOException; import java.util.Properties; -import org.apache.activemq.artemis.tests.util.SpawnedVMCheck; +import org.apache.activemq.artemis.tests.rules.SpawnedVMCheck; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/JoramCoreAggregationTest.java b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/JoramCoreAggregationTest.java index 64690f54de..9875b493db 100644 --- a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/JoramCoreAggregationTest.java +++ b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/JoramCoreAggregationTest.java @@ -19,7 +19,7 @@ package org.apache.activemq.artemis.jms; import java.io.IOException; import java.util.Properties; -import org.apache.activemq.artemis.tests.util.SpawnedVMCheck; +import org.apache.activemq.artemis.tests.rules.SpawnedVMCheck; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/tests/performance-tests/pom.xml b/tests/performance-tests/pom.xml index 49e0f42731..77ac404ba8 100644 --- a/tests/performance-tests/pom.xml +++ b/tests/performance-tests/pom.xml @@ -62,20 +62,6 @@ artemis-commons ${project.version} - - org.apache.activemq.tests - unit-tests - ${project.version} - test - test-jar - - - org.apache.activemq.tests - integration-tests - ${project.version} - test - test-jar - org.apache.activemq artemis-jms-client diff --git a/tests/soak-tests/pom.xml b/tests/soak-tests/pom.xml index 956bcc74a6..70aebe5297 100644 --- a/tests/soak-tests/pom.xml +++ b/tests/soak-tests/pom.xml @@ -108,13 +108,6 @@ ${project.version} test - - org.apache.activemq.tests - integration-tests - ${project.version} - test - test-jar - org.apache.activemq activemq-client @@ -176,7 +169,6 @@ jakarta.json-api test - diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/brokerConnection/mirror/IdempotentACKTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/brokerConnection/mirror/IdempotentACKTest.java index c6d89c5ca7..f8b0c41313 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/brokerConnection/mirror/IdempotentACKTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/brokerConnection/mirror/IdempotentACKTest.java @@ -41,8 +41,8 @@ import org.apache.activemq.artemis.api.core.management.SimpleManagement; import org.apache.activemq.artemis.core.config.amqpBrokerConnectivity.AMQPBrokerConnectionAddressType; import org.apache.activemq.artemis.tests.soak.SoakTestBase; import org.apache.activemq.artemis.tests.util.CFUtil; -import org.apache.activemq.artemis.tests.util.Wait; import org.apache.activemq.artemis.util.ServerUtil; +import org.apache.activemq.artemis.utils.Wait; import org.apache.activemq.artemis.utils.cli.helper.HelperCreate; import org.junit.Assert; import org.junit.Before; diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/brokerConnection/mirror/InterruptedLargeMessageTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/brokerConnection/mirror/InterruptedLargeMessageTest.java index 25f060e5ad..8cffd6126a 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/brokerConnection/mirror/InterruptedLargeMessageTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/brokerConnection/mirror/InterruptedLargeMessageTest.java @@ -42,8 +42,8 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.tests.soak.SoakTestBase; import org.apache.activemq.artemis.tests.util.CFUtil; -import org.apache.activemq.artemis.tests.util.Wait; import org.apache.activemq.artemis.util.ServerUtil; +import org.apache.activemq.artemis.utils.Wait; import org.apache.activemq.artemis.utils.cli.helper.HelperCreate; import org.junit.Assert; import org.junit.Before; diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/brokerConnection/mirror/MirroredTopicSoakTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/brokerConnection/mirror/MirroredTopicSoakTest.java index b44c2685e6..d39fbf73ae 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/brokerConnection/mirror/MirroredTopicSoakTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/brokerConnection/mirror/MirroredTopicSoakTest.java @@ -34,8 +34,8 @@ import org.apache.activemq.artemis.api.core.management.SimpleManagement; import org.apache.activemq.artemis.core.config.amqpBrokerConnectivity.AMQPBrokerConnectionAddressType; import org.apache.activemq.artemis.tests.soak.SoakTestBase; import org.apache.activemq.artemis.tests.util.CFUtil; -import org.apache.activemq.artemis.tests.util.Wait; import org.apache.activemq.artemis.util.ServerUtil; +import org.apache.activemq.artemis.utils.Wait; import org.apache.activemq.artemis.utils.cli.helper.HelperCreate; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/clientFailure/ClientFailureSoakTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/clientFailure/ClientFailureSoakTest.java index 2be261258d..ef16da818e 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/clientFailure/ClientFailureSoakTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/clientFailure/ClientFailureSoakTest.java @@ -42,8 +42,8 @@ import org.apache.activemq.RedeliveryPolicy; import org.apache.activemq.artemis.api.core.management.SimpleManagement; import org.apache.activemq.artemis.tests.soak.SoakTestBase; import org.apache.activemq.artemis.tests.util.CFUtil; -import org.apache.activemq.artemis.tests.util.Wait; import org.apache.activemq.artemis.utils.SpawnedVMSupport; +import org.apache.activemq.artemis.utils.Wait; import org.apache.activemq.artemis.utils.cli.helper.HelperCreate; import org.junit.Assert; import org.junit.Assume; diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/failover/RandomFailoverSoakTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/failover/RandomFailoverSoakTest.java index b37ca0aadc..4e3d9d6a3e 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/failover/RandomFailoverSoakTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/failover/RandomFailoverSoakTest.java @@ -16,11 +16,11 @@ */ package org.apache.activemq.artemis.tests.soak.failover; -import org.apache.activemq.artemis.tests.integration.cluster.reattach.RandomReattachTest; +import org.apache.activemq.artemis.tests.integration.cluster.reattach.RandomReattachTestBase; import static org.apache.activemq.artemis.utils.TestParameters.testProperty; -public class RandomFailoverSoakTest extends RandomReattachTest { +public class RandomFailoverSoakTest extends RandomReattachTestBase { private static final String TEST_NAME = "RANDOM"; public static final int TEST_REPETITION = testProperty(TEST_NAME, "TEST_REPETITION", 10); diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/interrupt/JournalFlushInterruptTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/interrupt/JournalFlushInterruptTest.java index e354492398..e0cb69ab49 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/interrupt/JournalFlushInterruptTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/interrupt/JournalFlushInterruptTest.java @@ -31,7 +31,7 @@ import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; import org.apache.activemq.artemis.api.core.management.QueueControl; import org.apache.activemq.artemis.tests.soak.SoakTestBase; import org.apache.activemq.artemis.tests.util.CFUtil; -import org.apache.activemq.artemis.tests.util.Wait; +import org.apache.activemq.artemis.utils.Wait; import org.apache.activemq.artemis.utils.cli.helper.HelperCreate; import org.junit.Assert; import org.junit.Before; diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/interruptlm/ClusteredLargeMessageInterruptTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/interruptlm/ClusteredLargeMessageInterruptTest.java index 6ddc655970..a938ee821e 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/interruptlm/ClusteredLargeMessageInterruptTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/interruptlm/ClusteredLargeMessageInterruptTest.java @@ -39,7 +39,7 @@ import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; import org.apache.activemq.artemis.api.core.management.QueueControl; import org.apache.activemq.artemis.tests.soak.SoakTestBase; import org.apache.activemq.artemis.tests.util.CFUtil; -import org.apache.activemq.artemis.tests.util.Wait; +import org.apache.activemq.artemis.utils.Wait; import org.apache.activemq.artemis.utils.cli.helper.HelperCreate; import org.junit.Assert; import org.junit.Before; diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/interruptlm/LargeMessageFrozenTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/interruptlm/LargeMessageFrozenTest.java index c629a7ee5a..b4e100687a 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/interruptlm/LargeMessageFrozenTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/interruptlm/LargeMessageFrozenTest.java @@ -38,7 +38,7 @@ import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.CFUtil; import org.apache.activemq.artemis.tests.util.TcpProxy; -import org.apache.activemq.artemis.tests.util.Wait; +import org.apache.activemq.artemis.utils.Wait; import org.apache.qpid.jms.JmsConnectionFactory; import org.junit.Assert; import org.junit.Before; diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/interruptlm/LargeMessageInterruptTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/interruptlm/LargeMessageInterruptTest.java index e8b99d61c9..d7bc41604f 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/interruptlm/LargeMessageInterruptTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/interruptlm/LargeMessageInterruptTest.java @@ -38,7 +38,7 @@ import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; import org.apache.activemq.artemis.api.core.management.QueueControl; import org.apache.activemq.artemis.tests.soak.SoakTestBase; import org.apache.activemq.artemis.tests.util.CFUtil; -import org.apache.activemq.artemis.tests.util.Wait; +import org.apache.activemq.artemis.utils.Wait; import org.apache.activemq.artemis.utils.cli.helper.HelperCreate; import org.junit.Assert; import org.junit.Before; diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/paging/MegaCleanerPagingTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/paging/MegaCleanerPagingTest.java index 9ddd864847..3c7cdb9e96 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/paging/MegaCleanerPagingTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/paging/MegaCleanerPagingTest.java @@ -40,8 +40,8 @@ import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.logs.AssertionLoggerHandler; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.CFUtil; -import org.apache.activemq.artemis.tests.util.Wait; import org.apache.activemq.artemis.utils.SpawnedVMSupport; +import org.apache.activemq.artemis.utils.Wait; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; diff --git a/tests/stress-tests/pom.xml b/tests/stress-tests/pom.xml index c8ed419acf..3dc3da8078 100644 --- a/tests/stress-tests/pom.xml +++ b/tests/stress-tests/pom.xml @@ -86,26 +86,12 @@ ${project.version} test - - org.apache.activemq.tests - unit-tests - ${project.version} - test - test-jar - org.apache.activemq.tests artemis-test-support ${project.version} test - - org.apache.activemq.tests - integration-tests - ${project.version} - test - test-jar - org.apache.activemq artemis-cli diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/failover/MultiThreadRandomReattachStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/failover/MultiThreadRandomReattachStressTest.java index 91683fadfe..84903f6683 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/failover/MultiThreadRandomReattachStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/failover/MultiThreadRandomReattachStressTest.java @@ -16,9 +16,9 @@ */ package org.apache.activemq.artemis.tests.stress.failover; -import org.apache.activemq.artemis.tests.integration.cluster.reattach.MultiThreadRandomReattachTest; +import org.apache.activemq.artemis.tests.integration.cluster.reattach.MultiThreadRandomReattachTestBase; -public class MultiThreadRandomReattachStressTest extends MultiThreadRandomReattachTest { +public class MultiThreadRandomReattachStressTest extends MultiThreadRandomReattachTestBase { @Override protected int getNumIterations() { diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/failover/RandomReattachStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/failover/RandomReattachStressTest.java index 4ab38036e2..2cea3f46b6 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/failover/RandomReattachStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/failover/RandomReattachStressTest.java @@ -16,9 +16,9 @@ */ package org.apache.activemq.artemis.tests.stress.failover; -import org.apache.activemq.artemis.tests.integration.cluster.reattach.RandomReattachTest; +import org.apache.activemq.artemis.tests.integration.cluster.reattach.RandomReattachTestBase; -public class RandomReattachStressTest extends RandomReattachTest { +public class RandomReattachStressTest extends RandomReattachTestBase { diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java index 2409858258..e01cc5d1c8 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java @@ -47,7 +47,7 @@ import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.transaction.Transaction; import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl; import org.apache.activemq.artemis.selector.filter.Filterable; -import org.apache.activemq.artemis.tests.unit.core.postoffice.impl.FakeQueue; +import org.apache.activemq.artemis.tests.unit.core.postoffice.impl.fakes.FakeQueue; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.utils.RandomUtil; import org.apache.activemq.artemis.utils.collections.LinkedListIterator; diff --git a/tests/timing-tests/pom.xml b/tests/timing-tests/pom.xml index 7331da1c4e..649f2f8461 100644 --- a/tests/timing-tests/pom.xml +++ b/tests/timing-tests/pom.xml @@ -33,11 +33,6 @@ - - org.slf4j - slf4j-api - test - org.apache.activemq artemis-core-client @@ -74,13 +69,6 @@ ${project.version} test - - org.apache.activemq.tests - unit-tests - ${project.version} - test - test-jar - org.apache.activemq artemis-jms-client @@ -114,6 +102,16 @@ jakarta.jms-api test + + org.slf4j + slf4j-api + test + + + org.apache.logging.log4j + log4j-slf4j2-impl + test + diff --git a/tests/unit-tests/pom.xml b/tests/unit-tests/pom.xml index 769d507ae0..8cc54ad1e6 100644 --- a/tests/unit-tests/pom.xml +++ b/tests/unit-tests/pom.xml @@ -147,8 +147,6 @@ log4j-slf4j2-impl test - - org.apache.activemq artemis-commons @@ -228,18 +226,6 @@ - - org.apache.maven.plugins - maven-jar-plugin - - - test - - test-jar - - - - org.apache.maven.plugins maven-surefire-plugin diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/paging/AmqpPageTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/AmqpPageTest.java similarity index 82% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/paging/AmqpPageTest.java rename to tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/AmqpPageTest.java index 4e7823695c..4196a9d49a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/paging/AmqpPageTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/AmqpPageTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.tests.integration.amqp.paging; +package org.apache.activemq.artemis.tests.unit.core.paging.impl; import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.SimpleString; @@ -23,11 +23,13 @@ import org.apache.activemq.artemis.core.paging.impl.PagedMessageImpl; import org.apache.activemq.artemis.core.persistence.StorageManager; import org.apache.activemq.artemis.protocol.amqp.broker.AMQPLargeMessage; import org.apache.activemq.artemis.protocol.amqp.broker.AMQPStandardMessage; -import org.apache.activemq.artemis.tests.integration.amqp.AmqpTestSupport; -import org.apache.activemq.artemis.tests.unit.core.paging.impl.PageTest; +import org.apache.activemq.artemis.protocol.amqp.util.NettyWritable; import org.apache.activemq.transport.amqp.client.AmqpMessage; import org.apache.qpid.proton.message.impl.MessageImpl; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + public class AmqpPageTest extends PageTest { private static MessageImpl createProtonMessage(String address, byte[] content) { @@ -41,7 +43,7 @@ public class AmqpPageTest extends PageTest { private static AMQPStandardMessage createStandardMessage(SimpleString address, long msgId, byte[] content) { MessageImpl protonMessage = createProtonMessage(address.toString(), content); - AMQPStandardMessage amqpMessage = AmqpTestSupport.encodeAndDecodeMessage(0, protonMessage, content.length + 1000); + AMQPStandardMessage amqpMessage = encodeAndDecodeMessage(0, protonMessage, content.length + 1000); amqpMessage.setMessageID(msgId); return amqpMessage; } @@ -74,4 +76,14 @@ public class AmqpPageTest extends PageTest { message.releaseResources(false, false); } } + + public static AMQPStandardMessage encodeAndDecodeMessage(int messageFormat, MessageImpl message, int expectedSize) { + ByteBuf nettyBuffer = Unpooled.buffer(expectedSize); + + message.encode(new NettyWritable(nettyBuffer)); + byte[] bytes = new byte[nettyBuffer.writerIndex()]; + nettyBuffer.readBytes(bytes); + + return new AMQPStandardMessage(messageFormat, bytes, null); + } } 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 1272ccff42..79bef75369 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 @@ -67,7 +67,7 @@ import org.apache.activemq.artemis.logs.AssertionLoggerHandler; import org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessagePersister; import org.apache.activemq.artemis.spi.core.protocol.MessagePersister; import org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.FakeSequentialFileFactory; -import org.apache.activemq.artemis.tests.unit.core.postoffice.impl.FakeQueue; +import org.apache.activemq.artemis.tests.unit.core.postoffice.impl.fakes.FakeQueue; import org.apache.activemq.artemis.tests.unit.util.FakePagingManager; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.utils.ActiveMQThreadFactory; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/BindingsImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/BindingsImplTest.java index 6502422af8..6de8b8236d 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/BindingsImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/BindingsImplTest.java @@ -45,6 +45,7 @@ import org.apache.activemq.artemis.core.server.impl.RoutingContextImpl; import org.apache.activemq.artemis.core.transaction.Transaction; import org.apache.activemq.artemis.core.transaction.TransactionOperation; import org.apache.activemq.artemis.selector.filter.Filterable; +import org.apache.activemq.artemis.tests.unit.core.postoffice.impl.fakes.FakeQueue; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.junit.Test; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/QueueComparatorTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/QueueComparatorTest.java index 9562f0d364..4df49bf559 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/QueueComparatorTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/QueueComparatorTest.java @@ -23,6 +23,7 @@ import java.util.List; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.impl.ScaleDownHandler; +import org.apache.activemq.artemis.tests.unit.core.postoffice.impl.fakes.FakeQueue; import org.junit.Assert; import org.junit.Test; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/cluster/impl/RemoteQueueBindImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/cluster/impl/RemoteQueueBindImplTest.java index cdeb4e42fd..743efe4d85 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/cluster/impl/RemoteQueueBindImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/cluster/impl/RemoteQueueBindImplTest.java @@ -24,7 +24,7 @@ import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType; import org.apache.activemq.artemis.core.server.cluster.impl.RemoteQueueBindingImpl; -import org.apache.activemq.artemis.tests.unit.core.postoffice.impl.FakeQueue; +import org.apache.activemq.artemis.tests.unit.core.postoffice.impl.fakes.FakeQueue; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.utils.RandomUtil; import org.junit.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 be63304543..6e148fc44c 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 @@ -18,7 +18,7 @@ package org.apache.activemq.artemis.tests.unit.core.util; import java.util.HashSet; -import org.apache.activemq.artemis.tests.util.SpawnedVMCheck; +import org.apache.activemq.artemis.tests.rules.SpawnedVMCheck; import org.apache.activemq.artemis.utils.RandomUtil; import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.junit.Assert; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/CreateMessage.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/CreateMessage.java deleted file mode 100644 index 6309ce15b6..0000000000 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/CreateMessage.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.artemis.tests.util; - -import org.apache.activemq.artemis.api.core.client.ClientMessage; -import org.apache.activemq.artemis.api.core.client.ClientSession; -import org.apache.activemq.artemis.jms.client.ActiveMQBytesMessage; -import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage; - -public final class CreateMessage { - - private CreateMessage() { - // Utility class - } - - public static ClientMessage createTextMessage(final String s, final ClientSession clientSession) { - ClientMessage message = clientSession.createMessage(ActiveMQTextMessage.TYPE, true, 0, System.currentTimeMillis(), (byte) 4); - message.getBodyBuffer().writeString(s); - return message; - } - - public static ClientMessage createBytesMessage(final ClientSession session, final byte[] b, final boolean durable) { - ClientMessage message = session.createMessage(ActiveMQBytesMessage.TYPE, durable, 0, System.currentTimeMillis(), (byte) 1); - message.getBodyBuffer().writeBytes(b); - return message; - } - - public static ClientMessage createTextMessage(final ClientSession session, final String s, final boolean durable) { - ClientMessage message = session.createMessage(ActiveMQTextMessage.TYPE, durable, 0, System.currentTimeMillis(), (byte) 1); - message.getBodyBuffer().writeString(s); - return message; - } - -}