From ca73dee630fd8afd463257551d067b5bbc2c7e8f Mon Sep 17 00:00:00 2001 From: Justin Bertram Date: Fri, 21 Jun 2024 17:20:34 -0500 Subject: [PATCH] ARTEMIS-4833 remove redundant type arguments --- .../artemis/json/impl/JsonArrayImpl.java | 2 +- .../artemis/json/impl/JsonObjectImpl.java | 8 ++++---- .../artemis/utils/collections/EmptyList.java | 2 +- .../api/core/TransportConfiguration.java | 2 +- .../client/impl/ClientSessionFactoryImpl.java | 2 +- .../artemis/core/cluster/DiscoveryGroup.java | 2 +- .../remoting/impl/netty/NettyConnector.java | 2 +- .../impl/netty/SharedEventLoopGroup.java | 2 +- .../artemis/ClientThreadPoolsTest.java | 8 ++++---- .../api/core/TransportConfigurationTest.java | 4 ++-- .../artemis/jms/client/ActiveMQMessage.java | 2 +- .../amqp/proton/AmqpTransferTagGenerator.java | 2 +- .../ra/ActiveMQRAManagedConnection.java | 4 ++-- .../activemq/artemis/ra/ActiveMQRaUtils.java | 2 +- .../artemis/ra/ActiveMQResourceAdapter.java | 2 +- .../artemis/ra/inflow/ActiveMQActivation.java | 4 ++-- .../core/config/impl/ConfigurationImpl.java | 2 +- .../config/impl/SecurityConfiguration.java | 2 +- .../impl/WildcardAddressManager.java | 2 +- .../core/remoting/impl/invm/InVMConnector.java | 2 +- .../remoting/impl/netty/NettyAcceptor.java | 2 +- .../server/impl/RemotingServiceImpl.java | 4 ++-- .../core/replication/ReplicationEndpoint.java | 2 +- .../group/impl/GroupHandlingAbstract.java | 2 +- .../core/server/impl/ActiveMQServerImpl.java | 8 ++++---- .../core/server/impl/ScaleDownHandler.java | 4 ++-- .../core/server/impl/ServiceRegistryImpl.java | 4 ++-- .../config/impl/ConfigurationImplTest.java | 2 +- .../jaas/CertificateLoginModuleTest.java | 4 ++-- ...PropertiesLoginModuleRaceConditionTest.java | 2 +- .../artemis/core/settings/RepositoryTest.java | 8 ++++---- .../security/jaas/LDAPLoginModuleTest.java | 2 +- .../artemis/tests/util/ServerTestBase.java | 2 +- .../xa/recovery/XARecoveryConfig.java | 4 ++-- .../artemiswrapper/ArtemisBrokerBase.java | 6 +++--- .../artemiswrapper/InVMNamingContext.java | 2 +- .../artemiswrapper/NonSerializableFactory.java | 2 +- .../org/apache/activemq/JMSConsumerTest.java | 2 +- .../activemq/JmsConnectionStartStopTest.java | 2 +- .../JmsMultipleClientsTestSupport.java | 2 +- .../activemq/JmsSendReceiveTestSupport.java | 2 +- .../activemq/JmsTempDestinationTest.java | 2 +- .../org/apache/activemq/JmsTestSupport.java | 2 +- .../test/JmsSendReceiveTestSupport.java | 2 +- .../transport/tcp/TcpTransportServerTest.java | 2 +- .../artemis/tests/unit/util/InVMContext.java | 2 +- .../tests/unit/util/InVMNamingContext.java | 2 +- .../unit/util/NonSerializableFactory.java | 2 +- .../artemis/tests/util/ActiveMQTestBase.java | 2 +- .../amqp/AmqpFullyQualifiedNameTest.java | 2 +- .../integration/amqp/TopicDurableTests.java | 2 +- .../ConcurrentCreateDeleteProduceTest.java | 5 ++--- .../client/InterruptedLargeMessageTest.java | 4 ++-- .../integration/client/LargeMessageTest.java | 2 +- .../client/MultipleThreadFilterOneTest.java | 11 +++++------ .../integration/cluster/bridge/BridgeTest.java | 2 +- .../cluster/failover/PagingFailoverTest.java | 9 ++++----- .../failover/ReplicatedFailoverTest.java | 2 +- .../failover/ReplicatedPagedFailoverTest.java | 7 +++---- ...NettyNoGroupNameReplicatedFailoverTest.java | 2 +- .../topology/TopologyClusterTestBase.java | 8 ++++---- .../integration/journal/RelativePathTest.java | 6 +++--- .../management/AcceptorControlTest.java | 8 ++++---- .../management/ActiveMQServerControlTest.java | 4 ++-- .../LargeMessageOverManagementTest.java | 2 +- .../management/QueueControlTest.java | 10 +++++----- .../openwire/amq/JMSConsumer2Test.java | 2 +- .../amq/JmsConnectionStartStopTest.java | 2 +- .../openwire/amq/JmsQueueBrowserTest.java | 2 +- .../amq/JmsSendReceiveTestSupport.java | 2 +- .../paging/PageTransactionCleanupTest.java | 11 +++++------ .../integration/paging/PagingOrderTest.java | 18 +++++++++--------- .../integration/paging/PagingSyncTest.java | 5 ++--- .../DeleteMessagesOnStartupTest.java | 11 ++++------- .../persistence/JMSStorageManagerTest.java | 2 +- .../integration/persistence/RestartSMTest.java | 6 ++---- .../persistence/StorageManagerTestBase.java | 5 +---- .../remoting/DestroyConsumerTest.java | 2 +- .../replication/ReplicationTest.java | 2 +- .../NettyConnectorWithHTTPUpgradeTest.java | 2 +- .../tests/util/NonSerializableFactory.java | 2 +- .../artemis/jms/tests/MessageConsumerTest.java | 2 +- .../jms/tests/tools/container/InVMContext.java | 2 +- .../artemis/tests/leak/ClientLeakTest.java | 2 +- .../journal/JournalImplTestUnit.java | 16 +++++++--------- .../smoke/upgradeTest/CompareUpgradeTest.java | 2 +- .../soak/client/ClientNonDivertedSoakTest.java | 9 ++++----- .../tests/soak/client/ClientSoakTest.java | 9 ++++----- .../soak/client/SimpleSendReceiveSoakTest.java | 9 ++++----- .../stress/paging/PageCursorStressTest.java | 15 +++++++-------- .../core/journal/impl/JournalImplTestUnit.java | 10 ++++------ .../config/impl/ConnectorsServiceTest.java | 8 ++++---- .../impl/BatchIDGeneratorUnitTest.java | 2 +- .../impl/DuplicateDetectionUnitTest.java | 13 +++++-------- .../impl/invm/InVMConnectorFactoryTest.java | 2 +- .../impl/netty/NettyAcceptorFactoryTest.java | 2 +- .../remoting/impl/netty/NettyAcceptorTest.java | 2 +- .../impl/netty/NettyConnectorFactoryTest.java | 2 +- .../server/impl/RemotingServiceImplTest.java | 7 +++---- 99 files changed, 195 insertions(+), 221 deletions(-) diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/json/impl/JsonArrayImpl.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/json/impl/JsonArrayImpl.java index a8056c3dbc..0803d1d344 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/json/impl/JsonArrayImpl.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/json/impl/JsonArrayImpl.java @@ -121,7 +121,7 @@ public class JsonArrayImpl extends JsonValueImpl implements JsonArray { @Override public Iterator iterator() { - return new Iterator() { + return new Iterator<>() { private Iterator rawIterator = rawArray.iterator(); @Override diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/json/impl/JsonObjectImpl.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/json/impl/JsonObjectImpl.java index 2b37f96c0d..4e9f8bdaa5 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/json/impl/JsonObjectImpl.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/json/impl/JsonObjectImpl.java @@ -160,10 +160,10 @@ public class JsonObjectImpl extends JsonValueImpl implements JsonObject { @Override public Collection values() { - return new AbstractCollection() { + return new AbstractCollection<>() { @Override public Iterator iterator() { - return new Iterator() { + return new Iterator<>() { private Iterator rawIterator = rawObject.values().iterator(); @Override @@ -187,10 +187,10 @@ public class JsonObjectImpl extends JsonValueImpl implements JsonObject { @Override public Set> entrySet() { - return new AbstractSet>() { + return new AbstractSet<>() { @Override public Iterator> iterator() { - return new Iterator>() { + return new Iterator<>() { private Iterator> rawIterator = rawObject.entrySet().iterator(); @Override diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/EmptyList.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/EmptyList.java index 7215a71921..616e8f71ca 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/EmptyList.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/EmptyList.java @@ -56,7 +56,7 @@ public class EmptyList implements LinkedList { return null; } - LinkedListIterator emptyIterator = new LinkedListIterator() { + LinkedListIterator emptyIterator = new LinkedListIterator<>() { @Override public void repeat() { } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/TransportConfiguration.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/TransportConfiguration.java index 67d7469f40..a1913d1255 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/TransportConfiguration.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/TransportConfiguration.java @@ -155,7 +155,7 @@ public class TransportConfiguration implements Serializable { * @param className The class name of the ConnectorFactory */ public TransportConfiguration(final String className) { - this(className, new HashMap(), UUIDGenerator.getInstance().generateStringUUID()); + this(className, new HashMap<>(), UUIDGenerator.getInstance().generateStringUUID()); } /** diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java index 67a6b723fb..85fe03593a 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java @@ -156,7 +156,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C public final Exception createTrace; - public static final Set CLOSE_RUNNABLES = Collections.synchronizedSet(new HashSet()); + public static final Set CLOSE_RUNNABLES = Collections.synchronizedSet(new HashSet<>()); private final ConfirmationWindowWarning confirmationWindowWarning; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java index 577694aecc..00f3ddb9ba 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java @@ -114,7 +114,7 @@ public final class DiscoveryGroup implements ActiveMQComponent { started = true; - ThreadFactory tfactory = AccessController.doPrivileged(new PrivilegedAction() { + ThreadFactory tfactory = AccessController.doPrivileged(new PrivilegedAction<>() { @Override public ThreadFactory run() { return new ActiveMQThreadFactory("DiscoveryGroup-" + System.identityHashCode(this), "activemq-discovery-group-thread-" + name, true, DiscoveryGroup.class.getClassLoader()); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java index 40314e57f3..43f4842bf1 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java @@ -649,7 +649,7 @@ public class NettyConnector extends AbstractConnector { realTrustStorePassword = null; } - bootstrap.handler(new ChannelInitializer() { + bootstrap.handler(new ChannelInitializer<>() { @Override public void initChannel(Channel channel) throws Exception { final ChannelPipeline pipeline = channel.pipeline(); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/SharedEventLoopGroup.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/SharedEventLoopGroup.java index e7affad519..adff92c07e 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/SharedEventLoopGroup.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/SharedEventLoopGroup.java @@ -61,7 +61,7 @@ public class SharedEventLoopGroup extends DelegatingEventLoopGroup { f.cancel(false); } } else { - instance = new SharedEventLoopGroup(eventLoopGroupSupplier.apply(AccessController.doPrivileged(new PrivilegedAction() { + instance = new SharedEventLoopGroup(eventLoopGroupSupplier.apply(AccessController.doPrivileged(new PrivilegedAction<>() { @Override public ThreadFactory run() { return new ActiveMQThreadFactory("ActiveMQ-client-netty-threads", true, ClientSessionFactoryImpl.class.getClassLoader()); diff --git a/artemis-core-client/src/test/java/org/apache/activemq/artemis/ClientThreadPoolsTest.java b/artemis-core-client/src/test/java/org/apache/activemq/artemis/ClientThreadPoolsTest.java index 7cf10b4937..733017ee6d 100644 --- a/artemis-core-client/src/test/java/org/apache/activemq/artemis/ClientThreadPoolsTest.java +++ b/artemis-core-client/src/test/java/org/apache/activemq/artemis/ClientThreadPoolsTest.java @@ -100,9 +100,9 @@ public class ClientThreadPoolsTest { public void testInjectPools() throws Exception { ActiveMQClient.clearThreadPools(); - ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue()); + ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>()); - ThreadPoolExecutor flowControlPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue()); + ThreadPoolExecutor flowControlPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>()); ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = (ScheduledThreadPoolExecutor) Executors.newScheduledThreadPool(1, ActiveMQThreadFactory.defaultThreadFactory(getClass().getName())); @@ -222,9 +222,9 @@ public class ClientThreadPoolsTest { ServerLocator serverLocator = new ServerLocatorImpl(false); - ThreadPoolExecutor threadPool = new ThreadPoolExecutor(1, 1, 60L, TimeUnit.SECONDS, new SynchronousQueue()); + ThreadPoolExecutor threadPool = new ThreadPoolExecutor(1, 1, 60L, TimeUnit.SECONDS, new SynchronousQueue<>()); ScheduledThreadPoolExecutor scheduledThreadPool = new ScheduledThreadPoolExecutor(1); - ThreadPoolExecutor flowControlThreadPool = new ThreadPoolExecutor(1, 1, 60L, TimeUnit.SECONDS, new SynchronousQueue()); + ThreadPoolExecutor flowControlThreadPool = new ThreadPoolExecutor(1, 1, 60L, TimeUnit.SECONDS, new SynchronousQueue<>()); serverLocator.setThreadPools(threadPool, scheduledThreadPool, flowControlThreadPool); Field threadPoolField = ServerLocatorImpl.class.getDeclaredField("threadPool"); diff --git a/artemis-core-client/src/test/java/org/apache/activemq/artemis/api/core/TransportConfigurationTest.java b/artemis-core-client/src/test/java/org/apache/activemq/artemis/api/core/TransportConfigurationTest.java index d50d6f6919..9ef6c1de35 100644 --- a/artemis-core-client/src/test/java/org/apache/activemq/artemis/api/core/TransportConfigurationTest.java +++ b/artemis-core-client/src/test/java/org/apache/activemq/artemis/api/core/TransportConfigurationTest.java @@ -34,8 +34,8 @@ public class TransportConfigurationTest { @Test public void testEquals() { - TransportConfiguration configuration = new TransportConfiguration("SomeClass", new HashMap(), null); - TransportConfiguration configuration2 = new TransportConfiguration("SomeClass", new HashMap(), null); + TransportConfiguration configuration = new TransportConfiguration("SomeClass", new HashMap<>(), null); + TransportConfiguration configuration2 = new TransportConfiguration("SomeClass", new HashMap<>(), null); assertEquals(configuration, configuration2); assertEquals(configuration.hashCode(), configuration2.hashCode()); diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java index 1fcc53bb5d..620d01b3a7 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java @@ -106,7 +106,7 @@ public class ActiveMQMessage implements javax.jms.Message { } public static CompositeData coreCompositeTypeToJMSCompositeType(CompositeDataSupport data) throws Exception { - CompositeData jmsdata = new CompositeDataSupport(data.getCompositeType(), new HashMap()); + CompositeData jmsdata = new CompositeDataSupport(data.getCompositeType(), new HashMap<>()); return jmsdata; } diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AmqpTransferTagGenerator.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AmqpTransferTagGenerator.java index 2cbf9edcd7..3337fd122a 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AmqpTransferTagGenerator.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AmqpTransferTagGenerator.java @@ -38,7 +38,7 @@ public final class AmqpTransferTagGenerator { public AmqpTransferTagGenerator(boolean pool) { if (pool) { - this.tagPool = new ArrayDeque(); + this.tagPool = new ArrayDeque<>(); } else { this.tagPool = null; } diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnection.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnection.java index 4043f94c64..a607efa20c 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnection.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnection.java @@ -149,8 +149,8 @@ public final class ActiveMQRAManagedConnection implements ManagedConnection, Exc this.ra = ra; this.userName = userName; this.password = password; - eventListeners = Collections.synchronizedList(new ArrayList()); - handles = Collections.synchronizedSet(new HashSet()); + eventListeners = Collections.synchronizedList(new ArrayList<>()); + handles = Collections.synchronizedSet(new HashSet<>()); connection = null; nonXAsession = null; diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRaUtils.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRaUtils.java index 2d01ce6376..a0f7583748 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRaUtils.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRaUtils.java @@ -209,7 +209,7 @@ public final class ActiveMQRaUtils { * For that reason any class trying to do a privileged block should do with the AccessController directly. */ private static Object safeInitNewInstance(final String className) { - return AccessController.doPrivileged(new PrivilegedAction() { + return AccessController.doPrivileged(new PrivilegedAction<>() { @Override public Object run() { ClassLoader loader = getClass().getClassLoader(); diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQResourceAdapter.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQResourceAdapter.java index 62d908b0b5..637c69c19b 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQResourceAdapter.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQResourceAdapter.java @@ -142,7 +142,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable { raProperties = new ActiveMQRAProperties(); configured = new AtomicBoolean(false); - activations = Collections.synchronizedMap(new IdentityHashMap()); + activations = Collections.synchronizedMap(new IdentityHashMap<>()); recoveryManager = new RecoveryManager(); } diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java index d7f673ee9e..6ba54725ba 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java @@ -121,7 +121,7 @@ public class ActiveMQActivation { private ActiveMQConnectionFactory factory; - private final List nodes = Collections.synchronizedList(new ArrayList()); + private final List nodes = Collections.synchronizedList(new ArrayList<>()); private final Map removedNodes = new ConcurrentHashMap<>(); @@ -135,7 +135,7 @@ public class ActiveMQActivation { static { try { - ONMESSAGE = MessageListener.class.getMethod("onMessage", new Class[]{Message.class}); + ONMESSAGE = MessageListener.class.getMethod("onMessage", Message.class); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java index 611b2d93ba..9f4ac3ccfb 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java @@ -852,7 +852,7 @@ public class ConfigurationImpl implements Configuration, Serializable { beanUtils.getConvertUtils().register(new Converter() { @Override public T convert(Class type, Object value) { - List convertedValue = new ArrayList(); + List convertedValue = new ArrayList<>(); for (String entry : value.toString().split(",")) { convertedValue.add(entry); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java index 3a94067de8..9ed1a86114 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java @@ -72,7 +72,7 @@ public class SecurityConfiguration extends Configuration { public void addRole(final String user, final String role) { if (roles.get(user) == null) { - roles.put(user, new ArrayList()); + roles.put(user, new ArrayList<>()); } roles.get(user).add(role); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/WildcardAddressManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/WildcardAddressManager.java index 18caf73f0b..a7d4518f43 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/WildcardAddressManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/WildcardAddressManager.java @@ -57,7 +57,7 @@ public class WildcardAddressManager extends SimpleAddressManager { final Bindings[] lazyCreateResult = new Bindings[1]; - addressMap.visitMatchingWildcards(address, new AddressMapVisitor() { + addressMap.visitMatchingWildcards(address, new AddressMapVisitor<>() { Bindings newBindings = null; @Override diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java index e546ee9be5..b1dbc795fa 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java @@ -125,7 +125,7 @@ public class InVMConnector extends AbstractConnector { private static synchronized ExecutorService getInVMExecutor() { if (threadPoolExecutor == null) { if (ActiveMQClient.getGlobalThreadPoolSize() <= -1) { - threadPoolExecutor = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue(), ActiveMQThreadFactory.defaultThreadFactory(InVMConnector.class.getName())); + threadPoolExecutor = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<>(), ActiveMQThreadFactory.defaultThreadFactory(InVMConnector.class.getName())); } else { threadPoolExecutor = new ActiveMQThreadPoolExecutor(0, ActiveMQClient.getGlobalThreadPoolSize(), 60L, TimeUnit.SECONDS, ActiveMQThreadFactory.defaultThreadFactory(InVMConnector.class.getName())); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java index 3da273d161..57e86a874e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java @@ -454,7 +454,7 @@ public class NettyAcceptor extends AbstractAcceptor { bootstrap.group(eventLoopGroup); bootstrap.channel(channelClazz); - ChannelInitializer factory = new ChannelInitializer() { + ChannelInitializer factory = new ChannelInitializer<>() { @Override public void initChannel(Channel channel) throws Exception { ChannelPipeline pipeline = channel.pipeline(); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java index 2b8e177014..619e058405 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.core.remoting.server.impl; +import java.lang.invoke.MethodHandles; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Collections; @@ -26,8 +27,8 @@ import java.util.Map; import java.util.Map.Entry; import java.util.ServiceLoader; import java.util.Set; -import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executor; @@ -80,7 +81,6 @@ import org.apache.activemq.artemis.utils.ConfigurationHelper; import org.apache.activemq.artemis.utils.ReusableLatch; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.lang.invoke.MethodHandles; public class RemotingServiceImpl implements RemotingService, ServerConnectionLifeCycleListener { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java index 891f97f733..09cf40567d 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java @@ -307,7 +307,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon journalsHolder.put(JournalContent.MESSAGES, storageManager.getMessageJournal()); for (JournalContent jc : EnumSet.allOf(JournalContent.class)) { - filesReservedForSync.put(jc, new HashMap()); + filesReservedForSync.put(jc, new HashMap<>()); // We only need to load internal structures on the backup... journalLoadInformation[jc.typeByte] = journalsHolder.get(jc).loadSyncOnly(JournalState.SYNCING); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/GroupHandlingAbstract.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/GroupHandlingAbstract.java index 35d68e43ec..d0451c9722 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/GroupHandlingAbstract.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/GroupHandlingAbstract.java @@ -41,7 +41,7 @@ public abstract class GroupHandlingAbstract implements GroupingHandler { protected final SimpleString address; // no need to synchronize listeners as we use a single threaded executor on all its accesses - final Set listeners = Collections.newSetFromMap(new WeakHashMap()); + final Set listeners = Collections.newSetFromMap(new WeakHashMap<>()); public GroupHandlingAbstract(final Executor executor, final ManagementService managementService, diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java index eca2376c5f..6e0bef711b 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java @@ -507,7 +507,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { securityRepository = new HierarchicalObjectRepository<>(configuration.getWildcardConfiguration()); - securityRepository.setDefault(new HashSet()); + securityRepository.setDefault(new HashSet<>()); this.parentServer = parentServer; @@ -3158,7 +3158,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { ThreadFactory tFactory = AccessController.doPrivileged((PrivilegedAction) ()-> new ActiveMQThreadFactory("ActiveMQ-server-" + this, false, ClientSessionFactoryImpl.class.getClassLoader())); if (configuration.getThreadPoolMaxSize() == -1) { - threadPool = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue(), tFactory); + threadPool = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<>(), tFactory); } else { threadPool = new ActiveMQThreadPoolExecutor(0, configuration.getThreadPoolMaxSize(), 60L, TimeUnit.SECONDS, tFactory); } @@ -3184,14 +3184,14 @@ public class ActiveMQServerImpl implements ActiveMQServer { } else { ThreadFactory tFactory = AccessController.doPrivileged((PrivilegedAction) () -> new ActiveMQThreadFactory("ActiveMQ-IO-server-" + this, false, ClientSessionFactoryImpl.class.getClassLoader())); - this.ioExecutorPool = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue(), tFactory); + this.ioExecutorPool = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<>(), tFactory); this.ioExecutorFactory = new OrderedExecutorFactory(ioExecutorPool); } if (serviceRegistry.getPageExecutorService() != null) { this.pageExecutorFactory = new OrderedExecutorFactory(serviceRegistry.getPageExecutorService()).setFair(true); } else { - ThreadFactory tFactory = AccessController.doPrivileged(new PrivilegedAction() { + ThreadFactory tFactory = AccessController.doPrivileged(new PrivilegedAction<>() { @Override public ThreadFactory run() { return new ActiveMQThreadFactory("ActiveMQ-PageExecutor-server-" + this.toString(), false, ClientSessionFactoryImpl.class.getClassLoader()); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java index 2930ea729e..0dc9a04bff 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java @@ -359,7 +359,7 @@ public class ScaleDownHandler { } Pair, List> queueIds = queuesToSendTo.get(message); if (queueIds == null) { - queueIds = new Pair, List>(new ArrayList(), new ArrayList()); + queueIds = new Pair<>(new ArrayList<>(), new ArrayList<>()); queuesToSendTo.put(message, queueIds); } queueIds.getA().add(queueID); @@ -381,7 +381,7 @@ public class ScaleDownHandler { } Pair, List> queueIds = queuesToSendTo.get(message); if (queueIds == null) { - queueIds = new Pair, List>(new ArrayList(), new ArrayList()); + queueIds = new Pair<>(new ArrayList<>(), new ArrayList<>()); queuesToSendTo.put(message, queueIds); } queueIds.getA().add(queueID); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServiceRegistryImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServiceRegistryImpl.java index 57f86654a1..cd89a82e22 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServiceRegistryImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServiceRegistryImpl.java @@ -67,8 +67,8 @@ public class ServiceRegistryImpl implements ServiceRegistry { private Map> connectorServices; public ServiceRegistryImpl() { - this.incomingInterceptors = Collections.synchronizedList(new ArrayList()); - this.outgoingInterceptors = Collections.synchronizedList(new ArrayList()); + this.incomingInterceptors = Collections.synchronizedList(new ArrayList<>()); + this.outgoingInterceptors = Collections.synchronizedList(new ArrayList<>()); this.connectorServices = new ConcurrentHashMap<>(); this.divertTransformers = new ConcurrentHashMap<>(); this.bridgeTransformers = new ConcurrentHashMap<>(); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java index 1e67e990df..43a1ac25e7 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java @@ -1935,7 +1935,7 @@ public class ConfigurationImplTest extends AbstractConfigurationTestBase { final AtomicReference errorAt = new AtomicReference<>(); ConfigurationImpl configuration = new ConfigurationImpl(); - configuration.setResourceLimitSettings(new HashMap() { + configuration.setResourceLimitSettings(new HashMap<>() { @Override public ResourceLimitSettings put(String key, ResourceLimitSettings value) { if (!(key.equals(insertionOrderedKeys.remove()))) { diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/jaas/CertificateLoginModuleTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/jaas/CertificateLoginModuleTest.java index 05b9ab7223..cbbaacdf2e 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/jaas/CertificateLoginModuleTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/jaas/CertificateLoginModuleTest.java @@ -60,7 +60,7 @@ public class CertificateLoginModuleTest { loginModule = new StubCertificateLoginModule(userName, new HashSet<>(rolesNames)); JaasCallbackHandler callbackHandler = new JaasCallbackHandler(null, null, null); - loginModule.initialize(subject, callbackHandler, null, new HashMap()); + loginModule.initialize(subject, callbackHandler, null, new HashMap<>()); loginModule.login(); loginModule.commit(); @@ -120,7 +120,7 @@ public class CertificateLoginModuleTest { boolean loginFailed = false; try { - loginWithCredentials(null, new HashSet()); + loginWithCredentials(null, new HashSet<>()); } catch (LoginException e) { loginFailed = true; } 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 82ad7c557b..1b2fb11117 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 @@ -89,7 +89,7 @@ public class PropertiesLoginModuleRaceConditionTest extends ArtemisTestCase { Subject subject = new Subject(); PropertiesLoginModule module = new PropertiesLoginModule(); - module.initialize(subject, callback, new HashMap(), options); + module.initialize(subject, callback, new HashMap<>(), options); module.login(); module.commit(); } catch (Exception e) { diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/RepositoryTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/RepositoryTest.java index e749388040..bca8cec81e 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/RepositoryTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/RepositoryTest.java @@ -49,7 +49,7 @@ public class RepositoryTest extends ServerTestBase { @Test public void testDefault() { - securityRepository.setDefault(new HashSet()); + securityRepository.setDefault(new HashSet<>()); HashSet roles = securityRepository.getMatch("queues.something"); assertEquals(roles.size(), 0); @@ -175,14 +175,14 @@ public class RepositoryTest extends ServerTestBase { @Test public void testSingleMatch() { - securityRepository.addMatch("queues.*", new HashSet()); + securityRepository.addMatch("queues.*", new HashSet<>()); HashSet hashSet = securityRepository.getMatch("queues.something"); assertEquals(hashSet.size(), 0); } @Test public void testSingletwo() { - securityRepository.addMatch("queues.another.aq.*", new HashSet()); + securityRepository.addMatch("queues.another.aq.*", new HashSet<>()); HashSet roles = new HashSet<>(2); roles.add(new Role("test1", true, true, true, true, true, true, true, true, true, true, false, false)); roles.add(new Role("test2", true, true, true, true, true, true, true, true, true, true, false, false)); @@ -199,7 +199,7 @@ public class RepositoryTest extends ServerTestBase { @Test public void testWithoutWildcard() { - securityRepository.addMatch("queues.1.*", new HashSet()); + securityRepository.addMatch("queues.1.*", new HashSet<>()); HashSet roles = new HashSet<>(2); roles.add(new Role("test1", true, true, true, true, true, true, true, true, true, true, false, false)); roles.add(new Role("test2", true, true, true, true, true, true, true, true, true, true, false, false)); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModuleTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModuleTest.java index 7b66b9f285..0d50af8c8d 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModuleTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModuleTest.java @@ -212,7 +212,7 @@ public class LDAPLoginModuleTest extends AbstractLdapTestUnit { LoginModule loginModule = new LDAPLoginModule(); JaasCallbackHandler callbackHandler = new JaasCallbackHandler(null, null, null); - loginModule.initialize(new Subject(), callbackHandler, null, new HashMap()); + loginModule.initialize(new Subject(), callbackHandler, null, new HashMap<>()); // login should return false due to null username assertFalse(loginModule.login()); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ServerTestBase.java b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ServerTestBase.java index 5e51f0d63a..947c7eb3e2 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ServerTestBase.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ServerTestBase.java @@ -239,7 +239,7 @@ public abstract class ServerTestBase extends ArtemisTestCase { ConfigurationImpl configuration = createBasicConfig(serverID).setJMXManagementEnabled(false).addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY, generateInVMParams(serverID), "invm")); if (netty) { - configuration.addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, new HashMap(), "netty", new HashMap())); + configuration.addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, new HashMap<>(), "netty", new HashMap<>())); } else { // if we're in-vm it's a waste to resolve protocols since they'll never be used configuration.setResolveProtocols(false); diff --git a/artemis-service-extensions/src/main/java/org/apache/activemq/artemis/service/extensions/xa/recovery/XARecoveryConfig.java b/artemis-service-extensions/src/main/java/org/apache/activemq/artemis/service/extensions/xa/recovery/XARecoveryConfig.java index f10dfc3190..83637e7cdd 100644 --- a/artemis-service-extensions/src/main/java/org/apache/activemq/artemis/service/extensions/xa/recovery/XARecoveryConfig.java +++ b/artemis-service-extensions/src/main/java/org/apache/activemq/artemis/service/extensions/xa/recovery/XARecoveryConfig.java @@ -109,7 +109,7 @@ public class XARecoveryConfig { this.password = password; this.ha = ha; this.clientProtocolManager = clientProtocolManager; - this.properties = properties == null ? Collections.unmodifiableMap(new HashMap()) : Collections.unmodifiableMap(properties); + this.properties = properties == null ? Collections.unmodifiableMap(new HashMap<>()) : Collections.unmodifiableMap(properties); } public XARecoveryConfig(final boolean ha, @@ -145,7 +145,7 @@ public class XARecoveryConfig { this.username = username; this.password = password; this.ha = serverLocator.isHA(); - this.properties = properties == null ? Collections.unmodifiableMap(new HashMap()) : Collections.unmodifiableMap(properties); + this.properties = properties == null ? Collections.unmodifiableMap(new HashMap<>()) : Collections.unmodifiableMap(properties); this.clientProtocolManager = clientProtocolManager; this.locatorConfig = serverLocator.getLocatorConfig(); } diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerBase.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerBase.java index 1cc825b388..0cad437a18 100644 --- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerBase.java +++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerBase.java @@ -428,7 +428,7 @@ public abstract class ArtemisBrokerBase implements Broker { } protected final ActiveMQServer createServer(final boolean realFiles, final boolean netty) throws Exception { - return createServer(realFiles, createDefaultConfig(netty), -1, -1, new HashMap()); + return createServer(realFiles, createDefaultConfig(netty), -1, -1, new HashMap<>()); } protected final ActiveMQServer createServer(final boolean realFiles, @@ -464,9 +464,9 @@ public abstract class ArtemisBrokerBase implements Broker { protected Configuration createDefaultConfig(final boolean netty) throws Exception { if (netty) { - return createDefaultConfig(new HashMap(), NETTY_ACCEPTOR_FACTORY); + return createDefaultConfig(new HashMap<>(), NETTY_ACCEPTOR_FACTORY); } else { - return createDefaultConfig(new HashMap(), INVM_ACCEPTOR_FACTORY); + return createDefaultConfig(new HashMap<>(), INVM_ACCEPTOR_FACTORY); } } diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/InVMNamingContext.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/InVMNamingContext.java index e0a6c9da36..7c4ac2e5de 100644 --- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/InVMNamingContext.java +++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/InVMNamingContext.java @@ -50,7 +50,7 @@ public class InVMNamingContext implements Context, Serializable { public InVMNamingContext() { - map = Collections.synchronizedMap(new HashMap()); + map = Collections.synchronizedMap(new HashMap<>()); } public InVMNamingContext(final String nameInNamespace) { diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/NonSerializableFactory.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/NonSerializableFactory.java index ebbcb54c9b..7dc42afdd9 100644 --- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/NonSerializableFactory.java +++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/NonSerializableFactory.java @@ -104,5 +104,5 @@ public class NonSerializableFactory implements ObjectFactory { return NonSerializableFactory.wrapperMap; } - private static Map wrapperMap = Collections.synchronizedMap(new HashMap()); + private static Map wrapperMap = Collections.synchronizedMap(new HashMap<>()); } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java index ab9c3bb766..cf3b8a49c9 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java @@ -132,7 +132,7 @@ public class JMSConsumerTest extends JmsTestSupport { final ActiveMQMessageConsumer consumer = (ActiveMQMessageConsumer) session.createConsumer(destination); - final Map exceptions = Collections.synchronizedMap(new HashMap()); + final Map exceptions = Collections.synchronizedMap(new HashMap<>()); Thread.setDefaultUncaughtExceptionHandler((t, e) -> { LOG.error("Uncaught exception:", e); exceptions.put(t, e); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConnectionStartStopTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConnectionStartStopTest.java index 954bf6cd5d..3e286fa4a7 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConnectionStartStopTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConnectionStartStopTest.java @@ -113,7 +113,7 @@ public class JmsConnectionStartStopTest extends TestSupport { } public void testConcurrentSessionCreateWithStart() throws Exception { - ThreadPoolExecutor executor = new ThreadPoolExecutor(50, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue()); + ThreadPoolExecutor executor = new ThreadPoolExecutor(50, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<>()); final Vector exceptions = new Vector<>(); final Random rand = new Random(); Runnable createSessionTask = () -> { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleClientsTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleClientsTestSupport.java index d60d041bda..8e8e01c5a5 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleClientsTestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleClientsTestSupport.java @@ -77,7 +77,7 @@ public class JmsMultipleClientsTestSupport { protected BrokerService broker; protected Destination destination; - protected List connections = Collections.synchronizedList(new ArrayList()); + protected List connections = Collections.synchronizedList(new ArrayList<>()); protected MessageIdList allMessagesList = new MessageIdList(); protected void startProducers(Destination dest, int msgCount) throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsSendReceiveTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsSendReceiveTestSupport.java index 943df18fe9..a8fb319f19 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsSendReceiveTestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsSendReceiveTestSupport.java @@ -227,7 +227,7 @@ public class JmsSendReceiveTestSupport extends TestSupport implements MessageLis * @return List */ protected List createConcurrentList() { - return Collections.synchronizedList(new ArrayList()); + return Collections.synchronizedList(new ArrayList<>()); } /** diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTempDestinationTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTempDestinationTest.java index 7c271922cc..ca6996d551 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTempDestinationTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTempDestinationTest.java @@ -50,7 +50,7 @@ public class JmsTempDestinationTest { private static final Logger LOG = LoggerFactory.getLogger(JmsTempDestinationTest.class); private Connection connection; private ActiveMQConnectionFactory factory; - protected List connections = Collections.synchronizedList(new ArrayList()); + protected List connections = Collections.synchronizedList(new ArrayList<>()); @Before public void setUp() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTestSupport.java index 9be42dcdaa..94a7c7f867 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTestSupport.java @@ -50,7 +50,7 @@ public class JmsTestSupport extends CombinationTestSupport { protected ActiveMQConnection connection; protected BrokerService broker; - protected List connections = Collections.synchronizedList(new ArrayList()); + protected List connections = Collections.synchronizedList(new ArrayList<>()); // ///////////////////////////////////////////////////////////////// // diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/test/JmsSendReceiveTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/test/JmsSendReceiveTestSupport.java index 17c1e87a2d..c429315fb2 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/test/JmsSendReceiveTestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/test/JmsSendReceiveTestSupport.java @@ -256,6 +256,6 @@ public abstract class JmsSendReceiveTestSupport extends org.apache.activemq.Test * @return a synchronized view of the specified list. */ protected List createConcurrentList() { - return Collections.synchronizedList(new ArrayList()); + return Collections.synchronizedList(new ArrayList<>()); } } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/TcpTransportServerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/TcpTransportServerTest.java index 02da83641d..edf28d5eec 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/TcpTransportServerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/TcpTransportServerTest.java @@ -35,7 +35,7 @@ public class TcpTransportServerTest extends TestCase { public void testDefaultPropertiesSetOnTransport() throws Exception { TcpTransportServer server = (TcpTransportServer) TransportFactory.bind(new URI("tcp://localhost:61616?trace=true")); - server.setTransportOption(new HashMap()); + server.setTransportOption(new HashMap<>()); try { server.setAcceptListener(new TransportAcceptListener() { diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/util/InVMContext.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/util/InVMContext.java index 72c096767a..fe3b4b15ae 100644 --- a/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/util/InVMContext.java +++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/util/InVMContext.java @@ -56,7 +56,7 @@ public class InVMContext implements Context, Serializable { public InVMContext() { - map = Collections.synchronizedMap(new HashMap()); + map = Collections.synchronizedMap(new HashMap<>()); } public InVMContext(final String nameInNamespace) { diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/util/InVMNamingContext.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/util/InVMNamingContext.java index 3b1a8fb93a..b5cb74f7f3 100644 --- a/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/util/InVMNamingContext.java +++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/util/InVMNamingContext.java @@ -56,7 +56,7 @@ public class InVMNamingContext implements Context, Serializable { public InVMNamingContext() { - map = Collections.synchronizedMap(new HashMap()); + map = Collections.synchronizedMap(new HashMap<>()); } public InVMNamingContext(final String nameInNamespace) { diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/util/NonSerializableFactory.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/util/NonSerializableFactory.java index 94d955322c..accf1a03ea 100644 --- a/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/util/NonSerializableFactory.java +++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/unit/util/NonSerializableFactory.java @@ -57,5 +57,5 @@ public class NonSerializableFactory implements ObjectFactory { return NonSerializableFactory.wrapperMap; } - private static Map wrapperMap = Collections.synchronizedMap(new HashMap()); + private static Map wrapperMap = Collections.synchronizedMap(new HashMap<>()); } \ No newline at end of file diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java index c5382494ed..217645cdc3 100644 --- a/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java +++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java @@ -420,7 +420,7 @@ public abstract class ActiveMQTestBase extends ArtemisTestCase { ConfigurationImpl configuration = createBasicConfig(serverID).setJMXManagementEnabled(false).addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY, generateInVMParams(serverID), "invm")); if (netty) { - configuration.addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, new HashMap(), "netty", new HashMap())); + configuration.addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, new HashMap<>(), "netty", new HashMap<>())); } else { // if we're in-vm it's a waste to resolve protocols since they'll never be used configuration.setResolveProtocols(false); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpFullyQualifiedNameTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpFullyQualifiedNameTest.java index 744e5bb3ba..d3a269d45c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpFullyQualifiedNameTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpFullyQualifiedNameTest.java @@ -75,7 +75,7 @@ public class AmqpFullyQualifiedNameTest extends JMSClientTestSupport { @Override protected void addAdditionalAcceptors(ActiveMQServer server) throws Exception { - server.getConfiguration().addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, new HashMap(), "netty", new HashMap())); + server.getConfiguration().addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, new HashMap<>(), "netty", new HashMap<>())); } @Test diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/TopicDurableTests.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/TopicDurableTests.java index 2a00b56896..cb4195f5bb 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/TopicDurableTests.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/TopicDurableTests.java @@ -131,7 +131,7 @@ public class TopicDurableTests extends JMSClientTestSupport { Connection connection1 = connectionFactory1.createConnection(); - Hashtable env2 = new Hashtable(); + Hashtable env2 = new Hashtable<>(); env2.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.qpid.jms.jndi.JmsInitialContextFactory"); env2.put("connectionfactory.qpidConnectionFactory", "amqp://localhost:5672"); env2.put("topic." + "jmsTopic", "jmsTopic"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConcurrentCreateDeleteProduceTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConcurrentCreateDeleteProduceTest.java index 5232c26726..e6142cb7e9 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConcurrentCreateDeleteProduceTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConcurrentCreateDeleteProduceTest.java @@ -20,6 +20,7 @@ import java.util.HashMap; import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.core.QueueConfiguration; +import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -30,8 +31,6 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.Queue; -import org.apache.activemq.artemis.api.core.RoutingType; -import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -63,7 +62,7 @@ public class ConcurrentCreateDeleteProduceTest extends ActiveMQTestBase { Configuration config = createDefaultInVMConfig().setJournalSyncNonTransactional(false).setJournalSyncTransactional(false); - server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap()); + server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<>()); server.start(); locator = createNonHALocator(false).setBlockOnDurableSend(false).setBlockOnAcknowledge(true); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InterruptedLargeMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InterruptedLargeMessageTest.java index b3e774eaba..767d408a85 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InterruptedLargeMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InterruptedLargeMessageTest.java @@ -325,7 +325,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase { ClientSession session = null; LargeMessageTestInterceptorIgnoreLastPacket.disableInterrupt(); - ActiveMQServer server = createServer(true, createDefaultConfig(isNetty()), 10000, 20000, new HashMap()); + ActiveMQServer server = createServer(true, createDefaultConfig(isNetty()), 10000, 20000, new HashMap<>()); // server.getConfiguration() // .getIncomingInterceptorClassNames() @@ -402,7 +402,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase { LargeMessageTestInterceptorIgnoreLastPacket.disableInterrupt(); - ActiveMQServer server = createServer(true, createDefaultConfig(isNetty()), 10000, 20000, new HashMap()); + ActiveMQServer server = createServer(true, createDefaultConfig(isNetty()), 10000, 20000, new HashMap<>()); server.getConfiguration().getIncomingInterceptorClassNames().add(LargeMessageTestInterceptorIgnoreLastPacket.class.getName()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageTest.java index 00071d1097..af19833f66 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageTest.java @@ -528,7 +528,7 @@ public class LargeMessageTest extends LargeMessageTestBase { Configuration config = createDefaultInVMConfig().setJournalSyncNonTransactional(false); - ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap(), storeType); + ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<>(), storeType); server.start(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MultipleThreadFilterOneTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MultipleThreadFilterOneTest.java index 425d88b8dd..232024b091 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MultipleThreadFilterOneTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MultipleThreadFilterOneTest.java @@ -16,10 +16,6 @@ */ package org.apache.activemq.artemis.tests.integration.client; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertNotNull; - import java.lang.invoke.MethodHandles; import java.util.HashMap; import java.util.concurrent.atomic.AtomicInteger; @@ -34,12 +30,15 @@ import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + /** * Multiple Threads producing Messages, with Multiple Consumers with different queues, each queue with a different filter * This is similar to MultipleThreadFilterTwoTest but it uses multiple queues @@ -211,7 +210,7 @@ public class MultipleThreadFilterOneTest extends ActiveMQTestBase { ActiveMQServer server; if (isPaging) { - server = createServer(true, createDefaultConfig(isNetty), PAGE_SIZE, PAGE_MAX, -1, -1, new HashMap()); + server = createServer(true, createDefaultConfig(isNetty), PAGE_SIZE, PAGE_MAX, -1, -1, new HashMap<>()); } else { server = createServer(true, isNetty); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java index 850c5b8f0f..f73047d732 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java @@ -418,7 +418,7 @@ public class BridgeTest extends ActiveMQTestBase { final String forwardAddress = "forwardAddress"; final String queueName1 = "queue1"; - // Map connectors = new HashMap(); + // Map connectors = new HashMap<>(); TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params); TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/PagingFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/PagingFailoverTest.java index 9439775639..c3ce8e9870 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/PagingFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/PagingFailoverTest.java @@ -16,9 +16,6 @@ */ package org.apache.activemq.artemis.tests.integration.cluster.failover; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - import java.util.HashMap; import org.apache.activemq.artemis.api.core.QueueConfiguration; @@ -33,7 +30,6 @@ import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.Queue; -import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer; import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer; import org.apache.activemq.artemis.tests.util.TransportConfigurationUtils; @@ -41,6 +37,9 @@ import org.apache.activemq.artemis.tests.util.Wait; 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.assertNotNull; + /** * A PagingFailoverTest *
@@ -207,7 +206,7 @@ public class PagingFailoverTest extends FailoverTestBase { @Override protected ActiveMQServer createServer(final boolean realFiles, final Configuration configuration) { - return addServer(createInVMFailoverServer(true, configuration, PAGE_SIZE, PAGE_MAX, new HashMap(), nodeManager, 2)); + return addServer(createInVMFailoverServer(true, configuration, PAGE_SIZE, PAGE_MAX, new HashMap<>(), nodeManager, 2)); } @Override diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedFailoverTest.java index 37717ca799..3be03403d7 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedFailoverTest.java @@ -160,7 +160,7 @@ public class ReplicatedFailoverTest extends FailoverTest { appDTO.url = "console"; BindingDTO bindingDTO = new BindingDTO(); bindingDTO.uri = "http://localhost:0"; - bindingDTO.apps = new ArrayList(); + bindingDTO.apps = new ArrayList<>(); bindingDTO.apps.add(appDTO); WebServerDTO wdto = new WebServerDTO(); wdto.setBindings(Collections.singletonList(bindingDTO)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedPagedFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedPagedFailoverTest.java index 50425c3f6f..3d267dd068 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedPagedFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedPagedFailoverTest.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.tests.integration.cluster.failover; -import static org.junit.jupiter.api.Assertions.assertNotNull; - import java.util.HashMap; import org.apache.activemq.artemis.api.core.QueueConfiguration; @@ -30,11 +28,12 @@ import org.apache.activemq.artemis.core.paging.PagingStore; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.NodeManager; import org.apache.activemq.artemis.core.server.Queue; -import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.utils.Wait; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; +import static org.junit.jupiter.api.Assertions.assertNotNull; + public class ReplicatedPagedFailoverTest extends ReplicatedFailoverTest { @Override @@ -42,7 +41,7 @@ public class ReplicatedPagedFailoverTest extends ReplicatedFailoverTest { final Configuration configuration, final NodeManager nodeManager, int id) { - return createInVMFailoverServer(realFiles, configuration, PAGE_SIZE, PAGE_MAX, new HashMap(), nodeManager, id); + return createInVMFailoverServer(realFiles, configuration, PAGE_SIZE, PAGE_MAX, new HashMap<>(), nodeManager, id); } @Override diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerNettyNoGroupNameReplicatedFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerNettyNoGroupNameReplicatedFailoverTest.java index 82fbd572fb..acbe946be5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerNettyNoGroupNameReplicatedFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerNettyNoGroupNameReplicatedFailoverTest.java @@ -148,7 +148,7 @@ public class LockManagerNettyNoGroupNameReplicatedFailoverTest extends FailoverT appDTO.url = "console"; BindingDTO bindingDTO = new BindingDTO(); bindingDTO.uri = "http://localhost:0"; - bindingDTO.apps = new ArrayList(); + bindingDTO.apps = new ArrayList<>(); bindingDTO.apps.add(appDTO); WebServerDTO wdto = new WebServerDTO(); wdto.setBindings(Collections.singletonList(bindingDTO)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/TopologyClusterTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/TopologyClusterTestBase.java index 40fd18b74c..10464a8eee 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/TopologyClusterTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/TopologyClusterTestBase.java @@ -213,7 +213,7 @@ public abstract class TopologyClusterTestBase extends ClusterTestBase { locator.getTopology().setOwner("testReceive"); - final List nodes = Collections.synchronizedList(new ArrayList()); + final List nodes = Collections.synchronizedList(new ArrayList<>()); final CountDownLatch upLatch = new CountDownLatch(5); final CountDownLatch downLatch = new CountDownLatch(4); @@ -259,7 +259,7 @@ public abstract class TopologyClusterTestBase extends ClusterTestBase { waitForClusterConnections(3, 4); waitForClusterConnections(4, 4); - final List nodes = Collections.synchronizedList(new ArrayList()); + final List nodes = Collections.synchronizedList(new ArrayList<>()); final CountDownLatch upLatch = new CountDownLatch(5); final CountDownLatch downLatch = new CountDownLatch(4); @@ -309,7 +309,7 @@ public abstract class TopologyClusterTestBase extends ClusterTestBase { waitForClusterConnections(3, 4); waitForClusterConnections(4, 4); - final List nodes = Collections.synchronizedList(new ArrayList()); + final List nodes = Collections.synchronizedList(new ArrayList<>()); final CountDownLatch upLatch = new CountDownLatch(5); locator.addClusterTopologyListener(new LatchListener(upLatch, nodes, new CountDownLatch(0))); @@ -389,7 +389,7 @@ public abstract class TopologyClusterTestBase extends ClusterTestBase { waitForClusterConnections(3, 4); waitForClusterConnections(4, 4); - final List nodes = Collections.synchronizedList(new ArrayList()); + final List nodes = Collections.synchronizedList(new ArrayList<>()); final CountDownLatch upLatch = new CountDownLatch(5); final CountDownLatch downLatch = new CountDownLatch(4); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/RelativePathTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/RelativePathTest.java index fe180b101f..90b0484994 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/RelativePathTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/RelativePathTest.java @@ -34,7 +34,7 @@ public class RelativePathTest extends ActiveMQTestBase { @Test public void testRelativePathOnDefaultConfig() throws Exception { Configuration configuration = createDefaultConfig(false); - ActiveMQServer server = createServer(true, configuration, AddressSettings.DEFAULT_PAGE_SIZE, AddressSettings.DEFAULT_MAX_SIZE_BYTES, new HashMap()); + ActiveMQServer server = createServer(true, configuration, AddressSettings.DEFAULT_PAGE_SIZE, AddressSettings.DEFAULT_MAX_SIZE_BYTES, new HashMap<>()); server.start(); server.stop(); @@ -62,7 +62,7 @@ public class RelativePathTest extends ActiveMQTestBase { // configuration.setJournal - ActiveMQServer server = createServer(true, configuration, AddressSettings.DEFAULT_PAGE_SIZE, AddressSettings.DEFAULT_MAX_SIZE_BYTES, new HashMap()); + ActiveMQServer server = createServer(true, configuration, AddressSettings.DEFAULT_PAGE_SIZE, AddressSettings.DEFAULT_MAX_SIZE_BYTES, new HashMap<>()); server.start(); server.stop(); @@ -91,7 +91,7 @@ public class RelativePathTest extends ActiveMQTestBase { // one folder up from instance home configuration.setLargeMessagesDirectory("./large"); - ActiveMQServer server = createServer(true, configuration, AddressSettings.DEFAULT_PAGE_SIZE, AddressSettings.DEFAULT_MAX_SIZE_BYTES, new HashMap()); + ActiveMQServer server = createServer(true, configuration, AddressSettings.DEFAULT_PAGE_SIZE, AddressSettings.DEFAULT_MAX_SIZE_BYTES, new HashMap<>()); server.start(); server.stop(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlTest.java index 4ca5f8f28b..ffe08a6d26 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlTest.java @@ -53,7 +53,7 @@ public class AcceptorControlTest extends ManagementTestBase { @Test public void testAttributes() throws Exception { - TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(), new HashMap(), RandomUtil.randomString()); + TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(), new HashMap<>(), RandomUtil.randomString()); acceptorConfig.getParams().put(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, "password"); Configuration config = createBasicConfig().addAcceptorConfiguration(acceptorConfig); @@ -71,7 +71,7 @@ public class AcceptorControlTest extends ManagementTestBase { @Test public void testStartStop() throws Exception { - TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(), new HashMap(), RandomUtil.randomString()); + TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(), new HashMap<>(), RandomUtil.randomString()); Configuration config = createBasicConfig().addAcceptorConfiguration(acceptorConfig); ActiveMQServer service = createServer(false, config); service.setMBeanServer(mbeanServer); @@ -121,8 +121,8 @@ public class AcceptorControlTest extends ManagementTestBase { @Test public void testNotifications() throws Exception { - TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(), new HashMap(), RandomUtil.randomString()); - TransportConfiguration acceptorConfig2 = new TransportConfiguration(NettyAcceptorFactory.class.getName(), new HashMap(), RandomUtil.randomString()); + TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(), new HashMap<>(), RandomUtil.randomString()); + TransportConfiguration acceptorConfig2 = new TransportConfiguration(NettyAcceptorFactory.class.getName(), new HashMap<>(), RandomUtil.randomString()); Configuration config = createBasicConfig().addAcceptorConfiguration(acceptorConfig).addAcceptorConfiguration(acceptorConfig2); ActiveMQServer service = createServer(false, config); service.setMBeanServer(mbeanServer); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java index 9a05de1710..a37e613335 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java @@ -5690,11 +5690,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testConnectorServiceManagement() throws Exception { ActiveMQServerControl managementControl = createManagementControl(); - managementControl.createConnectorService("myconn", FakeConnectorServiceFactory.class.getCanonicalName(), new HashMap()); + managementControl.createConnectorService("myconn", FakeConnectorServiceFactory.class.getCanonicalName(), new HashMap<>()); assertEquals(1, server.getConnectorsService().getConnectors().size()); - managementControl.createConnectorService("myconn2", FakeConnectorServiceFactory.class.getCanonicalName(), new HashMap()); + managementControl.createConnectorService("myconn2", FakeConnectorServiceFactory.class.getCanonicalName(), new HashMap<>()); assertEquals(2, server.getConnectorsService().getConnectors().size()); managementControl.destroyConnectorService("myconn"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/LargeMessageOverManagementTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/LargeMessageOverManagementTest.java index abd2506eb5..d9ef6114d6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/LargeMessageOverManagementTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/LargeMessageOverManagementTest.java @@ -88,7 +88,7 @@ public class LargeMessageOverManagementTest extends ManagementTestBase { int bodySize = (int) server.getStorageManager().getMaxRecordSize() + 100; byte[] bigData = createBytesData(bodySize); - queueControl.sendMessage(new HashMap(), Message.BYTES_TYPE, Base64.encodeBytes(bigData), true, "myUser", "myPassword"); + queueControl.sendMessage(new HashMap<>(), Message.BYTES_TYPE, Base64.encodeBytes(bigData), true, "myUser", "myPassword"); ClientConsumer consumer = session.createConsumer(queue); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java index 8e7e2f4413..fc7608292f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java @@ -2347,8 +2347,8 @@ public class QueueControlTest extends ManagementTestBase { // send two messages on queueA - queueControlA.sendMessage(new HashMap(), Message.BYTES_TYPE, Base64.encodeBytes("theBody".getBytes()), true, "myUser", "myPassword"); - queueControlA.sendMessage(new HashMap(), Message.BYTES_TYPE, Base64.encodeBytes("theBody2".getBytes()), true, "myUser", "myPassword"); + queueControlA.sendMessage(new HashMap<>(), Message.BYTES_TYPE, Base64.encodeBytes("theBody".getBytes()), true, "myUser", "myPassword"); + queueControlA.sendMessage(new HashMap<>(), Message.BYTES_TYPE, Base64.encodeBytes("theBody2".getBytes()), true, "myUser", "myPassword"); Wait.assertEquals(2, () -> getMessageCount(queueControlA)); Wait.assertEquals(0, () -> getMessageCount(queueControlB)); @@ -2361,7 +2361,7 @@ public class QueueControlTest extends ManagementTestBase { Wait.assertEquals(2, () -> getMessageCount(queueControlB)); // move 1 message to queueC - queueControlA.sendMessage(new HashMap(), Message.BYTES_TYPE, Base64.encodeBytes("theBody3".getBytes()), true, "myUser", "myPassword"); + queueControlA.sendMessage(new HashMap<>(), Message.BYTES_TYPE, Base64.encodeBytes("theBody3".getBytes()), true, "myUser", "myPassword"); Wait.assertEquals(1, () -> getMessageCount(queueControlA)); queueControlA.moveMessages(null, queueC.toString()); Wait.assertEquals(1, () -> getMessageCount(queueControlC)); @@ -4101,7 +4101,7 @@ public class QueueControlTest extends ManagementTestBase { QueueControl queueControl = createManagementControl(address, queue); - queueControl.sendMessage(new HashMap(), Message.BYTES_TYPE, Base64.encodeBytes("theBody".getBytes()), true, "myUser", "myPassword"); + queueControl.sendMessage(new HashMap<>(), Message.BYTES_TYPE, Base64.encodeBytes("theBody".getBytes()), true, "myUser", "myPassword"); queueControl.sendMessage(null, Message.BYTES_TYPE, Base64.encodeBytes("theBody".getBytes()), true, "myUser", "myPassword"); Wait.assertEquals(2, () -> getMessageCount(queueControl)); @@ -4262,7 +4262,7 @@ public class QueueControlTest extends ManagementTestBase { QueueControl queueControl = createManagementControl(address, queue); - queueControl.sendMessage(new HashMap(), Message.BYTES_TYPE, Base64.encodeBytes("theBody".getBytes()), true, "myUser", "myPassword"); + queueControl.sendMessage(new HashMap<>(), Message.BYTES_TYPE, Base64.encodeBytes("theBody".getBytes()), true, "myUser", "myPassword"); queueControl.sendMessage(null, Message.BYTES_TYPE, Base64.encodeBytes("theBody".getBytes()), true, "myUser", "myPassword", true); Wait.assertEquals(2, () -> getMessageCount(queueControl)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JMSConsumer2Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JMSConsumer2Test.java index 3052010e21..236871d624 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JMSConsumer2Test.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JMSConsumer2Test.java @@ -69,7 +69,7 @@ public class JMSConsumer2Test extends BasicOpenWireTest { final ActiveMQMessageConsumer consumer = (ActiveMQMessageConsumer) session.createConsumer(destination); - final Map exceptions = Collections.synchronizedMap(new HashMap()); + final Map exceptions = Collections.synchronizedMap(new HashMap<>()); Thread.setDefaultUncaughtExceptionHandler((t, e) -> exceptions.put(t, e)); final class AckAndClose implements Runnable { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsConnectionStartStopTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsConnectionStartStopTest.java index 09e3084ad3..2f7a250fb5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsConnectionStartStopTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsConnectionStartStopTest.java @@ -118,7 +118,7 @@ public class JmsConnectionStartStopTest extends BasicOpenWireTest { @Test public void testConcurrentSessionCreateWithStart() throws Exception { - ThreadPoolExecutor executor = new ThreadPoolExecutor(50, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue()); + ThreadPoolExecutor executor = new ThreadPoolExecutor(50, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<>()); final Vector exceptions = new Vector<>(); final AtomicInteger counter = new AtomicInteger(0); final Random rand = new Random(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsQueueBrowserTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsQueueBrowserTest.java index e0f3a24201..e63dcd5c30 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsQueueBrowserTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsQueueBrowserTest.java @@ -379,7 +379,7 @@ public class JmsQueueBrowserTest extends BasicOpenWireTest { @SuppressWarnings("unchecked") Enumeration browserView = browser.getEnumeration(); - List messages = new ArrayList(); + List messages = new ArrayList<>(); for (int i = 0; i < numMessages; i++) { Message m1 = consumer.receive(5000); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsSendReceiveTestSupport.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsSendReceiveTestSupport.java index 0fe0d51061..6a2e920695 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsSendReceiveTestSupport.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsSendReceiveTestSupport.java @@ -51,7 +51,7 @@ public abstract class JmsSendReceiveTestSupport extends BasicOpenWireTest implem protected MessageProducer producer; protected Destination consumerDestination; protected Destination producerDestination; - protected List messages = Collections.synchronizedList(new ArrayList()); + protected List messages = Collections.synchronizedList(new ArrayList<>()); protected boolean topic = true; protected boolean durable; protected int deliveryMode = DeliveryMode.PERSISTENT; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageTransactionCleanupTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageTransactionCleanupTest.java index de56de340a..093a269ddc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageTransactionCleanupTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageTransactionCleanupTest.java @@ -16,10 +16,6 @@ */ package org.apache.activemq.artemis.tests.integration.paging; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -38,7 +34,6 @@ import org.apache.activemq.artemis.core.paging.impl.PagingStoreImpl; import org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.Queue; -import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.logs.AssertionLoggerHandler; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.CFUtil; @@ -47,6 +42,10 @@ import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + /** * A PagingOrderTest. *
@@ -64,7 +63,7 @@ public class PageTransactionCleanupTest extends ActiveMQTestBase { Configuration config = createDefaultConfig(true).setJournalSyncNonTransactional(false); - ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap()); + ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<>()); server.start(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingOrderTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingOrderTest.java index f1756dc206..569dd3c0da 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingOrderTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingOrderTest.java @@ -85,7 +85,7 @@ public class PagingOrderTest extends ActiveMQTestBase { Configuration config = createDefaultInVMConfig().setJournalSyncNonTransactional(false); - ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, -1, -1, new HashMap()); + ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, -1, -1, new HashMap<>()); server.start(); @@ -175,7 +175,7 @@ public class PagingOrderTest extends ActiveMQTestBase { Configuration config = createDefaultInVMConfig().setJournalSyncNonTransactional(false); - ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap()); + ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<>()); server.start(); @@ -306,7 +306,7 @@ public class PagingOrderTest extends ActiveMQTestBase { Configuration config = createDefaultInVMConfig().setJournalSyncNonTransactional(false); - ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap()); + ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<>()); server.start(); @@ -397,7 +397,7 @@ public class PagingOrderTest extends ActiveMQTestBase { Configuration config = createDefaultInVMConfig().setJournalSyncNonTransactional(false); - ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, -1, -1, new HashMap()); + ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, -1, -1, new HashMap<>()); server.start(); @@ -482,7 +482,7 @@ public class PagingOrderTest extends ActiveMQTestBase { Configuration config = createDefaultInVMConfig().setJournalSyncNonTransactional(false); - ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, -1, -1, new HashMap()); + ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, -1, -1, new HashMap<>()); server.start(); @@ -605,7 +605,7 @@ public class PagingOrderTest extends ActiveMQTestBase { Configuration config = createDefaultInVMConfig().setJournalSyncNonTransactional(false); - ActiveMQServer server = createServer(true, config, PAGE_SIZE, -1, new HashMap()); + ActiveMQServer server = createServer(true, config, PAGE_SIZE, -1, new HashMap<>()); JMSServerManagerImpl jmsServer = new JMSServerManagerImpl(server); InVMNamingContext context = new InVMNamingContext(); @@ -642,7 +642,7 @@ public class PagingOrderTest extends ActiveMQTestBase { jmsServer.stop(); - server = createServer(true, config, PAGE_SIZE, -1, new HashMap()); + server = createServer(true, config, PAGE_SIZE, -1, new HashMap<>()); jmsServer = new JMSServerManagerImpl(server); context = new InVMNamingContext(); @@ -668,7 +668,7 @@ public class PagingOrderTest extends ActiveMQTestBase { Configuration config = createDefaultInVMConfig().setJournalSyncNonTransactional(false); - ActiveMQServer server = createServer(true, config, -1, -1, new HashMap()); + ActiveMQServer server = createServer(true, config, -1, -1, new HashMap<>()); server.getAddressSettingsRepository().getMatch("#").setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK); JMSServerManagerImpl jmsServer = new JMSServerManagerImpl(server); @@ -711,7 +711,7 @@ public class PagingOrderTest extends ActiveMQTestBase { jmsServer.stop(); - server = createServer(true, config, -1, -1, new HashMap()); + server = createServer(true, config, -1, -1, new HashMap<>()); server.getAddressSettingsRepository().getMatch("#").setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK); jmsServer = new JMSServerManagerImpl(server); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSyncTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSyncTest.java index 1b2b1f70e7..6379c9b3fc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSyncTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSyncTest.java @@ -21,6 +21,7 @@ import java.util.HashMap; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.QueueConfiguration; +import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -29,9 +30,7 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.server.impl.AddressInfo; -import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.junit.jupiter.api.Test; @@ -56,7 +55,7 @@ public class PagingSyncTest extends ActiveMQTestBase { Configuration config = createDefaultInVMConfig().setJournalSyncNonTransactional(false); - ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap()); + ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<>()); server.start(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java index 4e8941ce64..2cd8da2ab3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java @@ -16,9 +16,6 @@ */ package org.apache.activemq.artemis.tests.integration.persistence; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -29,9 +26,6 @@ import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.StoreConfiguration; import org.apache.activemq.artemis.core.message.impl.CoreMessage; -import org.apache.activemq.artemis.core.persistence.AddressBindingInfo; -import org.apache.activemq.artemis.core.persistence.GroupingInfo; -import org.apache.activemq.artemis.core.persistence.QueueBindingInfo; import org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager; import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.impl.PostOfficeJournalLoader; @@ -43,6 +37,9 @@ import org.apache.activemq.artemis.utils.critical.EmptyCriticalAnalyzer; import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.extension.ExtendWith; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + @ExtendWith(ParameterizedTestExtension.class) public class DeleteMessagesOnStartupTest extends StorageManagerTestBase { @@ -81,7 +78,7 @@ public class DeleteMessagesOnStartupTest extends StorageManagerTestBase { journal.start(); - journal.loadBindingJournal(new ArrayList(), new ArrayList(), new ArrayList()); + journal.loadBindingJournal(new ArrayList<>(), new ArrayList<>(), new ArrayList<>()); FakePostOffice postOffice = new FakePostOffice(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/JMSStorageManagerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/JMSStorageManagerTest.java index 5b4448e5d6..1e7828b2b3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/JMSStorageManagerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/JMSStorageManagerTest.java @@ -109,7 +109,7 @@ public class JMSStorageManagerTest extends ActiveMQTestBase { str[i] = "str" + i; } - ConnectionFactoryConfiguration config = new ConnectionFactoryConfigurationImpl().setName("some-name").setConnectorNames(new ArrayList()).setBindings(""); + ConnectionFactoryConfiguration config = new ConnectionFactoryConfigurationImpl().setName("some-name").setConnectorNames(new ArrayList<>()).setBindings(""); int size = config.getEncodeSize(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/RestartSMTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/RestartSMTest.java index 72be30c4d9..6cf3e3462c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/RestartSMTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/RestartSMTest.java @@ -22,8 +22,6 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutorService; -import org.apache.activemq.artemis.core.persistence.AddressBindingInfo; -import org.apache.activemq.artemis.core.persistence.GroupingInfo; import org.apache.activemq.artemis.core.persistence.QueueBindingInfo; import org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager; import org.apache.activemq.artemis.core.postoffice.PostOffice; @@ -71,7 +69,7 @@ public class RestartSMTest extends ActiveMQTestBase { List queueBindingInfos = new ArrayList<>(); - journal.loadBindingJournal(queueBindingInfos, new ArrayList(), new ArrayList()); + journal.loadBindingJournal(queueBindingInfos, new ArrayList<>(), new ArrayList<>()); journal.loadMessageJournal(postOffice, null, null, null, null, null, null, new FakeJournalLoader()); @@ -85,7 +83,7 @@ public class RestartSMTest extends ActiveMQTestBase { queueBindingInfos = new ArrayList<>(); - journal.loadBindingJournal(queueBindingInfos, new ArrayList(), new ArrayList()); + journal.loadBindingJournal(queueBindingInfos, new ArrayList<>(), new ArrayList<>()); journal.start(); } finally { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/StorageManagerTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/StorageManagerTestBase.java index 895f834c8d..a30f378109 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/StorageManagerTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/StorageManagerTestBase.java @@ -25,9 +25,6 @@ import java.util.concurrent.ScheduledThreadPoolExecutor; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.StoreConfiguration; -import org.apache.activemq.artemis.core.persistence.AddressBindingInfo; -import org.apache.activemq.artemis.core.persistence.GroupingInfo; -import org.apache.activemq.artemis.core.persistence.QueueBindingInfo; import org.apache.activemq.artemis.core.persistence.StorageManager; import org.apache.activemq.artemis.core.persistence.impl.journal.JDBCJournalStorageManager; import org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager; @@ -110,7 +107,7 @@ public abstract class StorageManagerTestBase extends ActiveMQTestBase { journal.start(); - journal.loadBindingJournal(new ArrayList(), new ArrayList(), new ArrayList()); + journal.loadBindingJournal(new ArrayList<>(), new ArrayList<>(), new ArrayList<>()); journal.loadMessageJournal(new FakePostOffice(), null, null, null, null, null, null, null, new FakeJournalLoader()); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/DestroyConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/DestroyConsumerTest.java index 07c78b68ef..94a6556859 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/DestroyConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/DestroyConsumerTest.java @@ -29,7 +29,7 @@ public class DestroyConsumerTest extends ActiveMQTestBase { // public void testDestroyConsumer() throws Exception // { - // ActiveMQServer server = createService(false, false, createDefaultInVMConfig(), new HashMap()); + // ActiveMQServer server = createService(false, false, createDefaultInVMConfig(), new HashMap<>()); // server.start(); // // SimpleString queue = SimpleString.of("add1"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java index 80d7438433..50f2728f6b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java @@ -166,7 +166,7 @@ public final class ReplicationTest extends ActiveMQTestBase { Configuration primaryConfig = createDefaultInVMConfig(); - Configuration backupConfig = createDefaultInVMConfig().setHAPolicyConfiguration(new SharedStoreBackupPolicyConfiguration()).setBindingsDirectory(getBindingsDir(0, true)).setJournalDirectory(getJournalDir(0, true)).setPagingDirectory(getPageDir(0, true)).setLargeMessagesDirectory(getLargeMessagesDir(0, true)).setIncomingInterceptorClassNames(incomingInterceptors.length > 0 ? Arrays.asList(incomingInterceptors) : new ArrayList()); + Configuration backupConfig = createDefaultInVMConfig().setHAPolicyConfiguration(new SharedStoreBackupPolicyConfiguration()).setBindingsDirectory(getBindingsDir(0, true)).setJournalDirectory(getJournalDir(0, true)).setPagingDirectory(getPageDir(0, true)).setLargeMessagesDirectory(getLargeMessagesDir(0, true)).setIncomingInterceptorClassNames(incomingInterceptors.length > 0 ? Arrays.asList(incomingInterceptors) : new ArrayList<>()); if (!pluggableQuorum) { ReplicatedBackupUtils.configureReplicationPair(backupConfig, backupConnector, backupAcceptor, primaryConfig, primaryConnector, primaryAcceptor); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/transports/netty/NettyConnectorWithHTTPUpgradeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/transports/netty/NettyConnectorWithHTTPUpgradeTest.java index 26197f5932..f76d05dabd 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/transports/netty/NettyConnectorWithHTTPUpgradeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/transports/netty/NettyConnectorWithHTTPUpgradeTest.java @@ -238,7 +238,7 @@ public class NettyConnectorWithHTTPUpgradeTest extends ActiveMQTestBase { } p.addLast("decoder", new HttpRequestDecoder()); p.addLast("encoder", new HttpResponseEncoder()); - p.addLast("http-upgrade-handler", new SimpleChannelInboundHandler() { + p.addLast("http-upgrade-handler", new SimpleChannelInboundHandler<>() { // handle HTTP GET + Upgrade with a handshake specific to ActiveMQ Artemis remoting. @Override protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/NonSerializableFactory.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/NonSerializableFactory.java index 0ace718585..582527161a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/NonSerializableFactory.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/NonSerializableFactory.java @@ -100,5 +100,5 @@ public final class NonSerializableFactory implements ObjectFactory { return NonSerializableFactory.wrapperMap; } - private static Map wrapperMap = Collections.synchronizedMap(new HashMap()); + private static Map wrapperMap = Collections.synchronizedMap(new HashMap<>()); } \ No newline at end of file diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/MessageConsumerTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/MessageConsumerTest.java index 951c9c74f1..61062ae0fb 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/MessageConsumerTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/MessageConsumerTest.java @@ -3918,7 +3918,7 @@ public class MessageConsumerTest extends JMSTestCase { private class MessageListenerImpl implements MessageListener { - private final List messages = Collections.synchronizedList(new ArrayList()); + private final List messages = Collections.synchronizedList(new ArrayList<>()); private CountDownLatch latch = new CountDownLatch(1); diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/InVMContext.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/InVMContext.java index ac75283606..4d534aba6c 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/InVMContext.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/InVMContext.java @@ -55,7 +55,7 @@ public class InVMContext implements Context, Serializable { public InVMContext() { - map = Collections.synchronizedMap(new HashMap()); + map = Collections.synchronizedMap(new HashMap<>()); } public InVMContext(final String nameInNamespace) { diff --git a/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/ClientLeakTest.java b/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/ClientLeakTest.java index 0c862de1ef..36ca6ebe4b 100644 --- a/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/ClientLeakTest.java +++ b/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/ClientLeakTest.java @@ -58,7 +58,7 @@ public class ClientLeakTest extends AbstractLeakTest { try { ConfigurationImpl configuration = new ConfigurationImpl().setSecurityEnabled(false).setJournalMinFiles(2).setJournalFileSize(100 * 1024).setJournalType(getDefaultJournalType()).setJournalDirectory("./data/journal").setBindingsDirectory("./data/binding").setPagingDirectory("./data/page").setLargeMessagesDirectory("./data/lm").setJournalCompactMinFiles(0).setJournalCompactPercentage(0).setClusterPassword(CLUSTER_PASSWORD).setJournalDatasync(false); - configuration.addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, new HashMap(), "netty", new HashMap())); + configuration.addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, new HashMap(), "netty", new HashMap<>())); ActiveMQServer server = ActiveMQServers.newActiveMQServer(configuration, false); server.start(); System.out.println(LEAK_SERVER); diff --git a/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/journal/JournalImplTestUnit.java b/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/journal/JournalImplTestUnit.java index 5a76d1302a..c94ffac741 100644 --- a/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/journal/JournalImplTestUnit.java +++ b/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/journal/JournalImplTestUnit.java @@ -16,13 +16,10 @@ */ package org.apache.activemq.artemis.tests.performance.journal; -import static org.junit.jupiter.api.Assertions.assertEquals; - +import java.lang.invoke.MethodHandles; import java.util.ArrayList; import org.apache.activemq.artemis.core.journal.Journal; -import org.apache.activemq.artemis.core.journal.PreparedTransactionInfo; -import org.apache.activemq.artemis.core.journal.RecordInfo; import org.apache.activemq.artemis.core.journal.impl.JournalImpl; import org.apache.activemq.artemis.nativo.jlibaio.LibaioContext; import org.apache.activemq.artemis.tests.unit.core.journal.impl.JournalImplTestBase; @@ -31,7 +28,8 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.lang.invoke.MethodHandles; + +import static org.junit.jupiter.api.Assertions.assertEquals; public abstract class JournalImplTestUnit extends JournalImplTestBase { @@ -163,7 +161,7 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase { stopJournal(); createJournal(); startJournal(); - journal.load(new ArrayList(), new ArrayList(), null); + journal.load(new ArrayList<>(), new ArrayList<>(), null); assertEquals(NUMBER_OF_RECORDS / 2, journal.getIDMapSize()); @@ -187,7 +185,7 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase { journal.start(); - journal.load(new ArrayList(), null, null); + journal.load(new ArrayList<>(), null, null); try { final int numMessages = 50050; @@ -242,7 +240,7 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase { journal.start(); - journal.load(new ArrayList(), null, null); + journal.load(new ArrayList<>(), null, null); JournalImplTestUnit.logger.debug("Adding data"); SimpleEncoding data = new SimpleEncoding(700, (byte) 'j'); @@ -264,7 +262,7 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase { journal = new JournalImpl(10 * 1024 * 1024, numFiles, numFiles, 0, 0, getFileFactory(), "activemq-data", "amq", 5000); journal.start(); - journal.load(new ArrayList(), null, null); + journal.load(new ArrayList<>(), null, null); journal.stop(); } diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/upgradeTest/CompareUpgradeTest.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/upgradeTest/CompareUpgradeTest.java index c325671db9..b08239536e 100644 --- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/upgradeTest/CompareUpgradeTest.java +++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/upgradeTest/CompareUpgradeTest.java @@ -308,7 +308,7 @@ public class CompareUpgradeTest { public static boolean compareDirectories(boolean allowExpectedWord, Path expected, Path upgrade) throws IOException { - Files.walkFileTree(expected, new SimpleFileVisitor() { + Files.walkFileTree(expected, new SimpleFileVisitor<>() { @Override public FileVisitResult visitFile(Path expectedFile, BasicFileAttributes attrs) throws IOException { FileVisitResult result = super.visitFile(expectedFile, attrs); diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/ClientNonDivertedSoakTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/ClientNonDivertedSoakTest.java index a5392264d5..abd953a835 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/ClientNonDivertedSoakTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/ClientNonDivertedSoakTest.java @@ -16,8 +16,7 @@ */ package org.apache.activemq.artemis.tests.soak.client; -import static org.junit.jupiter.api.Assertions.assertEquals; - +import java.lang.invoke.MethodHandles; import java.util.HashMap; import java.util.concurrent.TimeUnit; @@ -30,13 +29,13 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.lang.invoke.MethodHandles; + +import static org.junit.jupiter.api.Assertions.assertEquals; public class ClientNonDivertedSoakTest extends ActiveMQTestBase { @@ -63,7 +62,7 @@ public class ClientNonDivertedSoakTest extends ActiveMQTestBase { Configuration config = createDefaultConfig(isNetty()).setJournalFileSize(10 * 1024 * 1024); - server = createServer(IS_JOURNAL, config, -1, -1, new HashMap()); + server = createServer(IS_JOURNAL, config, -1, -1, new HashMap<>()); server.start(); diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/ClientSoakTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/ClientSoakTest.java index f636d75575..cbdecca98c 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/ClientSoakTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/ClientSoakTest.java @@ -16,8 +16,7 @@ */ package org.apache.activemq.artemis.tests.soak.client; -import static org.junit.jupiter.api.Assertions.assertEquals; - +import java.lang.invoke.MethodHandles; import java.util.ArrayList; import java.util.HashMap; import java.util.concurrent.TimeUnit; @@ -32,13 +31,13 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.DivertConfiguration; import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.lang.invoke.MethodHandles; + +import static org.junit.jupiter.api.Assertions.assertEquals; public class ClientSoakTest extends ActiveMQTestBase { @@ -70,7 +69,7 @@ public class ClientSoakTest extends ActiveMQTestBase { Configuration config = createDefaultConfig(isNetty()).setJournalFileSize(10 * 1024 * 1024); - server = createServer(IS_JOURNAL, config, -1, -1, new HashMap()); + server = createServer(IS_JOURNAL, config, -1, -1, new HashMap<>()); DivertConfiguration divert1 = new DivertConfiguration().setName("dv1").setRoutingName("nm1").setAddress(ClientSoakTest.ADDRESS.toString()).setForwardingAddress(ClientSoakTest.DIVERTED_AD1.toString()).setExclusive(true); diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/SimpleSendReceiveSoakTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/SimpleSendReceiveSoakTest.java index d7e99499c8..3a6565e902 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/SimpleSendReceiveSoakTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/SimpleSendReceiveSoakTest.java @@ -16,9 +16,6 @@ */ package org.apache.activemq.artemis.tests.soak.client; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - import java.util.HashMap; import org.apache.activemq.artemis.api.core.QueueConfiguration; @@ -31,11 +28,13 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; 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.assertNotNull; + public class SimpleSendReceiveSoakTest extends ActiveMQTestBase { @@ -62,7 +61,7 @@ public class SimpleSendReceiveSoakTest extends ActiveMQTestBase { Configuration config = createDefaultConfig(isNetty()).setJournalFileSize(10 * 1024 * 1024); - server = createServer(IS_JOURNAL, config, -1, -1, new HashMap()); + server = createServer(IS_JOURNAL, config, -1, -1, new HashMap<>()); server.start(); diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java index 1985749d41..9fec0a360d 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java @@ -16,12 +16,6 @@ */ package org.apache.activemq.artemis.tests.stress.paging; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -49,7 +43,6 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.RoutingContext; import org.apache.activemq.artemis.core.server.impl.RoutingContextImpl; -import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.transaction.Transaction; import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl; import org.apache.activemq.artemis.selector.filter.Filterable; @@ -60,6 +53,12 @@ import org.apache.activemq.artemis.utils.collections.LinkedListIterator; 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.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class PageCursorStressTest extends ActiveMQTestBase { @@ -770,7 +769,7 @@ public class PageCursorStressTest extends ActiveMQTestBase { Configuration config = createDefaultInVMConfig().setJournalSyncNonTransactional(true); - server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap()); + server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<>()); server.start(); diff --git a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/core/journal/impl/JournalImplTestUnit.java b/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/core/journal/impl/JournalImplTestUnit.java index 55e190df8d..96b85967cd 100644 --- a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/core/journal/impl/JournalImplTestUnit.java +++ b/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/core/journal/impl/JournalImplTestUnit.java @@ -16,19 +16,17 @@ */ package org.apache.activemq.artemis.tests.timing.core.journal.impl; -import static org.junit.jupiter.api.Assertions.assertEquals; - +import java.lang.invoke.MethodHandles; import java.util.ArrayList; -import org.apache.activemq.artemis.core.journal.PreparedTransactionInfo; -import org.apache.activemq.artemis.core.journal.RecordInfo; import org.apache.activemq.artemis.nativo.jlibaio.LibaioContext; import org.apache.activemq.artemis.tests.unit.core.journal.impl.JournalImplTestBase; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.lang.invoke.MethodHandles; + +import static org.junit.jupiter.api.Assertions.assertEquals; public abstract class JournalImplTestUnit extends JournalImplTestBase { @@ -159,7 +157,7 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase { stopJournal(); createJournal(); startJournal(); - journal.load(new ArrayList(), new ArrayList(), null); + journal.load(new ArrayList<>(), new ArrayList<>(), null); assertEquals(NUMBER_OF_RECORDS / 2, journal.getIDMapSize()); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/ConnectorsServiceTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/ConnectorsServiceTest.java index ed93a9db43..9013fbe3e8 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/ConnectorsServiceTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/ConnectorsServiceTest.java @@ -58,7 +58,7 @@ public class ConnectorsServiceTest extends ActiveMQTestBase { */ @Test public void testConnectorsServiceUsesInjectedConnectorServiceFactory() throws Exception { - ConnectorServiceConfiguration connectorServiceConfiguration = new ConnectorServiceConfiguration().setFactoryClassName(null).setParams(new HashMap()).setName("myfact"); + ConnectorServiceConfiguration connectorServiceConfiguration = new ConnectorServiceConfiguration().setFactoryClassName(null).setParams(new HashMap<>()).setName("myfact"); // Creates a fake connector service factory that returns the fake connector service object ConnectorService connectorService = new FakeConnectorService(); @@ -79,7 +79,7 @@ public class ConnectorsServiceTest extends ActiveMQTestBase { */ @Test public void testConnectorsServiceUsesConfiguredConnectorServices() throws Exception { - ConnectorServiceConfiguration connectorServiceConfiguration = new ConnectorServiceConfiguration().setFactoryClassName(FakeConnectorServiceFactory.class.getCanonicalName()).setParams(new HashMap()).setName("myfact"); + ConnectorServiceConfiguration connectorServiceConfiguration = new ConnectorServiceConfiguration().setFactoryClassName(FakeConnectorServiceFactory.class.getCanonicalName()).setParams(new HashMap<>()).setName("myfact"); List connectorServiceConfigurations = new ArrayList<>(); connectorServiceConfigurations.add(connectorServiceConfiguration); @@ -99,7 +99,7 @@ public class ConnectorsServiceTest extends ActiveMQTestBase { @Test public void testConnectorServiceUsedDirectly() throws Exception { // Initial setup with existing connector service - ConnectorServiceConfiguration connectorServiceConfiguration = new ConnectorServiceConfiguration().setFactoryClassName(FakeConnectorServiceFactory.class.getCanonicalName()).setParams(new HashMap()).setName("myfact"); + ConnectorServiceConfiguration connectorServiceConfiguration = new ConnectorServiceConfiguration().setFactoryClassName(FakeConnectorServiceFactory.class.getCanonicalName()).setParams(new HashMap<>()).setName("myfact"); configuration.setConnectorServiceConfigurations(Arrays.asList(connectorServiceConfiguration)); ConnectorsService connectorsService = new ConnectorsService(configuration, null, null, null, serviceRegistry); @@ -117,7 +117,7 @@ public class ConnectorsServiceTest extends ActiveMQTestBase { // Add unique with same factory - ConnectorServiceConfiguration additionalServiceConfiguration = new ConnectorServiceConfiguration().setFactoryClassName(FakeConnectorServiceFactory.class.getCanonicalName()).setParams(new HashMap()).setName("myfact2"); + ConnectorServiceConfiguration additionalServiceConfiguration = new ConnectorServiceConfiguration().setFactoryClassName(FakeConnectorServiceFactory.class.getCanonicalName()).setParams(new HashMap<>()).setName("myfact2"); connectorsService.createService(additionalServiceConfiguration, connectorServiceFactory); assertEquals(2, connectorsService.getConnectors().size()); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/persistence/impl/BatchIDGeneratorUnitTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/persistence/impl/BatchIDGeneratorUnitTest.java index fc8f290e17..b8ccc6d83d 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/persistence/impl/BatchIDGeneratorUnitTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/persistence/impl/BatchIDGeneratorUnitTest.java @@ -45,7 +45,7 @@ public class BatchIDGeneratorUnitTest extends ActiveMQTestBase { journal.start(); - journal.load(new ArrayList(), new ArrayList(), null); + journal.load(new ArrayList<>(), new ArrayList<>(), null); BatchingIDGenerator batch = new BatchingIDGenerator(0, 1000, getJournalStorageManager(journal)); long id1 = batch.generateID(); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/DuplicateDetectionUnitTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/DuplicateDetectionUnitTest.java index 6fbc5ac09c..fdc9536506 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/DuplicateDetectionUnitTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/DuplicateDetectionUnitTest.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.tests.unit.core.postoffice.impl; -import static org.junit.jupiter.api.Assertions.assertEquals; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -29,9 +27,6 @@ import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.Pair; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.persistence.AddressBindingInfo; -import org.apache.activemq.artemis.core.persistence.GroupingInfo; -import org.apache.activemq.artemis.core.persistence.QueueBindingInfo; import org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager; import org.apache.activemq.artemis.core.postoffice.DuplicateIDCache; import org.apache.activemq.artemis.core.postoffice.PostOffice; @@ -50,6 +45,8 @@ 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; + public class DuplicateDetectionUnitTest extends ActiveMQTestBase { @@ -92,7 +89,7 @@ public class DuplicateDetectionUnitTest extends ActiveMQTestBase { journal = new JournalStorageManager(configuration, EmptyCriticalAnalyzer.getInstance(), factory, factory); journal.start(); - journal.loadBindingJournal(new ArrayList(), new ArrayList(), new ArrayList()); + journal.loadBindingJournal(new ArrayList<>(), new ArrayList<>(), new ArrayList<>()); HashMap>> mapDups = new HashMap<>(); @@ -111,7 +108,7 @@ public class DuplicateDetectionUnitTest extends ActiveMQTestBase { journal = new JournalStorageManager(configuration, EmptyCriticalAnalyzer.getInstance(), factory, factory); journal.start(); - journal.loadBindingJournal(new ArrayList(), new ArrayList(), new ArrayList()); + journal.loadBindingJournal(new ArrayList<>(), new ArrayList<>(), new ArrayList<>()); journal.loadMessageJournal(postOffice, pagingManager, new ResourceManagerImpl(null, 0, 0, scheduledThreadPool), null, mapDups, null, null, new PostOfficeJournalLoader(postOffice, pagingManager, null, null, null, null, null, null)); @@ -134,7 +131,7 @@ public class DuplicateDetectionUnitTest extends ActiveMQTestBase { journal = new JournalStorageManager(configuration, EmptyCriticalAnalyzer.getInstance(), factory, factory); journal.start(); - journal.loadBindingJournal(new ArrayList(), new ArrayList(), new ArrayList()); + journal.loadBindingJournal(new ArrayList<>(), new ArrayList<>(), new ArrayList<>()); journal.loadMessageJournal(postOffice, pagingManager, new ResourceManagerImpl(null, 0, 0, scheduledThreadPool), null, mapDups, null, null, new PostOfficeJournalLoader(postOffice, pagingManager, null, null, null, null, null, null)); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/invm/InVMConnectorFactoryTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/invm/InVMConnectorFactoryTest.java index a3d8275384..97d45e63a0 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/invm/InVMConnectorFactoryTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/invm/InVMConnectorFactoryTest.java @@ -31,7 +31,7 @@ public class InVMConnectorFactoryTest { @Test public void testCreateConnectorSetsDefaults() { // Test defaults are added when TransportConfig params are empty - TransportConfiguration tc = new TransportConfiguration(InVMConnectorFactory.class.getName(), new HashMap()); + TransportConfiguration tc = new TransportConfiguration(InVMConnectorFactory.class.getName(), new HashMap<>()); assertTrue(tc.getParams().equals(InVMConnector.DEFAULT_CONFIG)); // Test defaults are added when TransportConfig params are null diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java index b79545df02..3d7c65eb15 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java @@ -68,7 +68,7 @@ public class NettyAcceptorFactoryTest extends ActiveMQTestBase { }; - Acceptor acceptor = factory.createAcceptor("netty", null, params, handler, listener, Executors.newCachedThreadPool(ActiveMQThreadFactory.defaultThreadFactory(getClass().getName())), Executors.newScheduledThreadPool(ActiveMQDefaultConfiguration.getDefaultScheduledThreadPoolMaxSize(), ActiveMQThreadFactory.defaultThreadFactory(getClass().getName())), new HashMap()); + Acceptor acceptor = factory.createAcceptor("netty", null, params, handler, listener, Executors.newCachedThreadPool(ActiveMQThreadFactory.defaultThreadFactory(getClass().getName())), Executors.newScheduledThreadPool(ActiveMQDefaultConfiguration.getDefaultScheduledThreadPoolMaxSize(), ActiveMQThreadFactory.defaultThreadFactory(getClass().getName())), new HashMap<>()); assertTrue(acceptor instanceof NettyAcceptor); } 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 032e0413eb..87af86d057 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 @@ -96,7 +96,7 @@ public class NettyAcceptorTest extends ActiveMQTestBase { }; pool2 = Executors.newScheduledThreadPool(ActiveMQDefaultConfiguration.getDefaultScheduledThreadPoolMaxSize(), ActiveMQThreadFactory.defaultThreadFactory(getClass().getName())); pool3 = Executors.newSingleThreadExecutor(ActiveMQThreadFactory.defaultThreadFactory(getClass().getName())); - NettyAcceptor acceptor = new NettyAcceptor("netty", null, params, handler, listener, pool2, pool3, new HashMap()); + NettyAcceptor acceptor = new NettyAcceptor("netty", null, params, handler, listener, pool2, pool3, new HashMap<>()); addActiveMQComponent(acceptor); acceptor.start(); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyConnectorFactoryTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyConnectorFactoryTest.java index 34f3f3cde4..a1ba26e77a 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyConnectorFactoryTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyConnectorFactoryTest.java @@ -31,7 +31,7 @@ public class NettyConnectorFactoryTest { @Test public void testCreateConnectorSetsDefaults() { // Test defaults are added when TransportConfig params are empty - TransportConfiguration tc = new TransportConfiguration(NettyConnectorFactory.class.getName(), new HashMap()); + TransportConfiguration tc = new TransportConfiguration(NettyConnectorFactory.class.getName(), new HashMap<>()); assertTrue(tc.getParams().equals(NettyConnector.DEFAULT_CONFIG)); // Test defaults are added when TransportConfig params are null diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/server/impl/RemotingServiceImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/server/impl/RemotingServiceImplTest.java index d6be8fcbe9..c4e562cacf 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/server/impl/RemotingServiceImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/server/impl/RemotingServiceImplTest.java @@ -16,15 +16,12 @@ */ package org.apache.activemq.artemis.tests.unit.core.remoting.server.impl; -import static org.junit.jupiter.api.Assertions.assertTrue; - import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashSet; import java.util.List; -import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl; import org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl; @@ -34,6 +31,8 @@ import org.apache.activemq.artemis.tests.unit.core.remoting.server.impl.fake.Fak import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class RemotingServiceImplTest { private ServiceRegistry serviceRegistry; @@ -46,7 +45,7 @@ public class RemotingServiceImplTest { public void setUp() throws Exception { serviceRegistry = new ServiceRegistryImpl(); configuration = new ConfigurationImpl(); - configuration.setAcceptorConfigurations(new HashSet()); + configuration.setAcceptorConfigurations(new HashSet<>()); remotingService = new RemotingServiceImpl(null, configuration, null, null, null, null, null, serviceRegistry); }