From 200b3e10333f149b5d13446b1bae72dbac8dc95f Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Fri, 19 Jul 2019 17:51:04 -0400 Subject: [PATCH] NO-JIRA Simple test fixes --- .../core/remoting/impl/netty/TransportConstants.java | 10 +++++----- .../tests/integration/amqp/AmqpMessageRoutingTest.java | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java index 54b2061c19..5b06415269 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java @@ -300,13 +300,13 @@ public class TransportConstants { public static final int DEFAULT_SHUTDOWN_TIMEOUT = parseDefaultVariable("DEFAULT_SHUTDOWN_TIMEOUT", 3_000); private static int parseDefaultVariable(String variableName, int defaultValue) { - String variable = System.getProperty(TransportConstants.class.getName() + "." + variableName); - if (variable != null) { - try { + try { + String variable = System.getProperty(TransportConstants.class.getName() + "." + variableName); + if (variable != null) { return Integer.parseInt(variable); - } catch (Throwable ignored) { - logger.debug(ignored); } + } catch (Throwable ignored) { + logger.debug(ignored); } return defaultValue; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpMessageRoutingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpMessageRoutingTest.java index 33a7371e82..92d1787f4b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpMessageRoutingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpMessageRoutingTest.java @@ -28,6 +28,7 @@ import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl; import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.utils.UUIDGenerator; +import org.apache.activemq.artemis.utils.Wait; import org.junit.Test; public class AmqpMessageRoutingTest extends JMSClientTestSupport { @@ -100,8 +101,8 @@ public class AmqpMessageRoutingTest extends JMSClientTestSupport { sendMessages("multicast://" + addressA, 1); - assertEquals(0, server.locateQueue(SimpleString.toSimpleString(queueA)).getMessageCount()); - assertEquals(2, server.locateQueue(SimpleString.toSimpleString(queueC)).getMessageCount() + server.locateQueue(SimpleString.toSimpleString(queueB)).getMessageCount()); + Wait.assertEquals(0, server.locateQueue(SimpleString.toSimpleString(queueA))::getMessageCount); + Wait.assertEquals(2, () -> (server.locateQueue(SimpleString.toSimpleString(queueC)).getMessageCount() + server.locateQueue(SimpleString.toSimpleString(queueB)).getMessageCount())); } @Test(timeout = 60000)