You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by zz...@apache.org on 2014/07/22 20:40:23 UTC

[5/9] [HELIX-475] Remove code duplication for Zk tests

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestInvalidResourceRebalance.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestInvalidResourceRebalance.java b/helix-core/src/test/java/org/apache/helix/integration/TestInvalidResourceRebalance.java
index 7b56f5d..2cedb83 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestInvalidResourceRebalance.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestInvalidResourceRebalance.java
@@ -24,19 +24,20 @@ import java.util.Map;
 
 import org.apache.helix.HelixAdmin;
 import org.apache.helix.TestHelper;
-import org.apache.helix.ZkUnitTestBase;
 import org.apache.helix.integration.manager.ClusterControllerManager;
 import org.apache.helix.integration.manager.MockParticipantManager;
 import org.apache.helix.model.HelixConfigScope.ConfigScopeProperty;
 import org.apache.helix.model.IdealState.RebalanceMode;
 import org.apache.helix.model.builder.HelixConfigScopeBuilder;
+import org.apache.helix.testutil.HelixTestUtil;
+import org.apache.helix.testutil.ZkTestBase;
 import org.apache.helix.tools.ClusterStateVerifier;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
 import com.google.common.collect.Maps;
 
-public class TestInvalidResourceRebalance extends ZkUnitTestBase {
+public class TestInvalidResourceRebalance extends ZkTestBase {
   /**
    * Ensure that the Helix controller doesn't attempt to rebalance resources with invalid ideal
    * states
@@ -54,7 +55,7 @@ public class TestInvalidResourceRebalance extends ZkUnitTestBase {
     System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
     // Set up cluster
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
+    TestHelper.setupCluster(clusterName, _zkaddr, 12918, // participant port
         "localhost", // participant name prefix
         "TestDB", // resource name prefix
         1, // resources
@@ -66,7 +67,7 @@ public class TestInvalidResourceRebalance extends ZkUnitTestBase {
 
     // start controller
     ClusterControllerManager controller =
-        new ClusterControllerManager(ZK_ADDR, clusterName, "controller");
+        new ClusterControllerManager(_zkaddr, clusterName, "controller");
     controller.syncStart();
 
     // add the ideal state spec (prevents non-CUSTOMIZED MasterSlave ideal states)
@@ -83,13 +84,14 @@ public class TestInvalidResourceRebalance extends ZkUnitTestBase {
     for (int i = 0; i < NUM_PARTICIPANTS; i++) {
       final String instanceName = "localhost_" + (12918 + i);
 
-      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+      participants[i] = new MockParticipantManager(_zkaddr, clusterName, instanceName);
       participants[i].syncStart();
     }
 
     Thread.sleep(1000);
     boolean result =
-        ClusterStateVerifier.verifyByZkCallback(new EmptyZkVerifier(clusterName, RESOURCE_NAME));
+        ClusterStateVerifier.verifyByZkCallback(new HelixTestUtil.EmptyZkVerifier(clusterName,
+            RESOURCE_NAME, _zkclient));
     Assert.assertTrue(result, "External view and current state must be empty");
 
     // cleanup

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestLocalContainerProvider.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestLocalContainerProvider.java b/helix-core/src/test/java/org/apache/helix/integration/TestLocalContainerProvider.java
index 111c921..b3c4c66 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestLocalContainerProvider.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestLocalContainerProvider.java
@@ -31,7 +31,6 @@ import org.apache.helix.HelixController;
 import org.apache.helix.HelixManager;
 import org.apache.helix.HelixParticipant;
 import org.apache.helix.TestHelper;
-import org.apache.helix.ZkUnitTestBase;
 import org.apache.helix.api.Cluster;
 import org.apache.helix.api.Participant;
 import org.apache.helix.api.accessor.ClusterAccessor;
@@ -58,6 +57,7 @@ import org.apache.helix.controller.serializer.DefaultStringSerializer;
 import org.apache.helix.controller.serializer.StringSerializer;
 import org.apache.helix.manager.zk.ZkHelixConnection;
 import org.apache.helix.model.StateModelDefinition;
+import org.apache.helix.testutil.ZkTestBase;
 import org.apache.helix.tools.StateModelConfigGenerator;
 import org.apache.log4j.Logger;
 import org.codehaus.jackson.annotate.JsonProperty;
@@ -70,7 +70,7 @@ import com.google.common.util.concurrent.AbstractService;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.SettableFuture;
 
-public class TestLocalContainerProvider extends ZkUnitTestBase {
+public class TestLocalContainerProvider extends ZkTestBase {
   private static final Logger LOG = Logger.getLogger(TestLocalContainerProvider.class);
 
   private static final int MAX_PARTICIPANTS = 4;
@@ -100,7 +100,7 @@ public class TestLocalContainerProvider extends ZkUnitTestBase {
     deallocated = 0;
 
     // connect
-    connection = new ZkHelixConnection(ZK_ADDR);
+    connection = new ZkHelixConnection(_zkaddr);
     connection.connect();
 
     // create the cluster

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestMessageThrottle.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestMessageThrottle.java b/helix-core/src/test/java/org/apache/helix/integration/TestMessageThrottle.java
index 0c7c131..1442979 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestMessageThrottle.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestMessageThrottle.java
@@ -37,23 +37,25 @@ import org.apache.helix.model.Message;
 import org.apache.helix.integration.manager.ClusterControllerManager;
 import org.apache.helix.integration.manager.MockParticipantManager;
 import org.apache.helix.model.builder.ConstraintItemBuilder;
+import org.apache.helix.testutil.TestUtil;
+import org.apache.helix.testutil.ZkTestBase;
 import org.apache.helix.tools.ClusterStateVerifier;
 import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier;
 import org.apache.helix.tools.ClusterStateVerifier.MasterNbInExtViewVerifier;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-public class TestMessageThrottle extends ZkIntegrationTestBase {
+public class TestMessageThrottle extends ZkTestBase {
   @Test()
   public void testMessageThrottle() throws Exception {
     // Logger.getRootLogger().setLevel(Level.INFO);
 
-    String clusterName = getShortClassName();
+    String clusterName = TestUtil.getTestName();
     MockParticipantManager[] participants = new MockParticipantManager[5];
 
     System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant start
+    TestHelper.setupCluster(clusterName, _zkaddr, 12918, // participant start
                                                          // port
         "localhost", // participant name prefix
         "TestDB", // resource name prefix
@@ -65,7 +67,7 @@ public class TestMessageThrottle extends ZkIntegrationTestBase {
 
     // setup message constraint
     // "MESSAGE_TYPE=STATE_TRANSITION,TRANSITION=OFFLINE-SLAVE,INSTANCE=.*,CONSTRAINT_VALUE=1";
-    HelixAdmin admin = new ZKHelixAdmin(_gZkClient);
+    HelixAdmin admin = new ZKHelixAdmin(_zkclient);
     ConstraintItemBuilder builder = new ConstraintItemBuilder();
     builder.addConstraintAttribute("MESSAGE_TYPE", "STATE_TRANSITION")
         .addConstraintAttribute("INSTANCE", ".*").addConstraintAttribute("CONSTRAINT_VALUE", "1");
@@ -79,7 +81,7 @@ public class TestMessageThrottle extends ZkIntegrationTestBase {
         builder.build());
 
     final ZKHelixDataAccessor accessor =
-        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
+        new ZKHelixDataAccessor(clusterName, _baseAccessor);
 
     // make sure we never see more than 1 state transition message for each participant
     final AtomicBoolean success = new AtomicBoolean(true);
@@ -87,7 +89,7 @@ public class TestMessageThrottle extends ZkIntegrationTestBase {
       String instanceName = "localhost_" + (12918 + i);
       String msgPath = PropertyPathConfig.getPath(PropertyType.MESSAGES, clusterName, instanceName);
 
-      _gZkClient.subscribeChildChanges(msgPath, new IZkChildListener() {
+      _zkclient.subscribeChildChanges(msgPath, new IZkChildListener() {
 
         @Override
         public void handleChildChange(String parentPath, List<String> currentChilds)
@@ -114,24 +116,24 @@ public class TestMessageThrottle extends ZkIntegrationTestBase {
     }
 
     ClusterControllerManager controller =
-        new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
+        new ClusterControllerManager(_zkaddr, clusterName, "controller_0");
     controller.syncStart();
 
     // start participants
     for (int i = 0; i < 5; i++) {
       String instanceName = "localhost_" + (12918 + i);
 
-      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+      participants[i] = new MockParticipantManager(_zkaddr, clusterName, instanceName);
       participants[i].syncStart();
     }
 
     boolean result =
         ClusterStateVerifier
-            .verifyByZkCallback(new MasterNbInExtViewVerifier(ZK_ADDR, clusterName));
+            .verifyByZkCallback(new MasterNbInExtViewVerifier(_zkaddr, clusterName));
     Assert.assertTrue(result);
 
     result =
-        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
             clusterName));
     Assert.assertTrue(result);
 

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestMessageThrottle2.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestMessageThrottle2.java b/helix-core/src/test/java/org/apache/helix/integration/TestMessageThrottle2.java
index a182753..2731b79 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestMessageThrottle2.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestMessageThrottle2.java
@@ -45,7 +45,6 @@ import org.apache.helix.controller.HelixControllerMain;
 import org.apache.helix.manager.zk.ZKHelixAdmin;
 import org.apache.helix.manager.zk.ZKHelixDataAccessor;
 import org.apache.helix.manager.zk.ZKHelixManager;
-import org.apache.helix.manager.zk.ZkBaseDataAccessor;
 import org.apache.helix.model.ClusterConstraints;
 import org.apache.helix.model.ExternalView;
 import org.apache.helix.model.IdealState;
@@ -59,6 +58,7 @@ import org.apache.helix.participant.statemachine.StateModel;
 import org.apache.helix.participant.statemachine.StateModelFactory;
 import org.apache.helix.participant.statemachine.StateModelInfo;
 import org.apache.helix.participant.statemachine.Transition;
+import org.apache.helix.testutil.ZkTestBase;
 import org.apache.helix.tools.ClusterStateVerifier;
 import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier;
 import org.apache.log4j.Logger;
@@ -66,7 +66,7 @@ import org.testng.Assert;
 import org.testng.annotations.Test;
 
 // test case from Ming Fang
-public class TestMessageThrottle2 extends ZkIntegrationTestBase {
+public class TestMessageThrottle2 extends ZkTestBase {
   final static String clusterName = "TestMessageThrottle2";
   final static String resourceName = "MyResource";
 
@@ -85,7 +85,7 @@ public class TestMessageThrottle2 extends ZkIntegrationTestBase {
     // wait for node2 becoming MASTER
     final Builder keyBuilder = new Builder(clusterName);
     final HelixDataAccessor accessor =
-        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
+        new ZKHelixDataAccessor(clusterName, _baseAccessor);
     TestHelper.verify(new TestHelper.Verifier() {
 
       @Override
@@ -109,7 +109,7 @@ public class TestMessageThrottle2 extends ZkIntegrationTestBase {
     });
 
     boolean result =
-        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
             clusterName));
     Assert.assertTrue(result);
 
@@ -119,9 +119,9 @@ public class TestMessageThrottle2 extends ZkIntegrationTestBase {
   void startController() throws Exception {
     // start helixController
     System.out.println(String.format("Starting Controller{Cluster:%s, Port:%s, Zookeeper:%s}",
-        clusterName, 12000, ZK_ADDR));
+        clusterName, 12000, _zkaddr));
     HelixManager helixController =
-        HelixControllerMain.startHelixController(ZK_ADDR, clusterName, "localhost_" + 12000,
+        HelixControllerMain.startHelixController(_zkaddr, clusterName, "localhost_" + 12000,
             HelixControllerMain.STANDALONE);
 
     StatusPrinter statusPrinter = new StatusPrinter();
@@ -129,7 +129,7 @@ public class TestMessageThrottle2 extends ZkIntegrationTestBase {
   }
 
   void startAdmin() throws Exception {
-    HelixAdmin admin = new ZKHelixAdmin(ZK_ADDR);
+    HelixAdmin admin = new ZKHelixAdmin(_zkaddr);
 
     // create cluster
     System.out.println("Creating cluster: " + clusterName);
@@ -245,7 +245,7 @@ public class TestMessageThrottle2 extends ZkIntegrationTestBase {
 
     public void start() throws Exception {
       helixManager =
-          new ZKHelixManager(clusterName, instanceName, InstanceType.PARTICIPANT, ZK_ADDR);
+          new ZKHelixManager(clusterName, instanceName, InstanceType.PARTICIPANT, _zkaddr);
       {
         // hack to set sessionTimeout
         Field sessionTimeout = ZKHelixManager.class.getDeclaredField("_sessionTimeout");
@@ -357,7 +357,7 @@ public class TestMessageThrottle2 extends ZkIntegrationTestBase {
 
     private static void addInstanceConfig(String instanceName) {
       // add node to cluster if not already added
-      ZKHelixAdmin admin = new ZKHelixAdmin(ZK_ADDR);
+      ZKHelixAdmin admin = new ZKHelixAdmin(_zkaddr);
 
       InstanceConfig instanceConfig = null;
       try {

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestNonOfflineInitState.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestNonOfflineInitState.java b/helix-core/src/test/java/org/apache/helix/integration/TestNonOfflineInitState.java
index aa48c90..1329cbe 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestNonOfflineInitState.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestNonOfflineInitState.java
@@ -26,6 +26,8 @@ import org.apache.helix.integration.manager.ClusterControllerManager;
 import org.apache.helix.integration.manager.MockParticipantManager;
 import org.apache.helix.mock.participant.MockBootstrapModelFactory;
 import org.apache.helix.participant.StateMachineEngine;
+import org.apache.helix.testutil.TestUtil;
+import org.apache.helix.testutil.ZkTestBase;
 import org.apache.helix.tools.ClusterSetup;
 import org.apache.helix.tools.ClusterStateVerifier;
 import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier;
@@ -33,15 +35,15 @@ import org.apache.log4j.Logger;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-public class TestNonOfflineInitState extends ZkIntegrationTestBase {
+public class TestNonOfflineInitState extends ZkTestBase {
   private static Logger LOG = Logger.getLogger(TestNonOfflineInitState.class);
 
   @Test
   public void testNonOfflineInitState() throws Exception {
     System.out.println("START testNonOfflineInitState at " + new Date(System.currentTimeMillis()));
-    String clusterName = getShortClassName();
+    String clusterName = TestUtil.getTestName();
 
-    setupCluster(clusterName, ZK_ADDR, 12918, // participant port
+    setupCluster(clusterName, _zkaddr, 12918, // participant port
         "localhost", // participant name prefix
         "TestDB", // resource name prefix
         1, // resources
@@ -51,7 +53,7 @@ public class TestNonOfflineInitState extends ZkIntegrationTestBase {
         "Bootstrap", true); // do rebalance
 
     ClusterControllerManager controller =
-        new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
+        new ClusterControllerManager(_zkaddr, clusterName, "controller_0");
     controller.syncStart();
 
     // start participants
@@ -59,7 +61,7 @@ public class TestNonOfflineInitState extends ZkIntegrationTestBase {
     for (int i = 0; i < 5; i++) {
       String instanceName = "localhost_" + (12918 + i);
 
-      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+      participants[i] = new MockParticipantManager(_zkaddr, clusterName, instanceName);
 
       // add a state model with non-OFFLINE initial state
       StateMachineEngine stateMach = participants[i].getStateMachineEngine();
@@ -70,7 +72,7 @@ public class TestNonOfflineInitState extends ZkIntegrationTestBase {
     }
 
     boolean result =
-        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
             clusterName));
     Assert.assertTrue(result);
 
@@ -86,26 +88,25 @@ public class TestNonOfflineInitState extends ZkIntegrationTestBase {
   private static void setupCluster(String clusterName, String ZkAddr, int startPort,
       String participantNamePrefix, String resourceNamePrefix, int resourceNb, int partitionNb,
       int nodesNb, int replica, String stateModelDef, boolean doRebalance) throws Exception {
-    if (_gZkClient.exists("/" + clusterName)) {
+    if (_zkclient.exists("/" + clusterName)) {
       LOG.warn("Cluster already exists:" + clusterName + ". Deleting it");
-      _gZkClient.deleteRecursive("/" + clusterName);
+      _zkclient.deleteRecursive("/" + clusterName);
     }
 
-    ClusterSetup setupTool = new ClusterSetup(ZkAddr);
-    setupTool.addCluster(clusterName, true);
-    setupTool.addStateModelDef(clusterName, "Bootstrap",
+    _setupTool.addCluster(clusterName, true);
+    _setupTool.addStateModelDef(clusterName, "Bootstrap",
         TestHelper.generateStateModelDefForBootstrap());
 
     for (int i = 0; i < nodesNb; i++) {
       int port = startPort + i;
-      setupTool.addInstanceToCluster(clusterName, participantNamePrefix + "_" + port);
+      _setupTool.addInstanceToCluster(clusterName, participantNamePrefix + "_" + port);
     }
 
     for (int i = 0; i < resourceNb; i++) {
       String dbName = resourceNamePrefix + i;
-      setupTool.addResourceToCluster(clusterName, dbName, partitionNb, stateModelDef);
+      _setupTool.addResourceToCluster(clusterName, dbName, partitionNb, stateModelDef);
       if (doRebalance) {
-        setupTool.rebalanceStorageCluster(clusterName, dbName, replica);
+        _setupTool.rebalanceStorageCluster(clusterName, dbName, replica);
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestNullReplica.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestNullReplica.java b/helix-core/src/test/java/org/apache/helix/integration/TestNullReplica.java
index 0f5cc72..544fbd5 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestNullReplica.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestNullReplica.java
@@ -28,12 +28,13 @@ import org.apache.helix.ZNRecord;
 import org.apache.helix.integration.manager.ClusterControllerManager;
 import org.apache.helix.integration.manager.MockParticipantManager;
 import org.apache.helix.model.IdealState;
+import org.apache.helix.testutil.ZkTestBase;
 import org.apache.helix.tools.ClusterStateVerifier;
 import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-public class TestNullReplica extends ZkIntegrationTestBase {
+public class TestNullReplica extends ZkTestBase {
 
   @Test
   public void testNullReplica() throws Exception {
@@ -46,7 +47,7 @@ public class TestNullReplica extends ZkIntegrationTestBase {
 
     MockParticipantManager[] participants = new MockParticipantManager[5];
 
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
+    TestHelper.setupCluster(clusterName, _zkaddr, 12918, // participant port
         "localhost", // participant name prefix
         "TestDB", // resource name prefix
         1, // resources
@@ -57,24 +58,24 @@ public class TestNullReplica extends ZkIntegrationTestBase {
     // set replica in ideal state to null
     String idealStatePath =
         PropertyPathConfig.getPath(PropertyType.IDEALSTATES, clusterName, "TestDB0");
-    ZNRecord idealState = _gZkClient.readData(idealStatePath);
+    ZNRecord idealState = _zkclient.readData(idealStatePath);
     idealState.getSimpleFields().remove(IdealState.IdealStateProperty.REPLICAS.toString());
-    _gZkClient.writeData(idealStatePath, idealState);
+    _zkclient.writeData(idealStatePath, idealState);
 
     ClusterControllerManager controller =
-        new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
+        new ClusterControllerManager(_zkaddr, clusterName, "controller_0");
     controller.syncStart();
 
     // start participants
     for (int i = 0; i < 5; i++) {
       String instanceName = "localhost_" + (12918 + i);
 
-      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+      participants[i] = new MockParticipantManager(_zkaddr, clusterName, instanceName);
       participants[i].syncStart();
     }
 
     boolean result =
-        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
             clusterName));
     Assert.assertTrue(result);
 

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestParticipantErrorMessage.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestParticipantErrorMessage.java b/helix-core/src/test/java/org/apache/helix/integration/TestParticipantErrorMessage.java
index 86d09d6..3a28f36 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestParticipantErrorMessage.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestParticipantErrorMessage.java
@@ -80,7 +80,7 @@ public class TestParticipantErrorMessage extends ZkStandAloneCMTestBase {
     }
 
     boolean result =
-        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
             CLUSTER_NAME));
     Assert.assertTrue(result);
     Builder kb = _participants[1].getHelixDataAccessor().keyBuilder();

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestParticipantNameCollision.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestParticipantNameCollision.java b/helix-core/src/test/java/org/apache/helix/integration/TestParticipantNameCollision.java
index aa67ac9..d4d56df 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestParticipantNameCollision.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestParticipantNameCollision.java
@@ -39,7 +39,7 @@ public class TestParticipantNameCollision extends ZkStandAloneCMTestBase {
       try {
         // the call fails on getClusterManagerForParticipant()
         // no threads start
-        newParticipant = new MockParticipantManager(ZK_ADDR, CLUSTER_NAME, instanceName);
+        newParticipant = new MockParticipantManager(_zkaddr, CLUSTER_NAME, instanceName);
         newParticipant.syncStart();
       } catch (Exception e) {
         e.printStackTrace();

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestPartitionLevelTransitionConstraint.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestPartitionLevelTransitionConstraint.java b/helix-core/src/test/java/org/apache/helix/integration/TestPartitionLevelTransitionConstraint.java
index b33ab23..2f27fd2 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestPartitionLevelTransitionConstraint.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestPartitionLevelTransitionConstraint.java
@@ -43,12 +43,13 @@ import org.apache.helix.model.StateModelDefinition;
 import org.apache.helix.model.builder.ConstraintItemBuilder;
 import org.apache.helix.participant.statemachine.StateModel;
 import org.apache.helix.participant.statemachine.StateModelFactory;
+import org.apache.helix.testutil.ZkTestBase;
 import org.apache.helix.tools.ClusterStateVerifier;
 import org.apache.log4j.Logger;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-public class TestPartitionLevelTransitionConstraint extends ZkIntegrationTestBase {
+public class TestPartitionLevelTransitionConstraint extends ZkTestBase {
 
   private static Logger LOG = Logger.getLogger(TestPartitionLevelTransitionConstraint.class);
 
@@ -106,7 +107,7 @@ public class TestPartitionLevelTransitionConstraint extends ZkIntegrationTestBas
 
     System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
+    TestHelper.setupCluster(clusterName, _zkaddr, 12918, // participant port
         "localhost", // participant name prefix
         "TestDB", // resource name prefix
         1, // resources
@@ -116,8 +117,7 @@ public class TestPartitionLevelTransitionConstraint extends ZkIntegrationTestBas
         "MasterSlave", false); // do not rebalance
 
     // setup semi-auto ideal-state
-    BaseDataAccessor<ZNRecord> baseAccessor = new ZkBaseDataAccessor<ZNRecord>(_gZkClient);
-    HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, baseAccessor);
+    HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, _baseAccessor);
     StateModelDefinition stateModelDef = defineStateModel();
     accessor.setProperty(accessor.keyBuilder().stateModelDef("Bootstrap"), stateModelDef);
     IdealState idealState = accessor.getProperty(accessor.keyBuilder().idealStates("TestDB0"));
@@ -135,39 +135,39 @@ public class TestPartitionLevelTransitionConstraint extends ZkIntegrationTestBas
         .addConstraintAttribute(ConstraintAttribute.PARTITION.toString(), ".*")
         .addConstraintAttribute(ConstraintAttribute.CONSTRAINT_VALUE.toString(), "1");
 
-    HelixAdmin admin = new ZKHelixAdmin(_gZkClient);
+    HelixAdmin admin = new ZKHelixAdmin(_zkclient);
     admin.setConstraint(clusterName, ConstraintType.MESSAGE_CONSTRAINT, "constraint1",
         constraintItemBuilder.build());
 
     ClusterControllerManager controller =
-        new ClusterControllerManager(ZK_ADDR, clusterName, "controller");
+        new ClusterControllerManager(_zkaddr, clusterName, "controller");
     controller.syncStart();
 
     // start 1st participant
     MockParticipantManager[] participants = new MockParticipantManager[n];
     String instanceName1 = "localhost_12918";
 
-    participants[0] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName1);
+    participants[0] = new MockParticipantManager(_zkaddr, clusterName, instanceName1);
     participants[0].getStateMachineEngine().registerStateModelFactory("Bootstrap",
         new BootstrapStateModelFactory());
     participants[0].syncStart();
 
     boolean result =
         ClusterStateVerifier
-            .verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
+            .verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(_zkaddr,
                 clusterName));
     Assert.assertTrue(result);
 
     // start 2nd participant which will be the master for Test0_0
     String instanceName2 = "localhost_12919";
-    participants[1] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName2);
+    participants[1] = new MockParticipantManager(_zkaddr, clusterName, instanceName2);
     participants[1].getStateMachineEngine().registerStateModelFactory("Bootstrap",
         new BootstrapStateModelFactory());
     participants[1].syncStart();
 
     result =
         ClusterStateVerifier
-            .verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
+            .verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(_zkaddr,
                 clusterName));
     Assert.assertTrue(result);
 

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestPauseSignal.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestPauseSignal.java b/helix-core/src/test/java/org/apache/helix/integration/TestPauseSignal.java
index a1c413b..2d87e61 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestPauseSignal.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestPauseSignal.java
@@ -31,13 +31,14 @@ import org.apache.helix.manager.zk.ZNRecordSerializer;
 import org.apache.helix.manager.zk.ZkBaseDataAccessor;
 import org.apache.helix.manager.zk.ZkClient;
 import org.apache.helix.model.PauseSignal;
+import org.apache.helix.testutil.ZkTestBase;
 import org.apache.helix.tools.ClusterSetup;
 import org.apache.helix.tools.ClusterStateVerifier;
 import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-public class TestPauseSignal extends ZkIntegrationTestBase {
+public class TestPauseSignal extends ZkTestBase {
   @Test()
   public void testPauseSignal() throws Exception {
     // Logger.getRootLogger().setLevel(Level.INFO);
@@ -49,7 +50,7 @@ public class TestPauseSignal extends ZkIntegrationTestBase {
 
     MockParticipantManager[] participants = new MockParticipantManager[5];
 
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
+    TestHelper.setupCluster(clusterName, _zkaddr, 12918, // participant port
         "localhost", // participant name prefix
         "TestDB", // resource name prefix
         1, // resources
@@ -60,29 +61,29 @@ public class TestPauseSignal extends ZkIntegrationTestBase {
 
     // start controller
     ClusterControllerManager controller =
-        new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
+        new ClusterControllerManager(_zkaddr, clusterName, "controller_0");
     controller.syncStart();
 
     // start participants
     for (int i = 0; i < 5; i++) {
       String instanceName = "localhost_" + (12918 + i);
 
-      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+      participants[i] = new MockParticipantManager(_zkaddr, clusterName, instanceName);
       participants[i].syncStart();
     }
 
     boolean result =
-        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
             clusterName));
     Assert.assertTrue(result);
 
     // pause the cluster and make sure pause is persistent
-    ZkClient zkClient = new ZkClient(ZK_ADDR);
+    ZkClient zkClient = new ZkClient(_zkaddr);
     zkClient.setZkSerializer(new ZNRecordSerializer());
     final HelixDataAccessor tmpAccessor =
         new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
 
-    String cmd = "-zkSvr " + ZK_ADDR + " -enableCluster " + clusterName + " false";
+    String cmd = "-zkSvr " + _zkaddr + " -enableCluster " + clusterName + " false";
     ClusterSetup.processCommandLineArgs(cmd.split(" "));
 
     tmpAccessor.setProperty(tmpAccessor.keyBuilder().pause(), new PauseSignal("pause"));
@@ -92,23 +93,19 @@ public class TestPauseSignal extends ZkIntegrationTestBase {
     Thread.sleep(1000);
 
     // add a new resource group
-    ClusterSetup setupTool = new ClusterSetup(ZK_ADDR);
-    setupTool.addResourceToCluster(clusterName, "TestDB1", 10, "MasterSlave");
-    setupTool.rebalanceStorageCluster(clusterName, "TestDB1", 3);
+    _setupTool.addResourceToCluster(clusterName, "TestDB1", 10, "MasterSlave");
+    _setupTool.rebalanceStorageCluster(clusterName, "TestDB1", 3);
 
     // make sure TestDB1 external view is empty
     TestHelper.verifyWithTimeout("verifyEmptyCurStateAndExtView", 1000, clusterName, "TestDB1",
         TestHelper.<String> setOf("localhost_12918", "localhost_12919", "localhost_12920",
-            "localhost_12921", "localhost_12922"), ZK_ADDR);
+            "localhost_12921", "localhost_12922"), _zkaddr);
 
     // resume controller
-    final HelixDataAccessor accessor =
-        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
-
-    cmd = "-zkSvr " + ZK_ADDR + " -enableCluster " + clusterName + " true";
+    cmd = "-zkSvr " + _zkaddr + " -enableCluster " + clusterName + " true";
     ClusterSetup.processCommandLineArgs(cmd.split(" "));
     result =
-        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
             clusterName));
     Assert.assertTrue(result);
 

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestPreferenceListAsQueue.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestPreferenceListAsQueue.java b/helix-core/src/test/java/org/apache/helix/integration/TestPreferenceListAsQueue.java
index 561f084..6de604b 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestPreferenceListAsQueue.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestPreferenceListAsQueue.java
@@ -33,7 +33,6 @@ import org.apache.helix.NotificationContext;
 import org.apache.helix.PropertyKey;
 import org.apache.helix.TestHelper;
 import org.apache.helix.ZNRecord;
-import org.apache.helix.ZkUnitTestBase;
 import org.apache.helix.model.ClusterConstraints.ConstraintAttribute;
 import org.apache.helix.model.ClusterConstraints.ConstraintType;
 import org.apache.helix.model.IdealState;
@@ -44,6 +43,7 @@ import org.apache.helix.model.StateModelDefinition;
 import org.apache.helix.model.builder.ConstraintItemBuilder;
 import org.apache.helix.participant.statemachine.StateModel;
 import org.apache.helix.participant.statemachine.StateModelFactory;
+import org.apache.helix.testutil.ZkTestBase;
 import org.apache.helix.tools.ClusterSetup;
 import org.apache.log4j.Logger;
 import org.testng.Assert;
@@ -52,7 +52,7 @@ import org.testng.annotations.Test;
 
 import com.google.common.collect.Lists;
 
-public class TestPreferenceListAsQueue extends ZkUnitTestBase {
+public class TestPreferenceListAsQueue extends ZkTestBase {
   private static final Logger LOG = Logger.getLogger(TestPreferenceListAsQueue.class);
   private static final int TRANSITION_TIME = 500;
   private static final int WAIT_TIME = TRANSITION_TIME + (TRANSITION_TIME / 2);
@@ -61,20 +61,18 @@ public class TestPreferenceListAsQueue extends ZkUnitTestBase {
   private List<String> _instanceList;
   private String _clusterName;
   private String _stateModel;
-  private ClusterSetup _clusterSetup;
   private HelixAdmin _admin;
 
   @BeforeMethod
   public void beforeMethod() {
     _instanceList = Lists.newLinkedList();
-    _clusterSetup = new ClusterSetup(ZK_ADDR);
-    _admin = _clusterSetup.getClusterManagementTool();
+    _admin = _setupTool.getClusterManagementTool();
 
     // Create cluster
     String className = TestHelper.getTestClassName();
     String methodName = TestHelper.getTestMethodName();
     _clusterName = className + "_" + methodName;
-    _clusterSetup.addCluster(_clusterName, true);
+    _setupTool.addCluster(_clusterName, true);
   }
 
   /**
@@ -87,7 +85,7 @@ public class TestPreferenceListAsQueue extends ZkUnitTestBase {
     _stateModel = "OnlineOfflineReprioritized";
 
     // Add a state model with the transition to ONLINE deprioritized
-    _clusterSetup.addStateModelDef(_clusterName, _stateModel,
+    _setupTool.addStateModelDef(_clusterName, _stateModel,
         createReprioritizedStateModelDef(_stateModel));
 
     // Add a constraint of one transition per partition
@@ -112,7 +110,7 @@ public class TestPreferenceListAsQueue extends ZkUnitTestBase {
     _stateModel = "OnlineOfflineBounded";
 
     // Add a state model with the parallelism implicit
-    _clusterSetup.addStateModelDef(_clusterName, _stateModel,
+    _setupTool.addStateModelDef(_clusterName, _stateModel,
         createEnforcedParallelismStateModelDef(_stateModel, PARALLELISM));
     runTest();
   }
@@ -129,10 +127,10 @@ public class TestPreferenceListAsQueue extends ZkUnitTestBase {
     String[] instanceInfoArray = {
         "localhost_1", "localhost_2"
     };
-    _clusterSetup.addInstancesToCluster(_clusterName, instanceInfoArray);
+    _setupTool.addInstancesToCluster(_clusterName, instanceInfoArray);
 
     // Add resource
-    _clusterSetup.addResourceToCluster(_clusterName, RESOURCE_NAME, NUM_PARTITIONS, _stateModel,
+    _setupTool.addResourceToCluster(_clusterName, RESOURCE_NAME, NUM_PARTITIONS, _stateModel,
         RebalanceMode.SEMI_AUTO.toString());
 
     // Update resource with empty preference lists
@@ -154,7 +152,7 @@ public class TestPreferenceListAsQueue extends ZkUnitTestBase {
     for (int i = 0; i < NUM_INSTANCES; i++) {
       participants[i] =
           HelixManagerFactory.getZKHelixManager(_clusterName, instanceInfoArray[i],
-              InstanceType.PARTICIPANT, ZK_ADDR);
+              InstanceType.PARTICIPANT, _zkaddr);
       participants[i].getStateMachineEngine().registerStateModelFactory(_stateModel,
           new PrefListTaskOnlineOfflineStateModelFactory());
       participants[i].connect();
@@ -162,7 +160,7 @@ public class TestPreferenceListAsQueue extends ZkUnitTestBase {
 
     // Start the controller
     HelixManager controller =
-        HelixManagerFactory.getZKHelixManager(_clusterName, null, InstanceType.CONTROLLER, ZK_ADDR);
+        HelixManagerFactory.getZKHelixManager(_clusterName, null, InstanceType.CONTROLLER, _zkaddr);
     controller.connect();
 
     // This resource only has 1 partition

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestRedefineStateModelDef.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestRedefineStateModelDef.java b/helix-core/src/test/java/org/apache/helix/integration/TestRedefineStateModelDef.java
index 3057ee0..1ce31f4 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestRedefineStateModelDef.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestRedefineStateModelDef.java
@@ -26,15 +26,13 @@ import java.util.TreeMap;
 
 import org.apache.helix.PropertyKey;
 import org.apache.helix.TestHelper;
-import org.apache.helix.ZNRecord;
-import org.apache.helix.ZkUnitTestBase;
 import org.apache.helix.integration.manager.ClusterControllerManager;
 import org.apache.helix.integration.manager.MockParticipantManager;
 import org.apache.helix.manager.zk.ZKHelixDataAccessor;
-import org.apache.helix.manager.zk.ZkBaseDataAccessor;
 import org.apache.helix.model.IdealState;
 import org.apache.helix.model.IdealState.RebalanceMode;
 import org.apache.helix.model.StateModelDefinition;
+import org.apache.helix.testutil.ZkTestBase;
 import org.apache.helix.tools.ClusterStateVerifier;
 import org.testng.Assert;
 import org.testng.annotations.Test;
@@ -45,7 +43,7 @@ import org.testng.annotations.Test;
  * states and transitions of old state model definition should be a subset of the new state model
  * definition)
  */
-public class TestRedefineStateModelDef extends ZkUnitTestBase {
+public class TestRedefineStateModelDef extends ZkTestBase {
 
   @Test
   public void test() throws Exception {
@@ -57,7 +55,7 @@ public class TestRedefineStateModelDef extends ZkUnitTestBase {
 
     System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
+    TestHelper.setupCluster(clusterName, _zkaddr, 12918, // participant port
         "localhost", // participant name prefix
         "TestDB", // resource name prefix
         1, // resources
@@ -69,7 +67,7 @@ public class TestRedefineStateModelDef extends ZkUnitTestBase {
 
     // start controller
     ClusterControllerManager controller =
-        new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
+        new ClusterControllerManager(_zkaddr, clusterName, "controller_0");
     controller.syncStart();
 
     // start participants
@@ -77,25 +75,25 @@ public class TestRedefineStateModelDef extends ZkUnitTestBase {
     for (int i = 0; i < n; i++) {
       String instanceName = "localhost_" + (12918 + i);
 
-      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+      participants[i] = new MockParticipantManager(_zkaddr, clusterName, instanceName);
       participants[i].syncStart();
     }
 
     boolean result =
         ClusterStateVerifier
-            .verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
+            .verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(_zkaddr,
                 clusterName));
     Assert.assertTrue(result);
 
     // stop controller, redefine state model definition, and re-start controller
     controller.syncStop();
     redefineStateModelDef(clusterName);
-    controller = new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
+    controller = new ClusterControllerManager(_zkaddr, clusterName, "controller_0");
     controller.syncStart();
 
     result =
         ClusterStateVerifier
-            .verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
+            .verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(_zkaddr,
                 clusterName));
     Assert.assertTrue(result);
 
@@ -113,7 +111,7 @@ public class TestRedefineStateModelDef extends ZkUnitTestBase {
   // auto-rebalance
   private void autoRebalance(String clusterName) {
     ZKHelixDataAccessor accessor =
-        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
+        new ZKHelixDataAccessor(clusterName, _baseAccessor);
     PropertyKey.Builder keyBuilder = accessor.keyBuilder();
     IdealState idealState = accessor.getProperty(keyBuilder.idealStates("TestDB0"));
 
@@ -132,7 +130,7 @@ public class TestRedefineStateModelDef extends ZkUnitTestBase {
   // the new state machine adds a new LEADER state which transfers to/from MASTER
   private void redefineStateModelDef(String clusterName) {
     ZKHelixDataAccessor accessor =
-        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
+        new ZKHelixDataAccessor(clusterName, _baseAccessor);
     PropertyKey.Builder keyBuilder = accessor.keyBuilder();
 
     StateModelDefinition masterSlave =

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestReelectedPipelineCorrectness.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestReelectedPipelineCorrectness.java b/helix-core/src/test/java/org/apache/helix/integration/TestReelectedPipelineCorrectness.java
index a1f1868..5595d0c 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestReelectedPipelineCorrectness.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestReelectedPipelineCorrectness.java
@@ -24,12 +24,12 @@ import java.util.Date;
 import org.apache.helix.HelixAdmin;
 import org.apache.helix.HelixDataAccessor;
 import org.apache.helix.TestHelper;
-import org.apache.helix.ZkUnitTestBase;
 import org.apache.helix.integration.manager.ClusterDistributedController;
 import org.apache.helix.integration.manager.MockParticipantManager;
 import org.apache.helix.model.IdealState;
 import org.apache.helix.model.IdealState.RebalanceMode;
 import org.apache.helix.model.LiveInstance;
+import org.apache.helix.testutil.ZkTestBase;
 import org.apache.helix.tools.ClusterSetup;
 import org.apache.helix.tools.ClusterStateVerifier;
 import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier;
@@ -41,7 +41,7 @@ import org.testng.annotations.Test;
  * when the change. However, if a controller loses leadership and subsequently regains it, we need
  * to ensure that the controller can verify its cache. That's what this test is for.
  */
-public class TestReelectedPipelineCorrectness extends ZkUnitTestBase {
+public class TestReelectedPipelineCorrectness extends ZkTestBase {
   private static final int CHECK_INTERVAL = 50;
   private static final int CHECK_TIMEOUT = 10000;
 
@@ -57,10 +57,8 @@ public class TestReelectedPipelineCorrectness extends ZkUnitTestBase {
     String clusterName = className + "_" + methodName;
     System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
-    ClusterSetup setupTool = new ClusterSetup(ZK_ADDR);
-
     // Set up cluster
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
+    TestHelper.setupCluster(clusterName, _zkaddr, 12918, // participant port
         "localhost", // participant name prefix
         "TestDB", // resource name prefix
         1, // resources
@@ -71,17 +69,17 @@ public class TestReelectedPipelineCorrectness extends ZkUnitTestBase {
 
     // configure distributed controllers
     String controllerCluster = clusterName + "_controllers";
-    setupTool.addCluster(controllerCluster, true);
+    _setupTool.addCluster(controllerCluster, true);
     for (int i = 0; i < NUM_CONTROLLERS; i++) {
-      setupTool.addInstanceToCluster(controllerCluster, "controller_" + i);
+      _setupTool.addInstanceToCluster(controllerCluster, "controller_" + i);
     }
-    setupTool.activateCluster(clusterName, controllerCluster, true);
+    _setupTool.activateCluster(clusterName, controllerCluster, true);
 
     // start participants
     MockParticipantManager[] participants = new MockParticipantManager[NUM_PARTICIPANTS];
     for (int i = 0; i < NUM_PARTICIPANTS; i++) {
       final String instanceName = "localhost_" + (12918 + i);
-      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+      participants[i] = new MockParticipantManager(_zkaddr, clusterName, instanceName);
       participants[i].syncStart();
     }
 
@@ -89,14 +87,14 @@ public class TestReelectedPipelineCorrectness extends ZkUnitTestBase {
     ClusterDistributedController[] controllers = new ClusterDistributedController[NUM_CONTROLLERS];
     for (int i = 0; i < NUM_CONTROLLERS; i++) {
       controllers[i] =
-          new ClusterDistributedController(ZK_ADDR, controllerCluster, "controller_" + i);
+          new ClusterDistributedController(_zkaddr, controllerCluster, "controller_" + i);
       controllers[i].syncStart();
     }
     Thread.sleep(1000);
 
     // Ensure a balanced cluster
     boolean result =
-        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
             clusterName));
     Assert.assertTrue(result);
 
@@ -114,7 +112,7 @@ public class TestReelectedPipelineCorrectness extends ZkUnitTestBase {
     }
     String leaderId = leader.getId();
     String standbyId = (leaderId.equals("controller_0")) ? "controller_1" : "controller_0";
-    HelixAdmin admin = setupTool.getClusterManagementTool();
+    HelixAdmin admin = _setupTool.getClusterManagementTool();
     admin.enableInstance(controllerCluster, leaderId, false);
 
     // Stop a participant to make sure that the leader election worked
@@ -122,7 +120,7 @@ public class TestReelectedPipelineCorrectness extends ZkUnitTestBase {
     participants[0].syncStop();
     Thread.sleep(500);
     result =
-        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
             clusterName));
     Assert.assertTrue(result);
 
@@ -146,7 +144,7 @@ public class TestReelectedPipelineCorrectness extends ZkUnitTestBase {
     // Now check that both the ideal state and the live instances are adhered to by the rebalance
     Thread.sleep(500);
     result =
-        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
             clusterName));
     Assert.assertTrue(result);
 

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestRenamePartition.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestRenamePartition.java b/helix-core/src/test/java/org/apache/helix/integration/TestRenamePartition.java
index d3a370d..c692ed5 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestRenamePartition.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestRenamePartition.java
@@ -33,14 +33,15 @@ import org.apache.helix.controller.strategy.DefaultTwoStateStrategy;
 import org.apache.helix.integration.manager.ClusterControllerManager;
 import org.apache.helix.integration.manager.MockParticipantManager;
 import org.apache.helix.manager.zk.ZKHelixDataAccessor;
-import org.apache.helix.manager.zk.ZkBaseDataAccessor;
 import org.apache.helix.model.IdealState;
 import org.apache.helix.model.IdealState.RebalanceMode;
+import org.apache.helix.testutil.TestUtil;
+import org.apache.helix.testutil.ZkTestBase;
 import org.apache.helix.tools.ClusterStateVerifier;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-public class TestRenamePartition extends ZkIntegrationTestBase {
+public class TestRenamePartition extends ZkTestBase {
   // map from clusterName to participants
   final Map<String, MockParticipantManager[]> _participantMap =
       new ConcurrentHashMap<String, MockParticipantManager[]>();
@@ -51,10 +52,10 @@ public class TestRenamePartition extends ZkIntegrationTestBase {
 
   @Test()
   public void testRenamePartitionAutoIS() throws Exception {
-    String clusterName = "CLUSTER_" + getShortClassName() + "_auto";
+    String clusterName = TestUtil.getTestName();
     System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant start port
+    TestHelper.setupCluster(clusterName, _zkaddr, 12918, // participant start port
         "localhost", // participant name prefix
         "TestDB", // resource name prefix
         1, // resources
@@ -67,7 +68,7 @@ public class TestRenamePartition extends ZkIntegrationTestBase {
 
     // rename partition name TestDB0_0 tp TestDB0_100
     ZKHelixDataAccessor accessor =
-        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
+        new ZKHelixDataAccessor(clusterName, _baseAccessor);
     Builder keyBuilder = accessor.keyBuilder();
 
     IdealState idealState = accessor.getProperty(keyBuilder.idealStates("TestDB0"));
@@ -78,7 +79,7 @@ public class TestRenamePartition extends ZkIntegrationTestBase {
 
     boolean result =
         ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(
-            ZK_ADDR, clusterName));
+            _zkaddr, clusterName));
     Assert.assertTrue(result);
 
     stop(clusterName);
@@ -88,10 +89,10 @@ public class TestRenamePartition extends ZkIntegrationTestBase {
   @Test()
   public void testRenamePartitionCustomIS() throws Exception {
 
-    String clusterName = "CLUSTER_" + getShortClassName() + "_custom";
+    String clusterName = TestUtil.getTestName();
     System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant start port
+    TestHelper.setupCluster(clusterName, _zkaddr, 12918, // participant start port
         "localhost", // participant name prefix
         "TestDB", // resource name prefix
         1, // resources
@@ -113,7 +114,7 @@ public class TestRenamePartition extends ZkIntegrationTestBase {
     idealState.setStateModelDefId(StateModelDefId.from("MasterSlave"));
 
     ZKHelixDataAccessor accessor =
-        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
+        new ZKHelixDataAccessor(clusterName, _baseAccessor);
     Builder keyBuilder = accessor.keyBuilder();
 
     accessor.setProperty(keyBuilder.idealStates("TestDB0"), idealState);
@@ -126,7 +127,7 @@ public class TestRenamePartition extends ZkIntegrationTestBase {
 
     boolean result =
         ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(
-            ZK_ADDR, clusterName));
+            _zkaddr, clusterName));
     Assert.assertTrue(result);
 
     stop(clusterName);
@@ -138,20 +139,20 @@ public class TestRenamePartition extends ZkIntegrationTestBase {
     MockParticipantManager[] participants = new MockParticipantManager[5];
 
     ClusterControllerManager controller =
-        new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
+        new ClusterControllerManager(_zkaddr, clusterName, "controller_0");
     controller.syncStart();
 
     // start participants
     for (int i = 0; i < 5; i++) {
       String instanceName = "localhost_" + (12918 + i);
 
-      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+      participants[i] = new MockParticipantManager(_zkaddr, clusterName, instanceName);
       participants[i].syncStart();
     }
 
     boolean result =
         ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(
-            ZK_ADDR, clusterName));
+            _zkaddr, clusterName));
     Assert.assertTrue(result);
 
     _participantMap.put(clusterName, participants);

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestResetInstance.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestResetInstance.java b/helix-core/src/test/java/org/apache/helix/integration/TestResetInstance.java
index 7159a17..e6b9c2d 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestResetInstance.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestResetInstance.java
@@ -28,12 +28,13 @@ import org.apache.helix.TestHelper;
 import org.apache.helix.integration.manager.ClusterControllerManager;
 import org.apache.helix.integration.manager.MockParticipantManager;
 import org.apache.helix.mock.participant.ErrTransition;
+import org.apache.helix.testutil.ZkTestBase;
 import org.apache.helix.tools.ClusterSetup;
 import org.apache.helix.tools.ClusterStateVerifier;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-public class TestResetInstance extends ZkIntegrationTestBase {
+public class TestResetInstance extends ZkTestBase {
 
   @Test
   public void testResetInstance() throws Exception {
@@ -44,7 +45,7 @@ public class TestResetInstance extends ZkIntegrationTestBase {
 
     System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
+    TestHelper.setupCluster(clusterName, _zkaddr, 12918, // participant port
         "localhost", // participant name prefix
         "TestDB", // resource name prefix
         1, // resources
@@ -55,7 +56,7 @@ public class TestResetInstance extends ZkIntegrationTestBase {
 
     // start controller
     ClusterControllerManager controller =
-        new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
+        new ClusterControllerManager(_zkaddr, clusterName, "controller_0");
     controller.syncStart();
 
     Map<String, Set<String>> errPartitions = new HashMap<String, Set<String>>() {
@@ -71,10 +72,10 @@ public class TestResetInstance extends ZkIntegrationTestBase {
       String instanceName = "localhost_" + (12918 + i);
 
       if (i == 0) {
-        participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+        participants[i] = new MockParticipantManager(_zkaddr, clusterName, instanceName);
         participants[i].setTransition(new ErrTransition(errPartitions));
       } else {
-        participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+        participants[i] = new MockParticipantManager(_zkaddr, clusterName, instanceName);
       }
       participants[i].syncStart();
     }
@@ -86,18 +87,18 @@ public class TestResetInstance extends ZkIntegrationTestBase {
     errStateMap.get("TestDB0").put("TestDB0_8", "localhost_12918");
     boolean result =
         ClusterStateVerifier
-            .verifyByZkCallback((new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
+            .verifyByZkCallback((new ClusterStateVerifier.BestPossAndExtViewZkVerifier(_zkaddr,
                 clusterName, errStateMap)));
     Assert.assertTrue(result, "Cluster verification fails");
 
     // reset node "localhost_12918"
     participants[0].setTransition(null);
-    String command = "--zkSvr " + ZK_ADDR + " --resetInstance " + clusterName + " localhost_12918";
+    String command = "--zkSvr " + _zkaddr + " --resetInstance " + clusterName + " localhost_12918";
     ClusterSetup.processCommandLineArgs(command.split("\\s+"));
 
     result =
         ClusterStateVerifier
-            .verifyByZkCallback((new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
+            .verifyByZkCallback((new ClusterStateVerifier.BestPossAndExtViewZkVerifier(_zkaddr,
                 clusterName)));
     Assert.assertTrue(result, "Cluster verification fails");
 

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestResetPartitionState.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestResetPartitionState.java b/helix-core/src/test/java/org/apache/helix/integration/TestResetPartitionState.java
index 5821153..85ab192 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestResetPartitionState.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestResetPartitionState.java
@@ -27,21 +27,20 @@ import java.util.Set;
 import org.apache.helix.NotificationContext;
 import org.apache.helix.PropertyKey.Builder;
 import org.apache.helix.TestHelper;
-import org.apache.helix.ZNRecord;
 import org.apache.helix.api.State;
 import org.apache.helix.manager.zk.ZKHelixDataAccessor;
-import org.apache.helix.manager.zk.ZkBaseDataAccessor;
 import org.apache.helix.integration.manager.ClusterControllerManager;
 import org.apache.helix.integration.manager.MockParticipantManager;
 import org.apache.helix.mock.participant.ErrTransition;
 import org.apache.helix.model.LiveInstance;
 import org.apache.helix.model.Message;
+import org.apache.helix.testutil.ZkTestBase;
 import org.apache.helix.tools.ClusterSetup;
 import org.apache.helix.tools.ClusterStateVerifier;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-public class TestResetPartitionState extends ZkIntegrationTestBase {
+public class TestResetPartitionState extends ZkTestBase {
   int _errToOfflineInvoked = 0;
 
   class ErrTransitionWithResetCnt extends ErrTransition {
@@ -71,7 +70,7 @@ public class TestResetPartitionState extends ZkIntegrationTestBase {
 
     System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
+    TestHelper.setupCluster(clusterName, _zkaddr, 12918, // participant port
         "localhost", // participant name prefix
         "TestDB", // resource name prefix
         1, // resources
@@ -82,7 +81,7 @@ public class TestResetPartitionState extends ZkIntegrationTestBase {
 
     // start controller
     ClusterControllerManager controller =
-        new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
+        new ClusterControllerManager(_zkaddr, clusterName, "controller_0");
     controller.syncStart();
 
     Map<String, Set<String>> errPartitions = new HashMap<String, Set<String>>() {
@@ -98,10 +97,10 @@ public class TestResetPartitionState extends ZkIntegrationTestBase {
       String instanceName = "localhost_" + (12918 + i);
 
       if (i == 0) {
-        participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+        participants[i] = new MockParticipantManager(_zkaddr, clusterName, instanceName);
         participants[i].setTransition(new ErrTransition(errPartitions));
       } else {
-        participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+        participants[i] = new MockParticipantManager(_zkaddr, clusterName, instanceName);
       }
       participants[i].syncStart();
     }
@@ -113,14 +112,14 @@ public class TestResetPartitionState extends ZkIntegrationTestBase {
     errStateMap.get("TestDB0").put("TestDB0_8", "localhost_12918");
     boolean result =
         ClusterStateVerifier
-            .verifyByZkCallback((new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
+            .verifyByZkCallback((new ClusterStateVerifier.BestPossAndExtViewZkVerifier(_zkaddr,
                 clusterName, errStateMap)));
     Assert.assertTrue(result, "Cluster verification fails");
 
     // reset a non-exist partition, should throw exception
     try {
       String command =
-          "--zkSvr " + ZK_ADDR + " --resetPartition " + clusterName
+          "--zkSvr " + _zkaddr + " --resetPartition " + clusterName
               + " localhost_12918 TestDB0 TestDB0_nonExist";
       ClusterSetup.processCommandLineArgs(command.split("\\s+"));
       Assert.fail("Should throw exception on reset a non-exist partition");
@@ -134,7 +133,7 @@ public class TestResetPartitionState extends ZkIntegrationTestBase {
     clearStatusUpdate(clusterName, "localhost_12918", "TestDB0", "TestDB0_4");
     _errToOfflineInvoked = 0;
     String command =
-        "--zkSvr " + ZK_ADDR + " --resetPartition " + clusterName
+        "--zkSvr " + _zkaddr + " --resetPartition " + clusterName
             + " localhost_12918 TestDB0 TestDB0_4";
 
     ClusterSetup.processCommandLineArgs(command.split("\\s+"));
@@ -149,7 +148,7 @@ public class TestResetPartitionState extends ZkIntegrationTestBase {
     errStateMap.get("TestDB0").remove("TestDB0_4");
     result =
         ClusterStateVerifier
-            .verifyByZkCallback((new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
+            .verifyByZkCallback((new ClusterStateVerifier.BestPossAndExtViewZkVerifier(_zkaddr,
                 clusterName, errStateMap)));
     Assert.assertTrue(result, "Cluster verification fails");
     Assert.assertEquals(_errToOfflineInvoked, 1);
@@ -159,13 +158,13 @@ public class TestResetPartitionState extends ZkIntegrationTestBase {
     clearStatusUpdate(clusterName, "localhost_12918", "TestDB0", "TestDB0_8");
 
     command =
-        "--zkSvr " + ZK_ADDR + " --resetPartition " + clusterName
+        "--zkSvr " + _zkaddr + " --resetPartition " + clusterName
             + " localhost_12918 TestDB0 TestDB0_8";
     ClusterSetup.processCommandLineArgs(command.split("\\s+"));
 
     result =
         ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(
-            ZK_ADDR, clusterName));
+            _zkaddr, clusterName));
     Assert.assertTrue(result, "Cluster verification fails");
     Assert.assertEquals(_errToOfflineInvoked, 2, "Should reset 2 partitions");
 
@@ -184,7 +183,7 @@ public class TestResetPartitionState extends ZkIntegrationTestBase {
     // clear status update for error partition so verify() will not fail on old
     // errors
     ZKHelixDataAccessor accessor =
-        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
+        new ZKHelixDataAccessor(clusterName, _baseAccessor);
     Builder keyBuilder = accessor.keyBuilder();
 
     LiveInstance liveInstance = accessor.getProperty(keyBuilder.liveInstance(instance));

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestResetResource.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestResetResource.java b/helix-core/src/test/java/org/apache/helix/integration/TestResetResource.java
index 46a05d8..60983af 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestResetResource.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestResetResource.java
@@ -28,12 +28,13 @@ import org.apache.helix.TestHelper;
 import org.apache.helix.integration.manager.ClusterControllerManager;
 import org.apache.helix.integration.manager.MockParticipantManager;
 import org.apache.helix.mock.participant.ErrTransition;
+import org.apache.helix.testutil.ZkTestBase;
 import org.apache.helix.tools.ClusterSetup;
 import org.apache.helix.tools.ClusterStateVerifier;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-public class TestResetResource extends ZkIntegrationTestBase {
+public class TestResetResource extends ZkTestBase {
   @Test
   public void testResetNode() throws Exception {
     String className = TestHelper.getTestClassName();
@@ -43,7 +44,7 @@ public class TestResetResource extends ZkIntegrationTestBase {
 
     System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
+    TestHelper.setupCluster(clusterName, _zkaddr, 12918, // participant port
         "localhost", // participant name prefix
         "TestDB", // resource name prefix
         1, // resources
@@ -54,7 +55,7 @@ public class TestResetResource extends ZkIntegrationTestBase {
 
     // start controller
     ClusterControllerManager controller =
-        new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
+        new ClusterControllerManager(_zkaddr, clusterName, "controller_0");
     controller.syncStart();
 
     Map<String, Set<String>> errPartitions = new HashMap<String, Set<String>>() {
@@ -70,10 +71,10 @@ public class TestResetResource extends ZkIntegrationTestBase {
       String instanceName = "localhost_" + (12918 + i);
 
       if (i == 0) {
-        participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+        participants[i] = new MockParticipantManager(_zkaddr, clusterName, instanceName);
         participants[i].setTransition(new ErrTransition(errPartitions));
       } else {
-        participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+        participants[i] = new MockParticipantManager(_zkaddr, clusterName, instanceName);
       }
       participants[i].syncStart();
     }
@@ -85,18 +86,18 @@ public class TestResetResource extends ZkIntegrationTestBase {
     errStateMap.get("TestDB0").put("TestDB0_8", "localhost_12918");
     boolean result =
         ClusterStateVerifier
-            .verifyByZkCallback((new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
+            .verifyByZkCallback((new ClusterStateVerifier.BestPossAndExtViewZkVerifier(_zkaddr,
                 clusterName, errStateMap)));
     Assert.assertTrue(result, "Cluster verification fails");
 
     // reset resource "TestDB0"
     participants[0].setTransition(null);
-    String command = "--zkSvr " + ZK_ADDR + " --resetResource " + clusterName + " TestDB0";
+    String command = "--zkSvr " + _zkaddr + " --resetResource " + clusterName + " TestDB0";
     ClusterSetup.processCommandLineArgs(command.split("\\s+"));
 
     result =
         ClusterStateVerifier
-            .verifyByZkCallback((new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
+            .verifyByZkCallback((new ClusterStateVerifier.BestPossAndExtViewZkVerifier(_zkaddr,
                 clusterName)));
     Assert.assertTrue(result, "Cluster verification fails");
 

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestRestartParticipant.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestRestartParticipant.java b/helix-core/src/test/java/org/apache/helix/integration/TestRestartParticipant.java
index 64043ed..e9d2b45 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestRestartParticipant.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestRestartParticipant.java
@@ -28,12 +28,14 @@ import org.apache.helix.integration.manager.ClusterControllerManager;
 import org.apache.helix.integration.manager.MockParticipantManager;
 import org.apache.helix.mock.participant.MockTransition;
 import org.apache.helix.model.Message;
+import org.apache.helix.testutil.TestUtil;
+import org.apache.helix.testutil.ZkTestBase;
 import org.apache.helix.tools.ClusterStateVerifier;
 import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-public class TestRestartParticipant extends ZkIntegrationTestBase {
+public class TestRestartParticipant extends ZkTestBase {
   public class KillOtherTransition extends MockTransition {
     final AtomicReference<MockParticipantManager> _other;
 
@@ -57,10 +59,10 @@ public class TestRestartParticipant extends ZkIntegrationTestBase {
     // Logger.getRootLogger().setLevel(Level.INFO);
     System.out.println("START testRestartParticipant at " + new Date(System.currentTimeMillis()));
 
-    String clusterName = getShortClassName();
+    String clusterName = TestUtil.getTestName();
     MockParticipantManager[] participants = new MockParticipantManager[5];
 
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
+    TestHelper.setupCluster(clusterName, _zkaddr, 12918, // participant port
         "localhost", // participant name prefix
         "TestDB", // resource name prefix
         1, // resources
@@ -70,7 +72,7 @@ public class TestRestartParticipant extends ZkIntegrationTestBase {
         "MasterSlave", true); // do rebalance
 
     ClusterControllerManager controller =
-        new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
+        new ClusterControllerManager(_zkaddr, clusterName, "controller_0");
     controller.syncStart();
 
     // start participants
@@ -78,29 +80,29 @@ public class TestRestartParticipant extends ZkIntegrationTestBase {
       String instanceName = "localhost_" + (12918 + i);
 
       if (i == 4) {
-        participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+        participants[i] = new MockParticipantManager(_zkaddr, clusterName, instanceName);
         participants[i].setTransition(new KillOtherTransition(participants[0]));
       } else {
-        participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+        participants[i] = new MockParticipantManager(_zkaddr, clusterName, instanceName);
       }
 
       participants[i].syncStart();
     }
 
     boolean result =
-        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
             clusterName));
     Assert.assertTrue(result);
 
     // restart
     Thread.sleep(500);
     MockParticipantManager participant =
-        new MockParticipantManager(ZK_ADDR, participants[0].getClusterName(),
+        new MockParticipantManager(_zkaddr, participants[0].getClusterName(),
             participants[0].getInstanceName());
     System.err.println("Restart " + participant.getInstanceName());
     participant.syncStart();
     result =
-        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
             clusterName));
     Assert.assertTrue(result);
 

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestSchedulerMessage.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestSchedulerMessage.java b/helix-core/src/test/java/org/apache/helix/integration/TestSchedulerMessage.java
index 80797bb..89af602 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestSchedulerMessage.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestSchedulerMessage.java
@@ -373,11 +373,11 @@ public class TestSchedulerMessage extends ZkStandAloneCMTestBase {
     String controllerStatusPath =
         HelixUtil.getControllerPropertyPath(manager.getClusterName(),
             PropertyType.STATUSUPDATES_CONTROLLER);
-    List<String> subPaths = _gZkClient.getChildren(controllerStatusPath);
+    List<String> subPaths = _zkclient.getChildren(controllerStatusPath);
     Assert.assertTrue(subPaths.size() > 0);
     for (String subPath : subPaths) {
       String nextPath = controllerStatusPath + "/" + subPath;
-      List<String> subsubPaths = _gZkClient.getChildren(nextPath);
+      List<String> subsubPaths = _zkclient.getChildren(nextPath);
       Assert.assertTrue(subsubPaths.size() > 0);
     }
 
@@ -385,38 +385,38 @@ public class TestSchedulerMessage extends ZkStandAloneCMTestBase {
         HelixUtil.getInstancePropertyPath(manager.getClusterName(), "localhost_" + (START_PORT),
             PropertyType.STATUSUPDATES);
 
-    subPaths = _gZkClient.getChildren(instanceStatusPath);
+    subPaths = _zkclient.getChildren(instanceStatusPath);
     Assert.assertTrue(subPaths.size() == 0);
     for (String subPath : subPaths) {
       String nextPath = instanceStatusPath + "/" + subPath;
-      List<String> subsubPaths = _gZkClient.getChildren(nextPath);
+      List<String> subsubPaths = _zkclient.getChildren(nextPath);
       Assert.assertTrue(subsubPaths.size() > 0);
       for (String subsubPath : subsubPaths) {
         String nextnextPath = nextPath + "/" + subsubPath;
-        Assert.assertTrue(_gZkClient.getChildren(nextnextPath).size() > 0);
+        Assert.assertTrue(_zkclient.getChildren(nextnextPath).size() > 0);
       }
     }
     Thread.sleep(3000);
     ZKPathDataDumpTask dumpTask = new ZKPathDataDumpTask(manager, 0L, 0L, Integer.MAX_VALUE);
     dumpTask.run();
 
-    subPaths = _gZkClient.getChildren(controllerStatusPath);
+    subPaths = _zkclient.getChildren(controllerStatusPath);
     Assert.assertTrue(subPaths.size() > 0);
     for (String subPath : subPaths) {
       String nextPath = controllerStatusPath + "/" + subPath;
-      List<String> subsubPaths = _gZkClient.getChildren(nextPath);
+      List<String> subsubPaths = _zkclient.getChildren(nextPath);
       Assert.assertTrue(subsubPaths.size() == 0);
     }
 
-    subPaths = _gZkClient.getChildren(instanceStatusPath);
+    subPaths = _zkclient.getChildren(instanceStatusPath);
     Assert.assertTrue(subPaths.size() == 0);
     for (String subPath : subPaths) {
       String nextPath = instanceStatusPath + "/" + subPath;
-      List<String> subsubPaths = _gZkClient.getChildren(nextPath);
+      List<String> subsubPaths = _zkclient.getChildren(nextPath);
       Assert.assertTrue(subsubPaths.size() > 0);
       for (String subsubPath : subsubPaths) {
         String nextnextPath = nextPath + "/" + subsubPath;
-        Assert.assertTrue(_gZkClient.getChildren(nextnextPath).size() == 0);
+        Assert.assertTrue(_zkclient.getChildren(nextnextPath).size() == 0);
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestSchemataSM.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestSchemataSM.java b/helix-core/src/test/java/org/apache/helix/integration/TestSchemataSM.java
index a927520..9adf374 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestSchemataSM.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestSchemataSM.java
@@ -26,19 +26,18 @@ import java.util.Map;
 import org.apache.helix.HelixConstants;
 import org.apache.helix.PropertyKey;
 import org.apache.helix.TestHelper;
-import org.apache.helix.ZNRecord;
 import org.apache.helix.integration.manager.ClusterControllerManager;
 import org.apache.helix.integration.manager.MockParticipantManager;
 import org.apache.helix.manager.zk.ZKHelixDataAccessor;
-import org.apache.helix.manager.zk.ZkBaseDataAccessor;
 import org.apache.helix.model.ExternalView;
 import org.apache.helix.model.IdealState;
+import org.apache.helix.testutil.ZkTestBase;
 import org.apache.helix.tools.ClusterStateVerifier;
 import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-public class TestSchemataSM extends ZkIntegrationTestBase {
+public class TestSchemataSM extends ZkTestBase {
   @Test
   public void testSchemataSM() throws Exception {
     String className = TestHelper.getTestClassName();
@@ -50,7 +49,7 @@ public class TestSchemataSM extends ZkIntegrationTestBase {
 
     System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant start port
+    TestHelper.setupCluster(clusterName, _zkaddr, 12918, // participant start port
         "localhost", // participant name prefix
         "TestSchemata", // resource name prefix
         1, // resources
@@ -61,7 +60,7 @@ public class TestSchemataSM extends ZkIntegrationTestBase {
 
     // rebalance ideal-state to use ANY_LIVEINSTANCE for preference list
     ZKHelixDataAccessor accessor =
-        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
+        new ZKHelixDataAccessor(clusterName, _baseAccessor);
     PropertyKey.Builder keyBuilder = accessor.keyBuilder();
     PropertyKey key = keyBuilder.idealStates("TestSchemata0");
     IdealState idealState = accessor.getProperty(key);
@@ -71,29 +70,29 @@ public class TestSchemataSM extends ZkIntegrationTestBase {
     accessor.setProperty(key, idealState);
 
     ClusterControllerManager controller =
-        new ClusterControllerManager(ZK_ADDR, clusterName, "controller");
+        new ClusterControllerManager(_zkaddr, clusterName, "controller");
     controller.syncStart();
 
     // start n-1 participants
     for (int i = 1; i < n; i++) {
       String instanceName = "localhost_" + (12918 + i);
 
-      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+      participants[i] = new MockParticipantManager(_zkaddr, clusterName, instanceName);
       participants[i].syncStart();
     }
 
     boolean result =
-        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
             clusterName));
     Assert.assertTrue(result);
 
     // start the remaining 1 participant
-    participants[0] = new MockParticipantManager(ZK_ADDR, clusterName, "localhost_12918");
+    participants[0] = new MockParticipantManager(_zkaddr, clusterName, "localhost_12918");
     participants[0].syncStart();
 
     // make sure we have all participants in MASTER state
     result =
-        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
             clusterName));
     Assert.assertTrue(result);
     key = keyBuilder.externalView("TestSchemata0");

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestSessionExpiryInTransition.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestSessionExpiryInTransition.java b/helix-core/src/test/java/org/apache/helix/integration/TestSessionExpiryInTransition.java
index 4abb519..bbca923 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestSessionExpiryInTransition.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestSessionExpiryInTransition.java
@@ -30,13 +30,14 @@ import org.apache.helix.integration.manager.ClusterControllerManager;
 import org.apache.helix.integration.manager.MockParticipantManager;
 import org.apache.helix.mock.participant.MockTransition;
 import org.apache.helix.model.Message;
+import org.apache.helix.testutil.ZkTestBase;
 import org.apache.helix.tools.ClusterStateVerifier;
 import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier;
 import org.apache.log4j.Logger;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-public class TestSessionExpiryInTransition extends ZkIntegrationTestBase {
+public class TestSessionExpiryInTransition extends ZkTestBase {
   private static Logger LOG = Logger.getLogger(TestSessionExpiryInTransition.class);
 
   public class SessionExpiryTransition extends MockTransition {
@@ -73,7 +74,7 @@ public class TestSessionExpiryInTransition extends ZkIntegrationTestBase {
 
     MockParticipantManager[] participants = new MockParticipantManager[5];
 
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
+    TestHelper.setupCluster(clusterName, _zkaddr, 12918, // participant port
         "localhost", // participant name prefix
         "TestDB", // resource name prefix
         1, // resources
@@ -84,19 +85,19 @@ public class TestSessionExpiryInTransition extends ZkIntegrationTestBase {
 
     // start controller
     ClusterControllerManager controller =
-        new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
+        new ClusterControllerManager(_zkaddr, clusterName, "controller_0");
     controller.syncStart();
 
     // start participants
     for (int i = 0; i < 5; i++) {
       String instanceName = "localhost_" + (12918 + i);
-      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+      participants[i] = new MockParticipantManager(_zkaddr, clusterName, instanceName);
       participants[i].setTransition(new SessionExpiryTransition());
       participants[i].syncStart();
     }
 
     boolean result =
-        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
             clusterName));
     Assert.assertTrue(result);
 

http://git-wip-us.apache.org/repos/asf/helix/blob/410815d0/helix-core/src/test/java/org/apache/helix/integration/TestSharedConnection.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestSharedConnection.java b/helix-core/src/test/java/org/apache/helix/integration/TestSharedConnection.java
index 0aef00e..665db05 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestSharedConnection.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestSharedConnection.java
@@ -27,7 +27,6 @@ import org.apache.helix.HelixConnection;
 import org.apache.helix.HelixController;
 import org.apache.helix.HelixParticipant;
 import org.apache.helix.TestHelper;
-import org.apache.helix.ZkUnitTestBase;
 import org.apache.helix.api.State;
 import org.apache.helix.api.id.ClusterId;
 import org.apache.helix.api.id.ControllerId;
@@ -39,6 +38,7 @@ import org.apache.helix.manager.zk.ZkHelixConnection;
 import org.apache.helix.manager.zk.ZkHelixLeaderElection;
 import org.apache.helix.model.IdealState;
 import org.apache.helix.model.IdealState.RebalanceMode;
+import org.apache.helix.testutil.ZkTestBase;
 import org.apache.helix.tools.ClusterStateVerifier;
 import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier;
 import org.testng.Assert;
@@ -47,7 +47,7 @@ import org.testng.annotations.Test;
 /**
  * Ensure that the external view is able to update properly when participants share a connection.
  */
-public class TestSharedConnection extends ZkUnitTestBase {
+public class TestSharedConnection extends ZkTestBase {
   /**
    * Ensure that the external view is able to update properly when participants share a connection.
    */
@@ -64,7 +64,7 @@ public class TestSharedConnection extends ZkUnitTestBase {
     System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
     // Set up cluster
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
+    TestHelper.setupCluster(clusterName, _zkaddr, 12918, // participant port
         "localhost", // participant name prefix
         "TestDB", // resource name prefix
         1, // resources
@@ -74,7 +74,7 @@ public class TestSharedConnection extends ZkUnitTestBase {
         "OnlineOffline", RebalanceMode.CUSTOMIZED, true); // do rebalance
 
     // Connect
-    HelixConnection connection = new ZkHelixConnection(ZK_ADDR);
+    HelixConnection connection = new ZkHelixConnection(_zkaddr);
     connection.connect();
 
     // Start some participants
@@ -96,7 +96,7 @@ public class TestSharedConnection extends ZkUnitTestBase {
 
     // Verify balanced cluster
     boolean result =
-        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
             clusterName));
     Assert.assertTrue(result);
 
@@ -112,7 +112,7 @@ public class TestSharedConnection extends ZkUnitTestBase {
 
     // Verify balanced cluster
     result =
-        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
             clusterName));
     Assert.assertTrue(result);
 
@@ -125,7 +125,7 @@ public class TestSharedConnection extends ZkUnitTestBase {
 
     // Verify balanced cluster
     result =
-        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
             clusterName));
     Assert.assertTrue(result);
 
@@ -154,7 +154,7 @@ public class TestSharedConnection extends ZkUnitTestBase {
     System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
     // Set up cluster
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
+    TestHelper.setupCluster(clusterName, _zkaddr, 12918, // participant port
         "localhost", // participant name prefix
         "TestDB", // resource name prefix
         1, // resources
@@ -164,7 +164,7 @@ public class TestSharedConnection extends ZkUnitTestBase {
         "OnlineOffline", RebalanceMode.CUSTOMIZED, true); // do rebalance
 
     // Connect
-    HelixConnection connection = new ZkHelixConnection(ZK_ADDR);
+    HelixConnection connection = new ZkHelixConnection(_zkaddr);
     connection.connect();
 
     // Create a couple controllers