Repository: helix
Updated Branches:
  refs/heads/master fe970550b -> c0d5792b7


http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/task/TestJobFailureDependence.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestJobFailureDependence.java
 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestJobFailureDependence.java
index 3d039aa..43d80fe 100644
--- 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestJobFailureDependence.java
+++ 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestJobFailureDependence.java
@@ -62,7 +62,7 @@ public class TestJobFailureDependence extends TaskTestBase {
     }
 
     _driver.start(queueBuilder.build());
-    _setupTool.dropResourceFromCluster(CLUSTER_NAME, _testDbs.get(2));
+    _gSetupTool.dropResourceFromCluster(CLUSTER_NAME, _testDbs.get(2));
 
     // all jobs after failed job should fail too.
     for (int i = 2; i < _numDbs; i++) {
@@ -90,7 +90,7 @@ public class TestJobFailureDependence extends TaskTestBase {
     }
 
     _driver.start(queueBuilder.build());
-    _setupTool.dropResourceFromCluster(CLUSTER_NAME, _testDbs.get(2));
+    _gSetupTool.dropResourceFromCluster(CLUSTER_NAME, _testDbs.get(2));
 
     String namedSpaceJob1 = String.format("%s_%s", queueName, 
currentJobNames.get(2));
     _driver.pollForJobState(queueName, namedSpaceJob1, TaskState.FAILED);
@@ -115,7 +115,7 @@ public class TestJobFailureDependence extends TaskTestBase {
     }
 
     _driver.start(queueBuilder.build());
-    _setupTool.dropResourceFromCluster(CLUSTER_NAME, _testDbs.get(2));
+    _gSetupTool.dropResourceFromCluster(CLUSTER_NAME, _testDbs.get(2));
     String namedSpaceJob2 = String.format("%s_%s", queueName, 
currentJobNames.get(2));
     _driver.pollForJobState(queueName, namedSpaceJob2, TaskState.FAILED);
 
@@ -145,7 +145,7 @@ public class TestJobFailureDependence extends TaskTestBase {
     }
 
     _driver.start(queueBuilder.build());
-    _setupTool.dropResourceFromCluster(CLUSTER_NAME, _testDbs.get(1));
+    _gSetupTool.dropResourceFromCluster(CLUSTER_NAME, _testDbs.get(1));
 
     String namedSpaceJob1 = String.format("%s_%s", queueName, 
currentJobNames.get(1));
     _driver.pollForJobState(queueName, namedSpaceJob1, TaskState.FAILED);

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/task/TestJobFailureHighThreshold.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestJobFailureHighThreshold.java
 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestJobFailureHighThreshold.java
index 9e67d46..062d277 100644
--- 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestJobFailureHighThreshold.java
+++ 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestJobFailureHighThreshold.java
@@ -43,7 +43,6 @@ import org.testng.annotations.Test;
 
 public class TestJobFailureHighThreshold extends TaskSynchronizedTestBase {
 
-  private ClusterControllerManager _controller;
   private static final String DB_NAME = WorkflowGenerator.DEFAULT_TGT_DB;
 
   @BeforeClass
@@ -54,13 +53,7 @@ public class TestJobFailureHighThreshold extends 
TaskSynchronizedTestBase {
     _numParitions = 5;
     _numReplicas = 1;
 
-    String namespace = "/" + CLUSTER_NAME;
-    if (_gZkClient.exists(namespace)) {
-      _gZkClient.deleteRecursively(namespace);
-    }
-
-    _setupTool = new ClusterSetup(ZK_ADDR);
-    _setupTool.addCluster(CLUSTER_NAME, true);
+    _gSetupTool.addCluster(CLUSTER_NAME, true);
     setupParticipants();
     setupDBs();
     startParticipants();

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/task/TestJobFailureTaskNotStarted.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestJobFailureTaskNotStarted.java
 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestJobFailureTaskNotStarted.java
index d1f8250..ace98e0 100644
--- 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestJobFailureTaskNotStarted.java
+++ 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestJobFailureTaskNotStarted.java
@@ -56,8 +56,6 @@ import org.testng.annotations.Test;
 
 
 public class TestJobFailureTaskNotStarted extends TaskSynchronizedTestBase {
-
-  private ClusterControllerManager _controller;
   private static final String DB_NAME = WorkflowGenerator.DEFAULT_TGT_DB;
   private static final String UNBALANCED_DB_NAME = "UnbalancedDB";
   private MockParticipantManager _blockedParticipant;
@@ -71,13 +69,7 @@ public class TestJobFailureTaskNotStarted extends 
TaskSynchronizedTestBase {
     _numParitions = 2;
     _numReplicas = 1;
 
-    String namespace = "/" + CLUSTER_NAME;
-    if (_gZkClient.exists(namespace)) {
-      _gZkClient.deleteRecursively(namespace);
-    }
-
-    _setupTool = new ClusterSetup(ZK_ADDR);
-    _setupTool.addCluster(CLUSTER_NAME, true);
+    _gSetupTool.addCluster(CLUSTER_NAME, true);
     setupParticipants();
     setupDBs();
     startParticipantsWithStuckTaskStateModelFactory();
@@ -101,7 +93,7 @@ public class TestJobFailureTaskNotStarted extends 
TaskSynchronizedTestBase {
       }
     });
 
-    List<String> instances = 
_setupTool.getClusterManagementTool().getInstancesInCluster(CLUSTER_NAME);
+    List<String> instances = 
_gSetupTool.getClusterManagementTool().getInstancesInCluster(CLUSTER_NAME);
 
     _participants[0] = new MockParticipantManager(ZK_ADDR, CLUSTER_NAME, 
instances.get(0));
     StateMachineEngine stateMachine = _participants[0].getStateMachineEngine();
@@ -180,12 +172,12 @@ public class TestJobFailureTaskNotStarted extends 
TaskSynchronizedTestBase {
 
   private void setupUnbalancedDB() throws InterruptedException {
     // Start with Full-Auto mode to create the partitions, Semi-Auto won't 
create partitions.
-    _setupTool.addResourceToCluster(CLUSTER_NAME, UNBALANCED_DB_NAME, 50, 
MASTER_SLAVE_STATE_MODEL,
+    _gSetupTool.addResourceToCluster(CLUSTER_NAME, UNBALANCED_DB_NAME, 50, 
MASTER_SLAVE_STATE_MODEL,
         IdealState.RebalanceMode.FULL_AUTO.toString());
-    _setupTool.rebalanceStorageCluster(CLUSTER_NAME, UNBALANCED_DB_NAME, 1);
+    _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, UNBALANCED_DB_NAME, 1);
 
     // Set preference list to put all partitions to one instance.
-    IdealState idealState = 
_setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME,
+    IdealState idealState = 
_gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME,
         UNBALANCED_DB_NAME);
     Set<String> partitions = idealState.getPartitionSet();
     for (String partition : partitions) {
@@ -193,7 +185,7 @@ public class TestJobFailureTaskNotStarted extends 
TaskSynchronizedTestBase {
     }
     idealState.setRebalanceMode(IdealState.RebalanceMode.SEMI_AUTO);
 
-    _setupTool.getClusterManagementTool().setResourceIdealState(CLUSTER_NAME, 
UNBALANCED_DB_NAME, idealState);
+    _gSetupTool.getClusterManagementTool().setResourceIdealState(CLUSTER_NAME, 
UNBALANCED_DB_NAME, idealState);
 
     HelixClusterVerifier clusterVerifier =
         new 
BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME).setZkClient(_gZkClient).build();

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/task/TestJobTimeout.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestJobTimeout.java
 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestJobTimeout.java
index 8482f69..dffb613 100644
--- 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestJobTimeout.java
+++ 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestJobTimeout.java
@@ -41,8 +41,6 @@ import com.google.common.collect.Sets;
 
 public final class TestJobTimeout extends TaskSynchronizedTestBase {
 
-  private ClusterControllerManager _controller;
-
   @BeforeClass
   public void beforeClass() throws Exception {
     _numNodes = 2;
@@ -50,13 +48,8 @@ public final class TestJobTimeout extends 
TaskSynchronizedTestBase {
     _numReplicas = 1; // only Master, no Slave
     _numDbs = 1;
     _participants =  new MockParticipantManager[_numNodes];
-    String namespace = "/" + CLUSTER_NAME;
-    if (_gZkClient.exists(namespace)) {
-      _gZkClient.deleteRecursively(namespace);
-    }
 
-    _setupTool = new ClusterSetup(ZK_ADDR);
-    _setupTool.addCluster(CLUSTER_NAME, true);
+    _gSetupTool.addCluster(CLUSTER_NAME, true);
     setupParticipants();
     setupDBs();
     startParticipants();

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/task/TestJobTimeoutTaskNotStarted.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestJobTimeoutTaskNotStarted.java
 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestJobTimeoutTaskNotStarted.java
index 6129946..32d5d52 100644
--- 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestJobTimeoutTaskNotStarted.java
+++ 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestJobTimeoutTaskNotStarted.java
@@ -52,8 +52,6 @@ import com.google.common.collect.Sets;
 
 public class TestJobTimeoutTaskNotStarted extends TaskSynchronizedTestBase {
 
-  private ClusterControllerManager _controller;
-
   @BeforeClass
   public void beforeClass() throws Exception {
     _numDbs = 1;
@@ -61,13 +59,7 @@ public class TestJobTimeoutTaskNotStarted extends 
TaskSynchronizedTestBase {
     _numParitions = 50;
     _numReplicas = 1;
     _participants =  new MockParticipantManager[_numNodes];
-    String namespace = "/" + CLUSTER_NAME;
-    if (_gZkClient.exists(namespace)) {
-      _gZkClient.deleteRecursively(namespace);
-    }
-
-    _setupTool = new ClusterSetup(ZK_ADDR);
-    _setupTool.addCluster(CLUSTER_NAME, true);
+    _gSetupTool.addCluster(CLUSTER_NAME, true);
     setupParticipants();
     setupDBs();
     startParticipantsWithStuckTaskStateModelFactory();

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/task/TestRebalanceRunningTask.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestRebalanceRunningTask.java
 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestRebalanceRunningTask.java
index f518d5c..f9fa2bc 100644
--- 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestRebalanceRunningTask.java
+++ 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestRebalanceRunningTask.java
@@ -42,8 +42,6 @@ import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 public final class TestRebalanceRunningTask extends TaskSynchronizedTestBase {
-
-  private ClusterControllerManager _controller;
   private final String JOB = "test_job";
   private String WORKFLOW;
   private final String DATABASE = WorkflowGenerator.DEFAULT_TGT_DB;
@@ -57,13 +55,7 @@ public final class TestRebalanceRunningTask extends 
TaskSynchronizedTestBase {
     _numReplicas = 1; // only Master, no Slave
     _numDbs = 1;
 
-    String namespace = "/" + CLUSTER_NAME;
-    if (_gZkClient.exists(namespace)) {
-      _gZkClient.deleteRecursively(namespace);
-    }
-
-    _setupTool = new ClusterSetup(ZK_ADDR);
-    _setupTool.addCluster(CLUSTER_NAME, true);
+    _gSetupTool.addCluster(CLUSTER_NAME, true);
     setupParticipants();
     setupDBs();
 

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/task/TestRunJobsWithMissingTarget.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestRunJobsWithMissingTarget.java
 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestRunJobsWithMissingTarget.java
index b50bf12..23da9dc 100644
--- 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestRunJobsWithMissingTarget.java
+++ 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestRunJobsWithMissingTarget.java
@@ -65,7 +65,7 @@ public class TestRunJobsWithMissingTarget extends 
TaskTestBase {
       currentJobNames.add(jobName);
     }
 
-    _setupTool.dropResourceFromCluster(CLUSTER_NAME, _testDbs.get(1));
+    _gSetupTool.dropResourceFromCluster(CLUSTER_NAME, _testDbs.get(1));
     _driver.start(builder.build());
 
     String namedSpaceJob = String.format("%s_%s", workflowName, 
currentJobNames.get(1));
@@ -129,7 +129,7 @@ public class TestRunJobsWithMissingTarget extends 
TaskTestBase {
     }
 
     _driver.start(builder.build());
-    _setupTool.dropResourceFromCluster(CLUSTER_NAME, _testDbs.get(0));
+    _gSetupTool.dropResourceFromCluster(CLUSTER_NAME, _testDbs.get(0));
 
     String namedSpaceJob1 = String.format("%s_%s", workflowName, 
currentJobNames.get(0));
     _driver.pollForJobState(workflowName, namedSpaceJob1, TaskState.FAILED);

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskAssignment.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskAssignment.java
 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskAssignment.java
index c78b43c..6045812 100644
--- 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskAssignment.java
+++ 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskAssignment.java
@@ -45,7 +45,7 @@ public class TestTaskAssignment extends TaskTestBase {
 
   @Test
   public void testTaskAssignment() throws InterruptedException {
-    _setupTool.getClusterManagementTool()
+    _gSetupTool.getClusterManagementTool()
         .enableInstance(CLUSTER_NAME, PARTICIPANT_PREFIX + "_" + (_startPort + 
0), false);
     String jobResource = TestHelper.getTestMethodName();
     JobConfig.Builder jobBuilder = new 
JobConfig.Builder().setCommand(MockTask.TASK_COMMAND)

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskRebalancerParallel.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskRebalancerParallel.java
 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskRebalancerParallel.java
index 225a75c..62aca00 100644
--- 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskRebalancerParallel.java
+++ 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskRebalancerParallel.java
@@ -121,9 +121,5 @@ public class TestTaskRebalancerParallel extends 
TaskTestBase {
     _driver.resume(queueName);
     Thread.sleep(2000);
     Assert.assertTrue(TaskTestUtil.pollForWorkflowParallelState(_driver, 
queueName));
-
-    for (int i = 1; i < _numNodes; i++) {
-      _participants[i].syncStart();
-    }
   }
 }

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskThreadLeak.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskThreadLeak.java
 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskThreadLeak.java
index 95ac55b..420c534 100644
--- 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskThreadLeak.java
+++ 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskThreadLeak.java
@@ -50,9 +50,9 @@ public class TestTaskThreadLeak extends TaskTestBase {
     String lastJob = null;
     for (int i = 0; i < 5; i++) {
       String db = TestHelper.getTestMethodName() + "_" + i;
-      _setupTool.addResourceToCluster(CLUSTER_NAME, db, 20, 
MASTER_SLAVE_STATE_MODEL,
+      _gSetupTool.addResourceToCluster(CLUSTER_NAME, db, 20, 
MASTER_SLAVE_STATE_MODEL,
           IdealState.RebalanceMode.FULL_AUTO.name());
-      _setupTool.rebalanceStorageCluster(CLUSTER_NAME, db, 1);
+      _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, db, 1);
       JobConfig.Builder jobBuilder =
           new 
JobConfig.Builder().setCommand(MockTask.TASK_COMMAND).setTargetResource(db)
               .setNumConcurrentTasksPerInstance(100);

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskThrottling.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskThrottling.java
 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskThrottling.java
index bec9505..d25397a 100644
--- 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskThrottling.java
+++ 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskThrottling.java
@@ -78,7 +78,7 @@ public class TestTaskThrottling extends TaskTestBase {
     Map<String, String> properties = new HashMap<String, String>();
     
properties.put(ClusterConfig.ClusterConfigProperty.MAX_CONCURRENT_TASK_PER_INSTANCE.name(),
         new Integer(perNodeTaskLimitation).toString());
-    _setupTool.getClusterManagementTool().setConfig(scope, properties);
+    _gSetupTool.getClusterManagementTool().setConfig(scope, properties);
 
     String jobName2 = "Job2";
     flow = WorkflowGenerator.generateSingleJobWorkflowBuilder(jobName2, 
jobConfig).build();
@@ -173,10 +173,10 @@ public class TestTaskThrottling extends TaskTestBase {
 
   private void setParticipantsCapacity(int perNodeTaskLimitation) {
     for (int i = 0; i < _numNodes; i++) {
-      InstanceConfig instanceConfig = _setupTool.getClusterManagementTool()
+      InstanceConfig instanceConfig = _gSetupTool.getClusterManagementTool()
           .getInstanceConfig(CLUSTER_NAME, PARTICIPANT_PREFIX + "_" + 
(_startPort + i));
       instanceConfig.setMaxConcurrentTask(perNodeTaskLimitation);
-      _setupTool.getClusterManagementTool()
+      _gSetupTool.getClusterManagementTool()
           .setInstanceConfig(CLUSTER_NAME, PARTICIPANT_PREFIX + "_" + 
(_startPort + i), instanceConfig);
     }
   }

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskWithInstanceDisabled.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskWithInstanceDisabled.java
 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskWithInstanceDisabled.java
index a95dfca..6bea3e7 100644
--- 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskWithInstanceDisabled.java
+++ 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskWithInstanceDisabled.java
@@ -41,7 +41,7 @@ public class TestTaskWithInstanceDisabled extends 
TaskTestBase {
   }
   @Test
   public void testTaskWithInstanceDisabled() throws InterruptedException {
-    _setupTool.getClusterManagementTool()
+    _gSetupTool.getClusterManagementTool()
         .enableInstance(CLUSTER_NAME, PARTICIPANT_PREFIX + "_" + (_startPort + 
0), false);
     String jobResource = TestHelper.getTestMethodName();
     JobConfig.Builder jobBuilder = new 
JobConfig.Builder().setCommand(MockTask.TASK_COMMAND)

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/task/TestUserContentStore.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestUserContentStore.java
 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestUserContentStore.java
index 0f3ab51..b656cdc 100644
--- 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestUserContentStore.java
+++ 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestUserContentStore.java
@@ -55,17 +55,12 @@ public class TestUserContentStore extends TaskTestBase {
   @BeforeClass
   public void beforeClass() throws Exception {
     _participants = new MockParticipantManager[_numNodes];
-    String namespace = "/" + CLUSTER_NAME;
-    if (_gZkClient.exists(namespace)) {
-      _gZkClient.deleteRecursively(namespace);
-    }
 
     // Setup cluster and instances
-    ClusterSetup setupTool = new ClusterSetup(ZK_ADDR);
-    setupTool.addCluster(CLUSTER_NAME, true);
+    _gSetupTool.addCluster(CLUSTER_NAME, true);
     for (int i = 0; i < _numNodes; i++) {
       String storageNodeName = PARTICIPANT_PREFIX + "_" + (_startPort + i);
-      setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName);
+      _gSetupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName);
     }
 
     // start dummy participants

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/manager/zk/TestHandleNewSession.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/manager/zk/TestHandleNewSession.java
 
b/helix-core/src/test/java/org/apache/helix/manager/zk/TestHandleNewSession.java
index 2c84d22..d960315 100644
--- 
a/helix-core/src/test/java/org/apache/helix/manager/zk/TestHandleNewSession.java
+++ 
b/helix-core/src/test/java/org/apache/helix/manager/zk/TestHandleNewSession.java
@@ -23,12 +23,12 @@ import java.util.Date;
 
 import org.apache.helix.TestHelper;
 import org.apache.helix.ZkTestHelper;
-import org.apache.helix.integration.common.ZkIntegrationTestBase;
+import org.apache.helix.common.ZkTestBase;
 import org.apache.helix.integration.manager.MockParticipantManager;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-public class TestHandleNewSession extends ZkIntegrationTestBase {
+public class TestHandleNewSession extends ZkTestBase {
   @Test
   public void testHandleNewSession() throws Exception {
     // Logger.getRootLogger().setLevel(Level.INFO);
@@ -72,6 +72,7 @@ public class TestHandleNewSession extends 
ZkIntegrationTestBase {
     // Logger.getRootLogger().setLevel(Level.INFO);
     System.out.println("Disconnecting ...");
     participant.syncStop();
+    _gSetupTool.deleteCluster(clusterName);
 
     System.out.println("END " + clusterName + " at " + new 
Date(System.currentTimeMillis()));
 

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkBaseDataAccessor.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkBaseDataAccessor.java
 
b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkBaseDataAccessor.java
index 021fb39..fb7b973 100644
--- 
a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkBaseDataAccessor.java
+++ 
b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkBaseDataAccessor.java
@@ -36,9 +36,26 @@ import 
org.apache.helix.manager.zk.ZkBaseDataAccessor.AccessResult;
 import org.apache.helix.manager.zk.ZkBaseDataAccessor.RetCode;
 import org.apache.zookeeper.data.Stat;
 import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
 import org.testng.annotations.Test;
 
 public class TestZkBaseDataAccessor extends ZkUnitTestBase {
+  String _rootPath = TestHelper.getTestClassName();
+
+
+  @AfterMethod
+  public void afterMethod() {
+    String path = "/" + _rootPath;
+    if (_gZkClient.exists(path)) {
+      _gZkClient.deleteRecursively(path);
+    }
+  }
+
+  @AfterClass
+  public void after() {
+    int a =1;
+  }
 
   @Test
   public void testSyncSet() {
@@ -48,7 +65,7 @@ public class TestZkBaseDataAccessor extends ZkUnitTestBase {
 
     System.out.println("START " + testName + " at " + new 
Date(System.currentTimeMillis()));
 
-    String path = String.format("/%s/%s", testName, "msg_0");
+    String path = String.format("/%s/%s", _rootPath, "msg_0");
     ZNRecord record = new ZNRecord("msg_0");
     BaseDataAccessor<ZNRecord> accessor = new 
ZkBaseDataAccessor<ZNRecord>(_gZkClient);
 
@@ -59,7 +76,6 @@ public class TestZkBaseDataAccessor extends ZkUnitTestBase {
     Assert.assertEquals(getRecord.getId(), "msg_0");
 
     System.out.println("END " + testName + " at " + new 
Date(System.currentTimeMillis()));
-
   }
 
   @Test
@@ -70,7 +86,7 @@ public class TestZkBaseDataAccessor extends ZkUnitTestBase {
 
     System.out.println("START " + testName + " at " + new 
Date(System.currentTimeMillis()));
 
-    String path = String.format("/%s/%s", testName, "msg_0");
+    String path = String.format("/%s/%s", _rootPath, "msg_0");
     ZNRecord record = new ZNRecord("msg_0");
     BaseDataAccessor<ZNRecord> accessor = new 
ZkBaseDataAccessor<ZNRecord>(_gZkClient);
 
@@ -91,7 +107,7 @@ public class TestZkBaseDataAccessor extends ZkUnitTestBase {
     Assert.assertEquals(getRecord.getId(), "msg_0");
 
     // set ephemeral
-    path = String.format("/%s/%s", testName, "msg_1");
+    path = String.format("/%s/%s", _rootPath, "msg_1");
     record = new ZNRecord("msg_1");
     success = accessor.set(path, record, 0, AccessOption.EPHEMERAL);
     Assert.assertFalse(success);
@@ -128,19 +144,17 @@ public class TestZkBaseDataAccessor extends 
ZkUnitTestBase {
 
     System.out.println("START " + testName + " at " + new 
Date(System.currentTimeMillis()));
 
-    String path = String.format("/%s/%s/%s", testName, "msg_0", "submsg_0");
+    String path = String.format("/%s/%s/%s", _rootPath, "msg_0", "submsg_0");
     ZNRecord record = new ZNRecord("submsg_0");
     ZkBaseDataAccessor<ZNRecord> accessor = new 
ZkBaseDataAccessor<ZNRecord>(_gZkClient);
 
     AccessResult result = accessor.doSet(path, record, -1, 
AccessOption.PERSISTENT);
     Assert.assertEquals(result._retCode, RetCode.OK);
     Assert.assertEquals(result._pathCreated.size(), 3);
-    Assert.assertTrue(result._pathCreated.contains(String.format("/%s", 
testName)));
-    Assert.assertTrue(result._pathCreated.contains(String.format("/%s/%s", 
testName, "msg_0")));
+    Assert.assertTrue(result._pathCreated.contains(String.format("/%s/%s", 
_rootPath, "msg_0")));
     Assert.assertTrue(result._pathCreated.contains(path));
 
-    Assert.assertTrue(_gZkClient.exists(String.format("/%s", testName)));
-    Assert.assertTrue(_gZkClient.exists(String.format("/%s/%s", testName, 
"msg_0")));
+    Assert.assertTrue(_gZkClient.exists(String.format("/%s/%s", _rootPath, 
"msg_0")));
     ZNRecord getRecord = _gZkClient.readData(path);
     Assert.assertNotNull(getRecord);
     Assert.assertEquals(getRecord.getId(), "submsg_0");
@@ -156,9 +170,9 @@ public class TestZkBaseDataAccessor extends ZkUnitTestBase {
 
     System.out.println("START " + testName + " at " + new 
Date(System.currentTimeMillis()));
 
-    String path = String.format("/%s/%s", testName, "msg_0");
+    String path = String.format("/%s/%s", _rootPath, "msg_0");
     ZNRecord record = new ZNRecord("msg_0");
-    ZkBaseDataAccessor<ZNRecord> accessor = new 
ZkBaseDataAccessor<ZNRecord>(_gZkClient);
+    ZkBaseDataAccessor<ZNRecord> accessor = new 
ZkBaseDataAccessor<>(_gZkClient);
 
     boolean success = accessor.create(path, record, AccessOption.PERSISTENT);
     Assert.assertTrue(success);
@@ -184,7 +198,7 @@ public class TestZkBaseDataAccessor extends ZkUnitTestBase {
 
     System.out.println("START " + testName + " at " + new 
Date(System.currentTimeMillis()));
 
-    String path = String.format("/%s/%s", testName, "msg_0");
+    String path = String.format("/%s/%s", _rootPath, "msg_0");
     ZNRecord record = new ZNRecord("msg_0");
     ZkBaseDataAccessor<ZNRecord> accessor = new 
ZkBaseDataAccessor<ZNRecord>(_gZkClient);
 
@@ -227,7 +241,7 @@ public class TestZkBaseDataAccessor extends ZkUnitTestBase {
 
     System.out.println("START " + testName + " at " + new 
Date(System.currentTimeMillis()));
 
-    String path = String.format("/%s/%s", testName, "msg_0");
+    String path = String.format("/%s/%s", _rootPath, "msg_0");
     ZNRecord record = new ZNRecord("msg_0");
     ZkBaseDataAccessor<ZNRecord> accessor = new 
ZkBaseDataAccessor<ZNRecord>(_gZkClient);
 
@@ -255,7 +269,7 @@ public class TestZkBaseDataAccessor extends ZkUnitTestBase {
 
     System.out.println("START " + testName + " at " + new 
Date(System.currentTimeMillis()));
 
-    String path = String.format("/%s/%s", testName, "msg_0");
+    String path = String.format("/%s/%s", _rootPath, "msg_0");
     ZNRecord record = new ZNRecord("msg_0");
     ZkBaseDataAccessor<ZNRecord> accessor = new 
ZkBaseDataAccessor<ZNRecord>(_gZkClient);
 
@@ -314,7 +328,7 @@ public class TestZkBaseDataAccessor extends ZkUnitTestBase {
 
     System.out.println("START " + testName + " at " + new 
Date(System.currentTimeMillis()));
 
-    String path = String.format("/%s/%s", testName, "msg_0");
+    String path = String.format("/%s/%s", _rootPath, "msg_0");
     ZNRecord record = new ZNRecord("msg_0");
     ZkBaseDataAccessor<ZNRecord> accessor = new 
ZkBaseDataAccessor<ZNRecord>(_gZkClient);
 
@@ -339,7 +353,7 @@ public class TestZkBaseDataAccessor extends ZkUnitTestBase {
 
     System.out.println("START " + testName + " at " + new 
Date(System.currentTimeMillis()));
 
-    String path = String.format("/%s/%s", testName, "msg_0");
+    String path = String.format("/%s/%s", _rootPath, "msg_0");
     ZNRecord record = new ZNRecord("msg_0");
     ZkBaseDataAccessor<ZNRecord> accessor = new 
ZkBaseDataAccessor<ZNRecord>(_gZkClient);
 
@@ -360,20 +374,17 @@ public class TestZkBaseDataAccessor extends 
ZkUnitTestBase {
 
   @Test
   public void testAsyncZkBaseDataAccessor() {
-    System.out.println("START TestZkBaseDataAccessor.async at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println(
+        "START TestZkBaseDataAccessor.async at " + new 
Date(System.currentTimeMillis()));
 
-    String root = "TestZkBaseDataAccessor_asyn";
-    ZkClient zkClient = new ZkClient(ZK_ADDR);
-    zkClient.setZkSerializer(new ZNRecordSerializer());
-    zkClient.deleteRecursively("/" + root);
+    String root = _rootPath;
+    _gZkClient.deleteRecursively("/" + root);
 
-    ZkBaseDataAccessor<ZNRecord> accessor = new 
ZkBaseDataAccessor<ZNRecord>(zkClient);
+    ZkBaseDataAccessor<ZNRecord> accessor = new 
ZkBaseDataAccessor<>(_gZkClient);
 
     // test async createChildren
-    String parentPath = PropertyPathBuilder.instanceMessage(root, "host_1");
-    List<ZNRecord> records = new ArrayList<ZNRecord>();
-    List<String> paths = new ArrayList<String>();
+    List<ZNRecord> records = new ArrayList<>();
+    List<String> paths = new ArrayList<>();
     for (int i = 0; i < 10; i++) {
       String msgId = "msg_" + i;
       paths.add(PropertyPathBuilder.instanceMessage(root, "host_1", msgId));
@@ -389,14 +400,13 @@ public class TestZkBaseDataAccessor extends 
ZkUnitTestBase {
     for (int i = 0; i < 10; i++) {
       String msgId = "msg_" + i;
       String path = PropertyPathBuilder.instanceMessage(root, "host_1", msgId);
-      ZNRecord record = zkClient.readData(path);
+      ZNRecord record = _gZkClient.readData(path);
       Assert.assertEquals(record.getId(), msgId, "Should get what we created");
     }
 
     // test async setChildren
-    parentPath = PropertyPathBuilder.instanceMessage(root, "host_1");
-    records = new ArrayList<ZNRecord>();
-    paths = new ArrayList<String>();
+    records = new ArrayList<>();
+    paths = new ArrayList<>();
     for (int i = 0; i < 10; i++) {
       String msgId = "msg_" + i;
       paths.add(PropertyPathBuilder.instanceMessage(root, "host_1", msgId));
@@ -414,16 +424,15 @@ public class TestZkBaseDataAccessor extends 
ZkUnitTestBase {
     for (int i = 0; i < 10; i++) {
       String msgId = "msg_" + i;
       String path = PropertyPathBuilder.instanceMessage(root, "host_1", msgId);
-      ZNRecord record = zkClient.readData(path);
+      ZNRecord record = _gZkClient.readData(path);
       Assert.assertEquals(record.getSimpleFields().size(), 1, "Should have 1 
simple field set");
       Assert.assertEquals(record.getSimpleField("key1"), "value1", "Should 
have value1 set");
     }
 
     // test async updateChildren
-    parentPath = PropertyPathBuilder.instanceMessage(root, "host_1");
     // records = new ArrayList<ZNRecord>();
     List<DataUpdater<ZNRecord>> znrecordUpdaters = new 
ArrayList<DataUpdater<ZNRecord>>();
-    paths = new ArrayList<String>();
+    paths = new ArrayList<>();
     for (int i = 0; i < 10; i++) {
       String msgId = "msg_" + i;
       paths.add(PropertyPathBuilder.instanceMessage(root, "host_1", msgId));
@@ -442,13 +451,13 @@ public class TestZkBaseDataAccessor extends 
ZkUnitTestBase {
     for (int i = 0; i < 10; i++) {
       String msgId = "msg_" + i;
       String path = PropertyPathBuilder.instanceMessage(root, "host_1", msgId);
-      ZNRecord record = zkClient.readData(path);
+      ZNRecord record = _gZkClient.readData(path);
       Assert.assertEquals(record.getSimpleFields().size(), 2, "Should have 2 
simple fields set");
       Assert.assertEquals(record.getSimpleField("key2"), "value2", "Should 
have value2 set");
     }
 
     // test async getChildren
-    parentPath = PropertyPathBuilder.instanceMessage(root, "host_1");
+    String parentPath = PropertyPathBuilder.instanceMessage(root, "host_1");
     records = accessor.getChildren(parentPath, null, 0);
     for (int i = 0; i < 10; i++) {
       String msgId = "msg_" + i;
@@ -459,8 +468,7 @@ public class TestZkBaseDataAccessor extends ZkUnitTestBase {
     }
 
     // test async exists
-    parentPath = PropertyPathBuilder.instanceMessage(root, "host_1");
-    paths = new ArrayList<String>();
+    paths = new ArrayList<>();
     for (int i = 0; i < 10; i++) {
       String msgId = "msg_" + i;
       paths.add(PropertyPathBuilder.instanceMessage(root, "host_1", msgId));
@@ -472,8 +480,7 @@ public class TestZkBaseDataAccessor extends ZkUnitTestBase {
     }
 
     // test async getStats
-    parentPath = PropertyPathBuilder.instanceMessage(root, "host_1");
-    paths = new ArrayList<String>();
+    paths = new ArrayList<>();
     for (int i = 0; i < 10; i++) {
       String msgId = "msg_" + i;
       paths.add(PropertyPathBuilder.instanceMessage(root, "host_1", msgId));
@@ -487,8 +494,7 @@ public class TestZkBaseDataAccessor extends ZkUnitTestBase {
     }
 
     // test async remove
-    parentPath = PropertyPathBuilder.instanceMessage(root, "host_1");
-    paths = new ArrayList<String>();
+    paths = new ArrayList<>();
     for (int i = 0; i < 10; i++) {
       String msgId = "msg_" + i;
       paths.add(PropertyPathBuilder.instanceMessage(root, "host_1", msgId));
@@ -503,11 +509,10 @@ public class TestZkBaseDataAccessor extends 
ZkUnitTestBase {
     for (int i = 0; i < 10; i++) {
       String msgId = "msg_" + i;
       String path = PropertyPathBuilder.instanceMessage(root, "host_1", msgId);
-      boolean pathExists = zkClient.exists(path);
+      boolean pathExists = _gZkClient.exists(path);
       Assert.assertFalse(pathExists, "Should be removed " + msgId);
     }
 
-    zkClient.close();
     System.out.println("END TestZkBaseDataAccessor.async at "
         + new Date(System.currentTimeMillis()));
   }

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkManagerFlappingDetection.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkManagerFlappingDetection.java
 
b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkManagerFlappingDetection.java
index bdad048..d175515 100644
--- 
a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkManagerFlappingDetection.java
+++ 
b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkManagerFlappingDetection.java
@@ -22,13 +22,13 @@ package org.apache.helix.manager.zk;
 
 import org.apache.helix.TestHelper;
 import org.apache.helix.ZkTestHelper;
-import org.apache.helix.integration.common.ZkIntegrationTestBase;
+import org.apache.helix.common.ZkTestBase;
 import org.apache.helix.integration.manager.ClusterControllerManager;
 import org.apache.helix.integration.manager.MockParticipantManager;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-public class TestZkManagerFlappingDetection extends ZkIntegrationTestBase {
+public class TestZkManagerFlappingDetection extends ZkTestBase {
   @Test
   public void testDisconnectHistory() throws Exception {
     String className = TestHelper.getTestClassName();

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/messaging/handling/TestBatchMessageModeConfigs.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/messaging/handling/TestBatchMessageModeConfigs.java
 
b/helix-core/src/test/java/org/apache/helix/messaging/handling/TestBatchMessageModeConfigs.java
index f0f49c5..de7c7da 100644
--- 
a/helix-core/src/test/java/org/apache/helix/messaging/handling/TestBatchMessageModeConfigs.java
+++ 
b/helix-core/src/test/java/org/apache/helix/messaging/handling/TestBatchMessageModeConfigs.java
@@ -46,30 +46,30 @@ public class TestBatchMessageModeConfigs extends 
ZkStandAloneCMTestBase {
 
   @Test
   public void testEnableBatchModeForCluster() throws InterruptedException {
-    _setupTool.getClusterManagementTool().enableBatchMessageMode(CLUSTER_NAME, 
true);
+    
_gSetupTool.getClusterManagementTool().enableBatchMessageMode(CLUSTER_NAME, 
true);
     String dbName = TEST_DB_PREFIX + "Cluster";
     setupResource(dbName);
-    _setupTool.rebalanceStorageCluster(CLUSTER_NAME, dbName, 1);
+    _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, dbName, 1);
     Thread.sleep(2000L);
     verify();
-    _setupTool.getClusterManagementTool().enableBatchMessageMode(CLUSTER_NAME, 
false);
+    
_gSetupTool.getClusterManagementTool().enableBatchMessageMode(CLUSTER_NAME, 
false);
   }
 
   @Test
   public void testEnableBatchModeForResource() throws InterruptedException {
     String dbName = TEST_DB_PREFIX + "Resource";
     setupResource(dbName);
-    _setupTool.getClusterManagementTool().enableBatchMessageMode(CLUSTER_NAME, 
dbName, true);
-    _setupTool.rebalanceStorageCluster(CLUSTER_NAME, dbName, 1);
+    
_gSetupTool.getClusterManagementTool().enableBatchMessageMode(CLUSTER_NAME, 
dbName, true);
+    _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, dbName, 1);
     Thread.sleep(2000L);
     verify();
-    _setupTool.getClusterManagementTool().enableBatchMessageMode(CLUSTER_NAME, 
dbName, false);
+    
_gSetupTool.getClusterManagementTool().enableBatchMessageMode(CLUSTER_NAME, 
dbName, false);
   }
 
   private void setupResource(String dbName) throws InterruptedException {
     IdealState idealState = new 
FullAutoModeISBuilder(dbName).setStateModel("OnlineOffline")
         
.setStateModelFactoryName("TestFactory").setNumPartitions(10).setNumReplica(1).build();
-    _setupTool.getClusterManagementTool().addResource(CLUSTER_NAME, dbName, 
idealState);
+    _gSetupTool.getClusterManagementTool().addResource(CLUSTER_NAME, dbName, 
idealState);
   }
 
   private void verify() {

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/messaging/handling/TestResourceThreadpoolSize.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/messaging/handling/TestResourceThreadpoolSize.java
 
b/helix-core/src/test/java/org/apache/helix/messaging/handling/TestResourceThreadpoolSize.java
index 3b8e8f0..6ee11ca 100644
--- 
a/helix-core/src/test/java/org/apache/helix/messaging/handling/TestResourceThreadpoolSize.java
+++ 
b/helix-core/src/test/java/org/apache/helix/messaging/handling/TestResourceThreadpoolSize.java
@@ -52,8 +52,8 @@ public class TestResourceThreadpoolSize extends 
ZkStandAloneCMTestBase {
   public void TestThreadPoolSizeConfig() {
     setResourceThreadPoolSize("NextDB", 12);
 
-    _setupTool.addResourceToCluster(CLUSTER_NAME, "NextDB", 64, STATE_MODEL);
-    _setupTool.rebalanceStorageCluster(CLUSTER_NAME, "NextDB", 3);
+    _gSetupTool.addResourceToCluster(CLUSTER_NAME, "NextDB", 64, STATE_MODEL);
+    _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, "NextDB", 3);
 
     boolean result =
         ClusterStateVerifier.verifyByPolling(new 
ClusterStateVerifier.BestPossAndExtViewZkVerifier(
@@ -84,26 +84,26 @@ public class TestResourceThreadpoolSize extends 
ZkStandAloneCMTestBase {
     }
 
     // add db with default thread pool
-    _setupTool.addResourceToCluster(CLUSTER_NAME, 
WorkflowGenerator.DEFAULT_TGT_DB + "1", 64,
+    _gSetupTool.addResourceToCluster(CLUSTER_NAME, 
WorkflowGenerator.DEFAULT_TGT_DB + "1", 64,
         STATE_MODEL);
-    _setupTool.rebalanceStorageCluster(CLUSTER_NAME, 
WorkflowGenerator.DEFAULT_TGT_DB + "1", 3);
+    _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, 
WorkflowGenerator.DEFAULT_TGT_DB + "1", 3);
 
     // add db with customized thread pool
     IdealState idealState = new 
FullAutoModeISBuilder(WorkflowGenerator.DEFAULT_TGT_DB + "2")
         
.setStateModel(ONLINE_OFFLINE).setStateModelFactoryName(TEST_FACTORY).setNumPartitions(10)
         .setNumReplica(1).build();
-    _setupTool.getClusterManagementTool()
+    _gSetupTool.getClusterManagementTool()
         .addResource(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB + "2", 
idealState);
-    _setupTool.rebalanceStorageCluster(CLUSTER_NAME, 
WorkflowGenerator.DEFAULT_TGT_DB + "2", 1);
+    _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, 
WorkflowGenerator.DEFAULT_TGT_DB + "2", 1);
 
     // add db with configured pool size
     idealState = new FullAutoModeISBuilder(WorkflowGenerator.DEFAULT_TGT_DB + 
"3")
         
.setStateModel(ONLINE_OFFLINE).setStateModelFactoryName(TEST_FACTORY).setNumPartitions(10)
         .setNumReplica(1).build();
-    _setupTool.getClusterManagementTool()
+    _gSetupTool.getClusterManagementTool()
         .addResource(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB + "3", 
idealState);
     setResourceThreadPoolSize(WorkflowGenerator.DEFAULT_TGT_DB + "3", 
configuredPoolSize);
-    _setupTool.rebalanceStorageCluster(CLUSTER_NAME, 
WorkflowGenerator.DEFAULT_TGT_DB + "3", 1);
+    _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, 
WorkflowGenerator.DEFAULT_TGT_DB + "3", 1);
 
     boolean result = ClusterStateVerifier.verifyByPolling(
         new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR, 
CLUSTER_NAME));
@@ -141,9 +141,9 @@ public class TestResourceThreadpoolSize extends 
ZkStandAloneCMTestBase {
     IdealState idealState = new 
FullAutoModeISBuilder(WorkflowGenerator.DEFAULT_TGT_DB + "4")
         
.setStateModel(MASTER_SLAVE).setStateModelFactoryName(TEST_FACTORY).setNumPartitions(10)
         .setNumReplica(1).build();
-    _setupTool.getClusterManagementTool()
+    _gSetupTool.getClusterManagementTool()
         .addResource(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB + "4", 
idealState);
-    _setupTool.rebalanceStorageCluster(CLUSTER_NAME, 
WorkflowGenerator.DEFAULT_TGT_DB + "4", 1);
+    _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, 
WorkflowGenerator.DEFAULT_TGT_DB + "4", 1);
 
     Thread.sleep(2000);
 
@@ -182,8 +182,8 @@ public class TestResourceThreadpoolSize extends 
ZkStandAloneCMTestBase {
       IdealState idealState = new 
FullAutoModeISBuilder(dbName).setStateModel("OnlineOffline")
           
.setStateModelFactoryName("TestFactory").setNumPartitions(10).setNumReplica(1).build();
       idealState.setBatchMessageMode(true);
-      _setupTool.getClusterManagementTool().addResource(CLUSTER_NAME, dbName, 
idealState);
-      _setupTool.rebalanceStorageCluster(CLUSTER_NAME, dbName, 1);
+      _gSetupTool.getClusterManagementTool().addResource(CLUSTER_NAME, dbName, 
idealState);
+      _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, dbName, 1);
     }
     Thread.sleep(2000L);
 

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/monitoring/TestClusterStatusMonitorLifecycle.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/monitoring/TestClusterStatusMonitorLifecycle.java
 
b/helix-core/src/test/java/org/apache/helix/monitoring/TestClusterStatusMonitorLifecycle.java
index ccaba4e..995e0eb 100644
--- 
a/helix-core/src/test/java/org/apache/helix/monitoring/TestClusterStatusMonitorLifecycle.java
+++ 
b/helix-core/src/test/java/org/apache/helix/monitoring/TestClusterStatusMonitorLifecycle.java
@@ -21,7 +21,7 @@ package org.apache.helix.monitoring;
 
 import org.apache.helix.HelixDataAccessor;
 import org.apache.helix.TestHelper;
-import org.apache.helix.integration.common.ZkIntegrationTestBase;
+import org.apache.helix.common.ZkTestBase;
 import org.apache.helix.integration.manager.ClusterDistributedController;
 import org.apache.helix.integration.manager.MockParticipantManager;
 import org.apache.helix.model.IdealState;
@@ -43,15 +43,15 @@ import java.util.Date;
 import java.util.HashSet;
 import java.util.Set;
 
-public class TestClusterStatusMonitorLifecycle extends ZkIntegrationTestBase {
-  private static final Logger LOG =
-      LoggerFactory.getLogger(TestClusterStatusMonitorLifecycle.class);
+public class TestClusterStatusMonitorLifecycle extends ZkTestBase {
+  private static final Logger LOG = 
LoggerFactory.getLogger(TestClusterStatusMonitorLifecycle.class);
 
   MockParticipantManager[] _participants;
   ClusterDistributedController[] _controllers;
   String _controllerClusterName;
   String _clusterNamePrefix;
   String _firstClusterName;
+  Set<String> _clusters = new HashSet<>();
 
   final int n = 5;
   final int clusterNb = 10;
@@ -77,6 +77,8 @@ public class TestClusterStatusMonitorLifecycle extends 
ZkIntegrationTestBase {
           n, // number of nodes
           3, // replicas
           "MasterSlave", true); // do rebalance
+
+      _clusters.add(clusterName);
     }
 
     // setup controller cluster
@@ -142,11 +144,18 @@ public class TestClusterStatusMonitorLifecycle extends 
ZkIntegrationTestBase {
   }
 
   @AfterClass
-  public void afterClass() {
+  public void afterClass() throws Exception {
     System.out.println("Cleaning up...");
     for (int i = 0; i < _participants.length; i++) {
       _participants[i].syncStop();
     }
+    cleanupControllers();
+    _gSetupTool.deleteCluster(_controllerClusterName);
+
+    for (String cluster : _clusters) {
+      TestHelper.dropCluster(cluster, _gZkClient);
+    }
+
     System.out.println("END " + _clusterNamePrefix + " at " + new 
Date(System.currentTimeMillis()));
   }
 
@@ -178,7 +187,9 @@ public class TestClusterStatusMonitorLifecycle extends 
ZkIntegrationTestBase {
 
   private void cleanupControllers() {
     for (int i = 0; i < _controllers.length; i++) {
-      _controllers[i].syncStop();
+      if (_controllers[i] != null && _controllers[i].isConnected()) {
+        _controllers[i].syncStop();
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterAggregateMetrics.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterAggregateMetrics.java
 
b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterAggregateMetrics.java
index dfe5016..ea7a680 100644
--- 
a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterAggregateMetrics.java
+++ 
b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterAggregateMetrics.java
@@ -35,7 +35,7 @@ import javax.management.QueryExp;
 import org.apache.helix.HelixManager;
 import org.apache.helix.HelixManagerFactory;
 import org.apache.helix.InstanceType;
-import org.apache.helix.integration.common.ZkIntegrationTestBase;
+import org.apache.helix.common.ZkTestBase;
 import org.apache.helix.integration.manager.ClusterControllerManager;
 import org.apache.helix.integration.manager.MockParticipantManager;
 import org.apache.helix.tools.ClusterSetup;
@@ -54,7 +54,7 @@ import org.testng.annotations.Test;
  * when a Participant is disabled.
  *
  */
-public class TestClusterAggregateMetrics extends ZkIntegrationTestBase {
+public class TestClusterAggregateMetrics extends ZkTestBase {
 
   // Configurable values for test setup
   private static final int NUM_PARTICIPANTS = 3;

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestDisableResourceMbean.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestDisableResourceMbean.java
 
b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestDisableResourceMbean.java
index 143f3c0..633a472 100644
--- 
a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestDisableResourceMbean.java
+++ 
b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestDisableResourceMbean.java
@@ -99,6 +99,7 @@ public class TestDisableResourceMbean extends ZkUnitTestBase {
     for (MockParticipantManager participant : participants) {
       participant.syncStop();
     }
+    TestHelper.dropCluster(clusterName, _gZkClient);
     System.out.println("END " + clusterName + " at " + new 
Date(System.currentTimeMillis()));
   }
 

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestDropResourceMetricsReset.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestDropResourceMetricsReset.java
 
b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestDropResourceMetricsReset.java
index 2529360..fa7abf0 100644
--- 
a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestDropResourceMetricsReset.java
+++ 
b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestDropResourceMetricsReset.java
@@ -98,6 +98,7 @@ public class TestDropResourceMetricsReset extends 
ZkUnitTestBase {
     for (MockParticipantManager participant : participants) {
       participant.syncStop();
     }
+    TestHelper.dropCluster(clusterName, _gZkClient);
     System.out.println("END " + clusterName + " at " + new 
Date(System.currentTimeMillis()));
   }
 

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestResetClusterMetrics.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestResetClusterMetrics.java
 
b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestResetClusterMetrics.java
index 409a10a..d4c64e0 100644
--- 
a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestResetClusterMetrics.java
+++ 
b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestResetClusterMetrics.java
@@ -72,6 +72,7 @@ public class TestResetClusterMetrics extends ZkUnitTestBase {
 
     // Stop the controller
     controller.syncStop();
+    TestHelper.dropCluster(clusterName, _gZkClient);
 
     // Check the metrics
     Thread.sleep(1000);

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerElection.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerElection.java
 
b/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerElection.java
index 90990ee..608e2e1 100644
--- 
a/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerElection.java
+++ 
b/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerElection.java
@@ -53,10 +53,6 @@ public class TestDistControllerElection extends 
ZkUnitTestBase {
     String className = getShortClassName();
 
     final String clusterName = CLUSTER_PREFIX + "_" + className + "_" + 
"testController";
-    String path = "/" + clusterName;
-    if (_gZkClient.exists(path)) {
-      _gZkClient.deleteRecursively(path);
-    }
 
     ZKHelixDataAccessor accessor =
         new ZKHelixDataAccessor(clusterName, new 
ZkBaseDataAccessor(_gZkClient));
@@ -96,6 +92,8 @@ public class TestDistControllerElection extends 
ZkUnitTestBase {
     // AssertJUnit.assertNull(election.getController());
     // AssertJUnit.assertNull(election.getLeader());
 
+    TestHelper.dropCluster(clusterName, _gZkClient);
+
     System.out.println("END TestDistControllerElection at " + new 
Date(System.currentTimeMillis()));
   }
 
@@ -106,10 +104,6 @@ public class TestDistControllerElection extends 
ZkUnitTestBase {
 
     final String clusterName =
         CONTROLLER_CLUSTER_PREFIX + "_" + className + "_" + 
"testControllerParticipant";
-    String path = "/" + clusterName;
-    if (_gZkClient.exists(path)) {
-      _gZkClient.deleteRecursively(path);
-    }
 
     ZKHelixDataAccessor accessor =
         new ZKHelixDataAccessor(clusterName, new 
ZkBaseDataAccessor(_gZkClient));
@@ -156,6 +150,7 @@ public class TestDistControllerElection extends 
ZkUnitTestBase {
     // AssertJUnit.assertNull(election.getController());
     // AssertJUnit.assertNull(election.getLeader());
 
+    TestHelper.dropCluster(clusterName, _gZkClient);
     LOG.info("END " + getShortClassName() + " at " + new 
Date(System.currentTimeMillis()));
   }
 
@@ -166,9 +161,6 @@ public class TestDistControllerElection extends 
ZkUnitTestBase {
 
     final String clusterName = CLUSTER_PREFIX + "_" + className + "_" + 
"testParticipant";
     String path = "/" + clusterName;
-    if (_gZkClient.exists(path)) {
-      _gZkClient.deleteRecursively(path);
-    }
     TestHelper.setupEmptyCluster(_gZkClient, clusterName);
 
     final String controllerName = "participant_0";
@@ -188,6 +180,8 @@ public class TestDistControllerElection extends 
ZkUnitTestBase {
     AssertJUnit.assertNull(leaderRecord);
     // AssertJUnit.assertNull(election.getController());
     // AssertJUnit.assertNull(election.getLeader());
+
+    TestHelper.dropCluster(clusterName, _gZkClient);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerStateModel.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerStateModel.java
 
b/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerStateModel.java
index 0642d67..804a0d7 100644
--- 
a/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerStateModel.java
+++ 
b/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerStateModel.java
@@ -28,6 +28,7 @@ import org.apache.helix.model.Message.MessageType;
 import org.apache.helix.participant.DistClusterControllerStateModel;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
@@ -46,6 +47,13 @@ public class TestDistControllerStateModel extends 
ZkUnitTestBase {
     TestHelper.setupEmptyCluster(_gZkClient, clusterName);
   }
 
+  @AfterMethod
+  public void afterMethod() throws Exception {
+    if (_gZkClient.exists("/" + clusterName)) {
+      TestHelper.dropCluster(clusterName, _gZkClient);
+    }
+  }
+
   @Test()
   public void testOnBecomeStandbyFromOffline() {
     stateModel.onBecomeStandbyFromOffline(new Message(new ZNRecord("test")), 
null);

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/spectator/TestRoutingDataCache.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/spectator/TestRoutingDataCache.java 
b/helix-core/src/test/java/org/apache/helix/spectator/TestRoutingDataCache.java
index 7ff3f67..6cf70bd 100644
--- 
a/helix-core/src/test/java/org/apache/helix/spectator/TestRoutingDataCache.java
+++ 
b/helix-core/src/test/java/org/apache/helix/spectator/TestRoutingDataCache.java
@@ -77,8 +77,8 @@ public class TestRoutingDataCache extends 
ZkStandAloneCMTestBase {
     Assert.assertEquals(accessor.getReadCount(PropertyType.EXTERNALVIEW), 0);
 
     // add new resources
-    _setupTool.addResourceToCluster(CLUSTER_NAME, "TestDB_1", 1, STATE_MODEL);
-    _setupTool.rebalanceStorageCluster(CLUSTER_NAME, "TestDB_1", _replica);
+    _gSetupTool.addResourceToCluster(CLUSTER_NAME, "TestDB_1", 1, STATE_MODEL);
+    _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, "TestDB_1", _replica);
 
     Thread.sleep(100);
     HelixClusterVerifier _clusterVerifier =
@@ -95,10 +95,10 @@ public class TestRoutingDataCache extends 
ZkStandAloneCMTestBase {
     // Add more resources
     accessor.clearReadCounters();
 
-    _setupTool.addResourceToCluster(CLUSTER_NAME, "TestDB_2", 1, STATE_MODEL);
-    _setupTool.rebalanceStorageCluster(CLUSTER_NAME, "TestDB_2", _replica);
-    _setupTool.addResourceToCluster(CLUSTER_NAME, "TestDB_3", 1, STATE_MODEL);
-    _setupTool.rebalanceStorageCluster(CLUSTER_NAME, "TestDB_3", _replica);
+    _gSetupTool.addResourceToCluster(CLUSTER_NAME, "TestDB_2", 1, STATE_MODEL);
+    _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, "TestDB_2", _replica);
+    _gSetupTool.addResourceToCluster(CLUSTER_NAME, "TestDB_3", 1, STATE_MODEL);
+    _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, "TestDB_3", _replica);
 
     Thread.sleep(100);
     Assert.assertTrue(_clusterVerifier.verify());
@@ -111,7 +111,7 @@ public class TestRoutingDataCache extends 
ZkStandAloneCMTestBase {
     // update one resource
     accessor.clearReadCounters();
 
-    _setupTool.getClusterManagementTool().enableResource(CLUSTER_NAME, 
"TestDB_2", false);
+    _gSetupTool.getClusterManagementTool().enableResource(CLUSTER_NAME, 
"TestDB_2", false);
 
     Thread.sleep(100);
     Assert.assertTrue(_clusterVerifier.verify());

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/task/TaskSynchronizedTestBase.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/task/TaskSynchronizedTestBase.java 
b/helix-core/src/test/java/org/apache/helix/task/TaskSynchronizedTestBase.java
index cab60ce..056e34c 100644
--- 
a/helix-core/src/test/java/org/apache/helix/task/TaskSynchronizedTestBase.java
+++ 
b/helix-core/src/test/java/org/apache/helix/task/TaskSynchronizedTestBase.java
@@ -28,17 +28,20 @@ import org.apache.helix.HelixException;
 import org.apache.helix.HelixManager;
 import org.apache.helix.HelixManagerFactory;
 import org.apache.helix.InstanceType;
-import org.apache.helix.integration.common.ZkIntegrationTestBase;
+import org.apache.helix.common.ZkTestBase;
+import org.apache.helix.integration.manager.ClusterControllerManager;
 import org.apache.helix.integration.manager.MockParticipantManager;
 import org.apache.helix.integration.task.MockTask;
 import org.apache.helix.integration.task.WorkflowGenerator;
 import org.apache.helix.model.IdealState;
 import org.apache.helix.participant.StateMachineEngine;
 import org.apache.helix.tools.ClusterSetup;
+import 
org.apache.helix.tools.ClusterVerifiers.BestPossibleExternalViewVerifier;
+import org.apache.helix.tools.ClusterVerifiers.HelixClusterVerifier;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 
-public class TaskSynchronizedTestBase extends ZkIntegrationTestBase {
+public class TaskSynchronizedTestBase extends ZkTestBase {
   protected int _numNodes = 5;
   protected int _startPort = 12918;
   protected int _numParitions = 20;
@@ -48,9 +51,9 @@ public class TaskSynchronizedTestBase extends 
ZkIntegrationTestBase {
   protected Boolean _partitionVary = true;
   protected Boolean _instanceGroupTag = false;
 
+  protected ClusterControllerManager _controller;
   protected HelixManager _manager;
   protected TaskDriver _driver;
-  protected ClusterSetup _setupTool;
 
   protected List<String> _testDbs = new ArrayList<String>();
 
@@ -58,64 +61,85 @@ public class TaskSynchronizedTestBase extends 
ZkIntegrationTestBase {
   protected final String CLUSTER_NAME = CLUSTER_PREFIX + "_" + 
getShortClassName();
   protected MockParticipantManager[] _participants;
 
+  protected HelixClusterVerifier _clusterVerifier;
+
   @BeforeClass
   public void beforeClass() throws Exception {
     _participants =  new MockParticipantManager[_numNodes];
-    String namespace = "/" + CLUSTER_NAME;
-    if (_gZkClient.exists(namespace)) {
-      _gZkClient.deleteRecursively(namespace);
-    }
-
-    _setupTool = new ClusterSetup(ZK_ADDR);
-    _setupTool.addCluster(CLUSTER_NAME, true);
+    _gSetupTool.addCluster(CLUSTER_NAME, true);
     setupParticipants();
     setupDBs();
     startParticipants();
     createManagers();
+    _clusterVerifier =
+        new 
BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME).setZkClient(_gZkClient).build();
   }
 
 
   @AfterClass
   public void afterClass() throws Exception {
-    _manager.disconnect();
+    if (_controller != null && _controller.isConnected()) {
+      _controller.syncStop();
+    }
+    if (_manager != null && _manager.isConnected()) {
+      _manager.disconnect();
+    }
     stopParticipants();
+
+    String namespace = "/" + CLUSTER_NAME;
+    if (_gZkClient.exists(namespace)) {
+      try {
+        _gSetupTool.deleteCluster(CLUSTER_NAME);
+      } catch (Exception ex) {
+        System.err.println(
+            "Failed to delete cluster " + CLUSTER_NAME + ", error: " + 
ex.getLocalizedMessage());
+      }
+    }
   }
 
   protected void setupDBs() {
+    setupDBs(_gSetupTool);
+  }
+
+  protected void setupDBs(ClusterSetup clusterSetup) {
     // Set up target db
     if (_numDbs > 1) {
       for (int i = 0; i < _numDbs; i++) {
         int varyNum = _partitionVary == true ? 10 * i : 0;
         String db = WorkflowGenerator.DEFAULT_TGT_DB + i;
-        _setupTool
+        clusterSetup
             .addResourceToCluster(CLUSTER_NAME, db, _numParitions + varyNum, 
MASTER_SLAVE_STATE_MODEL,
                 IdealState.RebalanceMode.FULL_AUTO.toString());
-        _setupTool.rebalanceStorageCluster(CLUSTER_NAME, db, _numReplicas);
+        clusterSetup.rebalanceStorageCluster(CLUSTER_NAME, db, _numReplicas);
         _testDbs.add(db);
       }
     } else {
       if (_instanceGroupTag) {
-        _setupTool
+        clusterSetup
             .addResourceToCluster(CLUSTER_NAME, 
WorkflowGenerator.DEFAULT_TGT_DB, _numParitions,
                 "OnlineOffline", IdealState.RebalanceMode.FULL_AUTO.name());
-        IdealState idealState = 
_setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, 
WorkflowGenerator.DEFAULT_TGT_DB);
+        IdealState idealState = 
clusterSetup.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, 
WorkflowGenerator.DEFAULT_TGT_DB);
         idealState.setInstanceGroupTag("TESTTAG0");
-        
_setupTool.getClusterManagementTool().setResourceIdealState(CLUSTER_NAME, 
WorkflowGenerator.DEFAULT_TGT_DB, idealState);
+        
clusterSetup.getClusterManagementTool().setResourceIdealState(CLUSTER_NAME, 
WorkflowGenerator.DEFAULT_TGT_DB, idealState);
       } else {
-        _setupTool.addResourceToCluster(CLUSTER_NAME, 
WorkflowGenerator.DEFAULT_TGT_DB,
+        clusterSetup.addResourceToCluster(CLUSTER_NAME, 
WorkflowGenerator.DEFAULT_TGT_DB,
             _numParitions, MASTER_SLAVE_STATE_MODEL, 
IdealState.RebalanceMode.FULL_AUTO.name());
       }
-      _setupTool.rebalanceStorageCluster(CLUSTER_NAME, 
WorkflowGenerator.DEFAULT_TGT_DB, _numReplicas);
+      clusterSetup.rebalanceStorageCluster(CLUSTER_NAME, 
WorkflowGenerator.DEFAULT_TGT_DB, _numReplicas);
     }
   }
 
   protected void setupParticipants() {
+    setupParticipants(_gSetupTool);
+  }
+
+  protected void setupParticipants(ClusterSetup setupTool) {
     _participants = new MockParticipantManager[_numNodes];
     for (int i = 0; i < _numNodes; i++) {
       String storageNodeName = PARTICIPANT_PREFIX + "_" + (_startPort + i);
-      _setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName);
+      setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName);
       if (_instanceGroupTag) {
-        _setupTool.addInstanceTag(CLUSTER_NAME, storageNodeName, "TESTTAG" + 
i);
+        setupTool.addInstanceTag(CLUSTER_NAME, storageNodeName, "TESTTAG" + i);
       }
     }
   }
@@ -173,7 +197,7 @@ public class TaskSynchronizedTestBase extends 
ZkIntegrationTestBase {
           + "were set up.", i, _participants.length));
     }
     if (_participants[i] != null && _participants[i].isConnected()) {
-      _participants[i].reset();
+      _participants[i].syncStop();
     }
   }
 

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/task/TestAssignableInstanceManagerControllerSwitch.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/task/TestAssignableInstanceManagerControllerSwitch.java
 
b/helix-core/src/test/java/org/apache/helix/task/TestAssignableInstanceManagerControllerSwitch.java
index f971820..21278f2 100644
--- 
a/helix-core/src/test/java/org/apache/helix/task/TestAssignableInstanceManagerControllerSwitch.java
+++ 
b/helix-core/src/test/java/org/apache/helix/task/TestAssignableInstanceManagerControllerSwitch.java
@@ -58,7 +58,7 @@ public class TestAssignableInstanceManagerControllerSwitch 
extends TaskTestBase
       String instanceName = liveInstance.getInstanceName();
       liveInstanceMap.put(instanceName, liveInstance);
       instanceConfigMap.put(instanceName,
-          
_setupTool.getClusterManagementTool().getInstanceConfig(CLUSTER_NAME, 
instanceName));
+          
_gSetupTool.getClusterManagementTool().getInstanceConfig(CLUSTER_NAME, 
instanceName));
     }
 
     // Get ClusterConfig

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/task/TestJobStateOnCreation.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/task/TestJobStateOnCreation.java 
b/helix-core/src/test/java/org/apache/helix/task/TestJobStateOnCreation.java
index c454879..c5707bc 100644
--- a/helix-core/src/test/java/org/apache/helix/task/TestJobStateOnCreation.java
+++ b/helix-core/src/test/java/org/apache/helix/task/TestJobStateOnCreation.java
@@ -50,12 +50,8 @@ public class TestJobStateOnCreation extends 
TaskSynchronizedTestBase {
     _resource = new Resource(WORKFLOW_NAME);
     _currStateOutput = new CurrentStateOutput();
     _participants =  new MockParticipantManager[_numNodes];
-    String namespace = "/" + CLUSTER_NAME;
-    if (_gZkClient.exists(namespace)) {
-      _gZkClient.deleteRecursively(namespace);
-    }
-    _setupTool = new ClusterSetup(ZK_ADDR);
-    _setupTool.addCluster(CLUSTER_NAME, true);
+
+    _gSetupTool.addCluster(CLUSTER_NAME, true);
     createManagers();
   }
 

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/task/TestSemiAutoStateTransition.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/task/TestSemiAutoStateTransition.java
 
b/helix-core/src/test/java/org/apache/helix/task/TestSemiAutoStateTransition.java
index 2f75c09..9d34980 100644
--- 
a/helix-core/src/test/java/org/apache/helix/task/TestSemiAutoStateTransition.java
+++ 
b/helix-core/src/test/java/org/apache/helix/task/TestSemiAutoStateTransition.java
@@ -47,22 +47,16 @@ public class TestSemiAutoStateTransition extends 
TaskTestBase {
     _participants =  new MockParticipantManager[_numNodes];
     _numParitions = 1;
 
-    String namespace = "/" + CLUSTER_NAME;
-    if (_gZkClient.exists(namespace)) {
-      _gZkClient.deleteRecursively(namespace);
-    }
-
-    _setupTool = new ClusterSetup(ZK_ADDR);
-    _setupTool.addCluster(CLUSTER_NAME, true);
+    _gSetupTool.addCluster(CLUSTER_NAME, true);
     _accessor = new ZKHelixDataAccessor(CLUSTER_NAME, _baseAccessor);
     _keyBuilder = _accessor.keyBuilder();
     setupParticipants();
 
     for (int i = 0; i < _numDbs; i++) {
       String db = WorkflowGenerator.DEFAULT_TGT_DB + i;
-      _setupTool.addResourceToCluster(CLUSTER_NAME, db, _numParitions, 
MASTER_SLAVE_STATE_MODEL,
+      _gSetupTool.addResourceToCluster(CLUSTER_NAME, db, _numParitions, 
MASTER_SLAVE_STATE_MODEL,
           IdealState.RebalanceMode.SEMI_AUTO.toString());
-      _setupTool.rebalanceStorageCluster(CLUSTER_NAME, db, _numReplicas);
+      _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, db, _numReplicas);
       _testDbs.add(db);
     }
 

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/tools/TestClusterSetup.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/tools/TestClusterSetup.java 
b/helix-core/src/test/java/org/apache/helix/tools/TestClusterSetup.java
index a959127..ec2c5a9 100644
--- a/helix-core/src/test/java/org/apache/helix/tools/TestClusterSetup.java
+++ b/helix-core/src/test/java/org/apache/helix/tools/TestClusterSetup.java
@@ -372,6 +372,9 @@ public class TestClusterSetup extends ZkUnitTestBase {
     exists = _gZkClient.exists(keyBuilder.pause().getPath());
     Assert.assertFalse(exists, "pause node under controller should be 
removed");
 
+    // clean up
+    TestHelper.dropCluster(clusterName, _gZkClient);
+
     System.out.println("END " + clusterName + " at " + new 
Date(System.currentTimeMillis()));
 
   }
@@ -435,11 +438,13 @@ public class TestClusterSetup extends ZkUnitTestBase {
 
     
Assert.assertNull(accessor.getProperty(keyBuilder.instanceConfig("localhost_12918")),
         "Instance config should be dropped");
-    
Assert.assertFalse(_gZkClient.exists(PropertyPathBuilder.instance(clusterName, 
"localhost_12918")),
+    Assert.assertFalse(
+        _gZkClient.exists(PropertyPathBuilder.instance(clusterName, 
"localhost_12918")),
         "Instance/host should be dropped");
 
-    System.out.println("END " + clusterName + " at " + new 
Date(System.currentTimeMillis()));
+    TestHelper.dropCluster(clusterName, _gZkClient);
 
+    System.out.println("END " + clusterName + " at " + new 
Date(System.currentTimeMillis()));
   }
 
   @Test
@@ -471,6 +476,8 @@ public class TestClusterSetup extends ZkUnitTestBase {
     });
     idealState = accessor.getProperty(keyBuilder.idealStates("TestDB0"));
     Assert.assertTrue(idealState.isEnabled());
+
+    TestHelper.dropCluster(clusterName, _gZkClient);
     System.out.println("END " + clusterName + " at " + new 
Date(System.currentTimeMillis()));
   }
 

http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/tools/TestHelixAdminCli.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/test/java/org/apache/helix/tools/TestHelixAdminCli.java 
b/helix-core/src/test/java/org/apache/helix/tools/TestHelixAdminCli.java
index caa8696..842fcfa 100644
--- a/helix-core/src/test/java/org/apache/helix/tools/TestHelixAdminCli.java
+++ b/helix-core/src/test/java/org/apache/helix/tools/TestHelixAdminCli.java
@@ -29,7 +29,7 @@ import org.apache.helix.BaseDataAccessor;
 import org.apache.helix.HelixDataAccessor;
 import org.apache.helix.TestHelper;
 import org.apache.helix.ZNRecord;
-import org.apache.helix.integration.common.ZkIntegrationTestBase;
+import org.apache.helix.common.ZkTestBase;
 import org.apache.helix.integration.manager.ClusterDistributedController;
 import org.apache.helix.integration.manager.MockParticipantManager;
 import org.apache.helix.manager.zk.ZKHelixDataAccessor;
@@ -45,7 +45,7 @@ import 
org.apache.helix.tools.ClusterStateVerifier.MasterNbInExtViewVerifier;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-public class TestHelixAdminCli extends ZkIntegrationTestBase {
+public class TestHelixAdminCli extends ZkTestBase {
   @Test
   public void testAddCluster() throws Exception {
     String command = "--zkSvr localhost:2183 -addCluster clusterTest";

Reply via email to