From 7118247b658335839bc792dde8f70eee2acc1f18 Mon Sep 17 00:00:00 2001 From: "Christopher L. Shannon (cshannon)" Date: Thu, 28 Jul 2016 13:10:44 -0400 Subject: [PATCH] https://issues.apache.org/jira/browse/AMQ-6379 Fixing unit test so that it uses a random port and changing the default platform details to be "java" if there is an error --- .../org/apache/activemq/ActiveMQConnectionMetaData.java | 2 +- .../activemq/openwire/WireFormatInfoPropertiesTest.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnectionMetaData.java b/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnectionMetaData.java index 64ec077d89..ff6c38ff13 100755 --- a/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnectionMetaData.java +++ b/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnectionMetaData.java @@ -157,7 +157,7 @@ public final class ActiveMQConnectionMetaData implements ConnectionMetaData { * @return String containing the platform details */ private static String getPlatformDetails() { - String details = "unknown"; + String details = "java"; try { StringBuilder platformInfo = new StringBuilder(128); diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/openwire/WireFormatInfoPropertiesTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/openwire/WireFormatInfoPropertiesTest.java index 6dfb6b1a20..5e90f872e8 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/openwire/WireFormatInfoPropertiesTest.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/openwire/WireFormatInfoPropertiesTest.java @@ -31,6 +31,7 @@ import org.apache.activemq.ActiveMQConnection; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQConnectionMetaData; import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.broker.TransportConnector; import org.apache.activemq.command.WireFormatInfo; import org.apache.activemq.transport.DefaultTransportListener; import org.junit.Test; @@ -42,8 +43,7 @@ public class WireFormatInfoPropertiesTest { static final Logger LOG = LoggerFactory.getLogger(WireFormatInfoPropertiesTest.class); protected BrokerService master; - - protected final String brokerUri = "tcp://localhost:61616"; + protected String brokerUri; @Test public void testClientProperties() throws Exception{ @@ -104,7 +104,8 @@ public class WireFormatInfoPropertiesTest { private BrokerService createBrokerService() throws Exception { BrokerService service = new BrokerService(); - service.addConnector(brokerUri); + TransportConnector connector = service.addConnector("tcp://localhost:0"); + brokerUri = connector.getPublishableConnectString(); service.setPersistent(false); service.setUseJmx(false); service.setBrokerName("Master");