From 09a0b98d244cf413329e5417e15f73d002407be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Fri, 13 May 2016 21:56:04 +0300 Subject: [PATCH] Remove redundant type arguments --- .../apache/activemq/broker/BrokerService.java | 2 +- .../activemq/JmsQueueTransactionTest.java | 2 +- .../activemq/JmsTransactionTestSupport.java | 18 +++++++++--------- .../failover/ConnectionHangOnStartupTest.java | 2 +- .../failover/FailoverClusterTest.java | 4 ++-- .../failover/FailoverComplexClusterTest.java | 12 ++++++------ .../FailoverConsumerOutstandingCommitTest.java | 2 +- .../FailoverConsumerUnconsumedTest.java | 2 +- .../failover/FailoverPriorityTest.java | 4 ++-- .../transport/failover/FailoverRandomTest.java | 2 +- .../failover/FailoverTransportBrokerTest.java | 2 +- .../failover/FailoverUpdateURIsTest.java | 2 +- .../failover/TwoBrokerFailoverClusterTest.java | 6 +++--- .../fanout/FanoutTransportBrokerTest.java | 2 +- .../org/apache/activemq/util/SocketProxy.java | 10 +++++----- 15 files changed, 36 insertions(+), 36 deletions(-) diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java index 7da162da0c..69724c7ef2 100644 --- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java +++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java @@ -104,7 +104,7 @@ public class BrokerService implements Service { private PolicyMap destinationPolicy; private SystemUsage systemUsage; - private final List networkConnectors = new CopyOnWriteArrayList(); + private final List networkConnectors = new CopyOnWriteArrayList<>(); private TemporaryFolder tmpfolder; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueTransactionTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueTransactionTest.java index e74bc0f502..e464b7c3e1 100755 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueTransactionTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueTransactionTest.java @@ -70,7 +70,7 @@ public class JmsQueueTransactionTest extends JmsTransactionTestSupport { LOG.info("Sent 0: " + outbound[0]); LOG.info("Sent 1: " + outbound[1]); - ArrayList messages = new ArrayList(); + ArrayList messages = new ArrayList<>(); beginTx(); Message message = consumer.receive(2000); assertEquals(outbound[0], message); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java index abaf52dbc4..0ced1cd482 100755 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java @@ -61,8 +61,8 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M protected BrokerService broker; // for message listener test - private final List unackMessages = new ArrayList(MESSAGE_COUNT); - private final List ackMessages = new ArrayList(MESSAGE_COUNT); + private final List unackMessages = new ArrayList<>(MESSAGE_COUNT); + private final List ackMessages = new ArrayList<>(MESSAGE_COUNT); private boolean resendPhase; public JmsTransactionTestSupport() { @@ -208,7 +208,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M // receives the first message beginTx(); - ArrayList messages = new ArrayList(); + ArrayList messages = new ArrayList<>(); LOG.info("About to consume message 1"); Message message = consumer.receive(1000); messages.add(message); @@ -243,7 +243,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M // receives the first message beginTx(); - ArrayList messages = new ArrayList(); + ArrayList messages = new ArrayList<>(); LOG.info("About to consume message 1"); Message message = consumer.receive(1000); messages.add(message); @@ -283,7 +283,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M commitTx(); // receives the first message - ArrayList messages = new ArrayList(); + ArrayList messages = new ArrayList<>(); LOG.info("About to consume message 1"); beginTx(); Message message = consumer.receive(1000); @@ -331,7 +331,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M commitTx(); // receives the first message - ArrayList messages = new ArrayList(); + ArrayList messages = new ArrayList<>(); LOG.info("About to consume message 1"); beginTx(); Message message = consumer.receive(1000); @@ -375,7 +375,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M LOG.info("Sent 0: " + outbound[0]); LOG.info("Sent 1: " + outbound[1]); - ArrayList messages = new ArrayList(); + ArrayList messages = new ArrayList<>(); beginTx(); Message message = consumer.receive(1000); messages.add(message); @@ -426,7 +426,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M LOG.info("Sent 0: " + outbound[0]); LOG.info("Sent 1: " + outbound[1]); - ArrayList messages = new ArrayList(); + ArrayList messages = new ArrayList<>(); beginTx(); Message message = consumer.receive(1000); assertEquals(outbound[0], message); @@ -566,7 +566,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M } public void testChangeMutableObjectInObjectMessageThenRollback() throws Exception { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); list.add("First"); Message outbound = session.createObjectMessage(list); outbound.setStringProperty("foo", "abc"); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/ConnectionHangOnStartupTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/ConnectionHangOnStartupTest.java index 99e22b4270..08d456cdb0 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/ConnectionHangOnStartupTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/ConnectionHangOnStartupTest.java @@ -44,7 +44,7 @@ public class ConnectionHangOnStartupTest extends OpenwireArtemisBaseTest { // connection sooner) protected String uriString = "failover://(tcp://localhost:62001?wireFormat.maxInactivityDurationInitalDelay=1,tcp://localhost:62002?wireFormat.maxInactivityDurationInitalDelay=1)?randomize=false&maxReconnectDelay=200"; protected EmbeddedJMS master = null; - protected AtomicReference slave = new AtomicReference(); + protected AtomicReference slave = new AtomicReference<>(); @After public void tearDown() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverClusterTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverClusterTest.java index 74fa6aa546..9e19b90970 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverClusterTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverClusterTest.java @@ -52,7 +52,7 @@ public class FailoverClusterTest extends OpenwireArtemisBaseTest { @Before public void setUp() throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put("rebalanceClusterClients", "true"); params.put("updateClusterClients", "true"); @@ -110,7 +110,7 @@ public class FailoverClusterTest extends OpenwireArtemisBaseTest { Thread.sleep(3000); - Set set = new HashSet(); + Set set = new HashSet<>(); for (ActiveMQConnection c : connections) { set.add(c.getTransportChannel().getRemoteAddress()); } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverComplexClusterTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverComplexClusterTest.java index fd9ce1f82d..66cb09a339 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverComplexClusterTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverComplexClusterTest.java @@ -56,7 +56,7 @@ public class FailoverComplexClusterTest extends OpenwireArtemisBaseTest { private EmbeddedJMS[] servers = new EmbeddedJMS[3]; private static final int NUMBER_OF_CLIENTS = 30; - private final List connections = new ArrayList(); + private final List connections = new ArrayList<>(); @Before @@ -65,7 +65,7 @@ public class FailoverComplexClusterTest extends OpenwireArtemisBaseTest { //default setup for most tests private void commonSetup() throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put("rebalanceClusterClients", "true"); params.put("updateClusterClients", "true"); @@ -349,7 +349,7 @@ public class FailoverComplexClusterTest extends OpenwireArtemisBaseTest { } protected void assertClientsConnectedToThreeBrokers() { - Set set = new HashSet(); + Set set = new HashSet<>(); for (ActiveMQConnection c : connections) { if (c.getTransportChannel().getRemoteAddress() != null) { set.add(c.getTransportChannel().getRemoteAddress()); @@ -359,7 +359,7 @@ public class FailoverComplexClusterTest extends OpenwireArtemisBaseTest { } protected void assertClientsConnectedToTwoBrokers() { - Set set = new HashSet(); + Set set = new HashSet<>(); for (ActiveMQConnection c : connections) { if (c.getTransportChannel().getRemoteAddress() != null) { set.add(c.getTransportChannel().getRemoteAddress()); @@ -415,7 +415,7 @@ public class FailoverComplexClusterTest extends OpenwireArtemisBaseTest { } protected void assertClientsConnectionsEvenlyDistributed(double minimumPercentage, double maximumPercentage) { - Map clientConnectionCounts = new HashMap(); + Map clientConnectionCounts = new HashMap<>(); int total = 0; for (ActiveMQConnection c : connections) { String key = c.getTransportChannel().getRemoteAddress(); @@ -432,7 +432,7 @@ public class FailoverComplexClusterTest extends OpenwireArtemisBaseTest { } } Set keys = clientConnectionCounts.keySet(); - List errorMsgs = new ArrayList(); + List errorMsgs = new ArrayList<>(); for (String key : keys) { double count = clientConnectionCounts.get(key); double percentage = count / total; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java index 09af25e2b0..449600a787 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java @@ -228,7 +228,7 @@ public class FailoverConsumerOutstandingCommitTest extends OpenwireArtemisBaseTe final CountDownLatch commitDoneLatch = new CountDownLatch(1); final CountDownLatch messagesReceived = new CountDownLatch(3); final AtomicBoolean gotCommitException = new AtomicBoolean(false); - final ArrayList receivedMessages = new ArrayList(); + final ArrayList receivedMessages = new ArrayList<>(); final MessageConsumer testConsumer = consumerSession.createConsumer(destination); doByteman.set(true); testConsumer.setMessageListener(new MessageListener() { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java index b0ee7ba78e..f51885b049 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java @@ -149,7 +149,7 @@ public class FailoverConsumerUnconsumedTest extends OpenwireArtemisBaseTest { doByteman.set(true); - final Vector testConsumers = new Vector(); + final Vector testConsumers = new Vector<>(); TestConsumer testConsumer = new TestConsumer(consumerSession, destination, connection); testConsumer.setMessageListener(new MessageListener() { @Override diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverPriorityTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverPriorityTest.java index 6f4b27ea4f..dce42bc03e 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverPriorityTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverPriorityTest.java @@ -47,10 +47,10 @@ public class FailoverPriorityTest extends OpenwireArtemisBaseTest { private static final String BROKER_C_CLIENT_TC_ADDRESS = "tcp://127.0.0.1:61618"; private final HashMap urls = new HashMap<>(); - private final List connections = new ArrayList(); + private final List connections = new ArrayList<>(); private EmbeddedJMS[] servers = new EmbeddedJMS[3]; private String clientUrl; - private Map params = new HashMap(); + private Map params = new HashMap<>(); @Before public void setUp() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverRandomTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverRandomTest.java index d11bae57a5..8500cdad00 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverRandomTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverRandomTest.java @@ -38,7 +38,7 @@ public class FailoverRandomTest extends OpenwireArtemisBaseTest { @Before public void setUp() throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put("rebalanceClusterClients", "true"); params.put("updateClusterClients", "true"); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java index 15d28d325d..fcd409ee40 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java @@ -60,7 +60,7 @@ import org.slf4j.LoggerFactory; public class FailoverTransportBrokerTest extends OpenwireArtemisBaseTest { private static final Logger LOG = LoggerFactory.getLogger(FailoverTransportBrokerTest.class); - protected ArrayList connections = new ArrayList(); + protected ArrayList connections = new ArrayList<>(); protected long idGenerator; protected int msgIdGenerator; protected int maxWait = 10000; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverUpdateURIsTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverUpdateURIsTest.java index 0a127dd0e9..ef0614f889 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverUpdateURIsTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverUpdateURIsTest.java @@ -119,7 +119,7 @@ public class FailoverUpdateURIsTest extends OpenwireArtemisBaseTest { @Test public void testAutoUpdateURIs() throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put("updateClusterClients", "true"); Configuration config0 = createConfig("localhost", 0, params); deployClusterConfiguration(config0, 10); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/TwoBrokerFailoverClusterTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/TwoBrokerFailoverClusterTest.java index 57595472b0..9daa4415ac 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/TwoBrokerFailoverClusterTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/TwoBrokerFailoverClusterTest.java @@ -41,7 +41,7 @@ import java.util.concurrent.TimeUnit; public class TwoBrokerFailoverClusterTest extends OpenwireArtemisBaseTest { private static final int NUMBER_OF_CLIENTS = 30; - private final List connections = new ArrayList(); + private final List connections = new ArrayList<>(); private EmbeddedJMS server0; private EmbeddedJMS server1; private String clientUrl; @@ -126,7 +126,7 @@ public class TwoBrokerFailoverClusterTest extends OpenwireArtemisBaseTest { } protected void assertClientsConnectedToTwoBrokers() { - Set set = new HashSet(); + Set set = new HashSet<>(); for (ActiveMQConnection c : connections) { if (c.getTransportChannel().getRemoteAddress() != null) { set.add(c.getTransportChannel().getRemoteAddress()); @@ -136,7 +136,7 @@ public class TwoBrokerFailoverClusterTest extends OpenwireArtemisBaseTest { } protected void assertClientsConnectionsEvenlyDistributed(double minimumPercentage) { - Map clientConnectionCounts = new HashMap(); + Map clientConnectionCounts = new HashMap<>(); int total = 0; for (ActiveMQConnection c : connections) { String key = c.getTransportChannel().getRemoteAddress(); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/fanout/FanoutTransportBrokerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/fanout/FanoutTransportBrokerTest.java index 72cc3f79f8..38ada79433 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/fanout/FanoutTransportBrokerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/fanout/FanoutTransportBrokerTest.java @@ -61,7 +61,7 @@ import org.slf4j.LoggerFactory; public class FanoutTransportBrokerTest extends OpenwireArtemisBaseTest { public static final boolean FAST_NO_MESSAGE_LEFT_ASSERT = System.getProperty("FAST_NO_MESSAGE_LEFT_ASSERT", "true").equals("true"); - protected ArrayList connections = new ArrayList(); + protected ArrayList connections = new ArrayList<>(); protected long idGenerator; protected int msgIdGenerator; protected int maxWait = 10000; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/util/SocketProxy.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/util/SocketProxy.java index ca9b42abf3..f6e3be321c 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/util/SocketProxy.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/util/SocketProxy.java @@ -52,7 +52,7 @@ public class SocketProxy { private CountDownLatch closed = new CountDownLatch(1); - public final List connections = new LinkedList(); + public final List connections = new LinkedList<>(); private int listenPort = 0; @@ -131,7 +131,7 @@ public class SocketProxy { public void close() { List connections; synchronized(this.connections) { - connections = new ArrayList(this.connections); + connections = new ArrayList<>(this.connections); } LOG.info("close, numConnections=" + connections.size()); for (Bridge con : connections) { @@ -148,7 +148,7 @@ public class SocketProxy { public void halfClose() { List connections; synchronized(this.connections) { - connections = new ArrayList(this.connections); + connections = new ArrayList<>(this.connections); } LOG.info("halfClose, numConnections=" + connections.size()); for (Bridge con : connections) { @@ -288,7 +288,7 @@ public class SocketProxy { protected Socket src; private Socket destination; - private AtomicReference pause = new AtomicReference(); + private AtomicReference pause = new AtomicReference<>(); public Pump(Socket source, Socket dest) { super("SocketProxy-DataTransfer-" + source.getPort() + ":" + dest.getPort()); @@ -339,7 +339,7 @@ public class SocketProxy { private ServerSocket socket; private URI target; - private AtomicReference pause = new AtomicReference(); + private AtomicReference pause = new AtomicReference<>(); public Acceptor(ServerSocket serverSocket, URI uri) {