activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From martyntay...@apache.org
Subject [15/52] [partial] activemq-artemis git commit: ARTEMIS-765 Improve Checkstyle
Date Fri, 30 Sep 2016 15:26:15 GMT
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/logger/ActiveMQCDILogger.java
----------------------------------------------------------------------
diff --git a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/logger/ActiveMQCDILogger.java b/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/logger/ActiveMQCDILogger.java
index ef8952f..fd2f7e7 100644
--- a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/logger/ActiveMQCDILogger.java
+++ b/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/logger/ActiveMQCDILogger.java
@@ -19,14 +19,14 @@
 
 package org.apache.artemis.client.cdi.logger;
 
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+
 import org.jboss.logging.BasicLogger;
 import org.jboss.logging.Logger;
 import org.jboss.logging.annotations.LogMessage;
 import org.jboss.logging.annotations.Message;
 import org.jboss.logging.annotations.MessageLogger;
 
-import javax.enterprise.inject.spi.ProcessAnnotatedType;
-
 /**
  * Logger code 57
  *
@@ -44,8 +44,7 @@ import javax.enterprise.inject.spi.ProcessAnnotatedType;
 @MessageLogger(projectCode = "AMQ")
 public interface ActiveMQCDILogger extends BasicLogger {
 
-   ActiveMQCDILogger LOGGER = Logger.getMessageLogger(ActiveMQCDILogger.class,
-                                                      ActiveMQCDILogger.class.getPackage().getName());
+   ActiveMQCDILogger LOGGER = Logger.getMessageLogger(ActiveMQCDILogger.class, ActiveMQCDILogger.class.getPackage().getName());
 
    @LogMessage
    @Message(id = 571000, value = "Discovered configuration class {0}", format = Message.Format.MESSAGE_FORMAT)

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/integration/artemis-cdi-integration/src/test/java/org/apache/activemq/artemis/cdi/bootstrap/CDIBootstrapTest.java
----------------------------------------------------------------------
diff --git a/integration/artemis-cdi-integration/src/test/java/org/apache/activemq/artemis/cdi/bootstrap/CDIBootstrapTest.java b/integration/artemis-cdi-integration/src/test/java/org/apache/activemq/artemis/cdi/bootstrap/CDIBootstrapTest.java
index 6762dd6..84afda7 100644
--- a/integration/artemis-cdi-integration/src/test/java/org/apache/activemq/artemis/cdi/bootstrap/CDIBootstrapTest.java
+++ b/integration/artemis-cdi-integration/src/test/java/org/apache/activemq/artemis/cdi/bootstrap/CDIBootstrapTest.java
@@ -19,6 +19,12 @@
 
 package org.apache.activemq.artemis.cdi.bootstrap;
 
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.spi.Extension;
+import javax.inject.Inject;
+import javax.jms.JMSContext;
+import javax.jms.Queue;
+
 import org.apache.artemis.client.cdi.configuration.ArtemisClientConfiguration;
 import org.apache.artemis.client.cdi.configuration.DefaultArtemisClientConfigurationImpl;
 import org.apache.artemis.client.cdi.extension.ArtemisExtension;
@@ -33,12 +39,6 @@ import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.spi.Extension;
-import javax.inject.Inject;
-import javax.jms.JMSContext;
-import javax.jms.Queue;
-
 import static org.junit.Assert.assertEquals;
 
 @RunWith(Arquillian.class)
@@ -46,10 +46,7 @@ public class CDIBootstrapTest {
 
    @Deployment
    public static Archive<?> createArchive() {
-      return ShrinkWrap.create(JavaArchive.class)
-         .addAsServiceProviderAndClasses(Extension.class, ArtemisExtension.class)
-         .addClasses(NativeConfig.class, ConnectionFactoryProvider.class)
-         .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+      return ShrinkWrap.create(JavaArchive.class).addAsServiceProviderAndClasses(Extension.class, ArtemisExtension.class).addClasses(NativeConfig.class, ConnectionFactoryProvider.class).addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
    }
 
    @Inject

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index b561726..e39d82c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1256,7 +1256,7 @@
                <excludes>
                   <exclude>**/*.txt</exclude>
                   <exclude>**/*.md</exclude>
-                  <exclude>etc/ide-settings/*</exclude>
+                  <exclude>etc/ide-settings/**</exclude>
                   <exclude>docs/**/*.json</exclude>
                   <exclude>docs/**/_book/</exclude>
                   <exclude>**/target/</exclude>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java
index 14244ff..c86ffb9 100644
--- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,16 +16,6 @@
  */
 package org.apache.activemq;
 
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.RejectedExecutionHandler;
-
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
 import javax.jms.ExceptionListener;
@@ -35,6 +25,15 @@ import javax.jms.QueueConnectionFactory;
 import javax.jms.TopicConnection;
 import javax.jms.TopicConnectionFactory;
 import javax.naming.Context;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.RejectedExecutionHandler;
 
 import org.apache.activemq.blob.BlobTransferPolicy;
 import org.apache.activemq.broker.region.policy.RedeliveryPolicyMap;
@@ -81,8 +80,7 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
                return result;
             }
          });
-      }
-      catch (Throwable e) {
+      } catch (Throwable e) {
          LOG.debug("Failed to look up System properties for host and port", e);
       }
       host = (host == null || host.isEmpty()) ? "localhost" : host;
@@ -106,16 +104,14 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
                return result;
             }
          });
-      }
-      catch (Throwable e) {
+      } catch (Throwable e) {
          LOG.debug("Failed to look up System properties for host and port", e);
       }
       bindURL = (bindURL == null || bindURL.isEmpty()) ? defaultURL : bindURL;
       DEFAULT_BROKER_BIND_URL = bindURL;
       try {
          defaultTcpUri = new URI(defaultURL);
-      }
-      catch (URISyntaxException e) {
+      } catch (URISyntaxException e) {
          LOG.debug("Failed to build default tcp url", e);
       }
 
@@ -210,8 +206,7 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
 
             this.vmBrokerUri = URISupport.createRemainingURI(uri, params);
          }
-      }
-      catch (URISyntaxException e) {
+      } catch (URISyntaxException e) {
       }
 
    }
@@ -235,8 +230,7 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
    public ActiveMQConnectionFactory copy() {
       try {
          return (ActiveMQConnectionFactory) super.clone();
-      }
-      catch (CloneNotSupportedException e) {
+      } catch (CloneNotSupportedException e) {
          throw new RuntimeException("This should never happen: " + e, e);
       }
    }
@@ -256,8 +250,7 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
             return defaultTcpUri;
          }
          return uri;
-      }
-      catch (URISyntaxException e) {
+      } catch (URISyntaxException e) {
          throw (IllegalArgumentException) new IllegalArgumentException("Invalid broker URI: " + brokerURL).initCause(e);
       }
    }
@@ -313,8 +306,7 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
          Transport t = TransportFactory.connect(brokerURL);
          System.out.println("xxxxxxxxxxxx created transport" + t);
          return t;
-      }
-      catch (Exception e) {
+      } catch (Exception e) {
          throw JMSExceptionSupport.create("Could not create Transport. Reason: " + e, e);
       }
    }
@@ -340,22 +332,18 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
          }
 
          return connection;
-      }
-      catch (JMSException e) {
+      } catch (JMSException e) {
          // Clean up!
          try {
             connection.close();
-         }
-         catch (Throwable ignore) {
+         } catch (Throwable ignore) {
          }
          throw e;
-      }
-      catch (Exception e) {
+      } catch (Exception e) {
          // Clean up!
          try {
             connection.close();
-         }
-         catch (Throwable ignore) {
+         } catch (Throwable ignore) {
          }
          throw JMSExceptionSupport.create("Could not connect to broker URL: " + brokerURL + ". Reason: " + e, e);
       }
@@ -437,8 +425,7 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
          if ("vm".equals(scheme)) {
             this.vmBrokerUri = uri;
          }
-      }
-      catch (URISyntaxException e) {
+      } catch (URISyntaxException e) {
       }
       this.brokerURL = createURI(brokerURL);
 
@@ -460,12 +447,10 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
                this.brokerURL = URISupport.createRemainingURI(this.brokerURL, map);
             }
 
-         }
-         catch (URISyntaxException e) {
+         } catch (URISyntaxException e) {
          }
 
-      }
-      else {
+      } else {
 
          // It might be a composite URI.
          try {
@@ -479,8 +464,7 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
 
                this.brokerURL = data.toURI();
             }
-         }
-         catch (URISyntaxException e) {
+         } catch (URISyntaxException e) {
          }
       }
    }
@@ -815,8 +799,7 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
       if (clientIdGenerator == null) {
          if (clientIDPrefix != null) {
             clientIdGenerator = new IdGenerator(clientIDPrefix);
-         }
-         else {
+         } else {
             clientIdGenerator = new IdGenerator();
          }
       }
@@ -835,8 +818,7 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
       if (connectionIdGenerator == null) {
          if (connectionIDPrefix != null) {
             connectionIdGenerator = new IdGenerator(connectionIDPrefix);
-         }
-         else {
+         } else {
             connectionIdGenerator = new IdGenerator();
          }
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/artemiswrapper/ArtemisBrokerHelper.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/artemiswrapper/ArtemisBrokerHelper.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/artemiswrapper/ArtemisBrokerHelper.java
index fce53ee..5cb3d40 100644
--- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/artemiswrapper/ArtemisBrokerHelper.java
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/artemiswrapper/ArtemisBrokerHelper.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -27,6 +27,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class ArtemisBrokerHelper {
+
    private static final Logger LOG = LoggerFactory.getLogger(ArtemisBrokerHelper.class);
 
    private static volatile Object service = null;
@@ -35,8 +36,7 @@ public class ArtemisBrokerHelper {
    static {
       try {
          serviceClass = Class.forName("org.apache.activemq.broker.BrokerService");
-      }
-      catch (ClassNotFoundException e) {
+      } catch (ClassNotFoundException e) {
          e.printStackTrace();
       }
 
@@ -54,23 +54,17 @@ public class ArtemisBrokerHelper {
          Method startMethod = serviceClass.getMethod("start");
          startMethod.invoke(service, (Object[]) null);
          LOG.info("started a service instance: " + service);
-      }
-      catch (InstantiationException e) {
+      } catch (InstantiationException e) {
          throw new IOException("Inst exception", e);
-      }
-      catch (IllegalAccessException e) {
+      } catch (IllegalAccessException e) {
          throw new IOException("IllegalAccess exception ", e);
-      }
-      catch (NoSuchMethodException e) {
+      } catch (NoSuchMethodException e) {
          throw new IOException("Nosuchmethod", e);
-      }
-      catch (SecurityException e) {
+      } catch (SecurityException e) {
          throw new IOException("Security exception", e);
-      }
-      catch (IllegalArgumentException e) {
+      } catch (IllegalArgumentException e) {
          throw new IOException("IllegalArgumentException exception", e);
-      }
-      catch (InvocationTargetException e) {
+      } catch (InvocationTargetException e) {
          throw new IOException("InvocationTargetException exception", e);
       }
    }
@@ -91,11 +85,9 @@ public class ArtemisBrokerHelper {
             startMethod.invoke(service, (Object[]) null);
             System.out.println("stopped the service instance: " + service);
          }
-      }
-      catch (Exception e) {
+      } catch (Exception e) {
          e.printStackTrace();
-      }
-      finally {
+      } finally {
          service = null;
       }
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/ArtemisBrokerWrapperFactory.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/ArtemisBrokerWrapperFactory.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/ArtemisBrokerWrapperFactory.java
index eff9ab3..97e3482 100644
--- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/ArtemisBrokerWrapperFactory.java
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/ArtemisBrokerWrapperFactory.java
@@ -17,12 +17,13 @@
 
 package org.apache.activemq.broker;
 
-import org.apache.activemq.broker.artemiswrapper.ArtemisBrokerWrapper;
-
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.activemq.broker.artemiswrapper.ArtemisBrokerWrapper;
+
 public class ArtemisBrokerWrapperFactory {
+
    List<ArtemisBrokerWrapper> brokers = new ArrayList<>();
 
    public static Broker createBroker(BrokerService brokerService) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
index 69724c7..58885d6 100644
--- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
@@ -117,8 +117,7 @@ public class BrokerService implements Service {
          BufferedReader reader = new BufferedReader(new InputStreamReader(in));
          try {
             version = reader.readLine();
-         }
-         catch (Exception e) {
+         } catch (Exception e) {
          }
       }
       BROKER_VERSION = version;
@@ -156,14 +155,12 @@ public class BrokerService implements Service {
             public void run() {
                try {
                   doStartBroker();
-               }
-               catch (Throwable t) {
+               } catch (Throwable t) {
                   startException = t;
                }
             }
          }.start();
-      }
-      else {
+      } else {
          doStartBroker();
       }
    }
@@ -180,11 +177,9 @@ public class BrokerService implements Service {
 
       try {
          broker.start();
-      }
-      catch (Exception e) {
+      } catch (Exception e) {
          throw e;
-      }
-      catch (Throwable t) {
+      } catch (Throwable t) {
          throw new Exception(t);
       }
 
@@ -360,8 +355,7 @@ public class BrokerService implements Service {
       try {
          URI substituteUri = new URI("tcp://localhost:61616");
          return substituteUri;
-      }
-      catch (URISyntaxException e) {
+      } catch (URISyntaxException e) {
          e.printStackTrace();
       }
       return null;
@@ -490,9 +484,8 @@ public class BrokerService implements Service {
       this.transportConnectors = transportConnectors;
       for (TransportConnector connector : transportConnectors) {
          if (sslContext instanceof SpringSslContext) {
-            this.extraConnectors.add(new ConnectorInfo(connector.getUri(), (SpringSslContext)sslContext));
-         }
-         else {
+            this.extraConnectors.add(new ConnectorInfo(connector.getUri(), (SpringSslContext) sslContext));
+         } else {
             this.extraConnectors.add(new ConnectorInfo(connector.getUri()));
          }
       }
@@ -509,7 +502,7 @@ public class BrokerService implements Service {
          @Override
          public boolean connectTo(URI location) {
             List<TransportConnector> transportConnectors = getTransportConnectors();
-            for (Iterator<TransportConnector> iter = transportConnectors.iterator(); iter.hasNext();) {
+            for (Iterator<TransportConnector> iter = transportConnectors.iterator(); iter.hasNext(); ) {
                try {
                   TransportConnector tc = iter.next();
                   if (location.equals(tc.getConnectUri())) {
@@ -556,15 +549,13 @@ public class BrokerService implements Service {
 
       }
 
-      bindAddress = new URI(bindAddress.getScheme(), bindAddress.getUserInfo(),
-              host, port, bindAddress.getPath(), bindAddress.getQuery(), bindAddress.getFragment());
+      bindAddress = new URI(bindAddress.getScheme(), bindAddress.getUserInfo(), host, port, bindAddress.getPath(), bindAddress.getQuery(), bindAddress.getFragment());
 
       connector = new FakeTransportConnector(bindAddress);
       this.transportConnectors.add(connector);
       if (sslContext instanceof SpringSslContext) {
          this.extraConnectors.add(new ConnectorInfo(bindAddress, (SpringSslContext) sslContext));
-      }
-      else {
+      } else {
          this.extraConnectors.add(new ConnectorInfo(bindAddress));
       }
 
@@ -584,8 +575,7 @@ public class BrokerService implements Service {
          }
          try {
             TimeUnit.SECONDS.sleep(5);
-         }
-         catch (InterruptedException e) {
+         } catch (InterruptedException e) {
          }
       }
       return currentRandomPort;
@@ -595,17 +585,14 @@ public class BrokerService implements Service {
       ServerSocket ssocket = null;
       try {
          ssocket = new ServerSocket(port);
-      }
-      catch (Exception e) {
+      } catch (Exception e) {
          LOG.info("port " + port + " is being used.");
          return false;
-      }
-      finally {
+      } finally {
          if (ssocket != null) {
             try {
                ssocket.close();
-            }
-            catch (IOException e) {
+            } catch (IOException e) {
             }
          }
       }
@@ -740,8 +727,7 @@ public class BrokerService implements Service {
          if (!b.isStopped()) {
             try {
                b.stop();
-            }
-            catch (Exception e) {
+            } catch (Exception e) {
                e.printStackTrace();
             }
             brokerExceptionEntry.getValue().printStackTrace();
@@ -807,20 +793,11 @@ public class BrokerService implements Service {
          String query = bindAddress.getQuery();
          if (!ssl || query != null && query.contains(TransportConstants.SSL_ENABLED_PROP_NAME)) {
             //it means the uri is already configured ssl
-            uri = new URI("tcp", bindAddress.getUserInfo(),
-                    host, port, bindAddress.getPath(), bindAddress.getQuery(), bindAddress.getFragment());
-         }
-         else {
-            String baseUri = "tcp://" + host + ":" + port + "?"
-                    + TransportConstants.SSL_ENABLED_PROP_NAME + "=true&"
-                    + TransportConstants.KEYSTORE_PATH_PROP_NAME + "=" + (context == null ? defaultKeyStore : context.getKeyStore()) + "&"
-                    + TransportConstants.KEYSTORE_PASSWORD_PROP_NAME + "=" + (context == null ? defaultKeyStorePassword : context.getKeyStorePassword()) + "&"
-                    + TransportConstants.KEYSTORE_PROVIDER_PROP_NAME + "=" + (context == null ? defaultKeyStoreType : context.getKeyStoreType());
+            uri = new URI("tcp", bindAddress.getUserInfo(), host, port, bindAddress.getPath(), bindAddress.getQuery(), bindAddress.getFragment());
+         } else {
+            String baseUri = "tcp://" + host + ":" + port + "?" + TransportConstants.SSL_ENABLED_PROP_NAME + "=true&" + TransportConstants.KEYSTORE_PATH_PROP_NAME + "=" + (context == null ? defaultKeyStore : context.getKeyStore()) + "&" + TransportConstants.KEYSTORE_PASSWORD_PROP_NAME + "=" + (context == null ? defaultKeyStorePassword : context.getKeyStorePassword()) + "&" + TransportConstants.KEYSTORE_PROVIDER_PROP_NAME + "=" + (context == null ? defaultKeyStoreType : context.getKeyStoreType());
             if (clientAuth) {
-               baseUri = baseUri + "&" + TransportConstants.NEED_CLIENT_AUTH_PROP_NAME + "=true" + "&"
-                       + TransportConstants.TRUSTSTORE_PATH_PROP_NAME + "=" + (context == null ? defaultTrustStore : context.getTrustStore()) + "&"
-                       + TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME + "=" + (context == null ? defaultTrustStorePassword : context.getTrustStorePassword()) + "&"
-                       + TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME + "=" + (context == null ? defaultTrustStoreType : context.getTrustStoreType());
+               baseUri = baseUri + "&" + TransportConstants.NEED_CLIENT_AUTH_PROP_NAME + "=true" + "&" + TransportConstants.TRUSTSTORE_PATH_PROP_NAME + "=" + (context == null ? defaultTrustStore : context.getTrustStore()) + "&" + TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME + "=" + (context == null ? defaultTrustStorePassword : context.getTrustStorePassword()) + "&" + TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME + "=" + (context == null ? defaultTrustStoreType : context.getTrustStoreType());
             }
             uri = new URI(baseUri);
          }
@@ -835,7 +812,7 @@ public class BrokerService implements Service {
       @Override
       public boolean equals(Object obj) {
          if (obj instanceof ConnectorInfo) {
-            return uri.getPort() == ((ConnectorInfo)obj).uri.getPort();
+            return uri.getPort() == ((ConnectorInfo) obj).uri.getPort();
          }
          return false;
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/FakeTransportConnector.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/FakeTransportConnector.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/FakeTransportConnector.java
index 9fb8233..8999078 100644
--- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/FakeTransportConnector.java
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/FakeTransportConnector.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/SslBrokerService.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/SslBrokerService.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/SslBrokerService.java
index 2f36cf6..ef96a6f 100644
--- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/SslBrokerService.java
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/SslBrokerService.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,7 +17,6 @@
 
 package org.apache.activemq.broker;
 
-import org.apache.activemq.transport.TransportServer;
 import javax.net.ssl.KeyManager;
 import javax.net.ssl.TrustManager;
 import java.io.IOException;
@@ -25,6 +24,8 @@ import java.net.URI;
 import java.security.KeyManagementException;
 import java.security.SecureRandom;
 
+import org.apache.activemq.transport.TransportServer;
+
 /**
  * A BrokerService that allows access to the key and trust managers used by SSL
  * connections. There is no reason to use this class unless SSL is being used

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerBase.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerBase.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerBase.java
index fb3c242..c4fe1c0 100644
--- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerBase.java
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerBase.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -465,8 +465,7 @@ public abstract class ArtemisBrokerBase implements Broker {
    protected Configuration createDefaultConfig(final boolean netty) throws Exception {
       if (netty) {
          return createDefaultConfig(new HashMap<String, Object>(), NETTY_ACCEPTOR_FACTORY);
-      }
-      else {
+      } else {
          return createDefaultConfig(new HashMap<String, Object>(), INVM_ACCEPTOR_FACTORY);
       }
    }
@@ -530,8 +529,7 @@ public abstract class ArtemisBrokerBase implements Broker {
    protected static JournalType getDefaultJournalType() {
       if (LibaioContext.isLoaded()) {
          return JournalType.ASYNCIO;
-      }
-      else {
+      } else {
          return JournalType.NIO;
       }
    }
@@ -593,8 +591,7 @@ public abstract class ArtemisBrokerBase implements Broker {
          while (files == null && (attempts < num)) {
             try {
                Thread.sleep(100);
-            }
-            catch (InterruptedException e) {
+            } catch (InterruptedException e) {
             }
             files = directory.list();
             attempts++;
@@ -611,8 +608,7 @@ public abstract class ArtemisBrokerBase implements Broker {
       return directory.delete();
    }
 
-   public ActiveMQServer getServer()
-   {
+   public ActiveMQServer getServer() {
       return server;
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
index c860221..b16383a 100644
--- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
@@ -16,6 +16,8 @@
  */
 package org.apache.activemq.broker.artemiswrapper;
 
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
 import java.io.File;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -45,10 +47,8 @@ import org.apache.activemq.broker.region.policy.PolicyMap;
 import org.apache.activemq.broker.region.virtual.VirtualDestination;
 import org.apache.activemq.command.ActiveMQDestination;
 
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-
 public class ArtemisBrokerWrapper extends ArtemisBrokerBase {
+
    protected final Map<String, SimpleString> testQueues = new HashMap<>();
    protected JMSServerManagerImpl jmsServer;
    protected MBeanServer mbeanServer;
@@ -224,8 +224,7 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase {
       String pattern = physicalName.replace(">", "#");
       if (dest.isTopic()) {
          pattern = "jms.topic." + pattern;
-      }
-      else {
+      } else {
          pattern = "jms.queue." + pattern;
       }
 
@@ -238,11 +237,9 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase {
          server.stop();
          testQueues.clear();
          stopped = true;
-      }
-      catch (Throwable t) {
+      } catch (Throwable t) {
          //ignore
-      }
-      finally {
+      } finally {
          server = null;
       }
    }
@@ -255,8 +252,7 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase {
             try {
                this.server.createQueue(coreQ, coreQ, null, false, false);
                testQueues.put(qname, coreQ);
-            }
-            catch (ActiveMQQueueExistsException e) {
+            } catch (ActiveMQQueueExistsException e) {
                //ignore
             }
          }
@@ -271,8 +267,7 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase {
       String qname = null;
       if (amq5Dest.isTemporary()) {
          qname = "jms.tempqueue." + amq5Dest.getPhysicalName();
-      }
-      else {
+      } else {
          qname = "jms.queue." + amq5Dest.getPhysicalName();
       }
       Binding binding = server.getPostOffice().getBinding(new SimpleString(qname));

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/CleanupThreadRule.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/CleanupThreadRule.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/CleanupThreadRule.java
index 2ddac3b..2c5a3e6 100644
--- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/CleanupThreadRule.java
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/CleanupThreadRule.java
@@ -36,15 +36,13 @@ public class CleanupThreadRule extends ExternalResource {
       // We shutdown the global pools to give a better isolation between tests
       try {
          ServerLocatorImpl.clearThreadPools();
-      }
-      catch (Throwable e) {
+      } catch (Throwable e) {
          e.printStackTrace();
       }
 
       try {
          NettyConnector.clearThreadPools();
-      }
-      catch (Exception e) {
+      } catch (Exception e) {
          e.printStackTrace();
       }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/InVMNameParser.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/InVMNameParser.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/InVMNameParser.java
index 6ab5340..facbe24 100644
--- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/InVMNameParser.java
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/InVMNameParser.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,13 +16,12 @@
  */
 package org.apache.activemq.broker.artemiswrapper;
 
-import java.io.Serializable;
-import java.util.Properties;
-
 import javax.naming.CompoundName;
 import javax.naming.Name;
 import javax.naming.NameParser;
 import javax.naming.NamingException;
+import java.io.Serializable;
+import java.util.Properties;
 
 /**
  * @author <a href="mailto:ovidiu@feodorov.com">Ovidiu Feodorov</a>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/InVMNamingContext.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/InVMNamingContext.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/InVMNamingContext.java
index 27b9f72..e1c40b6 100644
--- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/InVMNamingContext.java
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/InVMNamingContext.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,15 +16,6 @@
  */
 package org.apache.activemq.broker.artemiswrapper;
 
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
 import javax.naming.Binding;
 import javax.naming.Context;
 import javax.naming.Name;
@@ -36,6 +27,14 @@ import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.RefAddr;
 import javax.naming.Reference;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 public class InVMNamingContext implements Context, Serializable {
    // Constants -----------------------------------------------------
@@ -89,8 +88,7 @@ public class InVMNamingContext implements Context, Serializable {
          // we only deal with references create by NonSerializableFactory
          String key = (String) refAddr.getContent();
          return NonSerializableFactory.lookup(key);
-      }
-      else {
+      } else {
          return value;
       }
    }
@@ -127,8 +125,7 @@ public class InVMNamingContext implements Context, Serializable {
       boolean terminal = i == -1;
       if (terminal) {
          map.remove(name);
-      }
-      else {
+      } else {
          String tok = name.substring(0, i);
          InVMNamingContext c = (InVMNamingContext) map.get(tok);
          if (c == null) {
@@ -169,8 +166,7 @@ public class InVMNamingContext implements Context, Serializable {
       if (!"".equals(contextName) && !".".equals(contextName)) {
          try {
             return ((InVMNamingContext) lookup(contextName)).listBindings("");
-         }
-         catch (Throwable t) {
+         } catch (Throwable t) {
             throw new NamingException(t.getMessage());
          }
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/NonSerializableFactory.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/NonSerializableFactory.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/NonSerializableFactory.java
index 91b365e..6c0415d 100644
--- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/NonSerializableFactory.java
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/NonSerializableFactory.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -22,14 +22,13 @@ import javax.naming.NamingException;
 import javax.naming.RefAddr;
 import javax.naming.Reference;
 import javax.naming.spi.ObjectFactory;
-
-//import org.jboss.util.naming.Util;
-
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Map;
 
+//import org.jboss.util.naming.Util;
+
 /**
  * used by the default context when running in embedded local configuration
  *

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/OpenwireArtemisBaseTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/OpenwireArtemisBaseTest.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/OpenwireArtemisBaseTest.java
index c364916..2cb755a 100644
--- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/OpenwireArtemisBaseTest.java
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/OpenwireArtemisBaseTest.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,6 +17,9 @@
 
 package org.apache.activemq.broker.artemiswrapper;
 
+import javax.management.MBeanServer;
+import javax.management.MBeanServerInvocationHandler;
+import javax.management.ObjectName;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -41,11 +44,8 @@ import org.junit.Rule;
 import org.junit.rules.TemporaryFolder;
 import org.junit.rules.TestName;
 
-import javax.management.MBeanServer;
-import javax.management.MBeanServerInvocationHandler;
-import javax.management.ObjectName;
-
 public class OpenwireArtemisBaseTest {
+
    @Rule
    public CleanupThreadRule cleanupRules = new CleanupThreadRule();
 
@@ -69,7 +69,6 @@ public class OpenwireArtemisBaseTest {
       BrokerService.disableWrapper = true;
    }
 
-
    public String getTmp() {
       return getTmpFile().getAbsolutePath();
    }
@@ -123,16 +122,18 @@ public class OpenwireArtemisBaseTest {
       return createConfig(hostAddress, serverID, Collections.EMPTY_MAP);
    }
 
-   protected Configuration createConfig(final String hostAddress, final int serverID, Map<String, String> params) throws Exception {
+   protected Configuration createConfig(final String hostAddress,
+                                        final int serverID,
+                                        Map<String, String> params) throws Exception {
       ConfigurationImpl configuration = new ConfigurationImpl().setJMXManagementEnabled(false).
-              setSecurityEnabled(false).setJournalMinFiles(2).setJournalFileSize(1000 * 1024).setJournalType(JournalType.NIO).
-              setJournalDirectory(getJournalDir(serverID, false)).
-              setBindingsDirectory(getBindingsDir(serverID, false)).
-              setPagingDirectory(getPageDir(serverID, false)).
-              setLargeMessagesDirectory(getLargeMessagesDir(serverID, false)).
-              setJournalCompactMinFiles(0).
-              setJournalCompactPercentage(0).
-              setClusterPassword(CLUSTER_PASSWORD);
+         setSecurityEnabled(false).setJournalMinFiles(2).setJournalFileSize(1000 * 1024).setJournalType(JournalType.NIO).
+         setJournalDirectory(getJournalDir(serverID, false)).
+         setBindingsDirectory(getBindingsDir(serverID, false)).
+         setPagingDirectory(getPageDir(serverID, false)).
+         setLargeMessagesDirectory(getLargeMessagesDir(serverID, false)).
+         setJournalCompactMinFiles(0).
+         setJournalCompactPercentage(0).
+         setClusterPassword(CLUSTER_PASSWORD);
 
       configuration.addAddressesSetting("#", new AddressSettings().setAutoCreateJmsQueues(true).setAutoDeleteJmsQueues(true));
 
@@ -145,14 +146,14 @@ public class OpenwireArtemisBaseTest {
    //extraAcceptor takes form: "?name=value&name1=value ..."
    protected Configuration createConfig(final int serverID, String extraAcceptorParams) throws Exception {
       ConfigurationImpl configuration = new ConfigurationImpl().setJMXManagementEnabled(false).
-              setSecurityEnabled(false).setJournalMinFiles(2).setJournalFileSize(100 * 1024).setJournalType(JournalType.NIO).
-              setJournalDirectory(getJournalDir(serverID, false)).
-              setBindingsDirectory(getBindingsDir(serverID, false)).
-              setPagingDirectory(getPageDir(serverID, false)).
-              setLargeMessagesDirectory(getLargeMessagesDir(serverID, false)).
-              setJournalCompactMinFiles(0).
-              setJournalCompactPercentage(0).
-              setClusterPassword(CLUSTER_PASSWORD);
+         setSecurityEnabled(false).setJournalMinFiles(2).setJournalFileSize(100 * 1024).setJournalType(JournalType.NIO).
+         setJournalDirectory(getJournalDir(serverID, false)).
+         setBindingsDirectory(getBindingsDir(serverID, false)).
+         setPagingDirectory(getPageDir(serverID, false)).
+         setLargeMessagesDirectory(getLargeMessagesDir(serverID, false)).
+         setJournalCompactMinFiles(0).
+         setJournalCompactPercentage(0).
+         setClusterPassword(CLUSTER_PASSWORD);
 
       configuration.addAddressesSetting("#", new AddressSettings().setAutoCreateJmsQueues(true).setAutoDeleteJmsQueues(true));
 
@@ -163,7 +164,7 @@ public class OpenwireArtemisBaseTest {
       return configuration;
    }
 
-   public void deployClusterConfiguration(Configuration config, Integer ... targetIDs) throws Exception {
+   public void deployClusterConfiguration(Configuration config, Integer... targetIDs) throws Exception {
       StringBuffer stringBuffer = new StringBuffer();
       String separator = "";
       for (int x : targetIDs) {
@@ -188,7 +189,9 @@ public class OpenwireArtemisBaseTest {
       return newURIwithPort(localhostAddress, port, Collections.EMPTY_MAP);
    }
 
-   protected static String newURIwithPort(String localhostAddress, int port, Map<String, String> params) throws Exception {
+   protected static String newURIwithPort(String localhostAddress,
+                                          int port,
+                                          Map<String, String> params) throws Exception {
       return "tcp://" + localhostAddress + ":" + port + "?" + URISupport.createQueryString(params);
    }
 
@@ -211,8 +214,7 @@ public class OpenwireArtemisBaseTest {
       for (int i = 0; i < servers.length; i++) {
          try {
             servers[i].stop();
-         }
-         catch (Throwable t) {
+         } catch (Throwable t) {
             t.printStackTrace();
          }
       }
@@ -262,8 +264,7 @@ public class OpenwireArtemisBaseTest {
       }
    }
 
-   private Integer[] getTargets(int total, int self)
-   {
+   private Integer[] getTargets(int total, int self) {
       int lenTargets = total - self;
       List<Integer> targets = new ArrayList<>();
       for (int i = 0; i < lenTargets; i++) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java
index 1d10280..b6ee450 100644
--- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,6 +16,8 @@
  */
 package org.apache.activemq.transport.tcp;
 
+import javax.net.ServerSocketFactory;
+import javax.net.SocketFactory;
 import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -24,15 +26,16 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
-import javax.net.ServerSocketFactory;
-import javax.net.SocketFactory;
-
 import org.apache.activemq.TransportLoggerSupport;
 import org.apache.activemq.artemiswrapper.ArtemisBrokerHelper;
 import org.apache.activemq.broker.BrokerRegistry;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.openwire.OpenWireFormat;
-import org.apache.activemq.transport.*;
+import org.apache.activemq.transport.InactivityMonitor;
+import org.apache.activemq.transport.Transport;
+import org.apache.activemq.transport.TransportFactory;
+import org.apache.activemq.transport.TransportServer;
+import org.apache.activemq.transport.WireFormatNegotiator;
 import org.apache.activemq.util.IOExceptionSupport;
 import org.apache.activemq.util.IntrospectionSupport;
 import org.apache.activemq.util.URISupport;
@@ -53,8 +56,7 @@ public class TcpTransportFactory extends TransportFactory {
       String brokerId = params.remove("invmBrokerId");
       boolean autoCreate = true;
       String create = params.remove("create");
-      if (create != null)
-      {
+      if (create != null) {
          autoCreate = "true".equals(create);
       }
 
@@ -96,8 +98,7 @@ public class TcpTransportFactory extends TransportFactory {
          server.bind();
 
          return server;
-      }
-      catch (URISyntaxException e) {
+      } catch (URISyntaxException e) {
          throw IOExceptionSupport.create(e);
       }
    }
@@ -119,8 +120,7 @@ public class TcpTransportFactory extends TransportFactory {
       if (tcpTransport.isTrace()) {
          try {
             transport = TransportLoggerSupport.createTransportLogger(transport, tcpTransport.getLogWriterName(), tcpTransport.isDynamicManagement(), tcpTransport.isStartLogging(), tcpTransport.getJmxPort());
-         }
-         catch (Throwable e) {
+         } catch (Throwable e) {
             LOG.error("Could not create TransportLogger object for: " + tcpTransport.getLogWriterName() + ", reason: " + e, e);
          }
       }
@@ -154,8 +154,7 @@ public class TcpTransportFactory extends TransportFactory {
             Integer.parseInt(path.substring(localPortIndex + 1, path.length()));
             String localString = location.getScheme() + ":/" + path;
             localLocation = new URI(localString);
-         }
-         catch (Exception e) {
+         } catch (Exception e) {
             LOG.warn("path isn't a valid local location for TcpTransport to use", e.getMessage());
             if (LOG.isDebugEnabled()) {
                LOG.debug("Failure detail", e);
@@ -191,11 +190,9 @@ public class TcpTransportFactory extends TransportFactory {
       if (brokerService != null) {
          try {
             ArtemisBrokerHelper.stopArtemisBroker();
-         }
-         catch (Exception e) {
+         } catch (Exception e) {
             e.printStackTrace();
-         }
-         finally {
+         } finally {
             brokerService = null;
          }
       }
@@ -203,6 +200,7 @@ public class TcpTransportFactory extends TransportFactory {
 
    //added createTime for debugging
    private static class InternalServiceInfo {
+
       private String internalService;
       private long createTime;
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/usage/SystemUsage.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/usage/SystemUsage.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/usage/SystemUsage.java
index f6b4cde..97ae702 100644
--- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/usage/SystemUsage.java
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/usage/SystemUsage.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -147,8 +147,7 @@ public class SystemUsage implements Service {
    public boolean isSendFailIfNoSpace() {
       if (sendFailIfNoSpaceExplicitySet || parent == null) {
          return sendFailIfNoSpace;
-      }
-      else {
+      } else {
          return parent.isSendFailIfNoSpace();
       }
    }
@@ -180,8 +179,7 @@ public class SystemUsage implements Service {
    public long getSendFailIfNoSpaceAfterTimeout() {
       if (sendFailIfNoSpaceAfterTimeoutExplicitySet || parent == null) {
          return sendFailIfNoSpaceAfterTimeout;
-      }
-      else {
+      } else {
          return parent.getSendFailIfNoSpaceAfterTimeout();
       }
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQConnectionFactoryTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQConnectionFactoryTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQConnectionFactoryTest.java
index 8769324..ad590fe 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQConnectionFactoryTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQConnectionFactoryTest.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,6 +16,9 @@
  */
 package org.apache.activemq;
 
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.Session;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
@@ -23,10 +26,6 @@ import java.io.ObjectOutputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
 
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.Session;
-
 import org.apache.activemq.artemiswrapper.ArtemisBrokerHelper;
 import org.apache.activemq.broker.BrokerRegistry;
 import org.apache.activemq.broker.BrokerService;
@@ -60,19 +59,16 @@ public class ActiveMQConnectionFactoryTest extends CombinationTestSupport {
       // Try our best to close any previously opend connection.
       try {
          connection.close();
-      }
-      catch (Throwable ignore) {
+      } catch (Throwable ignore) {
       }
       // Try our best to stop any previously started broker.
       try {
          broker.stop();
-      }
-      catch (Throwable ignore) {
+      } catch (Throwable ignore) {
       }
       try {
          ArtemisBrokerHelper.stopArtemisBroker();
-      }
-      catch (Throwable ignore) {
+      } catch (Throwable ignore) {
       }
       TcpTransportFactory.clearService();
    }
@@ -171,8 +167,7 @@ public class ActiveMQConnectionFactoryTest extends CombinationTestSupport {
       try {
          factory.createConnection();
          fail("Expected connection failure.");
-      }
-      catch (JMSException e) {
+      } catch (JMSException e) {
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQMessageAuditTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQMessageAuditTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQMessageAuditTest.java
index d63d3c4..07d4c6d 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQMessageAuditTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQMessageAuditTest.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQSslConnectionFactoryTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQSslConnectionFactoryTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQSslConnectionFactoryTest.java
index df71ec5..f2c3b67 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQSslConnectionFactoryTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQSslConnectionFactoryTest.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,6 +16,10 @@
  */
 package org.apache.activemq;
 
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.TrustManagerFactory;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.FileInputStream;
@@ -23,11 +27,6 @@ import java.io.IOException;
 import java.security.KeyStore;
 import java.security.SecureRandom;
 
-import javax.net.ssl.KeyManager;
-import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.TrustManagerFactory;
-
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.SslBrokerService;
 import org.apache.commons.logging.Log;
@@ -50,14 +49,12 @@ public class ActiveMQSslConnectionFactoryTest extends CombinationTestSupport {
       // Try our best to close any previously opend connection.
       try {
          connection.close();
-      }
-      catch (Throwable ignore) {
+      } catch (Throwable ignore) {
       }
       // Try our best to stop any previously started broker.
       try {
          broker.stop();
-      }
-      catch (Throwable ignore) {
+      } catch (Throwable ignore) {
       }
    }
 
@@ -152,8 +149,7 @@ public class ActiveMQSslConnectionFactoryTest extends CombinationTestSupport {
       cf.setTrustStorePassword("wrongPassword");
       try {
          connection = (ActiveMQConnection) cf.createConnection();
-      }
-      catch (javax.jms.JMSException ignore) {
+      } catch (javax.jms.JMSException ignore) {
          // Expected exception
          LOG.info("Expected java.io.Exception [" + ignore + "]");
       }
@@ -174,8 +170,7 @@ public class ActiveMQSslConnectionFactoryTest extends CombinationTestSupport {
       cf.setTrustStorePassword("password");
       try {
          connection = (ActiveMQConnection) cf.createConnection();
-      }
-      catch (javax.jms.JMSException ignore) {
+      } catch (javax.jms.JMSException ignore) {
          // Expected exception
          LOG.info("Expected SSLHandshakeException [" + ignore + "]");
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java
index c96f370..c4203c7 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,13 +16,6 @@
  */
 package org.apache.activemq;
 
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.concurrent.CopyOnWriteArrayList;
-
 import javax.jms.Connection;
 import javax.jms.Destination;
 import javax.jms.JMSException;
@@ -36,6 +29,12 @@ import javax.jms.XATopicConnection;
 import javax.transaction.xa.XAException;
 import javax.transaction.xa.XAResource;
 import javax.transaction.xa.Xid;
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.concurrent.CopyOnWriteArrayList;
 
 import org.apache.activemq.broker.BrokerFactory;
 import org.apache.activemq.broker.BrokerRegistry;
@@ -65,14 +64,12 @@ public class ActiveMQXAConnectionFactoryTest extends CombinationTestSupport {
       // Try our best to close any previously opend connection.
       try {
          connection.close();
-      }
-      catch (Throwable ignore) {
+      } catch (Throwable ignore) {
       }
       // Try our best to stop any previously started broker.
       try {
          broker.stop();
-      }
-      catch (Throwable ignore) {
+      } catch (Throwable ignore) {
       }
       super.tearDown();
    }
@@ -170,21 +167,18 @@ public class ActiveMQXAConnectionFactoryTest extends CombinationTestSupport {
          assertTrue(resource1.isSameRM(resource2));
          session1.close();
          session2.close();
-      }
-      finally {
+      } finally {
          if (connection1 != null) {
             try {
                connection1.close();
-            }
-            catch (Exception e) {
+            } catch (Exception e) {
                // ignore
             }
          }
          if (connection2 != null) {
             try {
                connection2.close();
-            }
-            catch (Exception e) {
+            } catch (Exception e) {
                // ignore
             }
          }
@@ -213,21 +207,18 @@ public class ActiveMQXAConnectionFactoryTest extends CombinationTestSupport {
          assertTrue(resource1.isSameRM(session1a.getXAResource()));
          session1.close();
          session2.close();
-      }
-      finally {
+      } finally {
          if (connection1 != null) {
             try {
                connection1.close();
-            }
-            catch (Exception e) {
+            } catch (Exception e) {
                // ignore
             }
          }
          if (connection2 != null) {
             try {
                connection2.close();
-            }
-            catch (Exception e) {
+            } catch (Exception e) {
                // ignore
             }
          }
@@ -268,13 +259,11 @@ public class ActiveMQXAConnectionFactoryTest extends CombinationTestSupport {
          resource.commit(tid, true);
          session.close();
 
-      }
-      finally {
+      } finally {
          if (connection1 != null) {
             try {
                connection1.close();
-            }
-            catch (Exception e) {
+            } catch (Exception e) {
                // ignore
             }
          }
@@ -449,22 +438,19 @@ public class ActiveMQXAConnectionFactoryTest extends CombinationTestSupport {
       try {
          session.commit();
          fail("expect exception after close");
-      }
-      catch (javax.jms.IllegalStateException expected) {
+      } catch (javax.jms.IllegalStateException expected) {
       }
 
       try {
          session.rollback();
          fail("expect exception after close");
-      }
-      catch (javax.jms.IllegalStateException expected) {
+      } catch (javax.jms.IllegalStateException expected) {
       }
 
       try {
          session.getTransacted();
          fail("expect exception after close");
-      }
-      catch (javax.jms.IllegalStateException expected) {
+      } catch (javax.jms.IllegalStateException expected) {
       }
    }
 
@@ -483,8 +469,7 @@ public class ActiveMQXAConnectionFactoryTest extends CombinationTestSupport {
       try {
          resource.rollback(tid);
          fail("Expected xa exception on no tx");
-      }
-      catch (XAException expected) {
+      } catch (XAException expected) {
          LOG.info("got expected xa", expected);
          assertEquals("no tx", XAException.XAER_NOTA, expected.errorCode);
       }
@@ -516,8 +501,7 @@ public class ActiveMQXAConnectionFactoryTest extends CombinationTestSupport {
             try {
                connection.processPrepareTransaction(new TransactionInfo(connectionId, new XATransactionId(tid), TransactionInfo.PREPARE));
                fail("did not get expected excepton on missing transaction, it must be still there in error!");
-            }
-            catch (IllegalStateException expectedOnNoTransaction) {
+            } catch (IllegalStateException expectedOnNoTransaction) {
             }
          }
       }
@@ -529,8 +513,7 @@ public class ActiveMQXAConnectionFactoryTest extends CombinationTestSupport {
       try {
          transactionBroker.getTransaction(null, new XATransactionId(tid), false);
          fail("expected exception on tx not found");
-      }
-      catch (XAException expectedOnNotFound) {
+      } catch (XAException expectedOnNotFound) {
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/AutoFailTestSupport.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/AutoFailTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/AutoFailTestSupport.java
index 4a2ccc9..fe58442 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/AutoFailTestSupport.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/AutoFailTestSupport.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -33,130 +33,130 @@ import org.slf4j.LoggerFactory;
  */
 
 public abstract class AutoFailTestSupport extends TestCase {
-    public static final int EXIT_SUCCESS = 0;
-    public static final int EXIT_ERROR = 1;
-    private static final Logger LOG = LoggerFactory.getLogger(AutoFailTestSupport.class);
-
-    private long maxTestTime = 5 * 60 * 1000; // 5 mins by default
-    private Thread autoFailThread;
-
-    private boolean verbose = true;
-    private boolean useAutoFail; // Disable auto fail by default
-    private AtomicBoolean isTestSuccess;
-
-    @Override
-    protected void setUp() throws Exception {
-        // Runs the auto fail thread before performing any setup
-        if (isAutoFail()) {
-            startAutoFailThread();
-        }
-        super.setUp();
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
-
-        // Stops the auto fail thread only after performing any clean up
-        stopAutoFailThread();
-    }
-
-    /**
-     * Manually start the auto fail thread. To start it automatically, just set
-     * the auto fail to true before calling any setup methods. As a rule, this
-     * method is used only when you are not sure, if the setUp and tearDown
-     * method is propagated correctly.
-     */
-    public void startAutoFailThread() {
-        setAutoFail(true);
-        isTestSuccess = new AtomicBoolean(false);
-        autoFailThread = new Thread(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    // Wait for test to finish successfully
-                    Thread.sleep(getMaxTestTime());
-                } catch (InterruptedException e) {
-                    // This usually means the test was successful
-                } finally {
-                    // Check if the test was able to tear down successfully,
-                    // which usually means, it has finished its run.
-                    if (!isTestSuccess.get()) {
-                        LOG.error("Test case has exceeded the maximum allotted time to run of: " + getMaxTestTime() + " ms.");
-                        dumpAllThreads(getName());
-                        if (System.getProperty("org.apache.activemq.AutoFailTestSupport.disableSystemExit") == null) {
-                            System.exit(EXIT_ERROR);
-                        } else {
-                            LOG.error("No system.exit as it kills surefire - forkedProcessTimeoutInSeconds (surefire.timeout) will kick in eventually see pom.xml surefire plugin config");
-                        }
-                    }
-                }
-            }
-        }, "AutoFailThread");
-
-        if (verbose) {
-            LOG.info("Starting auto fail thread...");
-        }
-
-        LOG.info("Starting auto fail thread...");
-        autoFailThread.start();
-    }
-
-    /**
-     * Manually stops the auto fail thread. As a rule, this method is used only
-     * when you are not sure, if the setUp and tearDown method is propagated
-     * correctly.
-     */
-    public void stopAutoFailThread() {
-        if (isAutoFail() && autoFailThread != null && autoFailThread.isAlive()) {
-            isTestSuccess.set(true);
-
-            if (verbose) {
-                LOG.info("Stopping auto fail thread...");
-            }
 
-            LOG.info("Stopping auto fail thread...");
-            autoFailThread.interrupt();
-        }
-    }
-
-    /**
-     * Sets the auto fail value. As a rule, this should be used only before any
-     * setup methods is called to automatically enable the auto fail thread in
-     * the setup method of the test case.
-     *
-     * @param val
-     */
-    public void setAutoFail(boolean val) {
-        this.useAutoFail = val;
-    }
-
-    public boolean isAutoFail() {
-        return this.useAutoFail;
-    }
-
-    /**
-     * The assigned value will only be reflected when the auto fail thread has
-     * started its run. Value is in milliseconds.
-     *
-     * @param val
-     */
-    public void setMaxTestTime(long val) {
-        this.maxTestTime = val;
-    }
-
-    public long getMaxTestTime() {
-        return this.maxTestTime;
-    }
-
-
-    public static void dumpAllThreads(String prefix) {
-        Map<Thread, StackTraceElement[]> stacks = Thread.getAllStackTraces();
-        for (Entry<Thread, StackTraceElement[]> stackEntry : stacks.entrySet()) {
-            System.err.println(prefix + " " + stackEntry.getKey());
-            for(StackTraceElement element : stackEntry.getValue()) {
-                System.err.println("     " + element);
+   public static final int EXIT_SUCCESS = 0;
+   public static final int EXIT_ERROR = 1;
+   private static final Logger LOG = LoggerFactory.getLogger(AutoFailTestSupport.class);
+
+   private long maxTestTime = 5 * 60 * 1000; // 5 mins by default
+   private Thread autoFailThread;
+
+   private boolean verbose = true;
+   private boolean useAutoFail; // Disable auto fail by default
+   private AtomicBoolean isTestSuccess;
+
+   @Override
+   protected void setUp() throws Exception {
+      // Runs the auto fail thread before performing any setup
+      if (isAutoFail()) {
+         startAutoFailThread();
+      }
+      super.setUp();
+   }
+
+   @Override
+   protected void tearDown() throws Exception {
+      super.tearDown();
+
+      // Stops the auto fail thread only after performing any clean up
+      stopAutoFailThread();
+   }
+
+   /**
+    * Manually start the auto fail thread. To start it automatically, just set
+    * the auto fail to true before calling any setup methods. As a rule, this
+    * method is used only when you are not sure, if the setUp and tearDown
+    * method is propagated correctly.
+    */
+   public void startAutoFailThread() {
+      setAutoFail(true);
+      isTestSuccess = new AtomicBoolean(false);
+      autoFailThread = new Thread(new Runnable() {
+         @Override
+         public void run() {
+            try {
+               // Wait for test to finish successfully
+               Thread.sleep(getMaxTestTime());
+            } catch (InterruptedException e) {
+               // This usually means the test was successful
+            } finally {
+               // Check if the test was able to tear down successfully,
+               // which usually means, it has finished its run.
+               if (!isTestSuccess.get()) {
+                  LOG.error("Test case has exceeded the maximum allotted time to run of: " + getMaxTestTime() + " ms.");
+                  dumpAllThreads(getName());
+                  if (System.getProperty("org.apache.activemq.AutoFailTestSupport.disableSystemExit") == null) {
+                     System.exit(EXIT_ERROR);
+                  } else {
+                     LOG.error("No system.exit as it kills surefire - forkedProcessTimeoutInSeconds (surefire.timeout) will kick in eventually see pom.xml surefire plugin config");
+                  }
+               }
             }
-        }
-    }
+         }
+      }, "AutoFailThread");
+
+      if (verbose) {
+         LOG.info("Starting auto fail thread...");
+      }
+
+      LOG.info("Starting auto fail thread...");
+      autoFailThread.start();
+   }
+
+   /**
+    * Manually stops the auto fail thread. As a rule, this method is used only
+    * when you are not sure, if the setUp and tearDown method is propagated
+    * correctly.
+    */
+   public void stopAutoFailThread() {
+      if (isAutoFail() && autoFailThread != null && autoFailThread.isAlive()) {
+         isTestSuccess.set(true);
+
+         if (verbose) {
+            LOG.info("Stopping auto fail thread...");
+         }
+
+         LOG.info("Stopping auto fail thread...");
+         autoFailThread.interrupt();
+      }
+   }
+
+   /**
+    * Sets the auto fail value. As a rule, this should be used only before any
+    * setup methods is called to automatically enable the auto fail thread in
+    * the setup method of the test case.
+    *
+    * @param val
+    */
+   public void setAutoFail(boolean val) {
+      this.useAutoFail = val;
+   }
+
+   public boolean isAutoFail() {
+      return this.useAutoFail;
+   }
+
+   /**
+    * The assigned value will only be reflected when the auto fail thread has
+    * started its run. Value is in milliseconds.
+    *
+    * @param val
+    */
+   public void setMaxTestTime(long val) {
+      this.maxTestTime = val;
+   }
+
+   public long getMaxTestTime() {
+      return this.maxTestTime;
+   }
+
+   public static void dumpAllThreads(String prefix) {
+      Map<Thread, StackTraceElement[]> stacks = Thread.getAllStackTraces();
+      for (Entry<Thread, StackTraceElement[]> stackEntry : stacks.entrySet()) {
+         System.err.println(prefix + " " + stackEntry.getKey());
+         for (StackTraceElement element : stackEntry.getValue()) {
+            System.err.println("     " + element);
+         }
+      }
+   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ClientTestSupport.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ClientTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ClientTestSupport.java
index afa6846..1249b4f 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ClientTestSupport.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ClientTestSupport.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,6 +16,7 @@
  */
 package org.apache.activemq;
 
+import javax.jms.JMSException;
 import java.io.File;
 import java.io.IOException;
 import java.net.URI;
@@ -23,8 +24,6 @@ import java.net.URISyntaxException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 
-import javax.jms.JMSException;
-
 import junit.framework.TestCase;
 
 import org.apache.activemq.broker.Broker;
@@ -72,11 +71,9 @@ public class ClientTestSupport extends TestCase {
          broker.addConnector(connector);
          broker.start();
 
-      }
-      catch (IOException e) {
+      } catch (IOException e) {
          throw new JMSException("Error creating broker " + e);
-      }
-      catch (URISyntaxException e) {
+      } catch (URISyntaxException e) {
          throw new JMSException("Error creating broker " + e);
       }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/CombinationTestSupport.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/CombinationTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/CombinationTestSupport.java
index dc8f138..23ca5a7 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/CombinationTestSupport.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/CombinationTestSupport.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -76,8 +76,7 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport {
       try {
          ProtectionDomain protectionDomain = clazz.getProtectionDomain();
          return new File(new File(protectionDomain.getCodeSource().getLocation().getPath()), "../..").getCanonicalFile();
-      }
-      catch (IOException e) {
+      } catch (IOException e) {
          return new File(".");
       }
    }
@@ -101,8 +100,7 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport {
       ComboOption co = this.comboOptions.get(attribute);
       if (co == null) {
          this.comboOptions.put(attribute, new ComboOption(attribute, Arrays.asList(options)));
-      }
-      else {
+      } else {
          co.values.addAll(Arrays.asList(options));
       }
    }
@@ -123,16 +121,13 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport {
       ServerSocket socket = null;
       try {
          socket = new ServerSocket(61616);
-      }
-      catch (IOException e) {
+      } catch (IOException e) {
          fail("61616 port not released");
-      }
-      finally {
+      } finally {
          if (socket != null)
             try {
                socket.close();
-            }
-            catch (IOException e) {
+            } catch (IOException e) {
             }
       }
    }
@@ -141,8 +136,7 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport {
    public void runBare() throws Throwable {
       if (combosEvaluated) {
          super.runBare();
-      }
-      else {
+      } else {
          CombinationTestSupport[] combinations = getCombinations();
          for (int i = 0; i < combinations.length; i++) {
             CombinationTestSupport test = combinations[i];
@@ -161,8 +155,7 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport {
          try {
             Field field = getClass().getField(attribute);
             field.set(this, value);
-         }
-         catch (Throwable e) {
+         } catch (Throwable e) {
             try {
                boolean found = false;
                String setterName = "set" + attribute.substring(0, 1).toUpperCase() +
@@ -179,8 +172,7 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport {
                   throw new NoSuchMethodError("No setter found for field: " + attribute);
                }
 
-            }
-            catch (Throwable ex) {
+            } catch (Throwable ex) {
                LOG.info("Could not set field '" + attribute + "' to value '" + value +
                            "', make sure the field exists and is public or has a setter.");
             }
@@ -192,8 +184,7 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport {
       try {
          Method method = getClass().getMethod("initCombos", (Class[]) null);
          method.invoke(this, (Object[]) null);
-      }
-      catch (Throwable e) {
+      } catch (Throwable e) {
       }
 
       String name = getName().split(" ")[0];
@@ -201,8 +192,7 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport {
       try {
          Method method = getClass().getMethod(comboSetupMethodName, (Class[]) null);
          method.invoke(this, (Object[]) null);
-      }
-      catch (Throwable e) {
+      } catch (Throwable e) {
       }
 
       try {
@@ -212,8 +202,7 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport {
          if (expandedOptions.isEmpty()) {
             combosEvaluated = true;
             return new CombinationTestSupport[]{this};
-         }
-         else {
+         } else {
 
             ArrayList<CombinationTestSupport> result = new ArrayList<>();
             // Run the test case for each possible combination
@@ -228,8 +217,7 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport {
             result.toArray(rc);
             return rc;
          }
-      }
-      catch (Throwable e) {
+      } catch (Throwable e) {
          combosEvaluated = true;
          return new CombinationTestSupport[]{this};
       }
@@ -242,8 +230,7 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport {
          if (comboOptions.size() == optionsLeft.size()) {
             map = new HashMap<>();
             expandedCombos.add(map);
-         }
-         else {
+         } else {
             map = expandedCombos.get(expandedCombos.size() - 1);
          }
 
@@ -252,8 +239,7 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport {
          int i = 0;
          if (comboOption.values.isEmpty() && !l.isEmpty()) {
             expandCombinations(l, expandedCombos);
-         }
-         else {
+         } else {
             for (Iterator<Object> iter = comboOption.values.iterator(); iter.hasNext(); ) {
                Object value = iter.next();
                if (i != 0) {
@@ -285,8 +271,7 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport {
             for (int j = 0; j < combinations.length; j++) {
                suite.addTest(combinations[j]);
             }
-         }
-         else {
+         } else {
             suite.addTest(test);
          }
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ConnectionCleanupTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ConnectionCleanupTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ConnectionCleanupTest.java
index b8397e2..c26831f 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ConnectionCleanupTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ConnectionCleanupTest.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -53,8 +53,7 @@ public class ConnectionCleanupTest extends TestCase {
       try {
          connection.setClientID("test");
          fail("Should have received JMSException");
-      }
-      catch (JMSException e) {
+      } catch (JMSException e) {
       }
 
       connection.doCleanup(true);
@@ -65,8 +64,7 @@ public class ConnectionCleanupTest extends TestCase {
       try {
          connection.setClientID("test");
          fail("Should have received JMSException");
-      }
-      catch (JMSException e) {
+      } catch (JMSException e) {
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ConnectionCloseMultipleTimesConcurrentTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ConnectionCloseMultipleTimesConcurrentTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ConnectionCloseMultipleTimesConcurrentTest.java
index c4e5086..9c44b6d 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ConnectionCloseMultipleTimesConcurrentTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ConnectionCloseMultipleTimesConcurrentTest.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,12 +16,12 @@
  */
 package org.apache.activemq;
 
+import javax.jms.JMSException;
+import javax.jms.Session;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
-import javax.jms.JMSException;
-import javax.jms.Session;
 
 import junit.framework.TestCase;
 
@@ -78,8 +78,7 @@ public class ConnectionCloseMultipleTimesConcurrentTest extends TestCase {
                   assertTrue(connection.isClosed());
 
                   latch.countDown();
-               }
-               catch (JMSException e) {
+               } catch (JMSException e) {
                   // ignore
                }
             }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ConnectionCloseMultipleTimesTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ConnectionCloseMultipleTimesTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ConnectionCloseMultipleTimesTest.java
index dbd31f2..e6d56ce 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ConnectionCloseMultipleTimesTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ConnectionCloseMultipleTimesTest.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,


Mime
View raw message