From 2ab0e85db48964fdb45b47b7c7da3ea504943c56 Mon Sep 17 00:00:00 2001 From: Robbie Gemmell Date: Fri, 24 Jun 2022 18:09:13 +0100 Subject: [PATCH] ARTEMIS-3874: move/update various bits to allow removing many test-jar creations and dependencies --- artemis-cli/pom.xml | 20 +++---- ...iveMQDefaultConfigurationTestAccessor.java | 0 artemis-commons/pom.xml | 18 +++---- artemis-core-client/pom.xml | 20 +++---- .../activemq/artemis/util/XMLUtilTest.java | 2 +- artemis-jakarta-client/pom.xml | 7 --- artemis-jdbc-store/pom.xml | 13 +++-- artemis-jms-client/pom.xml | 7 --- artemis-quorum-ri/pom.xml | 25 +++------ artemis-rest/pom.xml | 14 +++-- artemis-server/pom.xml | 20 +++---- .../artemis/core/filter/impl/FilterTest.java | 2 +- .../core/server/impl/AdressInfoJSonTest.java | 2 +- .../utils/SimpleServerTestPasswordCodec.java | 45 ++++++++++++++++ .../critical/CriticalAnalyzerAccessor.java | 0 .../src/test/resources/login.config | 2 +- artemis-unit-test-support/pom.xml | 45 ++++++++++++++++ .../utils/CleanupSystemPropertiesRule.java | 2 +- .../activemq/artemis/utils/PortCheckRule.java | 0 .../activemq/artemis/utils/RetryMethod.java | 0 .../activemq/artemis/utils/RetryRule.java | 0 .../artemis/utils}/SilentTestCase.java | 2 +- .../artemis/utils/ThreadLeakCheckRule.java | 2 - .../apache/activemq/artemis/utils/Wait.java | 43 +++++++++++++-- artemis-web/pom.xml | 13 +++-- .../utils/SimpleWebTestPasswordCodec.java | 45 ++++++++++++++++ .../test/resources/bootstrap_web_codec.xml | 2 +- .../resources/bootstrap_web_old_config.xml | 2 +- pom.xml | 14 ++++- tests/activemq5-unit-tests/pom.xml | 20 +++---- tests/artemis-test-support/pom.xml | 53 ++++++++++++++++++- .../activemq/artemis/tests/util/CFUtil.java | 0 .../activemq/artemis/tests/util}/Jmx.java | 2 +- .../activemq/artemis/utils/ExecuteUtil.java | 0 .../artemis/utils/network/NetUtil.java | 0 .../utils/network/NetUtilResource.java | 0 tests/compatibility-tests/pom.xml | 44 +-------------- .../impl/nullpm/NullStorageAccessor.java | 0 tests/e2e-tests/pom.xml | 45 ++++------------ .../GCPauseSimulationTests.java | 2 +- tests/extra-tests/pom.xml | 45 +++++----------- tests/integration-tests/pom.xml | 27 +++------- .../artemis/tests/util/RandomUtil.java | 0 tests/jms-tests/pom.xml | 38 +++++-------- tests/joram-tests/pom.xml | 11 ---- tests/performance-tests/pom.xml | 20 +++---- tests/smoke-tests/pom.xml | 53 +++++++------------ .../bridgeTransfer/BridgeTransferingTest.java | 23 ++------ .../PagedMirrorSmokeTest.java | 2 +- .../infinite/InfiniteRedeliverySmokeTest.java | 2 +- .../tests/smoke/logging/AuditLoggerTest.java | 3 +- .../smoke/logging/AuditLoggerTestBase.java | 19 ------- .../tests/smoke/mmfactory/MMSFactoryTest.java | 23 ++------ .../quorum/PluggableQuorumSinglePairTest.java | 20 +++---- .../ZookeeperPluggableQuorumPeerTest.java | 16 +++--- .../tests/smoke/transfer/TransferTest.java | 22 ++------ tests/soak-tests/pom.xml | 12 +---- tests/stress-tests/pom.xml | 26 +-------- tests/timing-tests/pom.xml | 26 +++++---- tests/unit-tests/pom.xml | 27 +++------- .../artemis/tests/unit/AllClassesTest.java | 2 +- .../impl/netty/NettyAcceptorTest.java | 2 +- .../unit/logging/AssertionLoggerTest.java | 2 +- .../tests/unit/util/LinkedListTest.java | 2 +- 64 files changed, 427 insertions(+), 529 deletions(-) rename {artemis-core-client => artemis-cli}/src/test/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfigurationTestAccessor.java (100%) create mode 100644 artemis-server/src/test/java/org/apache/activemq/artemis/utils/SimpleServerTestPasswordCodec.java rename {artemis-commons => artemis-server}/src/test/java/org/apache/activemq/artemis/utils/critical/CriticalAnalyzerAccessor.java (100%) create mode 100644 artemis-unit-test-support/pom.xml rename {artemis-commons/src/test => artemis-unit-test-support/src/main}/java/org/apache/activemq/artemis/utils/CleanupSystemPropertiesRule.java (98%) rename {artemis-commons/src/test => artemis-unit-test-support/src/main}/java/org/apache/activemq/artemis/utils/PortCheckRule.java (100%) rename {artemis-commons/src/test => artemis-unit-test-support/src/main}/java/org/apache/activemq/artemis/utils/RetryMethod.java (100%) rename {artemis-commons/src/test => artemis-unit-test-support/src/main}/java/org/apache/activemq/artemis/utils/RetryRule.java (100%) rename {artemis-core-client/src/test/java/org/apache/activemq/artemis/tests/util => artemis-unit-test-support/src/main/java/org/apache/activemq/artemis/utils}/SilentTestCase.java (97%) rename {artemis-commons/src/test => artemis-unit-test-support/src/main}/java/org/apache/activemq/artemis/utils/ThreadLeakCheckRule.java (99%) rename {artemis-commons/src/test => artemis-unit-test-support/src/main}/java/org/apache/activemq/artemis/utils/Wait.java (82%) create mode 100644 artemis-web/src/test/java/org/apache/activemq/artemis/utils/SimpleWebTestPasswordCodec.java rename tests/{integration-tests/src/test => artemis-test-support/src/main}/java/org/apache/activemq/artemis/tests/util/CFUtil.java (100%) rename tests/{smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/utils => artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util}/Jmx.java (99%) rename {artemis-commons/src/test => tests/artemis-test-support/src/main}/java/org/apache/activemq/artemis/utils/ExecuteUtil.java (100%) rename {artemis-commons/src/test => tests/artemis-test-support/src/main}/java/org/apache/activemq/artemis/utils/network/NetUtil.java (100%) rename {artemis-commons/src/test => tests/artemis-test-support/src/main}/java/org/apache/activemq/artemis/utils/network/NetUtilResource.java (100%) rename {artemis-server => tests/compatibility-tests}/src/test/java/org/apache/activemq/artemis/core/persistence/impl/nullpm/NullStorageAccessor.java (100%) rename {artemis-core-client => tests/integration-tests}/src/test/java/org/apache/activemq/artemis/tests/util/RandomUtil.java (100%) diff --git a/artemis-cli/pom.xml b/artemis-cli/pom.xml index f8dbbd05bd..85c360403d 100644 --- a/artemis-cli/pom.xml +++ b/artemis-cli/pom.xml @@ -128,26 +128,12 @@ junit test - - org.apache.activemq - artemis-commons - ${project.version} - test - test-jar - org.apache.activemq artemis-junit ${project.version} test - - org.apache.activemq - artemis-core-client - ${project.version} - test - test-jar - org.apache.derby diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/filter/impl/FilterTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/filter/impl/FilterTest.java index 6775230420..394aa7d983 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/filter/impl/FilterTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/filter/impl/FilterTest.java @@ -22,8 +22,8 @@ import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.filter.Filter; import org.apache.activemq.artemis.core.message.impl.CoreMessage; -import org.apache.activemq.artemis.tests.util.SilentTestCase; import org.apache.activemq.artemis.utils.RandomUtil; +import org.apache.activemq.artemis.utils.SilentTestCase; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/AdressInfoJSonTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/AdressInfoJSonTest.java index 1d03d5f16c..15ade3f47b 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/AdressInfoJSonTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/AdressInfoJSonTest.java @@ -18,7 +18,7 @@ package org.apache.activemq.artemis.core.server.impl; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.SimpleString; -import org.apache.activemq.artemis.tests.util.RandomUtil; +import org.apache.activemq.artemis.utils.RandomUtil; import org.junit.Assert; import org.junit.Test; diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/utils/SimpleServerTestPasswordCodec.java b/artemis-server/src/test/java/org/apache/activemq/artemis/utils/SimpleServerTestPasswordCodec.java new file mode 100644 index 0000000000..0de49a1cdb --- /dev/null +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/utils/SimpleServerTestPasswordCodec.java @@ -0,0 +1,45 @@ +/* + * 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.utils; + +import java.util.HashMap; +import java.util.Map; + +public class SimpleServerTestPasswordCodec implements SensitiveDataCodec { + + private Map passwordBook = new HashMap<>(); + + public SimpleServerTestPasswordCodec() { + passwordBook.put("momsword", "secret"); + passwordBook.put("youneverknow", "keypass"); + passwordBook.put("youcanguess", "trustpass"); + } + + @Override + public String decode(Object mask) throws Exception { + String password = passwordBook.get(mask); + if (password == null) { + throw new IllegalArgumentException("I don't know the password " + mask); + } + return password; + } + + @Override + public String encode(Object secret) throws Exception { + return null; + } +} \ No newline at end of file diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/critical/CriticalAnalyzerAccessor.java b/artemis-server/src/test/java/org/apache/activemq/artemis/utils/critical/CriticalAnalyzerAccessor.java similarity index 100% rename from artemis-commons/src/test/java/org/apache/activemq/artemis/utils/critical/CriticalAnalyzerAccessor.java rename to artemis-server/src/test/java/org/apache/activemq/artemis/utils/critical/CriticalAnalyzerAccessor.java diff --git a/artemis-server/src/test/resources/login.config b/artemis-server/src/test/resources/login.config index 3de9f51300..b4d0b73077 100644 --- a/artemis-server/src/test/resources/login.config +++ b/artemis-server/src/test/resources/login.config @@ -209,7 +209,7 @@ LDAPLoginExternalPasswordCodec { LDAPLoginExternalPasswordCodec2 { org.apache.activemq.artemis.spi.core.security.jaas.LDAPLoginModule required debug=true - passwordCodec="org.apache.activemq.artemis.utils.MaskPasswordResolvingTest$SimplePasswordCodec" + passwordCodec="org.apache.activemq.artemis.utils.SimpleServerTestPasswordCodec" initialContextFactory=com.sun.jndi.ldap.LdapCtxFactory connectionURL="ldap://localhost:1024" connectionUsername="uid=admin,ou=system" diff --git a/artemis-unit-test-support/pom.xml b/artemis-unit-test-support/pom.xml new file mode 100644 index 0000000000..45409e7acb --- /dev/null +++ b/artemis-unit-test-support/pom.xml @@ -0,0 +1,45 @@ + + + 4.0.0 + + org.apache.activemq + artemis-pom + 2.24.0-SNAPSHOT + + + artemis-unit-test-support + jar + ActiveMQ Artemis Unit Test Support + + + ${project.basedir}/.. + + + + + junit + junit + provided + + + org.jboss.logging + jboss-logging + provided + + + diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/CleanupSystemPropertiesRule.java b/artemis-unit-test-support/src/main/java/org/apache/activemq/artemis/utils/CleanupSystemPropertiesRule.java similarity index 98% rename from artemis-commons/src/test/java/org/apache/activemq/artemis/utils/CleanupSystemPropertiesRule.java rename to artemis-unit-test-support/src/main/java/org/apache/activemq/artemis/utils/CleanupSystemPropertiesRule.java index e245d49b52..d5febd93c7 100644 --- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/CleanupSystemPropertiesRule.java +++ b/artemis-unit-test-support/src/main/java/org/apache/activemq/artemis/utils/CleanupSystemPropertiesRule.java @@ -36,7 +36,7 @@ public class CleanupSystemPropertiesRule extends ExternalResource { /** * Override to set up your specific external resource. * - * @throws if setup fails (which will disable {@code after} + * @throws Throwable if setup fails (which will disable {@code after} */ @Override protected void before() throws Throwable { diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/PortCheckRule.java b/artemis-unit-test-support/src/main/java/org/apache/activemq/artemis/utils/PortCheckRule.java similarity index 100% rename from artemis-commons/src/test/java/org/apache/activemq/artemis/utils/PortCheckRule.java rename to artemis-unit-test-support/src/main/java/org/apache/activemq/artemis/utils/PortCheckRule.java diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/RetryMethod.java b/artemis-unit-test-support/src/main/java/org/apache/activemq/artemis/utils/RetryMethod.java similarity index 100% rename from artemis-commons/src/test/java/org/apache/activemq/artemis/utils/RetryMethod.java rename to artemis-unit-test-support/src/main/java/org/apache/activemq/artemis/utils/RetryMethod.java diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/RetryRule.java b/artemis-unit-test-support/src/main/java/org/apache/activemq/artemis/utils/RetryRule.java similarity index 100% rename from artemis-commons/src/test/java/org/apache/activemq/artemis/utils/RetryRule.java rename to artemis-unit-test-support/src/main/java/org/apache/activemq/artemis/utils/RetryRule.java diff --git a/artemis-core-client/src/test/java/org/apache/activemq/artemis/tests/util/SilentTestCase.java b/artemis-unit-test-support/src/main/java/org/apache/activemq/artemis/utils/SilentTestCase.java similarity index 97% rename from artemis-core-client/src/test/java/org/apache/activemq/artemis/tests/util/SilentTestCase.java rename to artemis-unit-test-support/src/main/java/org/apache/activemq/artemis/utils/SilentTestCase.java index aa0669ed55..ba8b9a2ec1 100644 --- a/artemis-core-client/src/test/java/org/apache/activemq/artemis/tests/util/SilentTestCase.java +++ b/artemis-unit-test-support/src/main/java/org/apache/activemq/artemis/utils/SilentTestCase.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.util; +package org.apache.activemq.artemis.utils; import java.io.ByteArrayOutputStream; import java.io.PrintStream; diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ThreadLeakCheckRule.java b/artemis-unit-test-support/src/main/java/org/apache/activemq/artemis/utils/ThreadLeakCheckRule.java similarity index 99% rename from artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ThreadLeakCheckRule.java rename to artemis-unit-test-support/src/main/java/org/apache/activemq/artemis/utils/ThreadLeakCheckRule.java index bd7f80866f..13ec565b94 100644 --- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ThreadLeakCheckRule.java +++ b/artemis-unit-test-support/src/main/java/org/apache/activemq/artemis/utils/ThreadLeakCheckRule.java @@ -52,8 +52,6 @@ public class ThreadLeakCheckRule extends TestWatcher { /** * Override to set up your specific external resource. - * - * @throws if setup fails (which will disable {@code after} */ @Override protected void starting(Description description) { diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/Wait.java b/artemis-unit-test-support/src/main/java/org/apache/activemq/artemis/utils/Wait.java similarity index 82% rename from artemis-commons/src/test/java/org/apache/activemq/artemis/utils/Wait.java rename to artemis-unit-test-support/src/main/java/org/apache/activemq/artemis/utils/Wait.java index 50c09ec48c..3d782e19d4 100644 --- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/Wait.java +++ b/artemis-unit-test-support/src/main/java/org/apache/activemq/artemis/utils/Wait.java @@ -16,22 +16,38 @@ */ package org.apache.activemq.artemis.utils; +import java.lang.reflect.Method; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.LockSupport; import java.util.function.Supplier; +import org.jboss.logging.Logger; import org.junit.Assert; /** * Utility adapted from: org.apache.activemq.util.Wait */ public class Wait { - + private static Logger logger = Logger.getLogger(Wait.class); public static final long MAX_WAIT_MILLIS = 30 * 1000; public static final int SLEEP_MILLIS = 100; public static final String DEFAULT_FAILURE_MESSAGE = "Condition wasn't met"; + private static Method tdUtilMethod; + static { + try { + Class clazz = Class.forName("org.apache.activemq.artemis.utils.ThreadDumpUtil"); + tdUtilMethod = clazz.getMethod("threadDump", String.class); + } catch (ClassNotFoundException | NoSuchMethodException | SecurityException e) { + if (logger.isDebugEnabled()) { + logger.debug("Wait util was unable to locate ThreadDumpUtil class/method", e); + } else { + logger.info("Wait util was unable to locate ThreadDumpUtil class/method due to: " + e.getClass().getName() + ": " + e.getMessage()); + } + } + } + public interface Condition { boolean isSatisfied() throws Exception; @@ -71,11 +87,12 @@ public class Wait { } public static void assertEquals(Long size, LongCondition condition, long timeout, long sleepMillis, boolean printThreadDump) throws Exception { - boolean result = waitFor(() -> condition.getCount() == size, timeout, sleepMillis, printThreadDump); + checkForThreadDumpUtil(printThreadDump); + boolean result = waitFor(() -> condition.getCount() == size, timeout, sleepMillis, printThreadDump); if (!result) { if (printThreadDump) { - System.out.println(ThreadDumpUtil.threadDump("thread dump")); + callThreadDumpUtil("thread dump"); } Assert.assertEquals(size.longValue(), condition.getCount()); } @@ -170,7 +187,7 @@ public class Wait { final long durationMillis, final long sleepMillis, final boolean printThreadDump) { - + checkForThreadDumpUtil(printThreadDump); try { final long expiry = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(durationMillis); boolean conditionSatisified = condition.isSatisfied(); @@ -183,7 +200,7 @@ public class Wait { conditionSatisified = condition.isSatisfied(); } if (!conditionSatisified && printThreadDump) { - System.out.println(ThreadDumpUtil.threadDump("thread dump")); + callThreadDumpUtil("thread dump"); } return conditionSatisified; } catch (Exception e) { @@ -191,4 +208,20 @@ public class Wait { } } + private static void checkForThreadDumpUtil(boolean printThreadDump) { + if (printThreadDump && tdUtilMethod == null) { + throw new IllegalStateException("Unable to identify ThreadDumpUtil class/method."); + } + } + + private static void callThreadDumpUtil(String msg) { + checkForThreadDumpUtil(true); + + try { + Object threadDump = tdUtilMethod.invoke(null, msg); + System.out.println(threadDump); + } catch (Exception e) { + throw new RuntimeException("Failure running ThreadDumpUtil", e); + } + } } diff --git a/artemis-web/pom.xml b/artemis-web/pom.xml index b3f8a24357..a2c25eeae7 100644 --- a/artemis-web/pom.xml +++ b/artemis-web/pom.xml @@ -68,13 +68,6 @@ artemis-commons ${project.version} - - org.apache.activemq - artemis-commons - ${project.version} - tests - test - org.apache.activemq artemis-junit @@ -117,6 +110,12 @@ org.eclipse.jetty jetty-webapp + + org.apache.activemq + artemis-unit-test-support + ${project.version} + test + junit junit diff --git a/artemis-web/src/test/java/org/apache/activemq/artemis/utils/SimpleWebTestPasswordCodec.java b/artemis-web/src/test/java/org/apache/activemq/artemis/utils/SimpleWebTestPasswordCodec.java new file mode 100644 index 0000000000..1783d5b7cc --- /dev/null +++ b/artemis-web/src/test/java/org/apache/activemq/artemis/utils/SimpleWebTestPasswordCodec.java @@ -0,0 +1,45 @@ +/* + * 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.utils; + +import java.util.HashMap; +import java.util.Map; + +public class SimpleWebTestPasswordCodec implements SensitiveDataCodec { + + private Map passwordBook = new HashMap<>(); + + public SimpleWebTestPasswordCodec() { + passwordBook.put("momsword", "secret"); + passwordBook.put("youneverknow", "keypass"); + passwordBook.put("youcanguess", "trustpass"); + } + + @Override + public String decode(Object mask) throws Exception { + String password = passwordBook.get(mask); + if (password == null) { + throw new IllegalArgumentException("I don't know the password " + mask); + } + return password; + } + + @Override + public String encode(Object secret) throws Exception { + return null; + } +} diff --git a/artemis-web/src/test/resources/bootstrap_web_codec.xml b/artemis-web/src/test/resources/bootstrap_web_codec.xml index be4b26aaa7..3bac9d4657 100644 --- a/artemis-web/src/test/resources/bootstrap_web_codec.xml +++ b/artemis-web/src/test/resources/bootstrap_web_codec.xml @@ -26,7 +26,7 @@ - + diff --git a/artemis-web/src/test/resources/bootstrap_web_old_config.xml b/artemis-web/src/test/resources/bootstrap_web_old_config.xml index fdcbd4a254..198cdb55bd 100644 --- a/artemis-web/src/test/resources/bootstrap_web_old_config.xml +++ b/artemis-web/src/test/resources/bootstrap_web_old_config.xml @@ -25,7 +25,7 @@ - + diff --git a/pom.xml b/pom.xml index 4d62c80a96..8393b69496 100644 --- a/pom.xml +++ b/pom.xml @@ -63,6 +63,7 @@ artemis-hawtio integration/activemq-spring-integration artemis-distribution + artemis-unit-test-support tests artemis-features artemis-quorum-api @@ -164,6 +165,8 @@ 42.3.3 1.16.3 3.0.0 + 4.4.13 + 4.5.13 1.0.10.Final @@ -1088,9 +1091,18 @@ ${jackson.version} + + org.apache.httpcomponents + httpcore + ${apache.httpcore.version} + + + org.apache.httpcomponents + httpclient + ${apache.httpclient.version} + - diff --git a/tests/activemq5-unit-tests/pom.xml b/tests/activemq5-unit-tests/pom.xml index a70656cc98..abbfb1de82 100644 --- a/tests/activemq5-unit-tests/pom.xml +++ b/tests/activemq5-unit-tests/pom.xml @@ -33,20 +33,6 @@ - - - org.apache.activemq - artemis-server - ${project.version} - test-jar - - - org.apache.activemq - artemis-commons - ${project.version} - test-jar - - org.mockito mockito-core @@ -134,6 +120,12 @@ + + org.apache.activemq + artemis-unit-test-support + ${project.version} + + org.apache.activemq artemis-commons diff --git a/tests/artemis-test-support/pom.xml b/tests/artemis-test-support/pom.xml index 4cd9573750..a01162b339 100644 --- a/tests/artemis-test-support/pom.xml +++ b/tests/artemis-test-support/pom.xml @@ -31,38 +31,89 @@ + + org.apache.activemq + artemis-jms-client + ${project.version} + provided + + + org.apache.activemq + activemq-client + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + org.apache.geronimo.specs + geronimo-j2ee-management_1.1_spec + + + + + org.apache.qpid + qpid-jms-client + provided + org.apache.qpid proton-j + provided org.slf4j slf4j-api + provided io.netty netty-buffer + provided io.netty netty-codec-http + provided io.netty netty-transport + provided io.netty netty-common + provided io.netty netty-handler + provided jakarta.jms jakarta.jms-api + provided + + + junit + junit + provided + + + org.jboss.logging + jboss-logging + provided + + + + + org.apache.activemq + artemis-server + ${project.version} + test-jar - diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/CFUtil.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/CFUtil.java similarity index 100% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/CFUtil.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/CFUtil.java diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/utils/Jmx.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/Jmx.java similarity index 99% rename from tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/utils/Jmx.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/Jmx.java index b36b029e5a..05e2f8ad98 100644 --- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/utils/Jmx.java +++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/Jmx.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.smoke.utils; +package org.apache.activemq.artemis.tests.util; import org.apache.activemq.artemis.json.JsonArray; import org.apache.activemq.artemis.json.JsonObject; diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ExecuteUtil.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/utils/ExecuteUtil.java similarity index 100% rename from artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ExecuteUtil.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/utils/ExecuteUtil.java diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/network/NetUtil.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/utils/network/NetUtil.java similarity index 100% rename from artemis-commons/src/test/java/org/apache/activemq/artemis/utils/network/NetUtil.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/utils/network/NetUtil.java diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/network/NetUtilResource.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/utils/network/NetUtilResource.java similarity index 100% rename from artemis-commons/src/test/java/org/apache/activemq/artemis/utils/network/NetUtilResource.java rename to tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/utils/network/NetUtilResource.java diff --git a/tests/compatibility-tests/pom.xml b/tests/compatibility-tests/pom.xml index c714f10f07..a355ddcd1a 100644 --- a/tests/compatibility-tests/pom.xml +++ b/tests/compatibility-tests/pom.xml @@ -32,34 +32,6 @@ - - org.apache.activemq - artemis-server - ${project.version} - test - test-jar - - - org.apache.activemq - artemis-commons - ${project.version} - test - test-jar - - - org.apache.activemq.tests - unit-tests - ${project.version} - test - test-jar - - - org.apache.activemq - artemis-core-client - ${project.version} - test - test-jar - org.apache.activemq artemis-jms-client @@ -147,8 +119,8 @@ ${project.version} - org.apache.activemq.tests - artemis-test-support + org.apache.activemq + artemis-unit-test-support ${project.version} @@ -311,18 +283,6 @@ - - org.apache.maven.plugins - maven-jar-plugin - - - test - - test-jar - - - - org.apache.activemq artemis-maven-plugin diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/persistence/impl/nullpm/NullStorageAccessor.java b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/core/persistence/impl/nullpm/NullStorageAccessor.java similarity index 100% rename from artemis-server/src/test/java/org/apache/activemq/artemis/core/persistence/impl/nullpm/NullStorageAccessor.java rename to tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/core/persistence/impl/nullpm/NullStorageAccessor.java diff --git a/tests/e2e-tests/pom.xml b/tests/e2e-tests/pom.xml index dd3d82da88..d33284613e 100644 --- a/tests/e2e-tests/pom.xml +++ b/tests/e2e-tests/pom.xml @@ -49,6 +49,16 @@ compile pom + + org.apache.activemq.tests + artemis-test-support + ${project.version} + test + + + commons-io + commons-io + org.testcontainers testcontainers @@ -62,29 +72,6 @@ org.apache.qpid qpid-jms-client - - org.apache.activemq - artemis-server - ${project.version} - test - test-jar - - - - org.apache.activemq.tests - smoke-tests - ${project.version} - test - test-jar - - - - org.apache.activemq.tests - integration-tests - ${project.version} - test - test-jar - @@ -331,18 +318,6 @@ - - org.apache.maven.plugins - maven-jar-plugin - - - test - - test-jar - - - - org.apache.maven.plugins maven-surefire-plugin diff --git a/tests/e2e-tests/src/test/java/org/apache/activemq/artemis/tests/e2e/ha/replication/pluggablequorumvote/GCPauseSimulationTests.java b/tests/e2e-tests/src/test/java/org/apache/activemq/artemis/tests/e2e/ha/replication/pluggablequorumvote/GCPauseSimulationTests.java index 38e0b52660..0669fc4308 100644 --- a/tests/e2e-tests/src/test/java/org/apache/activemq/artemis/tests/e2e/ha/replication/pluggablequorumvote/GCPauseSimulationTests.java +++ b/tests/e2e-tests/src/test/java/org/apache/activemq/artemis/tests/e2e/ha/replication/pluggablequorumvote/GCPauseSimulationTests.java @@ -33,7 +33,7 @@ import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; import org.apache.activemq.artemis.tests.e2e.common.E2ETestBase; -import org.apache.activemq.artemis.tests.smoke.utils.Jmx; +import org.apache.activemq.artemis.tests.util.Jmx; import org.apache.commons.io.FileUtils; import org.apache.qpid.jms.JmsConnectionFactory; import org.junit.After; diff --git a/tests/extra-tests/pom.xml b/tests/extra-tests/pom.xml index 7d6a972682..d7792d513d 100644 --- a/tests/extra-tests/pom.xml +++ b/tests/extra-tests/pom.xml @@ -80,20 +80,6 @@ org.apache.activemq artemis-core-client ${project.version} - test - test-jar - - - org.apache.activemq - artemis-core-client - ${project.version} - - - org.apache.activemq - artemis-server - ${project.version} - test - test-jar org.apache.activemq @@ -107,13 +93,6 @@ test test-jar - - org.apache.activemq - artemis-commons - ${project.version} - test - test-jar - org.apache.activemq.tests unit-tests @@ -186,6 +165,18 @@ junit junit + + org.apache.activemq + artemis-unit-test-support + ${project.version} + test + + + org.apache.activemq.tests + artemis-test-support + ${project.version} + test + @@ -231,18 +222,6 @@ - - org.apache.maven.plugins - maven-jar-plugin - - - test - - test-jar - - - - org.apache.maven.plugins maven-surefire-plugin diff --git a/tests/integration-tests/pom.xml b/tests/integration-tests/pom.xml index 8b391cb314..ec6754bea3 100644 --- a/tests/integration-tests/pom.xml +++ b/tests/integration-tests/pom.xml @@ -33,20 +33,6 @@ - - org.apache.activemq - artemis-server - ${project.version} - test - test-jar - - - org.apache.activemq - artemis-commons - ${project.version} - test - test-jar - org.apache.activemq artemis-quorum-ri @@ -60,13 +46,6 @@ test test-jar - - org.apache.activemq - artemis-core-client - ${project.version} - test - test-jar - org.apache.activemq artemis-jms-client @@ -175,6 +154,12 @@ ${project.version} test + + org.apache.activemq + artemis-unit-test-support + ${project.version} + test + org.hamcrest hamcrest diff --git a/artemis-core-client/src/test/java/org/apache/activemq/artemis/tests/util/RandomUtil.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/RandomUtil.java similarity index 100% rename from artemis-core-client/src/test/java/org/apache/activemq/artemis/tests/util/RandomUtil.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/RandomUtil.java diff --git a/tests/jms-tests/pom.xml b/tests/jms-tests/pom.xml index 6b5d2034f0..ab112f7955 100644 --- a/tests/jms-tests/pom.xml +++ b/tests/jms-tests/pom.xml @@ -32,20 +32,6 @@ - - org.apache.activemq - artemis-server - ${project.version} - test - test-jar - - - org.apache.activemq - artemis-commons - ${project.version} - test - test-jar - org.apache.activemq artemis-core-client @@ -80,6 +66,18 @@ junit junit + + org.apache.activemq + artemis-unit-test-support + ${project.version} + test + + + org.apache.activemq.tests + artemis-test-support + ${project.version} + test + jakarta.jms jakarta.jms-api @@ -116,18 +114,6 @@ - - org.apache.maven.plugins - maven-jar-plugin - - - test - - test-jar - - - - org.apache.maven.plugins maven-surefire-plugin diff --git a/tests/joram-tests/pom.xml b/tests/joram-tests/pom.xml index 3c8f3c9d42..de019ad1b4 100644 --- a/tests/joram-tests/pom.xml +++ b/tests/joram-tests/pom.xml @@ -121,17 +121,6 @@ - - org.apache.maven.plugins - maven-jar-plugin - - - - test-jar - - - - org.apache.maven.plugins maven-surefire-plugin diff --git a/tests/performance-tests/pom.xml b/tests/performance-tests/pom.xml index 9b73bda02d..acb4b27fff 100644 --- a/tests/performance-tests/pom.xml +++ b/tests/performance-tests/pom.xml @@ -62,13 +62,6 @@ artemis-commons ${project.version} - - org.apache.activemq - artemis-server - ${project.version} - test - test-jar - org.apache.activemq.tests unit-tests @@ -76,13 +69,6 @@ test test-jar - - org.apache.activemq - artemis-commons - ${project.version} - test - test-jar - org.apache.activemq.tests integration-tests @@ -111,6 +97,12 @@ org.jboss.logging jboss-logging + + org.apache.activemq.tests + artemis-test-support + ${project.version} + test + diff --git a/tests/smoke-tests/pom.xml b/tests/smoke-tests/pom.xml index 2be5cc24de..1d2275dcd1 100644 --- a/tests/smoke-tests/pom.xml +++ b/tests/smoke-tests/pom.xml @@ -33,13 +33,6 @@ - - org.apache.activemq - artemis-server - ${project.version} - test - test-jar - - - org.apache.activemq.tests - integration-tests - ${project.version} - test - test-jar - + org.apache.curator @@ -197,6 +177,25 @@ jakarta.json-api test + + + org.apache.httpcomponents + httpclient + + + + org.apache.activemq + artemis-unit-test-support + ${project.version} + test + + + org.apache.activemq.tests + artemis-test-support + ${project.version} + test + + @@ -1181,18 +1180,6 @@ - - org.apache.maven.plugins - maven-jar-plugin - - - test - - test-jar - - - - org.apache.maven.plugins maven-surefire-plugin diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/bridgeTransfer/BridgeTransferingTest.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/bridgeTransfer/BridgeTransferingTest.java index 61a55c7e8c..fd12e170cc 100644 --- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/bridgeTransfer/BridgeTransferingTest.java +++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/bridgeTransfer/BridgeTransferingTest.java @@ -29,8 +29,8 @@ import java.util.Collection; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; import org.apache.activemq.artemis.tests.smoke.common.SmokeTestBase; +import org.apache.activemq.artemis.tests.util.CFUtil; import org.apache.activemq.artemis.utils.Wait; -import org.apache.qpid.jms.JmsConnectionFactory; import org.jboss.logging.Logger; import org.junit.After; import org.junit.Assert; @@ -74,23 +74,6 @@ public class BridgeTransferingTest extends SmokeTestBase { return Arrays.asList(new Object[][]{{"CORE", 200, 1000, 10000, 15_000, 5000, true}, {"CORE", 200, 1000, 10000, 15_000, 5000, false}}); } - public static ConnectionFactory createConnectionFactory(String protocol, String uri) { - if (protocol.toUpperCase().equals("OPENWIRE")) { - return new org.apache.activemq.ActiveMQConnectionFactory(uri); - } else if (protocol.toUpperCase().equals("AMQP")) { - - if (uri.startsWith("tcp://")) { - // replacing tcp:// by amqp:// - uri = "amqp" + uri.substring(3); - } - return new JmsConnectionFactory(uri); - } else if (protocol.toUpperCase().equals("CORE") || protocol.toUpperCase().equals("ARTEMIS")) { - return new org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory(uri); - } else { - throw new IllegalStateException("Unknown:" + protocol); - } - } - @Before public void before() throws Exception { cleanupData(SERVER_NAME_0); @@ -108,7 +91,7 @@ public class BridgeTransferingTest extends SmokeTestBase { @Test public void testTransfer() throws Exception { - ConnectionFactory cf = createConnectionFactory(theprotocol, "tcp://localhost:61616"); + ConnectionFactory cf = CFUtil.createConnectionFactory(theprotocol, "tcp://localhost:61616"); ((ActiveMQConnectionFactory) cf).setMinLargeMessageSize(minlargeMessageSize); String body; @@ -166,7 +149,7 @@ public class BridgeTransferingTest extends SmokeTestBase { session.commit(); } } - ConnectionFactory cf2 = createConnectionFactory(theprotocol, "tcp://localhost:61617"); + ConnectionFactory cf2 = CFUtil.createConnectionFactory(theprotocol, "tcp://localhost:61617"); try (Connection connection = cf2.createConnection()) { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue("bridgeQueue"); diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/brokerConnection/PagedMirrorSmokeTest.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/brokerConnection/PagedMirrorSmokeTest.java index a65cfcb9dc..3d88fbc2b0 100644 --- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/brokerConnection/PagedMirrorSmokeTest.java +++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/brokerConnection/PagedMirrorSmokeTest.java @@ -31,7 +31,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds; import org.apache.activemq.artemis.tests.smoke.common.SmokeTestBase; 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.util.ServerUtil; import org.jboss.logging.Logger; import org.junit.Assert; diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/infinite/InfiniteRedeliverySmokeTest.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/infinite/InfiniteRedeliverySmokeTest.java index f68da0bf8b..637cd695bf 100644 --- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/infinite/InfiniteRedeliverySmokeTest.java +++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/infinite/InfiniteRedeliverySmokeTest.java @@ -32,7 +32,7 @@ import org.apache.activemq.artemis.core.io.SequentialFileFactory; import org.apache.activemq.artemis.core.io.nio.NIOSequentialFileFactory; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; import org.apache.activemq.artemis.tests.smoke.common.SmokeTestBase; -import org.apache.activemq.artemis.tests.util.Wait; +import org.apache.activemq.artemis.utils.Wait; import org.jboss.logging.Logger; import org.junit.Assert; import org.junit.Before; diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/logging/AuditLoggerTest.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/logging/AuditLoggerTest.java index 8e94d86e25..8321852a8a 100644 --- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/logging/AuditLoggerTest.java +++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/logging/AuditLoggerTest.java @@ -38,6 +38,7 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.management.AddressControl; import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; +import org.apache.activemq.artemis.tests.util.CFUtil; import org.apache.activemq.artemis.utils.Base64; import org.apache.activemq.artemis.utils.RandomUtil; import org.apache.activemq.artemis.utils.Wait; @@ -143,7 +144,7 @@ public class AuditLoggerTest extends AuditLoggerTestBase { session.close(); - ConnectionFactory factory = createConnectionFactory(protocol, "tcp://localhost:61616"); + ConnectionFactory factory = CFUtil.createConnectionFactory(protocol, "tcp://localhost:61616"); Connection connection = factory.createConnection(); try { Session session = connection.createSession(); diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/logging/AuditLoggerTestBase.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/logging/AuditLoggerTestBase.java index 6367d0ef3d..efe56e8527 100644 --- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/logging/AuditLoggerTestBase.java +++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/logging/AuditLoggerTestBase.java @@ -16,13 +16,11 @@ */ package org.apache.activemq.artemis.tests.smoke.logging; -import javax.jms.ConnectionFactory; import java.io.File; import java.io.FileWriter; import java.io.PrintWriter; import org.apache.activemq.artemis.tests.smoke.common.SmokeTestBase; -import org.apache.qpid.jms.JmsConnectionFactory; import org.junit.Before; public abstract class AuditLoggerTestBase extends SmokeTestBase { @@ -58,21 +56,4 @@ public abstract class AuditLoggerTestBase extends SmokeTestBase { protected void checkAuditLogRecord(boolean exist, String... values) throws Exception { checkLogRecord(getAuditLog(), exist, values); } - - public static ConnectionFactory createConnectionFactory(String protocol, String uri) { - if (protocol.toUpperCase().equals("OPENWIRE")) { - return new org.apache.activemq.ActiveMQConnectionFactory(uri); - } else if (protocol.toUpperCase().equals("AMQP")) { - - if (uri.startsWith("tcp://")) { - // replacing tcp:// by amqp:// - uri = "amqp" + uri.substring(3); - } - return new JmsConnectionFactory(uri); - } else if (protocol.toUpperCase().equals("CORE") || protocol.toUpperCase().equals("ARTEMIS")) { - return new org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory(uri); - } else { - throw new IllegalStateException("Unknown:" + protocol); - } - } } diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/mmfactory/MMSFactoryTest.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/mmfactory/MMSFactoryTest.java index 9155926a88..620ef65bb5 100644 --- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/mmfactory/MMSFactoryTest.java +++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/mmfactory/MMSFactoryTest.java @@ -44,10 +44,10 @@ import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; import org.apache.activemq.artemis.api.core.management.QueueControl; import org.apache.activemq.artemis.tests.smoke.common.SmokeTestBase; +import org.apache.activemq.artemis.tests.util.CFUtil; import org.apache.activemq.artemis.utils.RandomUtil; import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.apache.activemq.artemis.utils.Wait; -import org.apache.qpid.jms.JmsConnectionFactory; import org.jboss.logging.Logger; import org.junit.Before; import org.junit.Test; @@ -106,23 +106,6 @@ public class MMSFactoryTest extends SmokeTestBase { return getServerLocation(SERVER_NAME_0) + "/data/" + "Consumer" + id + ".log"; } - public static ConnectionFactory createConnectionFactory(String protocol, String uri) { - if (protocol.toUpperCase().equals("OPENWIRE")) { - return new org.apache.activemq.ActiveMQConnectionFactory(uri); - } else if (protocol.toUpperCase().equals("AMQP")) { - - if (uri.startsWith("tcp://")) { - // replacing tcp:// by amqp:// - uri = "amqp" + uri.substring(3); - } - return new JmsConnectionFactory(uri); - } else if (protocol.toUpperCase().equals("CORE") || protocol.toUpperCase().equals("ARTEMIS")) { - return new org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory(uri); - } else { - throw new IllegalStateException("Unknown:" + protocol); - } - } - Process startConsumerProcess(String protocol, int slowTime, String queueName, @@ -200,7 +183,7 @@ public class MMSFactoryTest extends SmokeTestBase { AtomicInteger retryNumber = new AtomicInteger(0); int expectedTotalSize = 0; - ConnectionFactory factory = createConnectionFactory(theprotocol, "tcp://localhost:61616"); + ConnectionFactory factory = CFUtil.createConnectionFactory(theprotocol, "tcp://localhost:61616"); try (Connection connection = factory.createConnection()) { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Topic queue = session.createTopic("MMFactory"); @@ -402,7 +385,7 @@ public class MMSFactoryTest extends SmokeTestBase { public void runListener() { //factory = createConnectionFactory(protocol, "tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=" + credits); - factory = createConnectionFactory(protocol, "tcp://localhost:61616"); + factory = CFUtil.createConnectionFactory(protocol, "tcp://localhost:61616"); System.out.println("Starting"); connect(); diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/quorum/PluggableQuorumSinglePairTest.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/quorum/PluggableQuorumSinglePairTest.java index 3f739b10c4..864462c3e4 100644 --- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/quorum/PluggableQuorumSinglePairTest.java +++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/quorum/PluggableQuorumSinglePairTest.java @@ -28,7 +28,7 @@ import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; import org.apache.activemq.artemis.tests.smoke.common.SmokeTestBase; -import org.apache.activemq.artemis.tests.smoke.utils.Jmx; +import org.apache.activemq.artemis.tests.util.Jmx; import org.apache.activemq.artemis.util.ServerUtil; import org.apache.activemq.artemis.utils.Wait; import org.jboss.logging.Logger; @@ -39,15 +39,15 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.backupOf; -import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.containsExactNodeIds; -import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.decodeNetworkTopologyJson; -import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.liveOf; -import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.validateNetworkTopology; -import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.withBackup; -import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.withLive; -import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.withMembers; -import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.withNodes; +import static org.apache.activemq.artemis.tests.util.Jmx.backupOf; +import static org.apache.activemq.artemis.tests.util.Jmx.containsExactNodeIds; +import static org.apache.activemq.artemis.tests.util.Jmx.decodeNetworkTopologyJson; +import static org.apache.activemq.artemis.tests.util.Jmx.liveOf; +import static org.apache.activemq.artemis.tests.util.Jmx.validateNetworkTopology; +import static org.apache.activemq.artemis.tests.util.Jmx.withBackup; +import static org.apache.activemq.artemis.tests.util.Jmx.withLive; +import static org.apache.activemq.artemis.tests.util.Jmx.withMembers; +import static org.apache.activemq.artemis.tests.util.Jmx.withNodes; @RunWith(Parameterized.class) public abstract class PluggableQuorumSinglePairTest extends SmokeTestBase { diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/quorum/ZookeeperPluggableQuorumPeerTest.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/quorum/ZookeeperPluggableQuorumPeerTest.java index ca2bc13f7c..d6f2c50ca7 100644 --- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/quorum/ZookeeperPluggableQuorumPeerTest.java +++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/quorum/ZookeeperPluggableQuorumPeerTest.java @@ -28,14 +28,14 @@ import org.jboss.logging.Logger; import org.junit.Assert; import org.junit.Test; -import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.containsExactNodeIds; -import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.decodeNetworkTopologyJson; -import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.liveOf; -import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.validateNetworkTopology; -import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.withBackup; -import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.withLive; -import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.withMembers; -import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.withNodes; +import static org.apache.activemq.artemis.tests.util.Jmx.containsExactNodeIds; +import static org.apache.activemq.artemis.tests.util.Jmx.decodeNetworkTopologyJson; +import static org.apache.activemq.artemis.tests.util.Jmx.liveOf; +import static org.apache.activemq.artemis.tests.util.Jmx.validateNetworkTopology; +import static org.apache.activemq.artemis.tests.util.Jmx.withBackup; +import static org.apache.activemq.artemis.tests.util.Jmx.withLive; +import static org.apache.activemq.artemis.tests.util.Jmx.withMembers; +import static org.apache.activemq.artemis.tests.util.Jmx.withNodes; public class ZookeeperPluggableQuorumPeerTest extends ZookeeperPluggableQuorumSinglePairTest { diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/transfer/TransferTest.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/transfer/TransferTest.java index 292fae0f59..16807e9feb 100644 --- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/transfer/TransferTest.java +++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/transfer/TransferTest.java @@ -30,8 +30,8 @@ import java.util.ArrayList; import java.util.Collection; import org.apache.activemq.artemis.tests.smoke.common.SmokeTestBase; +import org.apache.activemq.artemis.tests.util.CFUtil; import org.apache.activemq.artemis.util.ServerUtil; -import org.apache.qpid.jms.JmsConnectionFactory; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -77,28 +77,12 @@ public class TransferTest extends SmokeTestBase { return parameters; } - private static ConnectionFactory createConnectionFactory(String protocol, String uri) { - if (protocol.toUpperCase().equals("AMQP")) { - - if (uri.startsWith("tcp://")) { - // replacing tcp:// by amqp:// - uri = "amqp" + uri.substring(3); - - } - return new JmsConnectionFactory(uri); - } else if (protocol.toUpperCase().equals("CORE") || protocol.toUpperCase().equals("ARTEMIS")) { - return new org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory(uri); - } else { - throw new IllegalStateException("Unknown:" + protocol); - } - } - private ConnectionFactory createConsumerCF() { - return createConnectionFactory(consumerProtocol, "tcp://localhost:61716"); + return CFUtil.createConnectionFactory(consumerProtocol, "tcp://localhost:61716"); } private ConnectionFactory createSenderCF() { - return createConnectionFactory(senderProtocol, "tcp://localhost:61616"); + return CFUtil.createConnectionFactory(senderProtocol, "tcp://localhost:61616"); } @Before diff --git a/tests/soak-tests/pom.xml b/tests/soak-tests/pom.xml index 2c8cc2ad4a..e67d51ecf0 100644 --- a/tests/soak-tests/pom.xml +++ b/tests/soak-tests/pom.xml @@ -45,13 +45,6 @@ ${project.version} test - - org.apache.activemq - artemis-server - ${project.version} - test - test-jar - org.apache.activemq.tests unit-tests @@ -77,11 +70,10 @@ test - org.apache.activemq - artemis-commons + org.apache.activemq.tests + artemis-test-support ${project.version} test - test-jar jakarta.transaction diff --git a/tests/stress-tests/pom.xml b/tests/stress-tests/pom.xml index f3614ed210..5cfdf53248 100644 --- a/tests/stress-tests/pom.xml +++ b/tests/stress-tests/pom.xml @@ -58,20 +58,6 @@ artemis-commons ${project.version} - - org.apache.activemq - artemis-core-client - ${project.version} - test - test-jar - - - org.apache.activemq - artemis-server - ${project.version} - test - test-jar - org.apache.activemq.tests unit-tests @@ -86,13 +72,6 @@ test test-jar - - org.apache.activemq.tests - jms-tests - ${project.version} - test - test-jar - org.apache.activemq artemis-cli @@ -113,11 +92,10 @@ test - org.apache.activemq - artemis-commons + org.apache.activemq.tests + artemis-test-support ${project.version} test - test-jar diff --git a/tests/timing-tests/pom.xml b/tests/timing-tests/pom.xml index 96b1c98561..bca4816783 100644 --- a/tests/timing-tests/pom.xml +++ b/tests/timing-tests/pom.xml @@ -63,13 +63,6 @@ artemis-commons ${project.version} - - org.apache.activemq - artemis-server - ${project.version} - test - test-jar - org.apache.activemq.tests unit-tests @@ -87,6 +80,18 @@ junit junit + + org.apache.activemq + artemis-unit-test-support + ${project.version} + test + + + org.apache.activemq.tests + artemis-test-support + ${project.version} + test + jakarta.transaction jakarta.transaction-api @@ -95,13 +100,6 @@ jakarta.jms jakarta.jms-api - - org.apache.activemq - artemis-commons - ${project.version} - test - test-jar - diff --git a/tests/unit-tests/pom.xml b/tests/unit-tests/pom.xml index fd762101b5..0e072db9f8 100644 --- a/tests/unit-tests/pom.xml +++ b/tests/unit-tests/pom.xml @@ -36,27 +36,6 @@ artemis-core-client ${project.version} - - org.apache.activemq - artemis-core-client - ${project.version} - test - test-jar - - - org.apache.activemq - artemis-commons - ${project.version} - test - test-jar - - - org.apache.activemq - artemis-server - ${project.version} - test - test-jar - org.apache.activemq artemis-amqp-protocol @@ -158,6 +137,12 @@ ${project.version} test + + org.apache.activemq + artemis-unit-test-support + ${project.version} + test + org.apache.activemq.tests artemis-test-support diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/AllClassesTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/AllClassesTest.java index d831a5b181..86bf3fbf35 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/AllClassesTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/AllClassesTest.java @@ -19,7 +19,7 @@ package org.apache.activemq.artemis.tests.unit; import com.google.common.collect.ImmutableSet; import com.google.common.reflect.ClassPath; -import org.apache.activemq.artemis.tests.util.RandomUtil; +import org.apache.activemq.artemis.utils.RandomUtil; import org.jboss.logging.Logger; import org.junit.Assume; import org.junit.Test; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java index b92a175fbe..4f825c1dfe 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java @@ -34,9 +34,9 @@ import org.apache.activemq.artemis.spi.core.remoting.BufferHandler; import org.apache.activemq.artemis.spi.core.remoting.Connection; import org.apache.activemq.artemis.spi.core.remoting.ServerConnectionLifeCycleListener; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; -import org.apache.activemq.artemis.tests.util.RandomUtil; import org.apache.activemq.artemis.utils.ActiveMQThreadFactory; import org.apache.activemq.artemis.utils.PortCheckRule; +import org.apache.activemq.artemis.utils.RandomUtil; import org.apache.activemq.artemis.utils.Wait; import org.junit.After; import org.junit.Assert; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/logging/AssertionLoggerTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/logging/AssertionLoggerTest.java index 5dcfb1bc99..c349a197e3 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/logging/AssertionLoggerTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/logging/AssertionLoggerTest.java @@ -21,7 +21,7 @@ import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl; import org.apache.activemq.artemis.logs.AssertionLoggerHandler; import org.apache.activemq.artemis.protocol.amqp.broker.ActiveMQProtonRemotingConnection; import org.apache.activemq.artemis.protocol.amqp.logger.ActiveMQAMQPProtocolLogger; -import org.apache.activemq.artemis.tests.util.RandomUtil; +import org.apache.activemq.artemis.utils.RandomUtil; import org.jboss.logging.Logger; import org.junit.After; import org.junit.Assert; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/LinkedListTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/LinkedListTest.java index e658345fd6..373619139c 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/LinkedListTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/LinkedListTest.java @@ -31,7 +31,7 @@ import java.util.concurrent.atomic.AtomicInteger; import io.netty.util.collection.LongObjectHashMap; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; -import org.apache.activemq.artemis.tests.util.RandomUtil; +import org.apache.activemq.artemis.utils.RandomUtil; import org.apache.activemq.artemis.utils.collections.NodeStore; import org.apache.activemq.artemis.utils.collections.LinkedListImpl; import org.apache.activemq.artemis.utils.collections.LinkedListIterator;