activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject activemq git commit: [no jira] remove hard coded 1099 dep to resolve ci failure in JmxAuditLogTest
Date Thu, 12 Jan 2017 11:53:46 GMT
Repository: activemq
Updated Branches:
  refs/heads/master 2769298cf -> 3a0a7238b


[no jira] remove hard coded 1099 dep to resolve ci failure in JmxAuditLogTest


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/3a0a7238
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/3a0a7238
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/3a0a7238

Branch: refs/heads/master
Commit: 3a0a7238b13427b6082e95bb0761fa74a62b12a2
Parents: 2769298
Author: gtully <gary.tully@gmail.com>
Authored: Thu Jan 12 11:52:48 2017 +0000
Committer: gtully <gary.tully@gmail.com>
Committed: Thu Jan 12 11:53:20 2017 +0000

----------------------------------------------------------------------
 .../java/org/apache/activemq/TestSupport.java   |  2 +
 .../apache/activemq/jmx/JmxAuditLogTest.java    |  9 +++-
 .../org/apache/activemq/proxy/AMQ4889Test.java  | 47 +++++---------------
 3 files changed, 21 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/3a0a7238/activemq-unit-tests/src/test/java/org/apache/activemq/TestSupport.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/TestSupport.java b/activemq-unit-tests/src/test/java/org/apache/activemq/TestSupport.java
index 5f7216a..877b22a 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/TestSupport.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/TestSupport.java
@@ -18,6 +18,7 @@ package org.apache.activemq;
 
 import java.io.File;
 import java.io.IOException;
+import java.net.ServerSocket;
 import java.util.Map;
 
 import javax.jms.Connection;
@@ -27,6 +28,7 @@ import javax.jms.Message;
 import javax.jms.TextMessage;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
+import javax.net.ServerSocketFactory;
 
 import org.apache.activemq.broker.BrokerRegistry;
 import org.apache.activemq.broker.BrokerService;

http://git-wip-us.apache.org/repos/asf/activemq/blob/3a0a7238/activemq-unit-tests/src/test/java/org/apache/activemq/jmx/JmxAuditLogTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/jmx/JmxAuditLogTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/jmx/JmxAuditLogTest.java
index 6ad570a..0f2695c 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/jmx/JmxAuditLogTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/jmx/JmxAuditLogTest.java
@@ -38,12 +38,16 @@ import org.apache.log4j.Logger;
 import org.apache.log4j.spi.LoggingEvent;
 import org.junit.Test;
 
+import static org.apache.activemq.util.TestUtils.findOpenPort;
+
 public class JmxAuditLogTest extends TestSupport
 {
    protected BrokerService broker;
 
    protected ActiveMQQueue queue;
 
+   int portToUse;
+
    @Override
    protected void setUp() throws Exception
    {
@@ -55,7 +59,8 @@ public class JmxAuditLogTest extends TestSupport
 
       broker = new BrokerService();
       broker.setUseJmx(true);
-      broker.setManagementContext(createManagementContext("broker", 1099));
+      portToUse = findOpenPort();
+      broker.setManagementContext(createManagementContext("broker", portToUse));
       broker.setPopulateUserNameInMBeans(true);
       broker.setDestinations(createDestinations());
       broker.start();
@@ -126,7 +131,7 @@ public class JmxAuditLogTest extends TestSupport
       };
       log4jLogger.addAppender(appender);
 
-      MBeanServerConnection conn = createJMXConnector(1099);
+      MBeanServerConnection conn = createJMXConnector(portToUse);
       ObjectName queueObjName = new ObjectName(broker.getBrokerObjectName() + ",destinationType=Queue,destinationName="
+ queue.getQueueName());
 
       Object[] params = {"body", "testUser", "testPassword"};

http://git-wip-us.apache.org/repos/asf/activemq/blob/3a0a7238/activemq-unit-tests/src/test/java/org/apache/activemq/proxy/AMQ4889Test.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/proxy/AMQ4889Test.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/proxy/AMQ4889Test.java
index 0b3d7ab..db542be 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/proxy/AMQ4889Test.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/proxy/AMQ4889Test.java
@@ -18,21 +18,6 @@
 package org.apache.activemq.proxy;
 
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSSecurityException;
-import javax.jms.Session;
-import javax.net.ServerSocketFactory;
-
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerPlugin;
 import org.apache.activemq.broker.BrokerService;
@@ -45,6 +30,18 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSSecurityException;
+import javax.jms.Session;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.apache.activemq.util.TestUtils.findOpenPort;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
 public class AMQ4889Test {
 
     protected static final Logger LOG = LoggerFactory.getLogger(AMQ4889Test.class);
@@ -140,24 +137,4 @@ public class AMQ4889Test {
         assertEquals(val, proxyConnector.getConnectionCount());
     }
 
-    protected int findOpenPort() throws IOException {
-        int openPort = 0;
-        ServerSocket ss = null;
-        try {
-            ss = ServerSocketFactory.getDefault().createServerSocket(0);
-            openPort = ss.getLocalPort();
-        } catch (IOException e) {
-            LOG.error("Could not locate an open port: ", e);
-            throw e;
-        } finally {
-            try {
-                if (ss != null ) {
-                    ss.close();
-                }
-            } catch (IOException e) { // ignore
-            }
-        }
-
-        return openPort;
-    }
 }


Mime
View raw message