ARTEMIS-4833 remove redundant type arguments

This commit is contained in:
Justin Bertram 2024-06-21 17:20:34 -05:00 committed by Timothy Bish
parent d7cf5dfa44
commit ca73dee630
99 changed files with 195 additions and 221 deletions

View File

@ -121,7 +121,7 @@ public class JsonArrayImpl extends JsonValueImpl implements JsonArray {
@Override
public Iterator<JsonValue> iterator() {
return new Iterator<JsonValue>() {
return new Iterator<>() {
private Iterator<javax.json.JsonValue> rawIterator = rawArray.iterator();
@Override

View File

@ -160,10 +160,10 @@ public class JsonObjectImpl extends JsonValueImpl implements JsonObject {
@Override
public Collection<JsonValue> values() {
return new AbstractCollection<JsonValue>() {
return new AbstractCollection<>() {
@Override
public Iterator<JsonValue> iterator() {
return new Iterator<JsonValue>() {
return new Iterator<>() {
private Iterator<javax.json.JsonValue> rawIterator = rawObject.values().iterator();
@Override
@ -187,10 +187,10 @@ public class JsonObjectImpl extends JsonValueImpl implements JsonObject {
@Override
public Set<Map.Entry<String, JsonValue>> entrySet() {
return new AbstractSet<Map.Entry<String, JsonValue>>() {
return new AbstractSet<>() {
@Override
public Iterator<Map.Entry<String, JsonValue>> iterator() {
return new Iterator<Map.Entry<String, JsonValue>>() {
return new Iterator<>() {
private Iterator<Map.Entry<String, javax.json.JsonValue>> rawIterator = rawObject.entrySet().iterator();
@Override

View File

@ -56,7 +56,7 @@ public class EmptyList<E> implements LinkedList<E> {
return null;
}
LinkedListIterator<E> emptyIterator = new LinkedListIterator<E>() {
LinkedListIterator<E> emptyIterator = new LinkedListIterator<>() {
@Override
public void repeat() {
}

View File

@ -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<String, Object>(), UUIDGenerator.getInstance().generateStringUUID());
this(className, new HashMap<>(), UUIDGenerator.getInstance().generateStringUUID());
}
/**

View File

@ -156,7 +156,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
public final Exception createTrace;
public static final Set<CloseRunnable> CLOSE_RUNNABLES = Collections.synchronizedSet(new HashSet<CloseRunnable>());
public static final Set<CloseRunnable> CLOSE_RUNNABLES = Collections.synchronizedSet(new HashSet<>());
private final ConfirmationWindowWarning confirmationWindowWarning;

View File

@ -114,7 +114,7 @@ public final class DiscoveryGroup implements ActiveMQComponent {
started = true;
ThreadFactory tfactory = AccessController.doPrivileged(new PrivilegedAction<ThreadFactory>() {
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());

View File

@ -649,7 +649,7 @@ public class NettyConnector extends AbstractConnector {
realTrustStorePassword = null;
}
bootstrap.handler(new ChannelInitializer<Channel>() {
bootstrap.handler(new ChannelInitializer<>() {
@Override
public void initChannel(Channel channel) throws Exception {
final ChannelPipeline pipeline = channel.pipeline();

View File

@ -61,7 +61,7 @@ public class SharedEventLoopGroup extends DelegatingEventLoopGroup {
f.cancel(false);
}
} else {
instance = new SharedEventLoopGroup(eventLoopGroupSupplier.apply(AccessController.doPrivileged(new PrivilegedAction<ThreadFactory>() {
instance = new SharedEventLoopGroup(eventLoopGroupSupplier.apply(AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public ThreadFactory run() {
return new ActiveMQThreadFactory("ActiveMQ-client-netty-threads", true, ClientSessionFactoryImpl.class.getClassLoader());

View File

@ -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<Runnable>());
ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>());
ThreadPoolExecutor flowControlPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
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<Runnable>());
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<Runnable>());
ThreadPoolExecutor flowControlThreadPool = new ThreadPoolExecutor(1, 1, 60L, TimeUnit.SECONDS, new SynchronousQueue<>());
serverLocator.setThreadPools(threadPool, scheduledThreadPool, flowControlThreadPool);
Field threadPoolField = ServerLocatorImpl.class.getDeclaredField("threadPool");

View File

@ -34,8 +34,8 @@ public class TransportConfigurationTest {
@Test
public void testEquals() {
TransportConfiguration configuration = new TransportConfiguration("SomeClass", new HashMap<String, Object>(), null);
TransportConfiguration configuration2 = new TransportConfiguration("SomeClass", new HashMap<String, Object>(), 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());

View File

@ -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<String, Object>());
CompositeData jmsdata = new CompositeDataSupport(data.getCompositeType(), new HashMap<>());
return jmsdata;
}

View File

@ -38,7 +38,7 @@ public final class AmqpTransferTagGenerator {
public AmqpTransferTagGenerator(boolean pool) {
if (pool) {
this.tagPool = new ArrayDeque<byte[]>();
this.tagPool = new ArrayDeque<>();
} else {
this.tagPool = null;
}

View File

@ -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<ConnectionEventListener>());
handles = Collections.synchronizedSet(new HashSet<ActiveMQRASession>());
eventListeners = Collections.synchronizedList(new ArrayList<>());
handles = Collections.synchronizedSet(new HashSet<>());
connection = null;
nonXAsession = null;

View File

@ -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<Object>() {
return AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public Object run() {
ClassLoader loader = getClass().getClassLoader();

View File

@ -142,7 +142,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
raProperties = new ActiveMQRAProperties();
configured = new AtomicBoolean(false);
activations = Collections.synchronizedMap(new IdentityHashMap<ActivationSpec, ActiveMQActivation>());
activations = Collections.synchronizedMap(new IdentityHashMap<>());
recoveryManager = new RecoveryManager();
}

View File

@ -121,7 +121,7 @@ public class ActiveMQActivation {
private ActiveMQConnectionFactory factory;
private final List<String> nodes = Collections.synchronizedList(new ArrayList<String>());
private final List<String> nodes = Collections.synchronizedList(new ArrayList<>());
private final Map<String, Long> 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);
}

View File

@ -852,7 +852,7 @@ public class ConfigurationImpl implements Configuration, Serializable {
beanUtils.getConvertUtils().register(new Converter() {
@Override
public <T> T convert(Class<T> type, Object value) {
List convertedValue = new ArrayList<String>();
List<String> convertedValue = new ArrayList<>();
for (String entry : value.toString().split(",")) {
convertedValue.add(entry);
}

View File

@ -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<String>());
roles.put(user, new ArrayList<>());
}
roles.get(user).add(role);
}

View File

@ -57,7 +57,7 @@ public class WildcardAddressManager extends SimpleAddressManager {
final Bindings[] lazyCreateResult = new Bindings[1];
addressMap.visitMatchingWildcards(address, new AddressMapVisitor<Bindings>() {
addressMap.visitMatchingWildcards(address, new AddressMapVisitor<>() {
Bindings newBindings = null;
@Override

View File

@ -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<Runnable>(), 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()));
}

View File

@ -454,7 +454,7 @@ public class NettyAcceptor extends AbstractAcceptor {
bootstrap.group(eventLoopGroup);
bootstrap.channel(channelClazz);
ChannelInitializer<Channel> factory = new ChannelInitializer<Channel>() {
ChannelInitializer<Channel> factory = new ChannelInitializer<>() {
@Override
public void initChannel(Channel channel) throws Exception {
ChannelPipeline pipeline = channel.pipeline();

View File

@ -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 {

View File

@ -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<Long, JournalSyncFile>());
filesReservedForSync.put(jc, new HashMap<>());
// We only need to load internal structures on the backup...
journalLoadInformation[jc.typeByte] = journalsHolder.get(jc).loadSyncOnly(JournalState.SYNCING);
}

View File

@ -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<UnproposalListener> listeners = Collections.newSetFromMap(new WeakHashMap<UnproposalListener, Boolean>());
final Set<UnproposalListener> listeners = Collections.newSetFromMap(new WeakHashMap<>());
public GroupHandlingAbstract(final Executor executor,
final ManagementService managementService,

View File

@ -507,7 +507,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
securityRepository = new HierarchicalObjectRepository<>(configuration.getWildcardConfiguration());
securityRepository.setDefault(new HashSet<Role>());
securityRepository.setDefault(new HashSet<>());
this.parentServer = parentServer;
@ -3158,7 +3158,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
ThreadFactory tFactory = AccessController.doPrivileged((PrivilegedAction<ThreadFactory>) ()-> 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<Runnable>(), 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<ThreadFactory>) () -> new ActiveMQThreadFactory("ActiveMQ-IO-server-" + this, false, ClientSessionFactoryImpl.class.getClassLoader()));
this.ioExecutorPool = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), 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>() {
ThreadFactory tFactory = AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public ThreadFactory run() {
return new ActiveMQThreadFactory("ActiveMQ-PageExecutor-server-" + this.toString(), false, ClientSessionFactoryImpl.class.getClassLoader());

View File

@ -359,7 +359,7 @@ public class ScaleDownHandler {
}
Pair<List<Long>, List<Long>> queueIds = queuesToSendTo.get(message);
if (queueIds == null) {
queueIds = new Pair<List<Long>, List<Long>>(new ArrayList<Long>(), new ArrayList<Long>());
queueIds = new Pair<>(new ArrayList<>(), new ArrayList<>());
queuesToSendTo.put(message, queueIds);
}
queueIds.getA().add(queueID);
@ -381,7 +381,7 @@ public class ScaleDownHandler {
}
Pair<List<Long>, List<Long>> queueIds = queuesToSendTo.get(message);
if (queueIds == null) {
queueIds = new Pair<List<Long>, List<Long>>(new ArrayList<Long>(), new ArrayList<Long>());
queueIds = new Pair<>(new ArrayList<>(), new ArrayList<>());
queuesToSendTo.put(message, queueIds);
}
queueIds.getA().add(queueID);

View File

@ -67,8 +67,8 @@ public class ServiceRegistryImpl implements ServiceRegistry {
private Map<String, Pair<ConnectorServiceFactory, ConnectorServiceConfiguration>> connectorServices;
public ServiceRegistryImpl() {
this.incomingInterceptors = Collections.synchronizedList(new ArrayList<BaseInterceptor>());
this.outgoingInterceptors = Collections.synchronizedList(new ArrayList<BaseInterceptor>());
this.incomingInterceptors = Collections.synchronizedList(new ArrayList<>());
this.outgoingInterceptors = Collections.synchronizedList(new ArrayList<>());
this.connectorServices = new ConcurrentHashMap<>();
this.divertTransformers = new ConcurrentHashMap<>();
this.bridgeTransformers = new ConcurrentHashMap<>();

View File

@ -1935,7 +1935,7 @@ public class ConfigurationImplTest extends AbstractConfigurationTestBase {
final AtomicReference<String> errorAt = new AtomicReference<>();
ConfigurationImpl configuration = new ConfigurationImpl();
configuration.setResourceLimitSettings(new HashMap<String, ResourceLimitSettings>() {
configuration.setResourceLimitSettings(new HashMap<>() {
@Override
public ResourceLimitSettings put(String key, ResourceLimitSettings value) {
if (!(key.equals(insertionOrderedKeys.remove()))) {

View File

@ -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<String, Object>());
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<String>());
loginWithCredentials(null, new HashSet<>());
} catch (LoginException e) {
loginFailed = true;
}

View File

@ -89,7 +89,7 @@ public class PropertiesLoginModuleRaceConditionTest extends ArtemisTestCase {
Subject subject = new Subject();
PropertiesLoginModule module = new PropertiesLoginModule();
module.initialize(subject, callback, new HashMap<String, Object>(), options);
module.initialize(subject, callback, new HashMap<>(), options);
module.login();
module.commit();
} catch (Exception e) {

View File

@ -49,7 +49,7 @@ public class RepositoryTest extends ServerTestBase {
@Test
public void testDefault() {
securityRepository.setDefault(new HashSet<Role>());
securityRepository.setDefault(new HashSet<>());
HashSet<Role> 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<Role>());
securityRepository.addMatch("queues.*", new HashSet<>());
HashSet<Role> hashSet = securityRepository.getMatch("queues.something");
assertEquals(hashSet.size(), 0);
}
@Test
public void testSingletwo() {
securityRepository.addMatch("queues.another.aq.*", new HashSet<Role>());
securityRepository.addMatch("queues.another.aq.*", new HashSet<>());
HashSet<Role> 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<Role>());
securityRepository.addMatch("queues.1.*", new HashSet<>());
HashSet<Role> 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));

View File

@ -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<String, Object>());
loginModule.initialize(new Subject(), callbackHandler, null, new HashMap<>());
// login should return false due to null username
assertFalse(loginModule.login());

View File

@ -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<String, Object>(), "netty", new HashMap<String, Object>()));
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);

View File

@ -109,7 +109,7 @@ public class XARecoveryConfig {
this.password = password;
this.ha = ha;
this.clientProtocolManager = clientProtocolManager;
this.properties = properties == null ? Collections.unmodifiableMap(new HashMap<String, String>()) : 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<String, String>()) : Collections.unmodifiableMap(properties);
this.properties = properties == null ? Collections.unmodifiableMap(new HashMap<>()) : Collections.unmodifiableMap(properties);
this.clientProtocolManager = clientProtocolManager;
this.locatorConfig = serverLocator.getLocatorConfig();
}

View File

@ -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<String, AddressSettings>());
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<String, Object>(), NETTY_ACCEPTOR_FACTORY);
return createDefaultConfig(new HashMap<>(), NETTY_ACCEPTOR_FACTORY);
} else {
return createDefaultConfig(new HashMap<String, Object>(), INVM_ACCEPTOR_FACTORY);
return createDefaultConfig(new HashMap<>(), INVM_ACCEPTOR_FACTORY);
}
}

View File

@ -50,7 +50,7 @@ public class InVMNamingContext implements Context, Serializable {
public InVMNamingContext() {
map = Collections.synchronizedMap(new HashMap<String, Object>());
map = Collections.synchronizedMap(new HashMap<>());
}
public InVMNamingContext(final String nameInNamespace) {

View File

@ -104,5 +104,5 @@ public class NonSerializableFactory implements ObjectFactory {
return NonSerializableFactory.wrapperMap;
}
private static Map<String, Object> wrapperMap = Collections.synchronizedMap(new HashMap<String, Object>());
private static Map<String, Object> wrapperMap = Collections.synchronizedMap(new HashMap<>());
}

View File

@ -132,7 +132,7 @@ public class JMSConsumerTest extends JmsTestSupport {
final ActiveMQMessageConsumer consumer = (ActiveMQMessageConsumer) session.createConsumer(destination);
final Map<Thread, Throwable> exceptions = Collections.synchronizedMap(new HashMap<Thread, Throwable>());
final Map<Thread, Throwable> exceptions = Collections.synchronizedMap(new HashMap<>());
Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
LOG.error("Uncaught exception:", e);
exceptions.put(t, e);

View File

@ -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<Runnable>());
ThreadPoolExecutor executor = new ThreadPoolExecutor(50, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<>());
final Vector<Throwable> exceptions = new Vector<>();
final Random rand = new Random();
Runnable createSessionTask = () -> {

View File

@ -77,7 +77,7 @@ public class JmsMultipleClientsTestSupport {
protected BrokerService broker;
protected Destination destination;
protected List<Connection> connections = Collections.synchronizedList(new ArrayList<Connection>());
protected List<Connection> connections = Collections.synchronizedList(new ArrayList<>());
protected MessageIdList allMessagesList = new MessageIdList();
protected void startProducers(Destination dest, int msgCount) throws Exception {

View File

@ -227,7 +227,7 @@ public class JmsSendReceiveTestSupport extends TestSupport implements MessageLis
* @return List
*/
protected List<Message> createConcurrentList() {
return Collections.synchronizedList(new ArrayList<Message>());
return Collections.synchronizedList(new ArrayList<>());
}
/**

View File

@ -50,7 +50,7 @@ public class JmsTempDestinationTest {
private static final Logger LOG = LoggerFactory.getLogger(JmsTempDestinationTest.class);
private Connection connection;
private ActiveMQConnectionFactory factory;
protected List<Connection> connections = Collections.synchronizedList(new ArrayList<Connection>());
protected List<Connection> connections = Collections.synchronizedList(new ArrayList<>());
@Before
public void setUp() throws Exception {

View File

@ -50,7 +50,7 @@ public class JmsTestSupport extends CombinationTestSupport {
protected ActiveMQConnection connection;
protected BrokerService broker;
protected List<Connection> connections = Collections.synchronizedList(new ArrayList<Connection>());
protected List<Connection> connections = Collections.synchronizedList(new ArrayList<>());
// /////////////////////////////////////////////////////////////////
//

View File

@ -256,6 +256,6 @@ public abstract class JmsSendReceiveTestSupport extends org.apache.activemq.Test
* @return a synchronized view of the specified list.
*/
protected List<Message> createConcurrentList() {
return Collections.synchronizedList(new ArrayList<Message>());
return Collections.synchronizedList(new ArrayList<>());
}
}

View File

@ -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<String, Object>());
server.setTransportOption(new HashMap<>());
try {
server.setAcceptListener(new TransportAcceptListener() {

View File

@ -56,7 +56,7 @@ public class InVMContext implements Context, Serializable {
public InVMContext() {
map = Collections.synchronizedMap(new HashMap<String, Object>());
map = Collections.synchronizedMap(new HashMap<>());
}
public InVMContext(final String nameInNamespace) {

View File

@ -56,7 +56,7 @@ public class InVMNamingContext implements Context, Serializable {
public InVMNamingContext() {
map = Collections.synchronizedMap(new HashMap<String, Object>());
map = Collections.synchronizedMap(new HashMap<>());
}
public InVMNamingContext(final String nameInNamespace) {

View File

@ -57,5 +57,5 @@ public class NonSerializableFactory implements ObjectFactory {
return NonSerializableFactory.wrapperMap;
}
private static Map<String, Object> wrapperMap = Collections.synchronizedMap(new HashMap<String, Object>());
private static Map<String, Object> wrapperMap = Collections.synchronizedMap(new HashMap<>());
}

View File

@ -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<String, Object>(), "netty", new HashMap<String, Object>()));
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);

View File

@ -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<String, Object>(), "netty", new HashMap<String, Object>()));
server.getConfiguration().addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, new HashMap<>(), "netty", new HashMap<>()));
}
@Test

View File

@ -131,7 +131,7 @@ public class TopicDurableTests extends JMSClientTestSupport {
Connection connection1 = connectionFactory1.createConnection();
Hashtable env2 = new Hashtable<Object, Object>();
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");

View File

@ -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<String, AddressSettings>());
server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<>());
server.start();
locator = createNonHALocator(false).setBlockOnDurableSend(false).setBlockOnAcknowledge(true);
}

View File

@ -325,7 +325,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase {
ClientSession session = null;
LargeMessageTestInterceptorIgnoreLastPacket.disableInterrupt();
ActiveMQServer server = createServer(true, createDefaultConfig(isNetty()), 10000, 20000, new HashMap<String, AddressSettings>());
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<String, AddressSettings>());
ActiveMQServer server = createServer(true, createDefaultConfig(isNetty()), 10000, 20000, new HashMap<>());
server.getConfiguration().getIncomingInterceptorClassNames().add(LargeMessageTestInterceptorIgnoreLastPacket.class.getName());

View File

@ -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<String, AddressSettings>(), storeType);
ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<>(), storeType);
server.start();

View File

@ -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<String, AddressSettings>());
server = createServer(true, createDefaultConfig(isNetty), PAGE_SIZE, PAGE_MAX, -1, -1, new HashMap<>());
} else {
server = createServer(true, isNetty);
}

View File

@ -418,7 +418,7 @@ public class BridgeTest extends ActiveMQTestBase {
final String forwardAddress = "forwardAddress";
final String queueName1 = "queue1";
// Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
// Map<String, TransportConfiguration> connectors = new HashMap<>();
TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params);
TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params);

View File

@ -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
* <br>
@ -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<String, AddressSettings>(), nodeManager, 2));
return addServer(createInVMFailoverServer(true, configuration, PAGE_SIZE, PAGE_MAX, new HashMap<>(), nodeManager, 2));
}
@Override

View File

@ -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<AppDTO>();
bindingDTO.apps = new ArrayList<>();
bindingDTO.apps.add(appDTO);
WebServerDTO wdto = new WebServerDTO();
wdto.setBindings(Collections.singletonList(bindingDTO));

View File

@ -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<String, AddressSettings>(), nodeManager, id);
return createInVMFailoverServer(realFiles, configuration, PAGE_SIZE, PAGE_MAX, new HashMap<>(), nodeManager, id);
}
@Override

View File

@ -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<AppDTO>();
bindingDTO.apps = new ArrayList<>();
bindingDTO.apps.add(appDTO);
WebServerDTO wdto = new WebServerDTO();
wdto.setBindings(Collections.singletonList(bindingDTO));

View File

@ -213,7 +213,7 @@ public abstract class TopologyClusterTestBase extends ClusterTestBase {
locator.getTopology().setOwner("testReceive");
final List<String> nodes = Collections.synchronizedList(new ArrayList<String>());
final List<String> 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<String> nodes = Collections.synchronizedList(new ArrayList<String>());
final List<String> 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<String> nodes = Collections.synchronizedList(new ArrayList<String>());
final List<String> 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<String> nodes = Collections.synchronizedList(new ArrayList<String>());
final List<String> nodes = Collections.synchronizedList(new ArrayList<>());
final CountDownLatch upLatch = new CountDownLatch(5);
final CountDownLatch downLatch = new CountDownLatch(4);

View File

@ -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<String, AddressSettings>());
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<String, AddressSettings>());
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<String, AddressSettings>());
ActiveMQServer server = createServer(true, configuration, AddressSettings.DEFAULT_PAGE_SIZE, AddressSettings.DEFAULT_MAX_SIZE_BYTES, new HashMap<>());
server.start();
server.stop();

View File

@ -53,7 +53,7 @@ public class AcceptorControlTest extends ManagementTestBase {
@Test
public void testAttributes() throws Exception {
TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(), new HashMap<String, Object>(), 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<String, Object>(), 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<String, Object>(), RandomUtil.randomString());
TransportConfiguration acceptorConfig2 = new TransportConfiguration(NettyAcceptorFactory.class.getName(), new HashMap<String, Object>(), 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);

View File

@ -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<String, Object>());
managementControl.createConnectorService("myconn", FakeConnectorServiceFactory.class.getCanonicalName(), new HashMap<>());
assertEquals(1, server.getConnectorsService().getConnectors().size());
managementControl.createConnectorService("myconn2", FakeConnectorServiceFactory.class.getCanonicalName(), new HashMap<String, Object>());
managementControl.createConnectorService("myconn2", FakeConnectorServiceFactory.class.getCanonicalName(), new HashMap<>());
assertEquals(2, server.getConnectorsService().getConnectors().size());
managementControl.destroyConnectorService("myconn");

View File

@ -88,7 +88,7 @@ public class LargeMessageOverManagementTest extends ManagementTestBase {
int bodySize = (int) server.getStorageManager().getMaxRecordSize() + 100;
byte[] bigData = createBytesData(bodySize);
queueControl.sendMessage(new HashMap<String, String>(), 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);

View File

@ -2347,8 +2347,8 @@ public class QueueControlTest extends ManagementTestBase {
// send two messages on queueA
queueControlA.sendMessage(new HashMap<String, String>(), Message.BYTES_TYPE, Base64.encodeBytes("theBody".getBytes()), true, "myUser", "myPassword");
queueControlA.sendMessage(new HashMap<String, String>(), 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<String, String>(), 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<String, String>(), 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<String, String>(), 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));

View File

@ -69,7 +69,7 @@ public class JMSConsumer2Test extends BasicOpenWireTest {
final ActiveMQMessageConsumer consumer = (ActiveMQMessageConsumer) session.createConsumer(destination);
final Map<Thread, Throwable> exceptions = Collections.synchronizedMap(new HashMap<Thread, Throwable>());
final Map<Thread, Throwable> exceptions = Collections.synchronizedMap(new HashMap<>());
Thread.setDefaultUncaughtExceptionHandler((t, e) -> exceptions.put(t, e));
final class AckAndClose implements Runnable {

View File

@ -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<Runnable>());
ThreadPoolExecutor executor = new ThreadPoolExecutor(50, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<>());
final Vector<Throwable> exceptions = new Vector<>();
final AtomicInteger counter = new AtomicInteger(0);
final Random rand = new Random();

View File

@ -379,7 +379,7 @@ public class JmsQueueBrowserTest extends BasicOpenWireTest {
@SuppressWarnings("unchecked")
Enumeration<Message> browserView = browser.getEnumeration();
List<Message> messages = new ArrayList<Message>();
List<Message> messages = new ArrayList<>();
for (int i = 0; i < numMessages; i++)
{
Message m1 = consumer.receive(5000);

View File

@ -51,7 +51,7 @@ public abstract class JmsSendReceiveTestSupport extends BasicOpenWireTest implem
protected MessageProducer producer;
protected Destination consumerDestination;
protected Destination producerDestination;
protected List<Message> messages = Collections.synchronizedList(new ArrayList<Message>());
protected List<Message> messages = Collections.synchronizedList(new ArrayList<>());
protected boolean topic = true;
protected boolean durable;
protected int deliveryMode = DeliveryMode.PERSISTENT;

View File

@ -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.
* <br>
@ -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<String, AddressSettings>());
ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<>());
server.start();

View File

@ -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<String, AddressSettings>());
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<String, AddressSettings>());
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<String, AddressSettings>());
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<String, AddressSettings>());
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<String, AddressSettings>());
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<String, AddressSettings>());
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<String, AddressSettings>());
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<String, AddressSettings>());
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<String, AddressSettings>());
server = createServer(true, config, -1, -1, new HashMap<>());
server.getAddressSettingsRepository().getMatch("#").setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
jmsServer = new JMSServerManagerImpl(server);

View File

@ -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<String, AddressSettings>());
ActiveMQServer server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<>());
server.start();

View File

@ -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<QueueBindingInfo>(), new ArrayList<GroupingInfo>(), new ArrayList<AddressBindingInfo>());
journal.loadBindingJournal(new ArrayList<>(), new ArrayList<>(), new ArrayList<>());
FakePostOffice postOffice = new FakePostOffice();

View File

@ -109,7 +109,7 @@ public class JMSStorageManagerTest extends ActiveMQTestBase {
str[i] = "str" + i;
}
ConnectionFactoryConfiguration config = new ConnectionFactoryConfigurationImpl().setName("some-name").setConnectorNames(new ArrayList<String>()).setBindings("");
ConnectionFactoryConfiguration config = new ConnectionFactoryConfigurationImpl().setName("some-name").setConnectorNames(new ArrayList<>()).setBindings("");
int size = config.getEncodeSize();

View File

@ -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<QueueBindingInfo> queueBindingInfos = new ArrayList<>();
journal.loadBindingJournal(queueBindingInfos, new ArrayList<GroupingInfo>(), new ArrayList<AddressBindingInfo>());
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<GroupingInfo>(), new ArrayList<AddressBindingInfo>());
journal.loadBindingJournal(queueBindingInfos, new ArrayList<>(), new ArrayList<>());
journal.start();
} finally {

View File

@ -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<QueueBindingInfo>(), new ArrayList<GroupingInfo>(), new ArrayList<AddressBindingInfo>());
journal.loadBindingJournal(new ArrayList<>(), new ArrayList<>(), new ArrayList<>());
journal.loadMessageJournal(new FakePostOffice(), null, null, null, null, null, null, null, new FakeJournalLoader());
}

View File

@ -29,7 +29,7 @@ public class DestroyConsumerTest extends ActiveMQTestBase {
// public void testDestroyConsumer() throws Exception
// {
// ActiveMQServer server = createService(false, false, createDefaultInVMConfig(), new HashMap<String, AddressSettings>());
// ActiveMQServer server = createService(false, false, createDefaultInVMConfig(), new HashMap<>());
// server.start();
//
// SimpleString queue = SimpleString.of("add1");

View File

@ -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<String>());
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);

View File

@ -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<Object>() {
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 {

View File

@ -100,5 +100,5 @@ public final class NonSerializableFactory implements ObjectFactory {
return NonSerializableFactory.wrapperMap;
}
private static Map<String, Object> wrapperMap = Collections.synchronizedMap(new HashMap<String, Object>());
private static Map<String, Object> wrapperMap = Collections.synchronizedMap(new HashMap<>());
}

View File

@ -3918,7 +3918,7 @@ public class MessageConsumerTest extends JMSTestCase {
private class MessageListenerImpl implements MessageListener {
private final List<Message> messages = Collections.synchronizedList(new ArrayList<Message>());
private final List<Message> messages = Collections.synchronizedList(new ArrayList<>());
private CountDownLatch latch = new CountDownLatch(1);

View File

@ -55,7 +55,7 @@ public class InVMContext implements Context, Serializable {
public InVMContext() {
map = Collections.synchronizedMap(new HashMap<String, Object>());
map = Collections.synchronizedMap(new HashMap<>());
}
public InVMContext(final String nameInNamespace) {

View File

@ -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<String, Object>(), "netty", new HashMap<String, Object>()));
configuration.addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, new HashMap<String, Object>(), "netty", new HashMap<>()));
ActiveMQServer server = ActiveMQServers.newActiveMQServer(configuration, false);
server.start();
System.out.println(LEAK_SERVER);

View File

@ -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<RecordInfo>(), new ArrayList<PreparedTransactionInfo>(), 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<RecordInfo>(), 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<RecordInfo>(), 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<RecordInfo>(), null, null);
journal.load(new ArrayList<>(), null, null);
journal.stop();
}

View File

@ -308,7 +308,7 @@ public class CompareUpgradeTest {
public static boolean compareDirectories(boolean allowExpectedWord, Path expected, Path upgrade) throws IOException {
Files.walkFileTree(expected, new SimpleFileVisitor<Path>() {
Files.walkFileTree(expected, new SimpleFileVisitor<>() {
@Override
public FileVisitResult visitFile(Path expectedFile, BasicFileAttributes attrs) throws IOException {
FileVisitResult result = super.visitFile(expectedFile, attrs);

View File

@ -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<String, AddressSettings>());
server = createServer(IS_JOURNAL, config, -1, -1, new HashMap<>());
server.start();

View File

@ -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<String, AddressSettings>());
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);

View File

@ -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<String, AddressSettings>());
server = createServer(IS_JOURNAL, config, -1, -1, new HashMap<>());
server.start();

View File

@ -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<String, AddressSettings>());
server = createServer(true, config, PAGE_SIZE, PAGE_MAX, new HashMap<>());
server.start();

View File

@ -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<RecordInfo>(), new ArrayList<PreparedTransactionInfo>(), null);
journal.load(new ArrayList<>(), new ArrayList<>(), null);
assertEquals(NUMBER_OF_RECORDS / 2, journal.getIDMapSize());

View File

@ -58,7 +58,7 @@ public class ConnectorsServiceTest extends ActiveMQTestBase {
*/
@Test
public void testConnectorsServiceUsesInjectedConnectorServiceFactory() throws Exception {
ConnectorServiceConfiguration connectorServiceConfiguration = new ConnectorServiceConfiguration().setFactoryClassName(null).setParams(new HashMap<String, Object>()).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<String, Object>()).setName("myfact");
ConnectorServiceConfiguration connectorServiceConfiguration = new ConnectorServiceConfiguration().setFactoryClassName(FakeConnectorServiceFactory.class.getCanonicalName()).setParams(new HashMap<>()).setName("myfact");
List<ConnectorServiceConfiguration> 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<String, Object>()).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<String, Object>()).setName("myfact2");
ConnectorServiceConfiguration additionalServiceConfiguration = new ConnectorServiceConfiguration().setFactoryClassName(FakeConnectorServiceFactory.class.getCanonicalName()).setParams(new HashMap<>()).setName("myfact2");
connectorsService.createService(additionalServiceConfiguration, connectorServiceFactory);
assertEquals(2, connectorsService.getConnectors().size());

View File

@ -45,7 +45,7 @@ public class BatchIDGeneratorUnitTest extends ActiveMQTestBase {
journal.start();
journal.load(new ArrayList<RecordInfo>(), new ArrayList<PreparedTransactionInfo>(), null);
journal.load(new ArrayList<>(), new ArrayList<>(), null);
BatchingIDGenerator batch = new BatchingIDGenerator(0, 1000, getJournalStorageManager(journal));
long id1 = batch.generateID();

View File

@ -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<QueueBindingInfo>(), new ArrayList<GroupingInfo>(), new ArrayList<AddressBindingInfo>());
journal.loadBindingJournal(new ArrayList<>(), new ArrayList<>(), new ArrayList<>());
HashMap<SimpleString, List<Pair<byte[], Long>>> 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<QueueBindingInfo>(), new ArrayList<GroupingInfo>(), new ArrayList<AddressBindingInfo>());
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<QueueBindingInfo>(), new ArrayList<GroupingInfo>(), new ArrayList<AddressBindingInfo>());
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));

View File

@ -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<String, Object>());
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

View File

@ -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<String, ProtocolManager>());
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);
}

View File

@ -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<String, ProtocolManager>());
NettyAcceptor acceptor = new NettyAcceptor("netty", null, params, handler, listener, pool2, pool3, new HashMap<>());
addActiveMQComponent(acceptor);
acceptor.start();

View File

@ -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<String, Object>());
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

View File

@ -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<TransportConfiguration>());
configuration.setAcceptorConfigurations(new HashSet<>());
remotingService = new RemotingServiceImpl(null, configuration, null, null, null, null, null, serviceRegistry);
}