You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2016/05/25 16:15:36 UTC

activemq git commit: Cleanup the tearDown method to ensure we follow on to the super tearDown where the broker is stopped.

Repository: activemq
Updated Branches:
  refs/heads/master 3b626c9ed -> 0757cdcd5


Cleanup the tearDown method to ensure we follow on to the super tearDown
where the broker is stopped.  

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

Branch: refs/heads/master
Commit: 0757cdcd596f1fd90c4c2e10a7e0f9b215ba7db6
Parents: 3b626c9
Author: Timothy Bish <ta...@gmail.com>
Authored: Wed May 25 12:15:21 2016 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Wed May 25 12:15:21 2016 -0400

----------------------------------------------------------------------
 .../transport/TransportBrokerTestSupport.java   | 30 ++++++++++++++------
 1 file changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/0757cdcd/activemq-unit-tests/src/test/java/org/apache/activemq/transport/TransportBrokerTestSupport.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/transport/TransportBrokerTestSupport.java b/activemq-unit-tests/src/test/java/org/apache/activemq/transport/TransportBrokerTestSupport.java
index 5c221d3..b40f574 100755
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/transport/TransportBrokerTestSupport.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/transport/TransportBrokerTestSupport.java
@@ -31,27 +31,38 @@ public abstract class TransportBrokerTestSupport extends BrokerTest {
     protected TransportConnector connector;
     private ArrayList<StubConnection> connections = new ArrayList<StubConnection>();
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
     }
 
+    @Override
     protected BrokerService createBroker() throws Exception {
         BrokerService service = super.createBroker();
         connector = service.addConnector(getBindLocation());
         return service;
     }
-    
+
     protected abstract String getBindLocation();
 
+    @Override
     protected void tearDown() throws Exception {
         for (Iterator<StubConnection> iter = connections.iterator(); iter.hasNext();) {
-            StubConnection connection = iter.next();
-            connection.stop();
-            iter.remove();
+            try {
+                StubConnection connection = iter.next();
+                connection.stop();
+                iter.remove();
+            } catch (Exception ex) {
+            }
         }
-        if( connector!=null ) {
-            connector.stop();
+
+        if (connector != null) {
+            try {
+                connector.stop();
+            } catch (Exception ex) {
+            }
         }
+
         super.tearDown();
     }
 
@@ -59,12 +70,13 @@ public abstract class TransportBrokerTestSupport extends BrokerTest {
         return new URI(getBindLocation());
     }
 
+    @Override
     protected StubConnection createConnection() throws Exception {
         URI bindURI = getBindURI();
-        
+
         // Note: on platforms like OS X we cannot bind to the actual hostname, so we
-        // instead use the original host name (typically localhost) to bind to 
-        
+        // instead use the original host name (typically localhost) to bind to
+
         URI actualURI = connector.getServer().getConnectURI();
         URI connectURI = new URI(actualURI.getScheme(), actualURI.getUserInfo(), bindURI.getHost(), actualURI.getPort(), actualURI.getPath(), bindURI
                 .getQuery(), bindURI.getFragment());