This is an automated email from the ASF dual-hosted git repository. robbie pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
commit 3578d562bd69feabfad9dbd8a71574a4587c7a5f Author: Justin Bertram <[email protected]> AuthorDate: Sat Feb 1 13:47:34 2025 -0600 ARTEMIS-5289 throw single exception from tests --- .../store/file/PostgresLargeObjectManagerTest.java | 9 ++-- .../io/util/ThreadLocalByteBufferPoolTest.java | 21 ++++---- .../artemis/lockmanager/DistributedLockTest.java | 52 +++++++++---------- .../zookeeper/CuratorDistributedLockTest.java | 10 ++-- .../artemis/protocol/amqp/sasl/SCRAMTest.java | 2 +- .../PropertiesLoginModuleRaceConditionTest.java | 2 +- .../integration/jms/SimpleJNDIClientTest.java | 59 +++++++++++----------- .../connection/CloseDestroyedConnectionTest.java | 9 ++-- .../integration/jms/jms2client/JmsContextTest.java | 2 +- .../openwire/amq/QueueConsumerPriorityTest.java | 9 ++-- 10 files changed, 84 insertions(+), 91 deletions(-) diff --git a/artemis-jdbc-store/src/test/java/org/apache/activemq/artemis/jdbc/store/file/PostgresLargeObjectManagerTest.java b/artemis-jdbc-store/src/test/java/org/apache/activemq/artemis/jdbc/store/file/PostgresLargeObjectManagerTest.java index d6e44746b4..fd24f7df1d 100644 --- a/artemis-jdbc-store/src/test/java/org/apache/activemq/artemis/jdbc/store/file/PostgresLargeObjectManagerTest.java +++ b/artemis-jdbc-store/src/test/java/org/apache/activemq/artemis/jdbc/store/file/PostgresLargeObjectManagerTest.java @@ -16,10 +16,6 @@ */ package org.apache.activemq.artemis.jdbc.store.file; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.fail; - -import java.lang.reflect.InvocationTargetException; import java.net.URL; import java.net.URLClassLoader; import java.sql.Array; @@ -43,6 +39,9 @@ import java.util.concurrent.Executor; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; + public class PostgresLargeObjectManagerTest { @Test @@ -56,7 +55,7 @@ public class PostgresLargeObjectManagerTest { } @Test - public void testShouldUseReflection() throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException { + public void testShouldUseReflection() throws Exception { ClassLoader loader = new FunkyClassLoader(); Class funkyClass = loader.loadClass("org.apache.activemq.artemis.jdbc.store.file.PostgresLargeObjectManager"); Object manager = funkyClass.getConstructor().newInstance(); diff --git a/artemis-journal/src/test/java/org/apache/activemq/artemis/core/io/util/ThreadLocalByteBufferPoolTest.java b/artemis-journal/src/test/java/org/apache/activemq/artemis/core/io/util/ThreadLocalByteBufferPoolTest.java index f1dc12db49..8b2dda4f49 100644 --- a/artemis-journal/src/test/java/org/apache/activemq/artemis/core/io/util/ThreadLocalByteBufferPoolTest.java +++ b/artemis-journal/src/test/java/org/apache/activemq/artemis/core/io/util/ThreadLocalByteBufferPoolTest.java @@ -16,19 +16,9 @@ */ package org.apache.activemq.artemis.core.io.util; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotSame; -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assumptions.assumeFalse; -import static org.junit.jupiter.api.Assumptions.assumeTrue; - import java.nio.ByteBuffer; import java.util.Arrays; import java.util.Collection; -import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -39,6 +29,15 @@ import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mockito; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assumptions.assumeFalse; +import static org.junit.jupiter.api.Assumptions.assumeTrue; + @ExtendWith(ParameterizedTestExtension.class) public class ThreadLocalByteBufferPoolTest { @@ -173,7 +172,7 @@ public class ThreadLocalByteBufferPoolTest { } @TestTemplate - public void shouldBorrowOnlyThreadLocalBuffers() throws ExecutionException, InterruptedException { + public void shouldBorrowOnlyThreadLocalBuffers() throws Exception { final int size = 32; final ByteBuffer buffer = pool.borrow(size, zeroed); pool.release(buffer); diff --git a/artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/DistributedLockTest.java b/artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/DistributedLockTest.java index aa3ed9ac46..ff5ba5c4b9 100644 --- a/artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/DistributedLockTest.java +++ b/artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/DistributedLockTest.java @@ -16,28 +16,26 @@ */ package org.apache.activemq.artemis.lockmanager; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotSame; -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; import java.util.function.Consumer; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + public abstract class DistributedLockTest { private final List<AutoCloseable> closeables = new ArrayList<>(); @@ -80,14 +78,14 @@ public abstract class DistributedLockTest { } @Test - public void managerReturnsSameLockIfNotClosed() throws ExecutionException, InterruptedException, TimeoutException { + public void managerReturnsSameLockIfNotClosed() throws Exception { DistributedLockManager manager = createManagedDistributeManager(); manager.start(); assertSame(manager.getDistributedLock("a"), manager.getDistributedLock("a")); } @Test - public void managerReturnsDifferentLocksIfClosed() throws ExecutionException, InterruptedException, TimeoutException { + public void managerReturnsDifferentLocksIfClosed() throws Exception { DistributedLockManager manager = createManagedDistributeManager(); manager.start(); DistributedLock closedLock = manager.getDistributedLock("a"); @@ -96,7 +94,7 @@ public abstract class DistributedLockTest { } @Test - public void managerReturnsDifferentLocksOnRestart() throws ExecutionException, InterruptedException, TimeoutException { + public void managerReturnsDifferentLocksOnRestart() throws Exception { DistributedLockManager manager = createManagedDistributeManager(); manager.start(); DistributedLock closedLock = manager.getDistributedLock("a"); @@ -106,7 +104,7 @@ public abstract class DistributedLockTest { } @Test - public void managerCannotGetLockIfNotStarted() throws ExecutionException, InterruptedException, TimeoutException { + public void managerCannotGetLockIfNotStarted() throws Exception { assertThrows(IllegalStateException.class, () -> { DistributedLockManager manager = createManagedDistributeManager(); manager.getDistributedLock("a"); @@ -114,7 +112,7 @@ public abstract class DistributedLockTest { } @Test - public void managerCannotGetLockWithNullLockId() throws ExecutionException, InterruptedException, TimeoutException { + public void managerCannotGetLockWithNullLockId() throws Exception { assertThrows(NullPointerException.class, () -> { DistributedLockManager manager = createManagedDistributeManager(); manager.start(); @@ -123,7 +121,7 @@ public abstract class DistributedLockTest { } @Test - public void closingLockUnlockIt() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { + public void closingLockUnlockIt() throws Exception { DistributedLockManager manager = createManagedDistributeManager(); manager.start(); DistributedLock closedLock = manager.getDistributedLock("a"); @@ -133,7 +131,7 @@ public abstract class DistributedLockTest { } @Test - public void managerStopUnlockLocks() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { + public void managerStopUnlockLocks() throws Exception { DistributedLockManager manager = createManagedDistributeManager(); manager.start(); assertTrue(manager.getDistributedLock("a").tryLock()); @@ -145,7 +143,7 @@ public abstract class DistributedLockTest { } @Test - public void acquireAndReleaseLock() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { + public void acquireAndReleaseLock() throws Exception { DistributedLockManager manager = createManagedDistributeManager(); manager.start(); DistributedLock lock = manager.getDistributedLock("a"); @@ -157,7 +155,7 @@ public abstract class DistributedLockTest { } @Test - public void cannotAcquireSameLockTwice() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { + public void cannotAcquireSameLockTwice() throws Exception { assertThrows(IllegalStateException.class, () -> { DistributedLockManager manager = createManagedDistributeManager(); manager.start(); @@ -168,7 +166,7 @@ public abstract class DistributedLockTest { } @Test - public void heldLockIsVisibleByDifferentManagers() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { + public void heldLockIsVisibleByDifferentManagers() throws Exception { DistributedLockManager ownerManager = createManagedDistributeManager(); DistributedLockManager observerManager = createManagedDistributeManager(); ownerManager.start(); @@ -179,7 +177,7 @@ public abstract class DistributedLockTest { } @Test - public void unlockedLockIsVisibleByDifferentManagers() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { + public void unlockedLockIsVisibleByDifferentManagers() throws Exception { DistributedLockManager ownerManager = createManagedDistributeManager(); DistributedLockManager observerManager = createManagedDistributeManager(); ownerManager.start(); @@ -192,7 +190,7 @@ public abstract class DistributedLockTest { } @Test - public void cannotAcquireSameLockFromDifferentManagers() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { + public void cannotAcquireSameLockFromDifferentManagers() throws Exception { DistributedLockManager ownerManager = createManagedDistributeManager(); DistributedLockManager notOwnerManager = createManagedDistributeManager(); ownerManager.start(); @@ -202,7 +200,7 @@ public abstract class DistributedLockTest { } @Test - public void cannotUnlockFromNotOwnerManager() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { + public void cannotUnlockFromNotOwnerManager() throws Exception { DistributedLockManager ownerManager = createManagedDistributeManager(); DistributedLockManager notOwnerManager = createManagedDistributeManager(); ownerManager.start(); @@ -214,7 +212,7 @@ public abstract class DistributedLockTest { } @Test - public void timedTryLockSucceedWithShortTimeout() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { + public void timedTryLockSucceedWithShortTimeout() throws Exception { DistributedLockManager manager = createManagedDistributeManager(); manager.start(); DistributedLock backgroundLock = manager.getDistributedLock("a"); @@ -222,7 +220,7 @@ public abstract class DistributedLockTest { } @Test - public void timedTryLockFailAfterTimeout() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { + public void timedTryLockFailAfterTimeout() throws Exception { DistributedLockManager manager = createManagedDistributeManager(); manager.start(); DistributedLockManager otherManager = createManagedDistributeManager(); @@ -236,7 +234,7 @@ public abstract class DistributedLockTest { } @Test - public void timedTryLockSuccess() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { + public void timedTryLockSuccess() throws Exception { DistributedLockManager manager = createManagedDistributeManager(); manager.start(); DistributedLockManager otherManager = createManagedDistributeManager(); @@ -264,7 +262,7 @@ public abstract class DistributedLockTest { } @Test - public void interruptStopTimedTryLock() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { + public void interruptStopTimedTryLock() throws Exception { DistributedLockManager manager = createManagedDistributeManager(); manager.start(); DistributedLockManager otherManager = createManagedDistributeManager(); @@ -293,7 +291,7 @@ public abstract class DistributedLockTest { } @Test - public void lockAndMutableLongWithSameIdCanExistsTogether() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { + public void lockAndMutableLongWithSameIdCanExistsTogether() throws Exception { DistributedLockManager manager = createManagedDistributeManager(); manager.start(); final String id = "a"; diff --git a/artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedLockTest.java b/artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedLockTest.java index f5bcfad156..4f36a85a94 100644 --- a/artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedLockTest.java +++ b/artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedLockTest.java @@ -116,7 +116,7 @@ public class CuratorDistributedLockTest extends DistributedLockTest { } @Test - public void canAcquireLocksFromDifferentNamespace() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { + public void canAcquireLocksFromDifferentNamespace() throws Exception { final DistributedLockManager manager1 = createManagedDistributeManager(config -> config.put("namespace", "1")); manager1.start(); final DistributedLockManager manager2 = createManagedDistributeManager(config -> config.put("namespace", "2")); @@ -126,14 +126,14 @@ public class CuratorDistributedLockTest extends DistributedLockTest { } @Test - public void cannotStartManagerWithDisconnectedServer() throws IOException, ExecutionException, InterruptedException { + public void cannotStartManagerWithDisconnectedServer() throws Exception { final DistributedLockManager manager = createManagedDistributeManager(); testingServer.close(); assertFalse(manager.start(1, TimeUnit.SECONDS)); } @Test - public void cannotAcquireLockWithDisconnectedServer() throws IOException, ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { + public void cannotAcquireLockWithDisconnectedServer() throws Exception { assertThrows(UnavailableStateException.class, () -> { final DistributedLockManager manager = createManagedDistributeManager(); manager.start(); @@ -148,7 +148,7 @@ public class CuratorDistributedLockTest extends DistributedLockTest { } @Test - public void cannotTryLockWithDisconnectedServer() throws IOException, ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { + public void cannotTryLockWithDisconnectedServer() throws Exception { assertThrows(UnavailableStateException.class, () -> { final DistributedLockManager manager = createManagedDistributeManager(); manager.start(); @@ -159,7 +159,7 @@ public class CuratorDistributedLockTest extends DistributedLockTest { } @Test - public void cannotCheckLockStatusWithDisconnectedServer() throws IOException, ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { + public void cannotCheckLockStatusWithDisconnectedServer() throws Exception { assertThrows(UnavailableStateException.class, () -> { final DistributedLockManager manager = createManagedDistributeManager(); manager.start(); diff --git a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/sasl/SCRAMTest.java b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/sasl/SCRAMTest.java index 62f9df5352..19cf8d7636 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/sasl/SCRAMTest.java +++ b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/sasl/SCRAMTest.java @@ -118,7 +118,7 @@ public class SCRAMTest { } @TestTemplate - public void testServerTryTrickClient() throws NoSuchAlgorithmException, ScramException { + public void testServerTryTrickClient() throws Exception { assertThrows(DecodeException.class, () -> { TestSCRAMClientSASL clientSASL = new TestSCRAMClientSASL(mechanism, USERNAME, PASSWORD); ScramServerFunctionalityImpl bad = diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/jaas/PropertiesLoginModuleRaceConditionTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/jaas/PropertiesLoginModuleRaceConditionTest.java index 5ebc76bf1b..b33a0de17b 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/jaas/PropertiesLoginModuleRaceConditionTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/jaas/PropertiesLoginModuleRaceConditionTest.java @@ -125,7 +125,7 @@ public class PropertiesLoginModuleRaceConditionTest extends ArtemisTestCase { } @Test - public void raceConditionInUsersAndGroupsLoading() throws InterruptedException, FileNotFoundException, IOException { + public void raceConditionInUsersAndGroupsLoading() throws Exception { boolean detected = false; // Brute force approach to increase the likelihood of the race condition occurring diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/SimpleJNDIClientTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/SimpleJNDIClientTest.java index f76744c7cf..54d80d52ea 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/SimpleJNDIClientTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/SimpleJNDIClientTest.java @@ -19,7 +19,6 @@ package org.apache.activemq.artemis.tests.integration.jms; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Destination; -import javax.jms.JMSException; import javax.jms.JMSSecurityException; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; @@ -102,7 +101,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testMultipleConnectionFactories() throws NamingException, JMSException { + public void testMultipleConnectionFactories() throws Exception { Hashtable<String, Object> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put("connectionFactory.VmConnectionFactory", "vm://0"); @@ -118,7 +117,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testVMCF0() throws NamingException, JMSException { + public void testVMCF0() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put("connectionFactory.ConnectionFactory", "vm://0"); @@ -131,7 +130,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testEmptyConnectionFactoryString() throws NamingException, JMSException { + public void testEmptyConnectionFactoryString() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put("connectionFactory.ConnectionFactory", "vm://0"); @@ -143,7 +142,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testVMCF1() throws NamingException, JMSException { + public void testVMCF1() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put("connectionFactory.ConnectionFactory", "vm://1"); @@ -155,7 +154,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testXACF() throws NamingException, JMSException { + public void testXACF() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put("connectionFactory.myConnectionFactory", "vm://0?type=XA_CF"); @@ -167,7 +166,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testQueueCF() throws NamingException, JMSException { + public void testQueueCF() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put("connectionFactory.myConnectionFactory", "vm://0?type=QUEUE_CF"); @@ -179,7 +178,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testQueueXACF() throws NamingException, JMSException { + public void testQueueXACF() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put("connectionFactory.myConnectionFactory", "vm://0?type=QUEUE_XA_CF"); @@ -191,7 +190,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testTopicCF() throws NamingException, JMSException { + public void testTopicCF() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put("connectionFactory.myConnectionFactory", "vm://0?type=TOPIC_CF"); @@ -203,7 +202,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testTopicXACF() throws NamingException, JMSException { + public void testTopicXACF() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put("connectionFactory.myConnectionFactory", "vm://0?type=TOPIC_XA_CF"); @@ -215,7 +214,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testRemoteCFWithTCP() throws NamingException, JMSException { + public void testRemoteCFWithTCP() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put("connectionFactory.myConnectionFactory", "tcp://127.0.0.1:61616"); @@ -227,7 +226,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testRemoteCFWithTCPandHA() throws NamingException, JMSException { + public void testRemoteCFWithTCPandHA() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put("connectionFactory.myConnectionFactory", "tcp://127.0.0.1:61616?ha=true"); @@ -270,7 +269,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testRemoteCFWithUDP() throws NamingException, JMSException { + public void testRemoteCFWithUDP() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put("connectionFactory.myConnectionFactory", "udp://" + getUDPDiscoveryAddress() + ":" + getUDPDiscoveryPort()); @@ -284,7 +283,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testRemoteCFWithUDPWithTransportConfig() throws NamingException, JMSException { + public void testRemoteCFWithUDPWithTransportConfig() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName()); props.put("connectionFactory.myConnectionFactory", "udp://" + getUDPDiscoveryAddress() + ":" + getUDPDiscoveryPort() + "?" + @@ -311,7 +310,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testRemoteCFWithMultipleHosts() throws NamingException, JMSException { + public void testRemoteCFWithMultipleHosts() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put("connectionFactory.myConnectionFactory", "tcp://127.0.0.1:61616/httpEnabled=true&foo=bar,tcp://127.0.0.2:61617?httpEnabled=false?clientID=myClientID"); @@ -324,7 +323,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testRemoteCFWithTransportConfig() throws NamingException, JMSException { + public void testRemoteCFWithTransportConfig() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put("connectionFactory.myConnectionFactory", "tcp://127.0.0.1:61616?" + @@ -438,7 +437,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testQueue() throws NamingException, JMSException { + public void testQueue() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put("queue.myQueue", "myQueue"); @@ -476,7 +475,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testDynamicQueue() throws NamingException, JMSException { + public void testDynamicQueue() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); Context ctx = new InitialContext(props); @@ -508,7 +507,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testTopic() throws NamingException, JMSException { + public void testTopic() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put("topic.myTopic", "myTopic"); @@ -545,7 +544,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testDynamicTopic() throws NamingException, JMSException { + public void testDynamicTopic() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); Context ctx = new InitialContext(props); @@ -638,7 +637,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { @Test - public void testProviderUrlDefault() throws NamingException, JMSException { + public void testProviderUrlDefault() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.PROVIDER_URL, "vm://0"); @@ -653,7 +652,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testProviderUrlCF() throws NamingException, JMSException { + public void testProviderUrlCF() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.PROVIDER_URL, "vm://0?type=CF"); @@ -668,7 +667,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testProviderUrlXACF() throws NamingException, JMSException { + public void testProviderUrlXACF() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.PROVIDER_URL, "vm://0?type=XA_CF"); @@ -683,7 +682,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testProviderUrlQueueCF() throws NamingException, JMSException { + public void testProviderUrlQueueCF() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.PROVIDER_URL, "vm://0?type=QUEUE_CF"); @@ -698,7 +697,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testProviderUrlQueueXACF() throws NamingException, JMSException { + public void testProviderUrlQueueXACF() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.PROVIDER_URL, "vm://0?type=QUEUE_XA_CF"); @@ -713,7 +712,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testProviderUrlTopicCF() throws NamingException, JMSException { + public void testProviderUrlTopicCF() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.PROVIDER_URL, "vm://0?type=TOPIC_CF"); @@ -728,7 +727,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testProviderUrlTopicXACF() throws NamingException, JMSException { + public void testProviderUrlTopicXACF() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.PROVIDER_URL, "vm://0?type=TOPIC_XA_CF"); @@ -743,7 +742,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void testProviderUrlDefaultAndCustom() throws NamingException, JMSException { + public void testProviderUrlDefaultAndCustom() throws Exception { Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.PROVIDER_URL, "vm://0"); @@ -762,7 +761,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void test1xNaming() throws NamingException, JMSException { + public void test1xNaming() throws Exception { liveService.getSecurityStore().setSecurityEnabled(false); Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); @@ -809,7 +808,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { } @Test - public void test1xNamingNegative() throws NamingException, JMSException { + public void test1xNamingNegative() throws Exception { liveService.getSecurityStore().setSecurityEnabled(false); Hashtable<String, String> props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/CloseDestroyedConnectionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/CloseDestroyedConnectionTest.java index 90e3a6ad5b..b247d38e86 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/CloseDestroyedConnectionTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/CloseDestroyedConnectionTest.java @@ -16,11 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.jms.connection; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.fail; - import javax.jms.Connection; -import javax.jms.JMSException; import javax.jms.Queue; import javax.jms.Session; @@ -40,6 +36,9 @@ import org.apache.activemq.artemis.tests.util.JMSTestBase; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; + public class CloseDestroyedConnectionTest extends JMSTestBase { private ActiveMQConnectionFactory cf; @@ -58,7 +57,7 @@ public class CloseDestroyedConnectionTest extends JMSTestBase { } @Test - public void testClosingTemporaryTopicDeletesQueue() throws JMSException, ActiveMQException { + public void testClosingTemporaryTopicDeletesQueue() throws Exception { conn = cf.createConnection(); assertEquals(1, server.getRemotingService().getConnections().size()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/JmsContextTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/JmsContextTest.java index 3b0ee66b25..5ca5237b7b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/JmsContextTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/JmsContextTest.java @@ -272,7 +272,7 @@ public class JmsContextTest extends JMSTestBase { } @Test - public void testSendStreamMessage() throws JMSException, InterruptedException { + public void testSendStreamMessage() throws Exception { JmsProducerCompletionListenerTest.CountingCompletionListener cl = new JmsProducerCompletionListenerTest.CountingCompletionListener(1); JMSProducer producer = context.createProducer(); producer.setAsync(cl); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/QueueConsumerPriorityTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/QueueConsumerPriorityTest.java index 1563e14509..e62f4121fc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/QueueConsumerPriorityTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/QueueConsumerPriorityTest.java @@ -16,10 +16,6 @@ */ package org.apache.activemq.artemis.tests.integration.openwire.amq; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; - -import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; @@ -30,6 +26,9 @@ import org.apache.activemq.command.ActiveMQQueue; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + public class QueueConsumerPriorityTest extends BasicOpenWireTest { @Override @@ -39,7 +38,7 @@ public class QueueConsumerPriorityTest extends BasicOpenWireTest { this.makeSureCoreQueueExist("QUEUE.A"); } @Test - public void testQueueConsumerPriority() throws JMSException, InterruptedException { + public void testQueueConsumerPriority() throws Exception { connection.start(); Session consumerLowPriority = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Session consumerHighPriority = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information, visit: https://activemq.apache.org/contact
