activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [16/21] activemq-artemis git commit: More test-suite refactoring
Date Thu, 28 May 2015 15:19:07 GMT
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/SimpleStringTest.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/SimpleStringTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/SimpleStringTest.java
index cc45e64..048b686 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/SimpleStringTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/SimpleStringTest.java
@@ -437,7 +437,7 @@ public class SimpleStringTest extends Assert
             x[i].start();
          }
 
-         ServiceTestBase.waitForLatch(latch);
+         ActiveMQTestBase.waitForLatch(latch);
          start.countDown();
 
          for (T t : x)

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/SingleServerTestBase.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/SingleServerTestBase.java b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/SingleServerTestBase.java
index 017c5aa..9de960b 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/SingleServerTestBase.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/SingleServerTestBase.java
@@ -16,12 +16,9 @@
  */
 package org.apache.activemq.artemis.tests.util;
 
-import org.apache.activemq.artemis.api.core.TransportConfiguration;
 import org.apache.activemq.artemis.api.core.client.ClientSession;
 import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
-import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
 import org.apache.activemq.artemis.api.core.client.ServerLocator;
-import org.apache.activemq.artemis.core.config.Configuration;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.junit.Before;
 
@@ -29,9 +26,8 @@ import org.junit.Before;
  * Any test based on a single server can extend this class.
  * This is useful for quick writing tests with starting a server, locator, factory... etc
  */
-public abstract class SingleServerTestBase extends ServiceTestBase
+public abstract class SingleServerTestBase extends ActiveMQTestBase
 {
-
    protected ActiveMQServer server;
 
    protected ClientSession session;
@@ -47,9 +43,7 @@ public abstract class SingleServerTestBase extends ServiceTestBase
    {
       super.setUp();
 
-      Configuration configuration = createDefaultConfig()
-         .setSecurityEnabled(false);
-      server = createServer(false, configuration);
+      server = createServer(false, createDefaultInVMConfig());
       server.start();
 
       locator = createLocator();
@@ -59,9 +53,6 @@ public abstract class SingleServerTestBase extends ServiceTestBase
 
    protected ServerLocator createLocator()
    {
-      ServerLocator retlocator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(INVM_CONNECTOR_FACTORY));
-      addServerLocator(retlocator);
-      return retlocator;
+      return createInVMNonHALocator();
    }
-
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/docs/hacking-guide/en/tests.md
----------------------------------------------------------------------
diff --git a/docs/hacking-guide/en/tests.md b/docs/hacking-guide/en/tests.md
index 24bb520..ce78b76 100644
--- a/docs/hacking-guide/en/tests.md
+++ b/docs/hacking-guide/en/tests.md
@@ -22,6 +22,48 @@ The broker is comprised of POJOs so it's simple to configure and run a broker in
 Even complex test-cases involving multiple clustered brokers are relatively easy to write. Almost every test in the 
 test-suite follows this pattern - configure broker, start broker, test functionality, stop broker.
 
-The test-suite uses JUnit to manage test execution and life-cycle.  Most tests extend [org.apache.activemq.artemis.tests.util.ServiceTestBase](../../../artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ServiceTestBase.java)
+The test-suite uses JUnit to manage test execution and life-cycle.  Most tests extend [org.apache.activemq.artemis.tests.util.ActiveMQTestBase](../../../artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java)
 which contains JUnit setup and tear-down methods as well as a wealth of utility functions to configure, start, manage,
-and stop brokers as well as perform other common tasks.
\ No newline at end of file
+and stop brokers as well as perform other common tasks.
+
+Check out [`org.apache.activemq.artemis.tests.integration.SimpleTest`](../../../tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/SimpleTest.java).
+It's a very simple test-case that extends `org.apache.activemq.artemis.tests.util.ActiveMQTestBase` and uses its methods
+to configure a server, run a test, and then `super.tearDown()` cleans it up once the test completes. The test-case 
+includes comments to explain everything. As the name implies, this is a simple test-case that demonstrates the most basic
+functionality of the test-suite. A simple test like this takes less than a second to run on modern hardware.
+
+Although `org.apache.activemq.artemis.tests.integration.SimpleTest` is simple it could be simpler still by extending
+[`org.apache.activemq.artemis.tests.util.SingleServerTestBase`](../../../artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/SingleServerTestBase.java).
+This class does all the setup of a simple server automatically and provides the test-case with a `ServerLocator`, 
+`ClientSessionFactory`, and `ClientSession` instance. [`org.apache.activemq.artemis.tests.integration.SingleServerSimpleTest`](../../../tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/SingleServerSimpleTest.java)
+is an example based on `org.apache.activemq.artemis.tests.integration.SimpleTest` but extends `org.apache.activemq.artemis.tests.util.SingleServerTestBase`
+which eliminates all the setup and class variables which are provided by `SingleServerTestBase` itself.
+
+## Keys for writing good tests
+
+### Avoid leaks
+
+An important task for any test-case is to clean up all the resources it creates when it runs. This includes the server
+instance itself and any resources created to connect to it (e.g. instances of `ServerLocator`, `ClientSessionFactory`,
+`ClientSession`, etc.). This task is typically completed in the test's `tearDown()` method.  However, `ActiveMQTestBase` 
+(and other classes which extend it) simplifies this process. As [`org.apache.activemq.artemis.tests.integration.SimpleTest`](../../../tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/SimpleTest.java)
+demonstrates, there are several methods you can use when creating your test which will ensure proper clean up _automatically_
+when the test is torn down. These include:
+
+- All the overloaded `org.apache.activemq.artemis.tests.util.ActiveMQTestBase.createServer(..)` methods. If you choose
+_not_ to use one of these methods to create your `ActiveMQServer` instance then use the `addServer(ActiveMQServer)` 
+method to add the instance to the test-suite's internal resource ledger.
+- Methods from `org.apache.activemq.artemis.tests.util.ActiveMQTestBase` to create a `ServerLocator` like 
+`createInVMNonHALocator` and `createNettyNonHALocator`. If you choose _not_ to use one of these methods then use 
+`addServerLocator(ServerLocator)` to add the locator to the test-suite's internal resource ledger.
+- `org.apache.activemq.artemis.tests.util.ActiveMQTestBase.createSessionFactory(ServerLocator)` for creating your session
+factory. If you choose _not_ to use this method then use `org.apache.activemq.artemis.tests.util.ActiveMQTestBase.addSessionFactory`
+to add the factory to the test-suite's internal resource ledger.
+
+### Create configurations
+
+There are numerous methods in `org.apache.activemq.artemis.tests.util.ActiveMQTestBase` to create a configuration. These
+methods are named like create*Config(..). Each one creates a slightly different configuration but there is a lot of 
+overlap between them. 
+
+    
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BMFailoverTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BMFailoverTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BMFailoverTest.java
index 7a726cb..84a056a 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BMFailoverTest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BMFailoverTest.java
@@ -16,10 +16,6 @@
  */
 package org.apache.activemq.artemis.tests.extras.byteman;
 
-import javax.transaction.xa.XAException;
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
-
 import org.apache.activemq.artemis.api.core.ActiveMQTransactionOutcomeUnknownException;
 import org.apache.activemq.artemis.api.core.ActiveMQTransactionRolledBackException;
 import org.apache.activemq.artemis.api.core.ActiveMQUnBlockedException;
@@ -45,12 +41,15 @@ import org.apache.activemq.artemis.utils.UUIDGenerator;
 import org.jboss.byteman.contrib.bmunit.BMRule;
 import org.jboss.byteman.contrib.bmunit.BMRules;
 import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
-import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
 @RunWith(BMUnitRunner.class)
 public class BMFailoverTest extends FailoverTestBase
 {
@@ -68,13 +67,6 @@ public class BMFailoverTest extends FailoverTestBase
       locator = getServerLocator();
    }
 
-   @After
-   @Override
-   public void tearDown() throws Exception
-   {
-      super.tearDown();
-   }
-
    private static boolean stopped = false;
    public static void stopAndThrow() throws ActiveMQUnBlockedException
    {
@@ -209,8 +201,8 @@ public class BMFailoverTest extends FailoverTestBase
    public void testFailoverOnCommit2() throws Exception
    {
       serverToStop = liveServer;
-      locator = getServerLocator();
-      locator.setFailoverOnInitialConnection(true);
+      locator = getServerLocator()
+              .setFailoverOnInitialConnection(true);
       SimpleString inQueue = new SimpleString("inQueue");
       SimpleString outQueue = new SimpleString("outQueue");
       createSessionFactory();
@@ -312,8 +304,8 @@ public class BMFailoverTest extends FailoverTestBase
    public void testFailoverOnCommit() throws Exception
    {
       serverToStop = liveServer;
-      locator = getServerLocator();
-      locator.setFailoverOnInitialConnection(true);
+      locator = getServerLocator()
+              .setFailoverOnInitialConnection(true);
       createSessionFactory();
       ClientSession session = createSessionAndQueue();
 
@@ -353,8 +345,8 @@ public class BMFailoverTest extends FailoverTestBase
    public void testFailoverOnReceiveCommit() throws Exception
    {
       serverToStop = liveServer;
-      locator = getServerLocator();
-      locator.setFailoverOnInitialConnection(true);
+      locator = getServerLocator()
+              .setFailoverOnInitialConnection(true);
       createSessionFactory();
       ClientSession session = createSessionAndQueue();
 
@@ -433,9 +425,9 @@ public class BMFailoverTest extends FailoverTestBase
 
    private void createSessionFactory() throws Exception
    {
-      locator.setBlockOnNonDurableSend(true);
-      locator.setBlockOnDurableSend(true);
-      locator.setReconnectAttempts(-1);
+      locator.setBlockOnNonDurableSend(true)
+              .setBlockOnDurableSend(true)
+              .setReconnectAttempts(-1);
 
       sf = createSessionFactoryAndWaitForTopology(locator, 2);
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BridgeServerLocatorConfigurationTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BridgeServerLocatorConfigurationTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BridgeServerLocatorConfigurationTest.java
index 3008421..f62001b 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BridgeServerLocatorConfigurationTest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BridgeServerLocatorConfigurationTest.java
@@ -28,14 +28,14 @@ import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
 import org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.cluster.impl.BridgeImpl;
-import org.apache.activemq.artemis.tests.util.ServiceTestBase;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.jboss.byteman.contrib.bmunit.BMRule;
 import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
 @RunWith(BMUnitRunner.class)
-public class BridgeServerLocatorConfigurationTest extends ServiceTestBase
+public class BridgeServerLocatorConfigurationTest extends ActiveMQTestBase
 {
 
    private static final long BRIDGE_TTL = 1234L;
@@ -130,10 +130,10 @@ public class BridgeServerLocatorConfigurationTest extends ServiceTestBase
          server1.getConfiguration().setQueueConfigurations(queueConfigs1);
 
          server1.start();
-         waitForServer(server1);
+         waitForServerToStart(server1);
 
          serverWithBridge.start();
-         waitForServer(serverWithBridge);
+         waitForServerToStart(serverWithBridge);
 
          long bridgeTTL = getBridgeTTL(serverWithBridge, BRIDGE_NAME);
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClosingConnectionTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClosingConnectionTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClosingConnectionTest.java
index 24f5af3..2e82f32 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClosingConnectionTest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClosingConnectionTest.java
@@ -31,7 +31,7 @@ import org.apache.activemq.artemis.core.server.JournalType;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
 import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper;
-import org.apache.activemq.artemis.tests.util.ServiceTestBase;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.jboss.byteman.contrib.bmunit.BMRule;
 import org.jboss.byteman.contrib.bmunit.BMRules;
 import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
@@ -40,7 +40,7 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 
 @RunWith(BMUnitRunner.class)
-public class ClosingConnectionTest extends ServiceTestBase
+public class ClosingConnectionTest extends ActiveMQTestBase
 {
    public static final SimpleString ADDRESS = new SimpleString("SimpleAddress");
 
@@ -68,7 +68,7 @@ public class ClosingConnectionTest extends ServiceTestBase
       server.getConfiguration().setJournalType(JournalType.NIO);
       server.getConfiguration().setJMXManagementEnabled(true);
       server.start();
-      waitForServer(server);
+      waitForServerToStart(server);
       locator = createFactory(isNetty());
       readyToKill = false;
    }
@@ -135,9 +135,9 @@ public class ClosingConnectionTest extends ServiceTestBase
       )
    public void testKillConnection() throws Exception
    {
-      locator.setBlockOnNonDurableSend(true);
-      locator.setBlockOnDurableSend(true);
-      locator.setBlockOnAcknowledge(true);
+      locator.setBlockOnNonDurableSend(true)
+              .setBlockOnDurableSend(true)
+              .setBlockOnAcknowledge(true);
 
       ClientSessionFactory sf = createSessionFactory(locator);
       ClientSession session = sf.createSession("guest", null, false, true, true, false, 0);
@@ -182,9 +182,9 @@ public class ClosingConnectionTest extends ServiceTestBase
       ActiveMQServer server = createServer(true, createDefaultConfig(isNetty()));
       server.setMBeanServer(mBeanServer);
 
-      AddressSettings defaultSetting = new AddressSettings();
-      defaultSetting.setPageSizeBytes(10 * 1024);
-      defaultSetting.setMaxSizeBytes(20 * 1024);
+      AddressSettings defaultSetting = new AddressSettings()
+              .setPageSizeBytes(10 * 1024)
+              .setMaxSizeBytes(20 * 1024);
 
       server.getAddressSettingsRepository().addMatch("#", defaultSetting);
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClusteredGroupingTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClusteredGroupingTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClusteredGroupingTest.java
index 4aea3bc..7041da2 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClusteredGroupingTest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClusteredGroupingTest.java
@@ -16,14 +16,11 @@
  */
 package org.apache.activemq.artemis.tests.extras.byteman;
 
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
 import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException;
 import org.apache.activemq.artemis.api.core.Message;
 import org.apache.activemq.artemis.api.core.SimpleString;
-import org.apache.activemq.artemis.api.core.management.ManagementHelper;
 import org.apache.activemq.artemis.api.core.management.CoreNotificationType;
+import org.apache.activemq.artemis.api.core.management.ManagementHelper;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.group.impl.GroupingHandlerConfiguration;
 import org.apache.activemq.artemis.core.server.group.impl.Response;
@@ -32,11 +29,12 @@ import org.apache.activemq.artemis.tests.integration.cluster.distribution.Cluste
 import org.jboss.byteman.contrib.bmunit.BMRule;
 import org.jboss.byteman.contrib.bmunit.BMRules;
 import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
 @RunWith(BMUnitRunner.class)
 public class ClusteredGroupingTest extends ClusterTestBase
 {
@@ -445,24 +443,6 @@ public class ClusteredGroupingTest extends ClusterTestBase
       latch.countDown();
    }
 
-
-   @Override
-   @Before
-   public void setUp() throws Exception
-   {
-      super.setUp();
-   }
-
-   @Override
-   @After
-   public void tearDown() throws Exception
-   {
-      closeAllConsumers();
-      closeAllSessionFactories();
-      closeAllServerLocatorsFactories();
-      super.tearDown();
-   }
-
    public boolean isNetty()
    {
       return true;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/GroupingTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/GroupingTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/GroupingTest.java
index 3cfcfcd..6f36d4f 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/GroupingTest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/GroupingTest.java
@@ -16,15 +16,6 @@
  */
 package org.apache.activemq.artemis.tests.extras.byteman;
 
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
 import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException;
 import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
 import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
@@ -32,11 +23,19 @@ import org.apache.activemq.artemis.tests.util.JMSTestBase;
 import org.jboss.byteman.contrib.bmunit.BMRule;
 import org.jboss.byteman.contrib.bmunit.BMRules;
 import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
 /**
  * GroupingTest
  */
@@ -55,13 +54,6 @@ public class GroupingTest extends JMSTestBase
       queue = createQueue("TestQueue");
    }
 
-   @After
-   @Override
-   public void tearDown() throws Exception
-   {
-      super.tearDown();
-   }
-
    protected ConnectionFactory getCF() throws Exception
    {
       return cf;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LatencyTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LatencyTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LatencyTest.java
index deb8b94..f411980 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LatencyTest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LatencyTest.java
@@ -20,7 +20,7 @@ import org.apache.activemq.artemis.api.core.client.ClientSession;
 import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
 import org.apache.activemq.artemis.api.core.client.ServerLocator;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
-import org.apache.activemq.artemis.tests.util.ServiceTestBase;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.jboss.byteman.contrib.bmunit.BMRule;
 import org.jboss.byteman.contrib.bmunit.BMRules;
 import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
@@ -28,7 +28,7 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 
 @RunWith(BMUnitRunner.class)
-public class LatencyTest extends ServiceTestBase
+public class LatencyTest extends ActiveMQTestBase
 {
    /*
    * simple test to make sure connect still works with some network latency  built into netty
@@ -58,7 +58,7 @@ public class LatencyTest extends ServiceTestBase
       )
    public void testLatency() throws Exception
    {
-      ActiveMQServer server = createServer(createDefaultConfig(true));
+      ActiveMQServer server = createServer(createDefaultNettyConfig());
       server.start();
       ServerLocator locator = createNettyNonHALocator();
       ClientSessionFactory factory = createSessionFactory(locator);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/OrphanedConsumerTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/OrphanedConsumerTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/OrphanedConsumerTest.java
index efda5c9..01e92f8 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/OrphanedConsumerTest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/OrphanedConsumerTest.java
@@ -26,7 +26,7 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator;
 import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.Queue;
-import org.apache.activemq.artemis.tests.util.ServiceTestBase;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.jboss.byteman.contrib.bmunit.BMRule;
 import org.jboss.byteman.contrib.bmunit.BMRules;
 import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
@@ -36,7 +36,7 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 
 @RunWith(BMUnitRunner.class)
-public class OrphanedConsumerTest extends ServiceTestBase
+public class OrphanedConsumerTest extends ActiveMQTestBase
 {
 
    private static boolean conditionActive = true;
@@ -200,16 +200,16 @@ public class OrphanedConsumerTest extends ServiceTestBase
       server.start();
       staticServer = server;
 
-      locator.setBlockOnNonDurableSend(false);
-      locator.setBlockOnDurableSend(false);
-      locator.setBlockOnAcknowledge(true);
-      locator.setConnectionTTL(1000);
-      locator.setClientFailureCheckPeriod(100);
-      locator.setReconnectAttempts(0);
       // We are not interested on consumer-window-size on this test
       // We want that every message is delivered
       // as we asserting for number of consumers available and round-robin on delivery
-      locator.setConsumerWindowSize(-1);
+      locator.setConsumerWindowSize(-1)
+              .setBlockOnNonDurableSend(false)
+              .setBlockOnDurableSend(false)
+              .setBlockOnAcknowledge(true)
+              .setConnectionTTL(1000)
+              .setClientFailureCheckPeriod(100)
+              .setReconnectAttempts(0);
 
       ClientSessionFactoryImpl sf = (ClientSessionFactoryImpl)createSessionFactory(locator);
 
@@ -258,13 +258,12 @@ public class OrphanedConsumerTest extends ServiceTestBase
 
       setConditionActive(false);
 
-      locator = internalCreateNonHALocator(true);
-
-      locator.setBlockOnNonDurableSend(false);
-      locator.setBlockOnDurableSend(false);
-      locator.setBlockOnAcknowledge(true);
-      locator.setReconnectAttempts(0);
-      locator.setConsumerWindowSize(-1);
+      locator = internalCreateNonHALocator(true)
+              .setBlockOnNonDurableSend(false)
+              .setBlockOnDurableSend(false)
+              .setBlockOnAcknowledge(true)
+              .setReconnectAttempts(0)
+              .setConsumerWindowSize(-1);
 
       sf = (ClientSessionFactoryImpl)locator.createSessionFactory();
       session = sf.createSession(true, true, 0);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/PagingLeakTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/PagingLeakTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/PagingLeakTest.java
index bbf43d5..87d73b4 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/PagingLeakTest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/PagingLeakTest.java
@@ -16,12 +16,7 @@
  */
 package org.apache.activemq.artemis.tests.extras.byteman;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-
 import org.apache.activemq.artemis.api.core.SimpleString;
-import org.apache.activemq.artemis.api.core.TransportConfiguration;
 import org.apache.activemq.artemis.api.core.client.ClientConsumer;
 import org.apache.activemq.artemis.api.core.client.ClientMessage;
 import org.apache.activemq.artemis.api.core.client.ClientProducer;
@@ -34,7 +29,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.ActiveMQServers;
 import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
-import org.apache.activemq.artemis.tests.util.ServiceTestBase;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.jboss.byteman.contrib.bmunit.BMRule;
 import org.jboss.byteman.contrib.bmunit.BMRules;
 import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
@@ -43,8 +38,12 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
 @RunWith(BMUnitRunner.class)
-public class PagingLeakTest extends ServiceTestBase
+public class PagingLeakTest extends ActiveMQTestBase
 {
 
    private static final AtomicInteger pagePosInstances = new AtomicInteger(0);
@@ -120,26 +119,19 @@ public class PagingLeakTest extends ServiceTestBase
 
       final ArrayList<Exception> errors = new ArrayList<Exception>();
       // A backup that will be waiting to be activated
-      Configuration conf = createDefaultConfig(true)
-         .setSecurityEnabled(false)
-         .addConnectorConfiguration("invm", new TransportConfiguration(INVM_CONNECTOR_FACTORY));
-
-      final ActiveMQServer server = ActiveMQServers.newActiveMQServer(conf, true);
-      addServer(server);
+      Configuration config = createDefaultNettyConfig();
 
+      final ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(config, true));
 
       server.start();
 
-
-      AddressSettings settings = new AddressSettings();
-      settings.setPageSizeBytes(20 * 1024);
-      settings.setMaxSizeBytes(200 * 1024);
-      settings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE);
-
+      AddressSettings settings = new AddressSettings()
+              .setPageSizeBytes(20 * 1024)
+              .setMaxSizeBytes(200 * 1024)
+              .setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE);
 
       server.getAddressSettingsRepository().addMatch("#", settings);
 
-
       final SimpleString address = new SimpleString("pgdAddress");
 
       class Consumer extends Thread
@@ -154,7 +146,6 @@ public class PagingLeakTest extends ServiceTestBase
 
          Consumer(int sleepTime, String suffix, int maxConsumed) throws Exception
          {
-
             server.createQueue(address, address.concat(suffix), null, true, false);
 
             this.sleepTime = sleepTime;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ReplicationBackupTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ReplicationBackupTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ReplicationBackupTest.java
index aa8165c..97b6838 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ReplicationBackupTest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ReplicationBackupTest.java
@@ -20,7 +20,7 @@ import org.apache.activemq.artemis.api.core.TransportConfiguration;
 import org.apache.activemq.artemis.core.config.Configuration;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.tests.util.ReplicatedBackupUtils;
-import org.apache.activemq.artemis.tests.util.ServiceTestBase;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.apache.activemq.artemis.tests.util.TransportConfigurationUtils;
 import org.jboss.byteman.contrib.bmunit.BMRule;
 import org.jboss.byteman.contrib.bmunit.BMRules;
@@ -31,7 +31,7 @@ import org.junit.runner.RunWith;
 import java.util.concurrent.CountDownLatch;
 
 @RunWith(BMUnitRunner.class)
-public class ReplicationBackupTest extends ServiceTestBase
+public class ReplicationBackupTest extends ActiveMQTestBase
 {
    private static final CountDownLatch ruleFired = new CountDownLatch(1);
    private ActiveMQServer backupServer;
@@ -63,15 +63,13 @@ public class ReplicationBackupTest extends ServiceTestBase
       TransportConfiguration backupConnector = TransportConfigurationUtils.getNettyConnector(false, 0);
       TransportConfiguration backupAcceptor = TransportConfigurationUtils.getNettyAcceptor(false, 0);
 
-      final String suffix = "_backup";
+      Configuration backupConfig = createDefaultInVMConfig()
+         .setBindingsDirectory(getBindingsDir(0, true))
+         .setJournalDirectory(getJournalDir(0, true))
+         .setPagingDirectory(getPageDir(0, true))
+         .setLargeMessagesDirectory(getLargeMessagesDir(0, true));
 
-      Configuration backupConfig = createDefaultConfig()
-         .setBindingsDirectory(getBindingsDir() + suffix)
-         .setJournalDirectory(getJournalDir() + suffix)
-         .setPagingDirectory(getPageDir() + suffix)
-         .setLargeMessagesDirectory(getLargeMessagesDir() + suffix);
-
-      Configuration liveConfig = createDefaultConfig();
+      Configuration liveConfig = createDefaultInVMConfig();
 
       ReplicatedBackupUtils.configureReplicationPair(backupConfig, backupConnector, backupAcceptor, liveConfig, liveConnector, liveAcceptor);
 
@@ -99,7 +97,7 @@ public class ReplicationBackupTest extends ServiceTestBase
 
       backupServer = createServer(backupConfig);
       backupServer.start();
-      ServiceTestBase.waitForRemoteBackup(null, 3, true, backupServer);
+      ActiveMQTestBase.waitForRemoteBackup(null, 3, true, backupServer);
    }
 
    public static void breakIt()

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ScaleDownFailoverTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ScaleDownFailoverTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ScaleDownFailoverTest.java
index a4c3b40..b93023a 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ScaleDownFailoverTest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ScaleDownFailoverTest.java
@@ -25,7 +25,6 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
 import org.jboss.byteman.contrib.bmunit.BMRule;
 import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
-import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -84,17 +83,6 @@ public class ScaleDownFailoverTest extends ClusterTestBase
       return false;
    }
 
-   @Override
-   @After
-   public void tearDown() throws Exception
-   {
-      closeAllConsumers();
-      closeAllSessionFactories();
-      closeAllServerLocatorsFactories();
-      stopServers(0, 1, 2);
-      super.tearDown();
-   }
-
 
    @Test
    @BMRule

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ScaleDownFailureTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ScaleDownFailureTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ScaleDownFailureTest.java
index 4f60723..35f2082 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ScaleDownFailureTest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ScaleDownFailureTest.java
@@ -22,7 +22,6 @@ import org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration;
 import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
 import org.jboss.byteman.contrib.bmunit.BMRule;
 import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
-import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -62,18 +61,6 @@ public class ScaleDownFailureTest extends ClusterTestBase
       return false;
    }
 
-   @Override
-   @After
-   public void tearDown() throws Exception
-   {
-      closeAllConsumers();
-      closeAllSessionFactories();
-      closeAllServerLocatorsFactories();
-      ((LiveOnlyPolicyConfiguration) servers[0].getConfiguration().getHAPolicyConfiguration()).setScaleDownConfiguration(null);
-      stopServers(0, 1);
-      super.tearDown();
-   }
-
    @Test
    @BMRule
       (

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StartStopDeadlockTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StartStopDeadlockTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StartStopDeadlockTest.java
index d45606c..e320a1a 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StartStopDeadlockTest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StartStopDeadlockTest.java
@@ -16,10 +16,6 @@
  */
 package org.apache.activemq.artemis.tests.extras.byteman;
 
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.activemq.artemis.api.core.TransportConfiguration;
 import org.apache.activemq.artemis.core.config.Configuration;
 import org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration;
 import org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration;
@@ -28,19 +24,21 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.ActiveMQServers;
 import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
 import org.apache.activemq.artemis.tests.unit.util.InVMNamingContext;
-import org.apache.activemq.artemis.tests.util.ServiceTestBase;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.jboss.byteman.contrib.bmunit.BMRule;
 import org.jboss.byteman.contrib.bmunit.BMRules;
 import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
-import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicInteger;
+
 /**
  * This test validates a deadlock identified by https://bugzilla.redhat.com/show_bug.cgi?id=959616
  */
 @RunWith(BMUnitRunner.class)
-public class StartStopDeadlockTest extends ServiceTestBase
+public class StartStopDeadlockTest extends ActiveMQTestBase
 {
    /*
    * simple test to make sure connect still works with some network latency  built into netty
@@ -80,23 +78,17 @@ public class StartStopDeadlockTest extends ServiceTestBase
    {
 
       // A live server that will always be crashed
-      Configuration confLive = createDefaultConfig(true)
-         .setSecurityEnabled(false)
-         .setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration())
-         .addConnectorConfiguration("invm", new TransportConfiguration(INVM_CONNECTOR_FACTORY));
-      final ActiveMQServer serverLive = ActiveMQServers.newActiveMQServer(confLive);
+      Configuration confLive = createDefaultNettyConfig()
+         .setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration());
+      final ActiveMQServer serverLive = addServer(ActiveMQServers.newActiveMQServer(confLive));
       serverLive.start();
-      addServer(serverLive);
 
 
       // A backup that will be waiting to be activated
-      Configuration conf = createDefaultConfig(true)
-         .setSecurityEnabled(false)
-         .setHAPolicyConfiguration(new SharedStoreSlavePolicyConfiguration())
-         .addConnectorConfiguration("invm", new TransportConfiguration(INVM_CONNECTOR_FACTORY));
+      Configuration config = createDefaultNettyConfig()
+         .setHAPolicyConfiguration(new SharedStoreSlavePolicyConfiguration());
 
-      final ActiveMQServer server = ActiveMQServers.newActiveMQServer(conf, true);
-      addServer(server);
+      final ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(config, true));
 
       final JMSServerManagerImpl jmsServer = new JMSServerManagerImpl(server);
       final InVMNamingContext context = new InVMNamingContext();
@@ -158,11 +150,4 @@ public class StartStopDeadlockTest extends ServiceTestBase
 
       assertEquals(0, errors.get());
    }
-
-   @Override
-   @After
-   public void tearDown() throws Exception
-   {
-      super.tearDown();
-   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StompInternalStateTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StompInternalStateTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StompInternalStateTest.java
index ebd57b6..e5c9ae9 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StompInternalStateTest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StompInternalStateTest.java
@@ -16,10 +16,6 @@
  */
 package org.apache.activemq.artemis.tests.extras.byteman;
 
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
 import org.apache.activemq.artemis.api.core.TransportConfiguration;
 import org.apache.activemq.artemis.api.core.client.ClientSession;
 import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
@@ -27,22 +23,24 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator;
 import org.apache.activemq.artemis.api.core.management.CoreNotificationType;
 import org.apache.activemq.artemis.core.config.Configuration;
 import org.apache.activemq.artemis.core.protocol.stomp.StompProtocolManagerFactory;
-import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory;
 import org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory;
 import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.management.Notification;
-import org.apache.activemq.artemis.tests.util.ServiceTestBase;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.jboss.byteman.contrib.bmunit.BMRule;
 import org.jboss.byteman.contrib.bmunit.BMRules;
 import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
 @RunWith(BMUnitRunner.class)
-public class StompInternalStateTest extends ServiceTestBase
+public class StompInternalStateTest extends ActiveMQTestBase
 {
    private static final String STOMP_QUEUE_NAME = "jms.queue.StompTestQueue";
 
@@ -92,17 +90,15 @@ public class StompInternalStateTest extends ServiceTestBase
    @Override
    protected Configuration createDefaultConfig(final boolean netty) throws Exception
    {
-      Configuration config = super.createDefaultConfig(netty)
-         .setSecurityEnabled(false)
-         .setPersistenceEnabled(false);
-
-      Map<String, Object> params = new HashMap<String, Object>();
+      Map<String, Object> params = new HashMap<>();
       params.put(TransportConstants.PROTOCOLS_PROP_NAME, StompProtocolManagerFactory.STOMP_PROTOCOL_NAME);
       params.put(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_STOMP_PORT);
       params.put(TransportConstants.STOMP_CONSUMERS_CREDIT, "-1");
       TransportConfiguration stompTransport = new TransportConfiguration(NettyAcceptorFactory.class.getName(), params);
-      config.getAcceptorConfigurations().add(stompTransport);
-      config.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
+
+      Configuration config = super.createDefaultConfig(netty)
+              .setPersistenceEnabled(false)
+              .addAcceptorConfiguration(stompTransport);
 
       return config;
    }
@@ -132,15 +128,7 @@ public class StompInternalStateTest extends ServiceTestBase
    public void setUp() throws Exception
    {
       super.setUp();
-      server = createServer(createDefaultConfig(true));
+      server = createServer(createDefaultNettyConfig());
       server.start();
    }
-
-   @Override
-   @After
-   public void tearDown() throws Exception
-   {
-      server.stop();
-      super.tearDown();
-   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java
index 1dc7d9e..a13ff37 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java
@@ -60,12 +60,12 @@ import org.apache.activemq.artemis.jms.server.JMSServerManager;
 import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
 import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
 import org.apache.activemq.artemis.tests.unit.util.InVMNamingContext;
-import org.apache.activemq.artemis.tests.util.ServiceTestBase;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 
-public abstract class BridgeTestBase extends ServiceTestBase
+public abstract class BridgeTestBase extends ActiveMQTestBase
 {
    private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
 
@@ -392,7 +392,7 @@ public abstract class BridgeTestBase extends ServiceTestBase
             if (largeMessage)
             {
                BytesMessage msg = sess.createBytesMessage();
-               ((ActiveMQMessage) msg).setInputStream(ServiceTestBase.createFakeLargeStream(1024L * 1024L));
+               ((ActiveMQMessage) msg).setInputStream(ActiveMQTestBase.createFakeLargeStream(1024L * 1024L));
                msg.setStringProperty("msg", "message" + i);
                prod.send(msg);
             }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/ClusteredBridgeTestBase.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/ClusteredBridgeTestBase.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/ClusteredBridgeTestBase.java
index 5f32f9f..1af1080 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/ClusteredBridgeTestBase.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/ClusteredBridgeTestBase.java
@@ -53,7 +53,7 @@ import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
 import org.apache.activemq.artemis.jms.server.JMSServerManager;
 import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
 import org.apache.activemq.artemis.tests.unit.util.InVMContext;
-import org.apache.activemq.artemis.tests.util.ServiceTestBase;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.junit.After;
 import org.junit.Before;
 
@@ -62,7 +62,7 @@ import org.junit.Before;
  * This class serves as a base class for jms bridge tests in
  * clustered scenarios.
  */
-public abstract class ClusteredBridgeTestBase extends ServiceTestBase
+public abstract class ClusteredBridgeTestBase extends ActiveMQTestBase
 {
    private static int index = 0;
 
@@ -170,7 +170,7 @@ public abstract class ClusteredBridgeTestBase extends ServiceTestBase
          liveNode.setRegistry(new JndiBindingRegistry(liveContext));
 
          //backup
-         Configuration conf = createBasicConfig()
+         Configuration config = createBasicConfig()
             .setJournalDirectory(getJournalDir(id, true))
             .setBindingsDirectory(getBindingsDir(id, true))
             .addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY, params))
@@ -179,7 +179,7 @@ public abstract class ClusteredBridgeTestBase extends ServiceTestBase
             .setHAPolicyConfiguration(new ReplicaPolicyConfiguration())
             .addClusterConfiguration(basicClusterConnectionConfig(backupConnector.getName(), liveConnector.getName()));
 
-         ActiveMQServer backup = addServer(ActiveMQServers.newActiveMQServer(conf, true));
+         ActiveMQServer backup = addServer(ActiveMQServers.newActiveMQServer(config, true));
 
          Context context = new InVMContext();
 
@@ -190,12 +190,12 @@ public abstract class ClusteredBridgeTestBase extends ServiceTestBase
       public void start() throws Exception
       {
          liveNode.start();
-         waitForServer(liveNode.getActiveMQServer());
+         waitForServerToStart(liveNode.getActiveMQServer());
          backupNode.start();
          waitForRemoteBackupSynchronization(backupNode.getActiveMQServer());
 
-         locator = ActiveMQClient.createServerLocatorWithHA(liveConnector);
-         locator.setReconnectAttempts(-1);
+         locator = ActiveMQClient.createServerLocatorWithHA(liveConnector)
+                 .setReconnectAttempts(-1);
          sessionFactory = locator.createSessionFactory();
       }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/protocols/hornetq/HornetQProtocolTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/protocols/hornetq/HornetQProtocolTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/protocols/hornetq/HornetQProtocolTest.java
index 0b37887..5e84c03 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/protocols/hornetq/HornetQProtocolTest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/protocols/hornetq/HornetQProtocolTest.java
@@ -27,11 +27,8 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
 import org.apache.activemq.artemis.api.core.client.ServerLocator;
 import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
-import org.apache.activemq.artemis.tests.util.ServiceTestBase;
-
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.hornetq.api.core.client.HornetQClient;
-
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -41,7 +38,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
 
-public class HornetQProtocolTest extends ServiceTestBase
+public class HornetQProtocolTest extends ActiveMQTestBase
 {
    protected ActiveMQServer server;
 
@@ -50,41 +47,17 @@ public class HornetQProtocolTest extends ServiceTestBase
    @Before
    public void setUp() throws Exception
    {
-      startBroker();
-   }
-
-   @After
-   public void tearDown() throws Exception
-   {
-      stopBroker();
-   }
-
-   public void startBroker() throws Exception
-   {
-      super.setUp();
-      server = createServer(true, true);
-      addHornetQConnector();
-      server.start();
-      waitForServer(server);
-   }
-
-   public void stopBroker() throws Exception
-   {
-      if (server.isStarted())
-      {
-         server.stop();
-         server = null;
-      }
-   }
-
-   protected void addHornetQConnector() throws Exception
-   {
       HashMap<String, Object> params = new HashMap<String, Object>();
       params.put(org.hornetq.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME, "" + 5445);
       params.put(org.hornetq.core.remoting.impl.netty.TransportConstants.PROTOCOLS_PROP_NAME, "HORNETQ");
       TransportConfiguration transportConfig = new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params);
+
+      super.setUp();
+      server = createServer(true, true);
       server.getConfiguration().getAcceptorConfigurations().add(transportConfig);
       LOG.info("Added connector {} to broker", "HornetQ");
+      server.start();
+      waitForServerToStart(server);
    }
 
    @Test

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/DuplicateDetectionTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/DuplicateDetectionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/DuplicateDetectionTest.java
index 264e597..eee1878 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/DuplicateDetectionTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/DuplicateDetectionTest.java
@@ -31,7 +31,7 @@ import org.apache.activemq.artemis.core.message.impl.MessageImpl;
 import org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.transaction.impl.XidImpl;
-import org.apache.activemq.artemis.tests.util.ServiceTestBase;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.apache.activemq.artemis.utils.UUIDGenerator;
 import org.junit.Assert;
 import org.junit.Before;
@@ -41,11 +41,11 @@ import javax.transaction.xa.XAException;
 import javax.transaction.xa.XAResource;
 import javax.transaction.xa.Xid;
 
-public class DuplicateDetectionTest extends ServiceTestBase
+public class DuplicateDetectionTest extends ActiveMQTestBase
 {
    private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
 
-   private ActiveMQServer messagingService;
+   private ActiveMQServer server;
 
    private final SimpleString propKey = new SimpleString("propkey");
 
@@ -54,10 +54,6 @@ public class DuplicateDetectionTest extends ServiceTestBase
    @Test
    public void testSimpleDuplicateDetecion() throws Exception
    {
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
-
       ClientSession session = sf.createSession(false, true, true);
 
       session.start();
@@ -114,12 +110,6 @@ public class DuplicateDetectionTest extends ServiceTestBase
       producer.send(message);
       message2 = consumer.receiveImmediate();
       Assert.assertNull(message2);
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
    }
 
    @Test
@@ -139,11 +129,13 @@ public class DuplicateDetectionTest extends ServiceTestBase
    {
       testDuplicateIDCacheMemoryRetention(false);
 
-      messagingService.stop();
+      server.stop();
 
-      messagingService.start();
+      waitForServerToStop(server);
 
-      Assert.assertEquals(0, ((PostOfficeImpl) messagingService.getPostOffice()).getDuplicateIDCaches().size());
+      server.start();
+
+      Assert.assertEquals(0, ((PostOfficeImpl) server.getPostOffice()).getDuplicateIDCaches().size());
    }
 
    @Test
@@ -151,28 +143,29 @@ public class DuplicateDetectionTest extends ServiceTestBase
    {
       testDuplicateIDCacheMemoryRetention(true);
 
-      messagingService.stop();
+      server.stop();
+
+      waitForServerToStop(server);
 
-      messagingService.start();
+      server.start();
 
-      Assert.assertEquals(0, ((PostOfficeImpl) messagingService.getPostOffice()).getDuplicateIDCaches().size());
+      Assert.assertEquals(0, ((PostOfficeImpl) server.getPostOffice()).getDuplicateIDCaches().size());
    }
 
    public void testDuplicateIDCacheMemoryRetention(boolean temporary) throws Exception
    {
       final int TEST_SIZE = 100;
 
-      ServerLocator locator = createInVMNonHALocator();
+      locator = createInVMNonHALocator()
+              .setBlockOnNonDurableSend(true);
 
-      locator.setBlockOnNonDurableSend(true);
-
-      ClientSessionFactory sf = createSessionFactory(locator);
+      sf = createSessionFactory(locator);
 
       ClientSession session = sf.createSession(false, true, true);
 
       session.start();
 
-      Assert.assertEquals(0, ((PostOfficeImpl)messagingService.getPostOffice()).getDuplicateIDCaches().size());
+      Assert.assertEquals(0, ((PostOfficeImpl) server.getPostOffice()).getDuplicateIDCaches().size());
 
       final SimpleString addressName = new SimpleString("DuplicateDetectionTestAddress");
 
@@ -222,27 +215,17 @@ public class DuplicateDetectionTest extends ServiceTestBase
          consumer.close();
 
          // there will be 2 ID caches, one for messages using "_AMQ_DUPL_ID" and one for "_AMQ_BRIDGE_DUP"
-         Assert.assertEquals(2, ((PostOfficeImpl)messagingService.getPostOffice()).getDuplicateIDCaches().size());
+         Assert.assertEquals(2, ((PostOfficeImpl) server.getPostOffice()).getDuplicateIDCaches().size());
          session.deleteQueue(queueName);
-         Assert.assertEquals(0, ((PostOfficeImpl)messagingService.getPostOffice()).getDuplicateIDCaches().size());
+         Assert.assertEquals(0, ((PostOfficeImpl) server.getPostOffice()).getDuplicateIDCaches().size());
       }
 
-      session.close();
-
-      sf.close();
-
-      locator.close();
-
-      Assert.assertEquals(0, ((PostOfficeImpl)messagingService.getPostOffice()).getDuplicateIDCaches().size());
+      Assert.assertEquals(0, ((PostOfficeImpl) server.getPostOffice()).getDuplicateIDCaches().size());
    }
 
    @Test
    public void testSimpleDuplicateDetectionWithString() throws Exception
    {
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
-
       ClientSession session = sf.createSession(false, true, true);
 
       session.start();
@@ -299,21 +282,11 @@ public class DuplicateDetectionTest extends ServiceTestBase
       producer.send(message);
       message2 = consumer.receiveImmediate();
       Assert.assertNull(message2);
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
    }
 
    @Test
    public void testCacheSize() throws Exception
    {
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
-
       ClientSession session = sf.createSession(false, true, true);
 
       session.start();
@@ -459,21 +432,11 @@ public class DuplicateDetectionTest extends ServiceTestBase
          Assert.assertNotNull(message);
          Assert.assertEquals(i, message.getObjectProperty(propKey));
       }
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
    }
 
    @Test
    public void testTransactedDuplicateDetection1() throws Exception
    {
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
-
       ClientSession session = sf.createSession(false, false, false);
 
       session.start();
@@ -512,21 +475,11 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       message = consumer.receiveImmediate();
       Assert.assertNull(message);
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
    }
 
    @Test
    public void testTransactedDuplicateDetection2() throws Exception
    {
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
-
       ClientSession session = sf.createSession(false, false, false);
 
       session.start();
@@ -559,21 +512,11 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       message = consumer.receiveImmediate();
       Assert.assertNull(message);
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
    }
 
    @Test
    public void testTransactedDuplicateDetection3() throws Exception
    {
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
-
       ClientSession session = sf.createSession(false, false, false);
 
       session.start();
@@ -625,21 +568,11 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       message = consumer.receiveImmediate();
       Assert.assertNull(message);
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
    }
 
    @Test
    public void testRollbackThenSend() throws Exception
    {
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
-
       ClientSession session = sf.createSession(false, false, false);
 
       session.start();
@@ -667,15 +600,9 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       session.commit();
 
-
       message = consumer.receive(5000);
       assertNotNull(message);
       assertTrue(message.getStringProperty("key").equals(dupID1.toString()));
-      session.close();
-
-      sf.close();
-
-      locator.close();
    }
 
    /*
@@ -685,10 +612,6 @@ public class DuplicateDetectionTest extends ServiceTestBase
    @Test
    public void testEntireTransactionRejected() throws Exception
    {
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
-
       ClientSession session = sf.createSession(false, false, false);
 
       session.start();
@@ -770,21 +693,11 @@ public class DuplicateDetectionTest extends ServiceTestBase
       message.acknowledge();
 
       session.commit();
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
    }
 
    @Test
    public void testXADuplicateDetection1() throws Exception
    {
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
-
       ClientSession session = sf.createSession(true, false, false);
 
       Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
@@ -850,21 +763,11 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       DuplicateDetectionTest.log.info("committing session");
       session.commit(xid3, false);
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
    }
 
    @Test
    public void testXADuplicateDetection2() throws Exception
    {
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
-
       ClientSession session = sf.createSession(true, false, false);
 
       Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
@@ -932,21 +835,11 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       DuplicateDetectionTest.log.info("committing session");
       session.commit(xid3, false);
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
    }
 
    @Test
    public void testXADuplicateDetection3() throws Exception
    {
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
-
       ClientSession session = sf.createSession(true, false, false);
 
       Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
@@ -1000,7 +893,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       session.start(xid3, XAResource.TMNOFLAGS);
 
-      message = consumer.receive(250);
+      consumer.receive(250);
 
       message = consumer.receiveImmediate();
       Assert.assertNull(message);
@@ -1013,21 +906,11 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       DuplicateDetectionTest.log.info("committing session");
       session.commit(xid3, false);
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
    }
 
    @Test
    public void testXADuplicateDetectionPrepareAndRollback() throws Exception
    {
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
-
       ClientSession session = sf.createSession(true, false, false);
 
       Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
@@ -1086,21 +969,11 @@ public class DuplicateDetectionTest extends ServiceTestBase
       msgRec.acknowledge();
 
       session.commit();
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
    }
 
    @Test
    public void testXADuplicateDetectionPrepareAndRollbackStopServer() throws Exception
    {
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
-
       ClientSession session = sf.createSession(true, false, false);
 
       Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
@@ -1126,9 +999,11 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       session.close();
 
-      messagingService.stop();
+      server.stop();
+
+      waitForServerToStop(server);
 
-      messagingService.start();
+      server.start();
 
       sf = createSessionFactory(locator);
 
@@ -1173,21 +1048,11 @@ public class DuplicateDetectionTest extends ServiceTestBase
       msgRec.acknowledge();
 
       session.commit();
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
    }
 
    @Test
    public void testXADuplicateDetection4() throws Exception
    {
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
-
       ClientSession session = sf.createSession(true, false, false);
 
       Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
@@ -1251,7 +1116,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       session.start(xid3, XAResource.TMNOFLAGS);
 
-      message = consumer.receive(250);
+      consumer.receive(250);
 
       message = consumer.receiveImmediate();
       Assert.assertNull(message);
@@ -1264,12 +1129,6 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       DuplicateDetectionTest.log.info("committing session");
       session.commit(xid3, false);
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
    }
 
    private ClientMessage createMessage(final ClientSession session, final int i)
@@ -1284,18 +1143,16 @@ public class DuplicateDetectionTest extends ServiceTestBase
    @Test
    public void testDuplicateCachePersisted() throws Exception
    {
-      messagingService.stop();
+      server.stop();
 
-      Configuration conf = createDefaultConfig()
+      config = createDefaultInVMConfig()
          .setIDCacheSize(cacheSize);
 
-      ActiveMQServer messagingService2 = createServer(conf);
+      server = createServer(config);
 
-      messagingService2.start();
+      server.start();
 
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
+      sf = createSessionFactory(locator);
 
       ClientSession session = sf.createSession(false, true, true);
 
@@ -1327,11 +1184,11 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       sf.close();
 
-      messagingService2.stop();
+      server.stop();
 
-      messagingService2 = createServer(conf);
+      waitForServerToStop(server);
 
-      messagingService2.start();
+      server.start();
 
       sf = createSessionFactory(locator);
 
@@ -1356,33 +1213,23 @@ public class DuplicateDetectionTest extends ServiceTestBase
       producer.send(message);
       message2 = consumer.receiveImmediate();
       Assert.assertNull(message2);
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
-
-      messagingService2.stop();
    }
 
    @Test
    public void testDuplicateCachePersisted2() throws Exception
    {
-      messagingService.stop();
+      server.stop();
 
       final int theCacheSize = 5;
 
-      Configuration conf = createDefaultConfig()
-         .setIDCacheSize(theCacheSize);
-
-      ActiveMQServer messagingService2 = createServer(conf);
+      config = createDefaultInVMConfig()
+              .setIDCacheSize(theCacheSize);
 
-      messagingService2.start();
+      server = createServer(config);
 
-      ServerLocator locator = createInVMNonHALocator();
+      server.start();
 
-      ClientSessionFactory sf = createSessionFactory(locator);
+      sf = createSessionFactory(locator);
 
       ClientSession session = sf.createSession(false, true, true);
 
@@ -1410,11 +1257,11 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       sf.close();
 
-      messagingService2.stop();
+      server.stop();
 
-      messagingService2 = createServer(conf);
+      waitForServerToStop(server);
 
-      messagingService2.start();
+      server.start();
 
       sf = createSessionFactory(locator);
 
@@ -1437,34 +1284,24 @@ public class DuplicateDetectionTest extends ServiceTestBase
          ClientMessage message2 = consumer.receiveImmediate();
          Assert.assertNull(message2);
       }
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
-
-      messagingService2.stop();
    }
 
    @Test
    public void testDuplicateCachePersistedRestartWithSmallerCache() throws Exception
    {
-      messagingService.stop();
+      server.stop();
 
       final int initialCacheSize = 10;
       final int subsequentCacheSize = 5;
 
-      Configuration conf = createDefaultConfig()
-         .setIDCacheSize(initialCacheSize);
+      config = createDefaultInVMConfig()
+              .setIDCacheSize(initialCacheSize);
 
-      ActiveMQServer messagingService2 = createServer(conf);
+      server = createServer(config);
 
-      messagingService2.start();
+      server.start();
 
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
+      sf = createSessionFactory(locator);
 
       ClientSession session = sf.createSession(false, true, true);
 
@@ -1492,13 +1329,15 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       sf.close();
 
-      messagingService2.stop();
+      server.stop();
 
-      conf.setIDCacheSize(subsequentCacheSize);
+      waitForServerToStop(server);
 
-      messagingService2 = createServer(conf);
+      config.setIDCacheSize(subsequentCacheSize);
 
-      messagingService2.start();
+      server = createServer(config);
+
+      server.start();
 
       sf = createSessionFactory(locator);
 
@@ -1530,34 +1369,24 @@ public class DuplicateDetectionTest extends ServiceTestBase
             Assert.assertNull(message2);
          }
       }
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
-
-      messagingService2.stop();
    }
 
    @Test
    public void testDuplicateCachePersistedRestartWithSmallerCacheEnsureDeleted() throws Exception
    {
-      messagingService.stop();
+      server.stop();
 
       final int initialCacheSize = 10;
       final int subsequentCacheSize = 5;
 
-      Configuration conf = createDefaultConfig()
-         .setIDCacheSize(initialCacheSize);
+      config = createDefaultInVMConfig()
+              .setIDCacheSize(initialCacheSize);
 
-      ActiveMQServer messagingService2 = createServer(conf);
+      server = createServer(config);
 
-      messagingService2.start();
+      server.start();
 
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
+      sf = createSessionFactory(locator);
 
       ClientSession session = sf.createSession(false, true, true);
 
@@ -1585,23 +1414,27 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       sf.close();
 
-      messagingService2.stop();
+      server.stop();
+
+      waitForServerToStop(server);
 
-      conf.setIDCacheSize(subsequentCacheSize);
+      config.setIDCacheSize(subsequentCacheSize);
 
-      messagingService2 = createServer(conf);
+      server = createServer(config);
 
-      messagingService2.start();
+      server.start();
 
       // Now stop and set back to original cache size and restart
 
-      messagingService2.stop();
+      server.stop();
 
-      conf.setIDCacheSize(initialCacheSize);
+      waitForServerToStop(server);
 
-      messagingService2 = createServer(conf);
+      config.setIDCacheSize(initialCacheSize);
 
-      messagingService2.start();
+      server = createServer(config);
+
+      server.start();
 
       sf = createSessionFactory(locator);
 
@@ -1633,32 +1466,22 @@ public class DuplicateDetectionTest extends ServiceTestBase
             Assert.assertNull(message2);
          }
       }
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
-
-      messagingService2.stop();
    }
 
    @Test
    public void testNoPersist() throws Exception
    {
-      messagingService.stop();
+      server.stop();
 
-      Configuration conf = createDefaultConfig()
-         .setIDCacheSize(cacheSize)
-         .setPersistIDCache(false);
+      config = createDefaultInVMConfig()
+              .setIDCacheSize(cacheSize)
+              .setPersistIDCache(false);
 
-      ActiveMQServer messagingService2 = createServer(conf);
+      server = createServer(config);
 
-      messagingService2.start();
+      server.start();
 
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
+      sf = createSessionFactory(locator);
 
       ClientSession session = sf.createSession(false, true, true);
 
@@ -1690,11 +1513,11 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       sf.close();
 
-      messagingService2.stop();
+      server.stop();
 
-      messagingService2 = createServer(conf);
+      waitForServerToStop(server);
 
-      messagingService2.start();
+      server.start();
 
       sf = createSessionFactory(locator);
 
@@ -1719,32 +1542,22 @@ public class DuplicateDetectionTest extends ServiceTestBase
       producer.send(message);
       message2 = consumer.receive(200);
       Assert.assertEquals(2, message2.getObjectProperty(propKey));
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
-
-      messagingService2.stop();
    }
 
    @Test
    public void testNoPersistTransactional() throws Exception
    {
-      messagingService.stop();
-
-      Configuration conf = createDefaultConfig()
-         .setIDCacheSize(cacheSize)
-         .setPersistIDCache(false);
+      server.stop();
 
-      ActiveMQServer messagingService2 = createServer(conf);
+      config = createDefaultInVMConfig()
+              .setIDCacheSize(cacheSize)
+              .setPersistIDCache(false);
 
-      messagingService2.start();
+      server = createServer(config);
 
-      ServerLocator locator = createInVMNonHALocator();
+      server.start();
 
-      ClientSessionFactory sf = createSessionFactory(locator);
+      sf = createSessionFactory(locator);
 
       ClientSession session = sf.createSession(false, false, false);
 
@@ -1778,11 +1591,11 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       sf.close();
 
-      messagingService2.stop();
+      server.stop();
 
-      messagingService2 = createServer(conf);
+      waitForServerToStop(server);
 
-      messagingService2.start();
+      server.start();
 
       sf = createSessionFactory(locator);
 
@@ -1809,32 +1622,11 @@ public class DuplicateDetectionTest extends ServiceTestBase
       session.commit();
       message2 = consumer.receive(200);
       Assert.assertEquals(2, message2.getObjectProperty(propKey));
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
-
-      messagingService2.stop();
    }
 
    @Test
    public void testPersistTransactional() throws Exception
    {
-      messagingService.stop();
-
-      Configuration conf = createDefaultConfig()
-         .setIDCacheSize(cacheSize);
-
-      ActiveMQServer messagingService2 = createServer(conf);
-
-      messagingService2.start();
-
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
-
       ClientSession session = sf.createSession(false, false, false);
 
       session.start();
@@ -1871,11 +1663,11 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       sf.close();
 
-      messagingService2.stop();
+      server.stop();
 
-      messagingService2 = createServer(conf);
+      waitForServerToStop(server);
 
-      messagingService2.start();
+      server.start();
 
       sf = createSessionFactory(locator);
 
@@ -1928,32 +1720,22 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       message2 = consumer.receiveImmediate();
       Assert.assertNull(message2);
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
-
-      messagingService2.stop();
    }
 
    @Test
    public void testNoPersistXA1() throws Exception
    {
-      messagingService.stop();
+      server.stop();
 
-      Configuration conf = createDefaultConfig()
-         .setIDCacheSize(cacheSize)
-         .setPersistIDCache(false);
+      config = createDefaultInVMConfig()
+              .setIDCacheSize(cacheSize)
+              .setPersistIDCache(false);
 
-      ActiveMQServer messagingService2 = createServer(conf);
+      server = createServer(config);
 
-      messagingService2.start();
+      server.start();
 
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
+      sf = createSessionFactory(locator);
 
       ClientSession session = sf.createSession(true, false, false);
 
@@ -1989,11 +1771,11 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       sf.close();
 
-      messagingService2.stop();
+      server.stop();
 
-      messagingService2 = createServer(conf);
+      waitForServerToStop(server);
 
-      messagingService2.start();
+      server.start();
 
       sf = createSessionFactory(locator);
 
@@ -2032,32 +1814,11 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       message2 = consumer.receive(200);
       Assert.assertEquals(2, message2.getObjectProperty(propKey));
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
-
-      messagingService2.stop();
    }
 
    @Test
    public void testNoPersistXA2() throws Exception
    {
-      messagingService.stop();
-
-      Configuration conf = createDefaultConfig()
-         .setIDCacheSize(cacheSize);
-
-      ActiveMQServer messagingService2 = createServer(conf);
-
-      messagingService2.start();
-
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
-
       ClientSession session = sf.createSession(true, false, false);
 
       Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
@@ -2072,8 +1833,6 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       ClientProducer producer = session.createProducer(queueName);
 
-      ClientConsumer consumer = session.createConsumer(queueName);
-
       ClientMessage message = createMessage(session, 1);
       SimpleString dupID = new SimpleString("abcdefg");
       message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData());
@@ -2090,15 +1849,15 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       sf.close();
 
-      messagingService2.stop();
+      server.stop();
 
-      messagingService2 = createServer(conf);
+      waitForServerToStop(server);
 
-      messagingService2.start();
+      server.start();
 
       sf = createSessionFactory(locator);
 
-      session = sf.createSession(true, false, false);
+      session = addClientSession(sf.createSession(true, false, false));
 
       Xid xid2 = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
 
@@ -2110,7 +1869,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       producer = session.createProducer(queueName);
 
-      consumer = session.createConsumer(queueName);
+      ClientConsumer consumer = session.createConsumer(queueName);
 
       message = createMessage(session, 1);
       message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData());
@@ -2133,33 +1892,12 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       message2 = consumer.receive(200);
       Assert.assertEquals(2, message2.getObjectProperty(propKey));
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
-
-      messagingService2.stop();
    }
 
    @Test
    public void testPersistXA1() throws Exception
    {
-      messagingService.stop();
-
-      Configuration conf = createDefaultConfig()
-         .setIDCacheSize(cacheSize);
-
-      ActiveMQServer messagingService2 = createServer(conf);
-
-      messagingService2.start();
-
-      ServerLocator locator = createInVMNonHALocator();
-
-      ClientSessionFactory sf = createSessionFactory(locator);
-
-      ClientSession session = sf.createSession(true, false, false);
+      ClientSession session = addClientSession(sf.createSession(true, false, false));
 
       Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
 
@@ -2193,15 +1931,15 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       sf.close();
 
-      messagingService2.stop();
+      server.stop();
 
-      messagingService2 = createServer(conf);
+      waitForServerToStop(server);
 
-      messagingService2.start();
+      server.start();
 
       sf = createSessionFactory(locator);
 
-      session = sf.createSession(true, false, false);
+      session = addClientSession(sf.createSession(true, false, false));
 
       Xid xid2 = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
 
@@ -2245,27 +1983,27 @@ public class DuplicateDetectionTest extends ServiceTestBase
 
       message2 = consumer.receiveImmediate();
       Assert.assertNull(message2);
-
-      session.close();
-
-      sf.close();
-
-      locator.close();
-
-      messagingService2.stop();
    }
 
+   private Configuration config;
+   ServerLocator locator;
+   ClientSessionFactory sf;
+
    @Override
    @Before
    public void setUp() throws Exception
    {
       super.setUp();
 
-      Configuration conf = createDefaultConfig()
-         .setIDCacheSize(cacheSize);
+      config = createDefaultInVMConfig()
+              .setIDCacheSize(cacheSize);
 
-      messagingService = createServer(true, conf);
+      server = createServer(true, config);
 
-      messagingService.start();
+      server.start();
+
+      locator = createInVMNonHALocator();
+
+      sf = createSessionFactory(locator);
    }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/InterceptorTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/InterceptorTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/InterceptorTest.java
index 30f0c7a..9d1a984 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/InterceptorTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/InterceptorTest.java
@@ -42,12 +42,12 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.ServerMessage;
 import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
 import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
-import org.apache.activemq.artemis.tests.util.ServiceTestBase;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-public class InterceptorTest extends ServiceTestBase
+public class InterceptorTest extends ActiveMQTestBase
 {
    private ActiveMQServer server;
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/328611fd/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/String64KLimitTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/String64KLimitTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/String64KLimitTest.java
index bffdc97..972c48f 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/String64KLimitTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/String64KLimitTest.java
@@ -33,7 +33,7 @@ import org.apache.activemq.artemis.core.config.Configuration;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.ActiveMQServers;
 import org.apache.activemq.artemis.tests.util.RandomUtil;
-import org.apache.activemq.artemis.tests.util.ServiceTestBase;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 
 /**
  *
@@ -43,7 +43,7 @@ import org.apache.activemq.artemis.tests.util.ServiceTestBase;
  * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4806007
  * http://jira.jboss.com/jira/browse/JBAS-2641
  */
-public class String64KLimitTest extends ServiceTestBase
+public class String64KLimitTest extends ActiveMQTestBase
 {
    // Constants -----------------------------------------------------
 


Mime
View raw message