[AMQ-8978] Clean up WARNs in activemq-unit-tests (#852)

This commit is contained in:
Matt Pavlovich 2022-06-29 09:08:22 -05:00 committed by GitHub
parent 6598ec5717
commit a1b2e3ae02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 72 additions and 84 deletions

View File

@ -55,9 +55,9 @@ public class BrokerBenchmark extends BrokerTestSupport {
public void initCombosForTestPerformance() {
addCombinationValues("destination", new Object[] {new ActiveMQQueue("TEST"), new ActiveMQTopic("TEST")});
addCombinationValues("PRODUCER_COUNT", new Object[] {new Integer("1"), new Integer("10")});
addCombinationValues("CONSUMER_COUNT", new Object[] {new Integer("1"), new Integer("10")});
addCombinationValues("CONSUMER_COUNT", new Object[] {new Integer("1"), new Integer("10")});
addCombinationValues("PRODUCER_COUNT", new Object[] {Integer.valueOf("1"), Integer.valueOf("10")});
addCombinationValues("CONSUMER_COUNT", new Object[] {Integer.valueOf("1"), Integer.valueOf("10")});
addCombinationValues("CONSUMER_COUNT", new Object[] {Integer.valueOf("1"), Integer.valueOf("10")});
addCombinationValues("deliveryMode", new Object[] {Boolean.TRUE});
}

View File

@ -38,8 +38,6 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.junit.Assert.assertEquals;
/**
*
*

View File

@ -17,7 +17,7 @@
package org.apache.activemq.broker.virtual;
import junit.framework.Assert;
import org.junit.Assert;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.jmx.TopicViewMBean;

View File

@ -18,8 +18,6 @@ package org.apache.activemq.broker.virtual;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerService;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;

View File

@ -25,7 +25,6 @@ import javax.jms.Connection;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.MessageProducer;

View File

@ -16,7 +16,6 @@
*/
package org.apache.activemq.broker.virtual;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
@ -49,11 +48,6 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class VirtualDestPerfTest {
private static final Logger LOG = LoggerFactory.getLogger(VirtualDestPerfTest.class);

View File

@ -31,7 +31,6 @@ import org.apache.activemq.command.ActiveMQTopic;
import org.apache.activemq.util.Wait;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

View File

@ -46,7 +46,7 @@ public class VirtualTopicPubSubTest extends EmbeddedBrokerTestSupport {
}
public void initCombosForTestVirtualTopicCreation() {
addCombinationValues("ackMode", new Object[] {new Integer(Session.AUTO_ACKNOWLEDGE), new Integer(Session.CLIENT_ACKNOWLEDGE) });
addCombinationValues("ackMode", new Object[] {Integer.valueOf(Session.AUTO_ACKNOWLEDGE), Integer.valueOf(Session.CLIENT_ACKNOWLEDGE) });
}
private boolean doneTwice = false;

View File

@ -48,7 +48,7 @@ public class ConnectionPerMessageTest extends EmbeddedBrokerTestSupport {
for (int i = 0; i < COUNT; i++) {
if (i % 100 == 0) {
LOG.info(new Integer(i).toString());
LOG.info(Integer.toString(i));
}
Connection conn = null;

View File

@ -33,7 +33,7 @@ import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

View File

@ -311,7 +311,7 @@ public class DurableConsumerTest extends CombinationTestSupport{
public void testPrefetchViaBrokerConfig() throws Exception {
Integer prefetchVal = new Integer(150);
Integer prefetchVal = Integer.valueOf(150);
PolicyEntry policyEntry = new PolicyEntry();
policyEntry.setDurableTopicPrefetch(prefetchVal.intValue());
policyEntry.setPrioritizedMessages(true);

View File

@ -240,8 +240,8 @@ public class ActiveMQBytesMessageTest extends TestCase {
msg.writeObject(Short.valueOf((short) 3));
msg.writeObject(Integer.valueOf(3));
msg.writeObject(Long.valueOf(300L));
msg.writeObject(new Float(3.3f));
msg.writeObject(new Double(3.3));
msg.writeObject(Float.valueOf(3.3f));
msg.writeObject(Double.valueOf(3.3));
msg.writeObject(new byte[3]);
} catch (MessageFormatException mfe) {
fail("objectified primitives should be allowed");

View File

@ -61,7 +61,7 @@ public class ActiveMQDestinationTest extends DataStructureTestSupport {
}
public void testDestinationOptions() throws IOException {
Map options = destination.getOptions();
Map<String,String> options = destination.getOptions();
assertNotNull(options);
assertEquals("v1", options.get("k1"));
assertEquals("v2", options.get("k2"));

View File

@ -208,7 +208,7 @@ public class ActiveMQMapMessageTest {
Boolean booleanValue = Boolean.TRUE;
Byte byteValue = Byte.valueOf("1");
byte[] bytesValue = new byte[3];
Character charValue = new Character('a');
Character charValue = Character.valueOf('a');
Double doubleValue = Double.valueOf("1.5");
Float floatValue = Float.valueOf("1.5");
Integer intValue = Integer.valueOf("1");

View File

@ -118,7 +118,7 @@ public class ActiveMQStreamMessageTest {
msg.reset();
assertTrue(msg.readLong() == test);
msg.reset();
assertTrue(msg.readString().equals(new Byte(test).toString()));
assertTrue(msg.readString().equals(Byte.toString(test)));
msg.reset();
try {
msg.readBoolean();
@ -168,7 +168,7 @@ public class ActiveMQStreamMessageTest {
msg.reset();
assertTrue(msg.readLong() == test);
msg.reset();
assertTrue(msg.readString().equals(new Short(test).toString()));
assertTrue(msg.readString().equals(Short.toString(test)));
msg.reset();
try {
msg.readBoolean();
@ -220,7 +220,7 @@ public class ActiveMQStreamMessageTest {
msg.reset();
assertTrue(msg.readChar() == test);
msg.reset();
assertTrue(msg.readString().equals(new Character(test).toString()));
assertTrue(msg.readString().equals(Character.toString(test)));
msg.reset();
try {
msg.readBoolean();
@ -286,7 +286,7 @@ public class ActiveMQStreamMessageTest {
msg.reset();
assertTrue(msg.readLong() == test);
msg.reset();
assertTrue(msg.readString().equals(new Integer(test).toString()));
assertTrue(msg.readString().equals(Integer.toString(test)));
msg.reset();
try {
msg.readBoolean();
@ -344,7 +344,7 @@ public class ActiveMQStreamMessageTest {
msg.reset();
assertTrue(msg.readLong() == test);
msg.reset();
assertTrue(msg.readString().equals(Long.valueOf(test).toString()));
assertTrue(msg.readString().equals(Long.toString(test)));
msg.reset();
try {
msg.readBoolean();
@ -394,10 +394,10 @@ public class ActiveMQStreamMessageTest {
} catch (MessageFormatException mfe) {
}
msg = new ActiveMQStreamMessage();
msg.writeObject(new Long("1"));
msg.writeObject(Long.valueOf("1"));
// reset so it's readable now
msg.reset();
assertEquals(new Long("1"), msg.readObject());
assertEquals(Long.parseLong("1"), msg.readObject());
} catch (JMSException jmsEx) {
jmsEx.printStackTrace();
assertTrue(false);
@ -415,7 +415,7 @@ public class ActiveMQStreamMessageTest {
msg.reset();
assertTrue(msg.readDouble() == test);
msg.reset();
assertTrue(msg.readString().equals(new Float(test).toString()));
assertTrue(msg.readString().equals(Float.toString(test)));
msg.reset();
try {
msg.readBoolean();
@ -473,7 +473,7 @@ public class ActiveMQStreamMessageTest {
msg.reset();
assertTrue(msg.readDouble() == test);
msg.reset();
assertTrue(msg.readString().equals(new Double(test).toString()));
assertTrue(msg.readString().equals(Double.toString(test)));
msg.reset();
try {
msg.readBoolean();
@ -533,32 +533,32 @@ public class ActiveMQStreamMessageTest {
ActiveMQStreamMessage msg = new ActiveMQStreamMessage();
try {
byte testByte = (byte)2;
msg.writeString(new Byte(testByte).toString());
msg.writeString(Byte.toString(testByte));
msg.reset();
assertTrue(msg.readByte() == testByte);
msg.clearBody();
short testShort = 3;
msg.writeString(new Short(testShort).toString());
msg.writeString(Short.toString(testShort));
msg.reset();
assertTrue(msg.readShort() == testShort);
msg.clearBody();
int testInt = 4;
msg.writeString(new Integer(testInt).toString());
msg.writeString(Integer.toString(testInt));
msg.reset();
assertTrue(msg.readInt() == testInt);
msg.clearBody();
long testLong = 6L;
msg.writeString(new Long(testLong).toString());
msg.writeString(Long.toString(testLong));
msg.reset();
assertTrue(msg.readLong() == testLong);
msg.clearBody();
float testFloat = 6.6f;
msg.writeString(new Float(testFloat).toString());
msg.writeString(Float.toString(testFloat));
msg.reset();
assertTrue(msg.readFloat() == testFloat);
msg.clearBody();
double testDouble = 7.7d;
msg.writeString(new Double(testDouble).toString());
msg.writeString(Double.toString(testDouble));
msg.reset();
assertTrue(msg.readDouble() == testDouble);
msg.clearBody();
@ -743,10 +743,10 @@ public class ActiveMQStreamMessageTest {
public void testClearBody() throws JMSException {
ActiveMQStreamMessage streamMessage = new ActiveMQStreamMessage();
try {
streamMessage.writeObject(new Long(2));
streamMessage.writeObject(Long.valueOf(2));
streamMessage.clearBody();
assertFalse(streamMessage.isReadOnlyBody());
streamMessage.writeObject(new Long(2));
streamMessage.writeObject(Long.valueOf(2));
streamMessage.readObject();
fail("should throw exception");
} catch (MessageNotReadableException mnwe) {
@ -967,14 +967,14 @@ public class ActiveMQStreamMessageTest {
ActiveMQStreamMessage message = new ActiveMQStreamMessage();
message.clearBody();
message.writeObject("test");
message.writeObject(new Character('a'));
message.writeObject(new Boolean(false));
message.writeObject(new Byte((byte) 2));
message.writeObject(new Short((short) 2));
message.writeObject(new Integer(2));
message.writeObject(new Long(2l));
message.writeObject(new Float(2.0f));
message.writeObject(new Double(2.0d));
message.writeObject(Character.valueOf('a'));
message.writeObject(Boolean.FALSE);
message.writeObject(Byte.valueOf((byte) 2));
message.writeObject(Short.valueOf((short) 2));
message.writeObject(Integer.valueOf(2));
message.writeObject(Long.valueOf(2l));
message.writeObject(Float.valueOf(2.0f));
message.writeObject(Double.valueOf(2.0d));
} catch(Exception e) {
fail(e.getMessage());
}

View File

@ -152,7 +152,7 @@ public class ActiveMQTextMessageTest extends TestCase {
}
public void testTransient() throws Exception {
Method method = ActiveMQTextMessage.class.getMethod("getRegionDestination", null);
Method method = ActiveMQTextMessage.class.getMethod("getRegionDestination");
assertTrue(method.isAnnotationPresent(Transient.class));
}

View File

@ -70,7 +70,7 @@ public abstract class DataStructureTestSupport extends CombinationTestSupport {
throw new AssertionFailedError("Not equals, classes don't match. expected: " + expect.getClass() + ", was: " + was.getClass());
}
if (expect.getClass().isArray()) {
Class componentType = expect.getClass().getComponentType();
Class<?> componentType = expect.getClass().getComponentType();
if (componentType.isPrimitive()) {
boolean ok = false;
if (componentType == byte.class) {

View File

@ -76,7 +76,7 @@ public final class SimpleProducer {
destinationName = args[0];
LOG.info("Destination name is " + destinationName);
if (args.length == 2) {
numMsgs = (new Integer(args[1])).intValue();
numMsgs = (Integer.valueOf(args[1])).intValue();
} else {
numMsgs = 1;
}

View File

@ -74,7 +74,7 @@ public final class SimpleQueueSender {
queueName = args[0];
LOG.info("Queue name is " + queueName);
if (args.length == 2) {
numMsgs = (new Integer(args[1])).intValue();
numMsgs = (Integer.valueOf(args[1])).intValue();
} else {
numMsgs = 1;
}

View File

@ -39,8 +39,8 @@ public class DemandForwardingBridgeTest extends NetworkTestSupport {
private DemandForwardingBridge bridge;
public void initCombosForTestSendThenAddConsumer() {
addCombinationValues("deliveryMode", new Object[] {new Integer(DeliveryMode.NON_PERSISTENT), new Integer(DeliveryMode.PERSISTENT)});
addCombinationValues("destinationType", new Object[] {new Byte(ActiveMQDestination.QUEUE_TYPE)});
addCombinationValues("deliveryMode", new Object[] {Integer.valueOf(DeliveryMode.NON_PERSISTENT), Integer.valueOf(DeliveryMode.PERSISTENT)});
addCombinationValues("destinationType", new Object[] {Byte.valueOf(ActiveMQDestination.QUEUE_TYPE)});
}
public void testSendThenAddConsumer() throws Exception {
@ -116,8 +116,8 @@ public class DemandForwardingBridgeTest extends NetworkTestSupport {
}
public void initCombosForTestAddConsumerThenSend() {
addCombinationValues("deliveryMode", new Object[] {new Integer(DeliveryMode.NON_PERSISTENT), new Integer(DeliveryMode.PERSISTENT)});
addCombinationValues("destinationType", new Object[] {new Byte(ActiveMQDestination.QUEUE_TYPE), new Byte(ActiveMQDestination.TOPIC_TYPE)});
addCombinationValues("deliveryMode", new Object[] {Integer.valueOf(DeliveryMode.NON_PERSISTENT), Integer.valueOf(DeliveryMode.PERSISTENT)});
addCombinationValues("destinationType", new Object[] {Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), Byte.valueOf(ActiveMQDestination.TOPIC_TYPE)});
}
public void testAddConsumerThenSend() throws Exception {

View File

@ -37,10 +37,10 @@ public class ForwardingBridgeTest extends NetworkTestSupport {
private ForwardingBridge bridge;
public void initCombosForTestForwardMessageCompressed() {
addCombinationValues("deliveryMode", new Object[] {new Integer(DeliveryMode.NON_PERSISTENT),
new Integer(DeliveryMode.PERSISTENT)});
addCombinationValues("destinationType", new Object[] {new Byte(ActiveMQDestination.QUEUE_TYPE),
new Byte(ActiveMQDestination.TOPIC_TYPE)});
addCombinationValues("deliveryMode", new Object[] {Integer.valueOf(DeliveryMode.NON_PERSISTENT),
Integer.valueOf(DeliveryMode.PERSISTENT)});
addCombinationValues("destinationType", new Object[] {Byte.valueOf(ActiveMQDestination.QUEUE_TYPE),
Byte.valueOf(ActiveMQDestination.TOPIC_TYPE)});
}
public void testForwardMessageCompressed() throws Exception {
@ -87,10 +87,10 @@ public class ForwardingBridgeTest extends NetworkTestSupport {
}
public void initCombosForTestAddConsumerThenSend() {
addCombinationValues("deliveryMode", new Object[] {new Integer(DeliveryMode.NON_PERSISTENT),
new Integer(DeliveryMode.PERSISTENT)});
addCombinationValues("destinationType", new Object[] {new Byte(ActiveMQDestination.QUEUE_TYPE),
new Byte(ActiveMQDestination.TOPIC_TYPE)});
addCombinationValues("deliveryMode", new Object[] {Integer.valueOf(DeliveryMode.NON_PERSISTENT),
Integer.valueOf(DeliveryMode.PERSISTENT)});
addCombinationValues("destinationType", new Object[] {Byte.valueOf(ActiveMQDestination.QUEUE_TYPE),
Byte.valueOf(ActiveMQDestination.TOPIC_TYPE)});
}
public void testAddConsumerThenSend() throws Exception {

View File

@ -199,8 +199,8 @@ abstract public class MessagePriorityTest extends CombinationTestSupport {
}
public void initCombosForTestQueues() {
addCombinationValues("useCache", new Object[] {new Boolean(true), new Boolean(false)});
addCombinationValues("deliveryMode", new Object[] {new Integer(DeliveryMode.NON_PERSISTENT), new Integer(DeliveryMode.PERSISTENT)});
addCombinationValues("useCache", new Object[] {Boolean.TRUE, Boolean.FALSE});
addCombinationValues("deliveryMode", new Object[] {Integer.valueOf(DeliveryMode.NON_PERSISTENT), Integer.valueOf(DeliveryMode.PERSISTENT)});
}
public void testQueues() throws Exception {
@ -232,7 +232,7 @@ abstract public class MessagePriorityTest extends CombinationTestSupport {
}
public void initCombosForTestDurableSubs() {
addCombinationValues("prefetchVal", new Object[] {new Integer(1000), new Integer(MSG_NUM/4)});
addCombinationValues("prefetchVal", new Object[] {Integer.valueOf(1000), Integer.valueOf(MSG_NUM/4)});
}
public void testDurableSubs() throws Exception {
@ -281,7 +281,7 @@ abstract public class MessagePriorityTest extends CombinationTestSupport {
}
public void initCombosForTestDurableSubsReconnect() {
addCombinationValues("prefetchVal", new Object[] {new Integer(1000), new Integer(MSG_NUM/2)});
addCombinationValues("prefetchVal", new Object[] {Integer.valueOf(1000), Integer.valueOf(MSG_NUM/2)});
// REVISIT = is dispatchAsync = true a problem or is it just the test?
addCombinationValues("dispatchAsync", new Object[] {Boolean.FALSE});
addCombinationValues("useCache", new Object[] {Boolean.TRUE, Boolean.FALSE});
@ -568,10 +568,10 @@ abstract public class MessagePriorityTest extends CombinationTestSupport {
public void initCombosForTestQueueBacklog() {
// the cache limits the priority ordering to available memory
addCombinationValues("useCache", new Object[] {new Boolean(false)});
addCombinationValues("useCache", new Object[] {Boolean.FALSE});
// expiry processing can fill the cursor with a snapshot of the producer
// priority, before producers are complete
addCombinationValues("expireMessagePeriod", new Object[] {new Integer(0)});
addCombinationValues("expireMessagePeriod", new Object[] {Integer.valueOf(0)});
}
public void testQueueBacklog() throws Exception {
@ -608,10 +608,10 @@ abstract public class MessagePriorityTest extends CombinationTestSupport {
public void initCombosForTestLowThenHighBatch() {
// the cache limits the priority ordering to available memory
addCombinationValues("useCache", new Object[] {new Boolean(false)});
addCombinationValues("useCache", new Object[] {Boolean.FALSE});
// expiry processing can fill the cursor with a snapshot of the producer
// priority, before producers are complete
addCombinationValues("expireMessagePeriod", new Object[] {new Integer(0)});
addCombinationValues("expireMessagePeriod", new Object[] {Integer.valueOf(0)});
}
public void testLowThenHighBatch() throws Exception {
@ -724,7 +724,7 @@ abstract public class MessagePriorityTest extends CombinationTestSupport {
addCombinationValues("useCache", new Object[] {Boolean.FALSE, Boolean.TRUE});
// expiry processing can fill the cursor with a snapshot of the producer
// priority, before producers are complete
addCombinationValues("expireMessagePeriod", new Object[] {new Integer(0)});
addCombinationValues("expireMessagePeriod", new Object[] {Integer.valueOf(0)});
}
public void testEveryXHi() throws Exception {

View File

@ -168,7 +168,7 @@ public class JDBCMessagePriorityTest extends MessagePriorityTest {
}
public void initCombosForTestConcurrentRate() {
addCombinationValues("prefetchVal", new Object[]{new Integer(1), new Integer(500)});
addCombinationValues("prefetchVal", new Object[]{Integer.valueOf(1), Integer.valueOf(500)});
}
public void testConcurrentRate() throws Exception {

View File

@ -45,8 +45,8 @@ public class NestedMapAndListPropertyTest extends JmsTopicSendReceiveWithTwoConn
Map map = (Map)message.getObjectProperty("mapField");
assertNotNull(map);
assertEquals("mapField.a", "foo", map.get("a"));
assertEquals("mapField.b", new Integer(23), map.get("b"));
assertEquals("mapField.c", new Long(45), map.get("c"));
assertEquals("mapField.b", Integer.valueOf(23), map.get("b"));
assertEquals("mapField.c", Long.valueOf(45), map.get("c"));
value = map.get("d");
assertTrue("mapField.d should be a Map", value instanceof Map);
@ -82,8 +82,8 @@ public class NestedMapAndListPropertyTest extends JmsTopicSendReceiveWithTwoConn
Map<String, Object> nestedMap = new HashMap<String, Object>();
nestedMap.put("a", "foo");
nestedMap.put("b", new Integer(23));
nestedMap.put("c", new Long(45));
nestedMap.put("b", Integer.valueOf(23));
nestedMap.put("c", Long.valueOf(45));
nestedMap.put("d", grandChildMap);
answer.setObjectProperty("mapField", nestedMap);

View File

@ -75,7 +75,7 @@ public class SocketTstFactory extends SocketFactory {
lastDelayVal += 1;
}
lastDelay = new Integer(lastDelayVal);
lastDelay = Integer.valueOf(lastDelayVal);
LOG.info("Trying to close client socket " + socket.toString() + " in " + lastDelayVal + " milliseconds");

View File

@ -35,7 +35,7 @@ public class DurableSubscriptionReactivationTest extends EmbeddedBrokerTestSuppo
public boolean keepDurableSubsActive;
public void initCombosForTestReactivateKeepaliveSubscription() {
addCombinationValues("keepDurableSubsActive", new Object[] { new Boolean(true), new Boolean(false) });
addCombinationValues("keepDurableSubsActive", new Object[] { Boolean.TRUE, Boolean.FALSE });
}
public void testReactivateKeepaliveSubscription() throws Exception {

View File

@ -118,9 +118,9 @@ public class NetworkBridgeProducerFlowControlTest extends
public void initCombosForTestFastAndSlowRemoteConsumers() {
addCombinationValues("persistentTestMessages", new Object[]{
new Boolean(true), new Boolean(false)});
Boolean.TRUE, Boolean.FALSE});
addCombinationValues("networkIsAlwaysSendSync", new Object[]{
new Boolean(true), new Boolean(false)});
Boolean.TRUE, Boolean.FALSE});
}
@Override

View File

@ -103,7 +103,7 @@ public class ReflectionSupportTest extends TestCase {
}
public static class TestWitBoolean {
private Boolean keepAlive = new Boolean(false);
private Boolean keepAlive = Boolean.FALSE;
public Boolean getKeepAlive() {
return keepAlive;
}