helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zzh...@apache.org
Subject [07/51] [partial] [HELIX-198] Unify helix code style, rb=13710
Date Wed, 21 Aug 2013 20:43:20 GMT
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/integration/manager/MockParticipantManager.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/manager/MockParticipantManager.java b/helix-core/src/test/java/org/apache/helix/integration/manager/MockParticipantManager.java
index d93804c..8249f4a 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/manager/MockParticipantManager.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/manager/MockParticipantManager.java
@@ -33,58 +33,44 @@ import org.apache.helix.mock.participant.MockTransition;
 import org.apache.helix.participant.StateMachineEngine;
 import org.apache.log4j.Logger;
 
+public class MockParticipantManager extends ParticipantManager implements Runnable, ZkTestManager {
+  private static Logger LOG = Logger.getLogger(MockParticipantManager.class);
 
-public class MockParticipantManager extends ParticipantManager implements Runnable, ZkTestManager
-{
-  private static Logger           LOG = Logger.getLogger(MockParticipantManager.class);
-
-  private final CountDownLatch    _startCountDown          = new CountDownLatch(1);
-  private final CountDownLatch    _stopCountDown           = new CountDownLatch(1);
-  private final CountDownLatch    _waitStopCompleteCountDown = new CountDownLatch(1);
+  private final CountDownLatch _startCountDown = new CountDownLatch(1);
+  private final CountDownLatch _stopCountDown = new CountDownLatch(1);
+  private final CountDownLatch _waitStopCompleteCountDown = new CountDownLatch(1);
 
   private final MockMSModelFactory _msModelFactory = new MockMSModelFactory(null);
 
-  public MockParticipantManager(String zkAddr, String clusterName, String instanceName)
-  {
+  public MockParticipantManager(String zkAddr, String clusterName, String instanceName) {
     super(zkAddr, clusterName, instanceName);
   }
 
-  public void setTransition(MockTransition transition)
-  {
+  public void setTransition(MockTransition transition) {
     _msModelFactory.setTrasition(transition);
   }
 
-  public void syncStop()
-  {
+  public void syncStop() {
     _stopCountDown.countDown();
-    try
-    {
+    try {
       _waitStopCompleteCountDown.await();
-    }
-    catch (InterruptedException e)
-    {
+    } catch (InterruptedException e) {
       LOG.error("exception in syncStop participant-manager", e);
     }
   }
 
-  public void syncStart()
-  {
-    try
-    {
+  public void syncStart() {
+    try {
       new Thread(this).start();
       _startCountDown.await();
-    }
-    catch (InterruptedException e)
-    {
+    } catch (InterruptedException e) {
       LOG.error("exception in syncStart participant-manager", e);
     }
   }
 
   @Override
-  public void run()
-  {
-    try
-    {
+  public void run() {
+    try {
       StateMachineEngine stateMach = getStateMachineEngine();
       stateMach.registerStateModelFactory("MasterSlave", _msModelFactory);
 
@@ -102,20 +88,14 @@ public class MockParticipantManager extends ParticipantManager implements Runnab
       _startCountDown.countDown();
 
       _stopCountDown.await();
-    }
-    catch (InterruptedException e)
-    {
+    } catch (InterruptedException e) {
       String msg =
           "participant: " + getInstanceName() + ", " + Thread.currentThread().getName()
               + " is interrupted";
       LOG.info(msg);
-    }
-    catch (Exception e)
-    {
+    } catch (Exception e) {
       LOG.error("exception running participant-manager", e);
-    }
-    finally
-    {
+    } finally {
       _startCountDown.countDown();
 
       disconnect();

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/integration/manager/TestConsecutiveZkSessionExpiry.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/manager/TestConsecutiveZkSessionExpiry.java b/helix-core/src/test/java/org/apache/helix/integration/manager/TestConsecutiveZkSessionExpiry.java
index 8bbb684..296181b 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/manager/TestConsecutiveZkSessionExpiry.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/manager/TestConsecutiveZkSessionExpiry.java
@@ -19,7 +19,6 @@ package org.apache.helix.integration.manager;
  * under the License.
  */
 
-
 import java.util.Date;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
@@ -42,8 +41,7 @@ import org.apache.log4j.Logger;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-public class TestConsecutiveZkSessionExpiry extends ZkUnitTestBase
-{
+public class TestConsecutiveZkSessionExpiry extends ZkUnitTestBase {
   private static Logger LOG = Logger.getLogger(TestConsecutiveZkSessionExpiry.class);
 
   /**
@@ -56,26 +54,22 @@ public class TestConsecutiveZkSessionExpiry extends ZkUnitTestBase
     int count = 0;
 
     public PreConnectTestCallback(String instanceName, CountDownLatch startCountdown,
-                                  CountDownLatch endCountdown) {
+        CountDownLatch endCountdown) {
       this.instanceName = instanceName;
       this.startCountDown = startCountdown;
       this.endCountDown = endCountdown;
     }
 
     @Override
-    public void onPreConnect()
-    {
+    public void onPreConnect() {
       // TODO Auto-generated method stub
       LOG.info("handleNewSession for instance: " + instanceName + ", count: " + count);
       if (count++ == 1) {
         startCountDown.countDown();
         LOG.info("wait session expiry to happen");
-        try
-        {
+        try {
           endCountDown.await();
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
           LOG.error("interrupted in waiting", e);
         }
       }
@@ -84,27 +78,23 @@ public class TestConsecutiveZkSessionExpiry extends ZkUnitTestBase
   }
 
   @Test
-  public void testParticipant() throws Exception
-  {
+  public void testParticipant() throws Exception {
     // Logger.getRootLogger().setLevel(Level.INFO);
     String className = TestHelper.getTestClassName();
     String methodName = TestHelper.getTestMethodName();
     String clusterName = className + "_" + methodName;
     final int n = 2;
 
-    System.out.println("START " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
-    TestHelper.setupCluster(clusterName,
-                            ZK_ADDR, 12918, // participant port
-                            "localhost", // participant name prefix
-                            "TestDB", // resource name prefix
-                            1, // resources
-                            32, // partitions per resource
-                            n, // number of nodes
-                            2, // replicas
-                            "MasterSlave",
-                            true); // do rebalance
+    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
+        "localhost", // participant name prefix
+        "TestDB", // resource name prefix
+        1, // resources
+        32, // partitions per resource
+        n, // number of nodes
+        2, // replicas
+        "MasterSlave", true); // do rebalance
 
     // start controller
     final ClusterControllerManager controller =
@@ -116,24 +106,22 @@ public class TestConsecutiveZkSessionExpiry extends ZkUnitTestBase
     CountDownLatch endCountdown = new CountDownLatch(1);
 
     MockParticipantManager[] participants = new MockParticipantManager[n];
-    for (int i = 0; i < n; i++)
-    {
+    for (int i = 0; i < n; i++) {
       final String instanceName = "localhost_" + (12918 + i);
 
-      participants[i] =
-          new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
 
       if (i == 0) {
         participants[i].addPreConnectCallback(new PreConnectTestCallback(instanceName,
-                                                                         startCountdown,
-                                                                         endCountdown));
+            startCountdown, endCountdown));
       }
       participants[i].syncStart();
     }
 
     boolean result =
-        ClusterStateVerifier.verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                                      clusterName));
+        ClusterStateVerifier
+            .verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
+                clusterName));
     Assert.assertTrue(result);
 
     // expire the session of participant
@@ -142,8 +130,8 @@ public class TestConsecutiveZkSessionExpiry extends ZkUnitTestBase
 
     ZkTestHelper.asyncExpireSession(participants[0].getZkClient());
     String newSessionId = participants[0].getSessionId();
-    LOG.info("Expried participant session. oldSessionId: " + oldSessionId
-        + ", newSessionId: " + newSessionId);
+    LOG.info("Expried participant session. oldSessionId: " + oldSessionId + ", newSessionId: "
+        + newSessionId);
 
     // expire zk session again during HelixManager#handleNewSession()
     startCountdown.await();
@@ -152,14 +140,14 @@ public class TestConsecutiveZkSessionExpiry extends ZkUnitTestBase
 
     ZkTestHelper.asyncExpireSession(participants[0].getZkClient());
     newSessionId = participants[0].getSessionId();
-    LOG.info("Expried participant session. oldSessionId: " + oldSessionId
-        + ", newSessionId: " + newSessionId);
+    LOG.info("Expried participant session. oldSessionId: " + oldSessionId + ", newSessionId: "
+        + newSessionId);
 
     endCountdown.countDown();
 
     result =
-        ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                                   clusterName));
+        ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(
+            ZK_ADDR, clusterName));
     Assert.assertTrue(result);
 
     // clean up
@@ -168,8 +156,7 @@ public class TestConsecutiveZkSessionExpiry extends ZkUnitTestBase
       participants[i].syncStop();
     }
 
-    System.out.println("END " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis()));
   }
 
   @Test
@@ -180,18 +167,16 @@ public class TestConsecutiveZkSessionExpiry extends ZkUnitTestBase
     String clusterName = className + "_" + methodName;
     int n = 2;
 
-    System.out.println("START " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
     TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
-                            "localhost", // participant name prefix
-                            "TestDB", // resource name prefix
-                            1, // resources
-                            4, // partitions per resource
-                            n, // number of nodes
-                            2, // replicas
-                            "MasterSlave",
-                            true); // do rebalance
+        "localhost", // participant name prefix
+        "TestDB", // resource name prefix
+        1, // resources
+        4, // partitions per resource
+        n, // number of nodes
+        2, // replicas
+        "MasterSlave", true); // do rebalance
 
     ClusterDistributedController[] distributedControllers = new ClusterDistributedController[n];
     CountDownLatch startCountdown = new CountDownLatch(1);
@@ -199,19 +184,20 @@ public class TestConsecutiveZkSessionExpiry extends ZkUnitTestBase
 
     for (int i = 0; i < n; i++) {
       String contrllerName = "localhost_" + (12918 + i);
-      distributedControllers[i] = new ClusterDistributedController(ZK_ADDR, clusterName, contrllerName);
-      distributedControllers[i].getStateMachineEngine().registerStateModelFactory("MasterSlave", new MockMSModelFactory());
+      distributedControllers[i] =
+          new ClusterDistributedController(ZK_ADDR, clusterName, contrllerName);
+      distributedControllers[i].getStateMachineEngine().registerStateModelFactory("MasterSlave",
+          new MockMSModelFactory());
       if (i == 0) {
         distributedControllers[i].addPreConnectCallback(new PreConnectTestCallback(contrllerName,
-                                                                         startCountdown,
-                                                                         endCountdown));
+            startCountdown, endCountdown));
       }
       distributedControllers[i].connect();
     }
 
     boolean result =
         ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                 clusterName));
+            clusterName));
     Assert.assertTrue(result);
 
     // expire the session of distributedController
@@ -236,12 +222,13 @@ public class TestConsecutiveZkSessionExpiry extends ZkUnitTestBase
     endCountdown.countDown();
 
     result =
-        ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                                   clusterName));
+        ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(
+            ZK_ADDR, clusterName));
     Assert.assertTrue(result);
 
     // verify leader changes to localhost_12919
-    ZKHelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
+    ZKHelixDataAccessor accessor =
+        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
     PropertyKey.Builder keyBuilder = accessor.keyBuilder();
     Assert.assertNotNull(accessor.getProperty(keyBuilder.liveInstance("localhost_12918")));
     LiveInstance leader = accessor.getProperty(keyBuilder.controllerLeader());
@@ -251,17 +238,18 @@ public class TestConsecutiveZkSessionExpiry extends ZkUnitTestBase
     // check localhost_12918 has 2 handlers: message and data-accessor
     LOG.debug("handlers: " + TestHelper.printHandlers(distributedControllers[0]));
     List<CallbackHandler> handlers = distributedControllers[0].getHandlers();
-    Assert.assertEquals(handlers.size(), 2,
-                        "Distributed controller should have 2 handlers (message and data-accessor) after lose leadership, but was "
-                        + handlers.size());
+    Assert
+        .assertEquals(
+            handlers.size(),
+            2,
+            "Distributed controller should have 2 handlers (message and data-accessor) after lose leadership, but was "
+                + handlers.size());
 
     // clean up
     distributedControllers[1].disconnect();
     Assert.assertNull(accessor.getProperty(keyBuilder.liveInstance("localhost_12919")));
     Assert.assertNull(accessor.getProperty(keyBuilder.controllerLeader()));
 
-
-    System.out.println("END " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis()));
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/integration/manager/TestControllerManager.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/manager/TestControllerManager.java b/helix-core/src/test/java/org/apache/helix/integration/manager/TestControllerManager.java
index 07d019d..0234300 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/manager/TestControllerManager.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/manager/TestControllerManager.java
@@ -30,9 +30,7 @@ import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-
-public class TestControllerManager extends ZkUnitTestBase
-{
+public class TestControllerManager extends ZkUnitTestBase {
 
   @Test
   public void testMultipleControllersOfSameName() throws Exception {
@@ -42,18 +40,16 @@ public class TestControllerManager extends ZkUnitTestBase
     String clusterName = className + "_" + methodName;
     int n = 5;
 
-    System.out.println("START " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
     TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
-                            "localhost", // participant name prefix
-                            "TestDB", // resource name prefix
-                            1, // resources
-                            16, // partitions per resource
-                            n, // number of nodes
-                            3, // replicas
-                            "MasterSlave",
-                            true); // do rebalance
+        "localhost", // participant name prefix
+        "TestDB", // resource name prefix
+        1, // resources
+        16, // partitions per resource
+        n, // number of nodes
+        3, // replicas
+        "MasterSlave", true); // do rebalance
 
     // start multiple controllers of same name
     int m = 3;
@@ -74,19 +70,18 @@ public class TestControllerManager extends ZkUnitTestBase
     Assert.assertEquals(leaderCnt, 1, "Should have only 1 leader but was " + leaderCnt);
 
     MockParticipantManager[] participants = new MockParticipantManager[n];
-    for (int i = 0; i < n; i++)
-    {
+    for (int i = 0; i < n; i++) {
       final String instanceName = "localhost_" + (12918 + i);
 
-      participants[i] =
-          new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
 
       participants[i].syncStart();
     }
 
     boolean result =
-        ClusterStateVerifier.verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                                      clusterName));
+        ClusterStateVerifier
+            .verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
+                clusterName));
     Assert.assertTrue(result);
 
     // cleanup
@@ -98,53 +93,46 @@ public class TestControllerManager extends ZkUnitTestBase
       participants[i].syncStop();
     }
 
-    System.out.println("END " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis()));
   }
 
   @Test
-  public void simpleSessionExpiryTest() throws Exception
-  {
-//    Logger.getRootLogger().setLevel(Level.WARN);
+  public void simpleSessionExpiryTest() throws Exception {
+    // Logger.getRootLogger().setLevel(Level.WARN);
 
     String className = TestHelper.getTestClassName();
     String methodName = TestHelper.getTestMethodName();
     final String clusterName = className + "_" + methodName;
     int n = 5;
 
-    System.out.println("START " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
     MockParticipantManager[] participants = new MockParticipantManager[n];
 
     TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
-                            "localhost", // participant name prefix
-                            "TestDB", // resource name prefix
-                            1, // resources
-                            16, // partitions per resource
-                            n, // number of nodes
-                            3, // replicas
-                            "MasterSlave",
-                            true); // do rebalance
+        "localhost", // participant name prefix
+        "TestDB", // resource name prefix
+        1, // resources
+        16, // partitions per resource
+        n, // number of nodes
+        3, // replicas
+        "MasterSlave", true); // do rebalance
 
     // start controller
-    ClusterControllerManager controller = new ClusterControllerManager(ZK_ADDR, clusterName, "controller");
+    ClusterControllerManager controller =
+        new ClusterControllerManager(ZK_ADDR, clusterName, "controller");
     controller.syncStart();
 
     // start participants
-    for (int i = 0; i < n; i++)
-    {
+    for (int i = 0; i < n; i++) {
       String instanceName = "localhost_" + (12918 + i);
-      participants[i] =
-          new MockParticipantManager(ZK_ADDR,
-                                 clusterName,
-                                 instanceName);
+      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
       participants[i].syncStart();
     }
 
     boolean result =
         ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                 clusterName));
+            clusterName));
     Assert.assertTrue(result);
     String oldSessionId = controller.getSessionId();
 
@@ -156,7 +144,7 @@ public class TestControllerManager extends ZkUnitTestBase
 
     result =
         ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                 clusterName));
+            clusterName));
     Assert.assertTrue(result);
     String newSessionId = controller.getSessionId();
     Assert.assertNotSame(newSessionId, oldSessionId);
@@ -167,8 +155,7 @@ public class TestControllerManager extends ZkUnitTestBase
       participants[i].syncStop();
     }
 
-    System.out.println("END " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/integration/manager/TestDistributedControllerManager.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/manager/TestDistributedControllerManager.java b/helix-core/src/test/java/org/apache/helix/integration/manager/TestDistributedControllerManager.java
index 6af0380..b5ef255 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/manager/TestDistributedControllerManager.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/manager/TestDistributedControllerManager.java
@@ -50,30 +50,30 @@ public class TestDistributedControllerManager extends ZkIntegrationTestBase {
     String clusterName = className + "_" + methodName;
     int n = 2;
 
-    System.out.println("START " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
     TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
-                            "localhost", // participant name prefix
-                            "TestDB", // resource name prefix
-                            1, // resources
-                            4, // partitions per resource
-                            n, // number of nodes
-                            2, // replicas
-                            "MasterSlave",
-                            true); // do rebalance
+        "localhost", // participant name prefix
+        "TestDB", // resource name prefix
+        1, // resources
+        4, // partitions per resource
+        n, // number of nodes
+        2, // replicas
+        "MasterSlave", true); // do rebalance
 
     DistributedControllerManager[] distributedControllers = new DistributedControllerManager[n];
     for (int i = 0; i < n; i++) {
       int port = 12918 + i;
-      distributedControllers[i] = new DistributedControllerManager(ZK_ADDR, clusterName, "localhost_" + port);
-      distributedControllers[i].getStateMachineEngine().registerStateModelFactory("MasterSlave", new MockMSModelFactory());
+      distributedControllers[i] =
+          new DistributedControllerManager(ZK_ADDR, clusterName, "localhost_" + port);
+      distributedControllers[i].getStateMachineEngine().registerStateModelFactory("MasterSlave",
+          new MockMSModelFactory());
       distributedControllers[i].connect();
     }
 
     boolean result =
         ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                 clusterName));
+            clusterName));
     Assert.assertTrue(result);
 
     // disconnect first distributed-controller, and verify second takes leadership
@@ -83,10 +83,11 @@ public class TestDistributedControllerManager extends ZkIntegrationTestBase {
     Thread.sleep(100);
     result =
         ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                 clusterName));
+            clusterName));
     Assert.assertTrue(result);
 
-    ZKHelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
+    ZKHelixDataAccessor accessor =
+        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
     PropertyKey.Builder keyBuilder = accessor.keyBuilder();
     Assert.assertNull(accessor.getProperty(keyBuilder.liveInstance("localhost_12918")));
     LiveInstance leader = accessor.getProperty(keyBuilder.controllerLeader());
@@ -98,52 +99,53 @@ public class TestDistributedControllerManager extends ZkIntegrationTestBase {
     Assert.assertNull(accessor.getProperty(keyBuilder.liveInstance("localhost_12919")));
     Assert.assertNull(accessor.getProperty(keyBuilder.controllerLeader()));
 
-
-    System.out.println("START " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
   }
 
   /**
    * expire a controller and make sure the other takes the leadership
-   *
    * @param expireController
    * @param newController
    * @throws Exception
    */
   void expireController(ClusterDistributedController expireController,
-                        ClusterDistributedController newController) throws Exception
-  {
+      ClusterDistributedController newController) throws Exception {
     String clusterName = expireController.getClusterName();
     LOG.info("Expiring distributedController: " + expireController.getInstanceName()
-             + ", session: " + expireController.getSessionId() + " ...");
+        + ", session: " + expireController.getSessionId() + " ...");
     String oldSessionId = expireController.getSessionId();
 
     ZkTestHelper.expireSession(expireController.getZkClient());
     String newSessionId = expireController.getSessionId();
     LOG.debug("Expried distributedController: " + expireController.getInstanceName()
-                       + ", oldSessionId: " + oldSessionId + ", newSessionId: " + newSessionId);
+        + ", oldSessionId: " + oldSessionId + ", newSessionId: " + newSessionId);
 
     boolean result =
-        ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                                   clusterName));
+        ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(
+            ZK_ADDR, clusterName));
     Assert.assertTrue(result);
 
     // verify leader changes to localhost_12919
-    ZKHelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
+    ZKHelixDataAccessor accessor =
+        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
     PropertyKey.Builder keyBuilder = accessor.keyBuilder();
-    Assert.assertNotNull(accessor.getProperty(keyBuilder.liveInstance(expireController.getInstanceName())));
+    Assert.assertNotNull(accessor.getProperty(keyBuilder.liveInstance(expireController
+        .getInstanceName())));
     LiveInstance leader = accessor.getProperty(keyBuilder.controllerLeader());
     Assert.assertNotNull(leader);
     Assert.assertEquals(leader.getId(), newController.getInstanceName());
 
-
     // check expired-controller has 2 handlers: message and data-accessor
-    LOG.debug(expireController.getInstanceName() + " handlers: " + TestHelper.printHandlers(expireController));
+    LOG.debug(expireController.getInstanceName() + " handlers: "
+        + TestHelper.printHandlers(expireController));
 
     List<CallbackHandler> handlers = expireController.getHandlers();
-    Assert.assertEquals(handlers.size(), 2,
-                        "Distributed controller should have 2 handlers (message and data-accessor) after lose leadership, but was "
-                        + handlers.size());
+    Assert
+        .assertEquals(
+            handlers.size(),
+            2,
+            "Distributed controller should have 2 handlers (message and data-accessor) after lose leadership, but was "
+                + handlers.size());
   }
 
   @Test
@@ -154,31 +156,31 @@ public class TestDistributedControllerManager extends ZkIntegrationTestBase {
     String clusterName = className + "_" + methodName;
     int n = 2;
 
-    System.out.println("START " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
     TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
-                            "localhost", // participant name prefix
-                            "TestDB", // resource name prefix
-                            1, // resources
-                            4, // partitions per resource
-                            n, // number of nodes
-                            2, // replicas
-                            "MasterSlave",
-                            true); // do rebalance
+        "localhost", // participant name prefix
+        "TestDB", // resource name prefix
+        1, // resources
+        4, // partitions per resource
+        n, // number of nodes
+        2, // replicas
+        "MasterSlave", true); // do rebalance
 
     ClusterDistributedController[] distributedControllers = new ClusterDistributedController[n];
 
     for (int i = 0; i < n; i++) {
       String contrllerName = "localhost_" + (12918 + i);
-      distributedControllers[i] = new ClusterDistributedController(ZK_ADDR, clusterName, contrllerName);
-      distributedControllers[i].getStateMachineEngine().registerStateModelFactory("MasterSlave", new MockMSModelFactory());
+      distributedControllers[i] =
+          new ClusterDistributedController(ZK_ADDR, clusterName, contrllerName);
+      distributedControllers[i].getStateMachineEngine().registerStateModelFactory("MasterSlave",
+          new MockMSModelFactory());
       distributedControllers[i].connect();
     }
 
     boolean result =
         ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                 clusterName));
+            clusterName));
     Assert.assertTrue(result);
 
     // expire localhost_12918
@@ -187,19 +189,18 @@ public class TestDistributedControllerManager extends ZkIntegrationTestBase {
     // expire localhost_12919
     expireController(distributedControllers[1], distributedControllers[0]);
 
-
     // clean up
-    ZKHelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
+    ZKHelixDataAccessor accessor =
+        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
     PropertyKey.Builder keyBuilder = accessor.keyBuilder();
 
     for (int i = 0; i < n; i++) {
       distributedControllers[i].disconnect();
-      Assert.assertNull(accessor.getProperty(keyBuilder.liveInstance(distributedControllers[i].getInstanceName())));
+      Assert.assertNull(accessor.getProperty(keyBuilder.liveInstance(distributedControllers[i]
+          .getInstanceName())));
     }
     Assert.assertNull(accessor.getProperty(keyBuilder.controllerLeader()));
 
-
-    System.out.println("END " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis()));
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/integration/manager/TestParticipantManager.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/manager/TestParticipantManager.java b/helix-core/src/test/java/org/apache/helix/integration/manager/TestParticipantManager.java
index 3cfdb76..85dc029 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/manager/TestParticipantManager.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/manager/TestParticipantManager.java
@@ -59,21 +59,21 @@ public class TestParticipantManager extends ZkIntegrationTestBase {
     String clusterName = className + "_" + methodName;
     int n = 1;
 
-    System.out.println("START " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
     TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
-                            "localhost", // participant name prefix
-                            "TestDB", // resource name prefix
-                            1, // resources
-                            4, // partitions per resource
-                            n, // number of nodes
-                            1, // replicas
-                            "MasterSlave",
-                            true); // do rebalance
-
-    ParticipantManager participant = new ParticipantManager(ZK_ADDR, clusterName, "localhost_12918");
-    participant.getStateMachineEngine().registerStateModelFactory("MasterSlave", new MockMSModelFactory());
+        "localhost", // participant name prefix
+        "TestDB", // resource name prefix
+        1, // resources
+        4, // partitions per resource
+        n, // number of nodes
+        1, // replicas
+        "MasterSlave", true); // do rebalance
+
+    ParticipantManager participant =
+        new ParticipantManager(ZK_ADDR, clusterName, "localhost_12918");
+    participant.getStateMachineEngine().registerStateModelFactory("MasterSlave",
+        new MockMSModelFactory());
     participant.connect();
 
     ControllerManager controller = new ControllerManager(ZK_ADDR, clusterName, "controller_0");
@@ -81,7 +81,7 @@ public class TestParticipantManager extends ZkIntegrationTestBase {
 
     boolean result =
         ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                 clusterName));
+            clusterName));
     Assert.assertTrue(result);
 
     // cleanup
@@ -89,58 +89,51 @@ public class TestParticipantManager extends ZkIntegrationTestBase {
     participant.disconnect();
 
     // verify all live-instances and leader nodes are gone
-    ZKHelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
+    ZKHelixDataAccessor accessor =
+        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
     PropertyKey.Builder keyBuilder = accessor.keyBuilder();
     Assert.assertNull(accessor.getProperty(keyBuilder.liveInstance("localhost_12918")));
     Assert.assertNull(accessor.getProperty(keyBuilder.controllerLeader()));
 
-    System.out.println("END " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis()));
   }
 
   @Test
-  public void simpleSessionExpiryTest() throws Exception
-  {
-//    Logger.getRootLogger().setLevel(Level.WARN);
+  public void simpleSessionExpiryTest() throws Exception {
+    // Logger.getRootLogger().setLevel(Level.WARN);
 
     String className = TestHelper.getTestClassName();
     String methodName = TestHelper.getTestMethodName();
     final String clusterName = className + "_" + methodName;
     int n = 1;
 
-    System.out.println("START " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
     MockParticipantManager[] participants = new MockParticipantManager[n];
 
     TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
-                            "localhost", // participant name prefix
-                            "TestDB", // resource name prefix
-                            1, // resources
-                            1, // partitions per resource
-                            n, // number of nodes
-                            1, // replicas
-                            "MasterSlave",
-                            true); // do rebalance
+        "localhost", // participant name prefix
+        "TestDB", // resource name prefix
+        1, // resources
+        1, // partitions per resource
+        n, // number of nodes
+        1, // replicas
+        "MasterSlave", true); // do rebalance
 
     // start controller
     ControllerManager controller = new ControllerManager(ZK_ADDR, clusterName, "controller_0");
     controller.connect();
 
     // start participants
-    for (int i = 0; i < n; i++)
-    {
+    for (int i = 0; i < n; i++) {
       String instanceName = "localhost_" + (12918 + i);
-      participants[i] =
-          new MockParticipantManager(ZK_ADDR,
-                                 clusterName,
-                                 instanceName);
+      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
       participants[i].syncStart();
     }
 
     boolean result =
         ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                 clusterName));
+            clusterName));
     Assert.assertTrue(result);
     String oldSessionId = participants[0].getSessionId();
 
@@ -152,7 +145,7 @@ public class TestParticipantManager extends ZkIntegrationTestBase {
 
     result =
         ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                 clusterName));
+            clusterName));
     Assert.assertTrue(result);
     String newSessionId = participants[0].getSessionId();
     Assert.assertNotSame(newSessionId, oldSessionId);
@@ -163,13 +156,11 @@ public class TestParticipantManager extends ZkIntegrationTestBase {
       participants[i].syncStop();
     }
 
-    System.out.println("END " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
   }
 
-  class SessionExpiryTransition extends MockTransition
-  {
+  class SessionExpiryTransition extends MockTransition {
     private final AtomicBoolean _done = new AtomicBoolean();
     private final CountDownLatch _startCountdown;
     private final CountDownLatch _endCountdown;
@@ -180,14 +171,12 @@ public class TestParticipantManager extends ZkIntegrationTestBase {
     }
 
     @Override
-    public void doTransition(Message message, NotificationContext context) throws InterruptedException
-    {
+    public void doTransition(Message message, NotificationContext context)
+        throws InterruptedException {
       String instance = message.getTgtName();
       String partition = message.getPartitionName();
-      if (instance.equals("localhost_12918")
-          && partition.equals("TestDB0_0")
-          && _done.getAndSet(true) == false)
-      {
+      if (instance.equals("localhost_12918") && partition.equals("TestDB0_0")
+          && _done.getAndSet(true) == false) {
         _startCountdown.countDown();
         // this await will be interrupted since we cancel the task during handleNewSession
         _endCountdown.await();
@@ -204,34 +193,27 @@ public class TestParticipantManager extends ZkIntegrationTestBase {
     CountDownLatch startCountdown = new CountDownLatch(1);
     CountDownLatch endCountdown = new CountDownLatch(1);
 
-
-    System.out.println("START " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
     MockParticipantManager[] participants = new MockParticipantManager[n];
 
     TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
-                            "localhost", // participant name prefix
-                            "TestDB", // resource name prefix
-                            1, // resources
-                            1, // partitions per resource
-                            n, // number of nodes
-                            1, // replicas
-                            "MasterSlave",
-                            true); // do rebalance
+        "localhost", // participant name prefix
+        "TestDB", // resource name prefix
+        1, // resources
+        1, // partitions per resource
+        n, // number of nodes
+        1, // replicas
+        "MasterSlave", true); // do rebalance
 
     // start controller
     ControllerManager controller = new ControllerManager(ZK_ADDR, clusterName, "controller_0");
     controller.connect();
 
     // start participants
-    for (int i = 0; i < n; i++)
-    {
+    for (int i = 0; i < n; i++) {
       String instanceName = "localhost_" + (12918 + i);
-      participants[i] =
-          new MockParticipantManager(ZK_ADDR,
-                                 clusterName,
-                                 instanceName);
+      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
       participants[i].setTransition(new SessionExpiryTransition(startCountdown, endCountdown));
       participants[i].syncStart();
     }
@@ -244,16 +226,21 @@ public class TestParticipantManager extends ZkIntegrationTestBase {
 
     boolean result =
         ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                 clusterName));
+            clusterName));
     Assert.assertTrue(result);
 
     String newSessionId = participants[0].getSessionId();
     Assert.assertNotSame(newSessionId, oldSessionId);
 
     // assert interrupt exception error in old session
-    String errPath = PropertyPathConfig.getPath(PropertyType.ERRORS, clusterName, "localhost_12918", oldSessionId, "TestDB0", "TestDB0_0");
+    String errPath =
+        PropertyPathConfig.getPath(PropertyType.ERRORS, clusterName, "localhost_12918",
+            oldSessionId, "TestDB0", "TestDB0_0");
     ZNRecord error = _gZkClient.readData(errPath);
-    Assert.assertNotNull(error, "InterruptedException should happen in old session since task is being cancelled during handleNewSession");
+    Assert
+        .assertNotNull(
+            error,
+            "InterruptedException should happen in old session since task is being cancelled during handleNewSession");
     String errString = new String(new ZNRecordSerializer().serialize(error));
     Assert.assertTrue(errString.indexOf("InterruptedException") != -1);
 
@@ -263,7 +250,6 @@ public class TestParticipantManager extends ZkIntegrationTestBase {
       participants[i].syncStop();
     }
 
-    System.out.println("END " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis()));
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/integration/manager/TestStateModelLeak.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/manager/TestStateModelLeak.java b/helix-core/src/test/java/org/apache/helix/integration/manager/TestStateModelLeak.java
index efd2459..2aff5b6 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/manager/TestStateModelLeak.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/manager/TestStateModelLeak.java
@@ -43,8 +43,7 @@ import org.testng.annotations.Test;
 /**
  * test drop resource should remove state-models
  */
-public class TestStateModelLeak extends ZkUnitTestBase
-{
+public class TestStateModelLeak extends ZkUnitTestBase {
   private static Logger LOG = Logger.getLogger(TestStateModelLeak.class);
 
   /**
@@ -52,8 +51,7 @@ public class TestStateModelLeak extends ZkUnitTestBase
    * @throws Exception
    */
   @Test
-  public void testDrop() throws Exception
-  {
+  public void testDrop() throws Exception {
     // Logger.getRootLogger().setLevel(Level.INFO);
     String className = TestHelper.getTestClassName();
     String methodName = TestHelper.getTestMethodName();
@@ -63,33 +61,35 @@ public class TestStateModelLeak extends ZkUnitTestBase
     System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
     TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
-                            "localhost", // participant name prefix
-                            "TestDB", // resource name prefix
-                            1, // resources
-                            4, // partitions per resource
-                            n, // number of nodes
-                            2, // replicas
-                            "MasterSlave",
-                            true); // do rebalance
+        "localhost", // participant name prefix
+        "TestDB", // resource name prefix
+        1, // resources
+        4, // partitions per resource
+        n, // number of nodes
+        2, // replicas
+        "MasterSlave", true); // do rebalance
 
     // start controller
-    ClusterControllerManager controller = new ClusterControllerManager(ZK_ADDR, clusterName, "controller");
+    ClusterControllerManager controller =
+        new ClusterControllerManager(ZK_ADDR, clusterName, "controller");
     controller.syncStart();
 
     MockParticipantManager[] participants = new MockParticipantManager[n];
-    for (int i = 0; i < n; i++)
-    {
+    for (int i = 0; i < n; i++) {
       final String instanceName = "localhost_" + (12918 + i);
 
       participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
       participants[i].syncStart();
     }
 
-    boolean result = ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR, clusterName));
+    boolean result =
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+            clusterName));
     Assert.assertTrue(result);
 
     // check state-models in state-machine
-    HelixStateMachineEngine stateMachine = (HelixStateMachineEngine) participants[0].getStateMachineEngine();
+    HelixStateMachineEngine stateMachine =
+        (HelixStateMachineEngine) participants[0].getStateMachineEngine();
     StateModelFactory<? extends StateModel> fty = stateMachine.getStateModelFactory("MasterSlave");
     Map<String, String> expectStateModelMap = new TreeMap<String, String>();
     expectStateModelMap.put("TestDB0_0", "SLAVE");
@@ -102,17 +102,18 @@ public class TestStateModelLeak extends ZkUnitTestBase
     HelixAdmin admin = new ZKHelixAdmin(_gZkClient);
     admin.dropResource(clusterName, "TestDB0");
 
-    result = ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR, clusterName));
+    result =
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+            clusterName));
     Assert.assertTrue(result);
 
     // check state models have been dropped also
-    Assert.assertTrue(fty.getPartitionSet().isEmpty(), "All state-models should be dropped, but was "
-    + fty.getPartitionSet());
+    Assert.assertTrue(fty.getPartitionSet().isEmpty(),
+        "All state-models should be dropped, but was " + fty.getPartitionSet());
 
     // cleanup
     controller.syncStop();
-    for (int i = 0; i < n; i++)
-    {
+    for (int i = 0; i < n; i++) {
       participants[i].syncStop();
     }
 
@@ -124,8 +125,7 @@ public class TestStateModelLeak extends ZkUnitTestBase
    * @throws Exception
    */
   @Test
-  public void testDropErrorPartition() throws Exception
-  {
+  public void testDropErrorPartition() throws Exception {
     // Logger.getRootLogger().setLevel(Level.INFO);
     String className = TestHelper.getTestClassName();
     String methodName = TestHelper.getTestMethodName();
@@ -135,27 +135,25 @@ public class TestStateModelLeak extends ZkUnitTestBase
     System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
     TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
-                            "localhost", // participant name prefix
-                            "TestDB", // resource name prefix
-                            1, // resources
-                            4, // partitions per resource
-                            n, // number of nodes
-                            2, // replicas
-                            "MasterSlave",
-                            true); // do rebalance
+        "localhost", // participant name prefix
+        "TestDB", // resource name prefix
+        1, // resources
+        4, // partitions per resource
+        n, // number of nodes
+        2, // replicas
+        "MasterSlave", true); // do rebalance
 
     // start controller
-    ClusterControllerManager controller = new ClusterControllerManager(ZK_ADDR, clusterName, "controller");
+    ClusterControllerManager controller =
+        new ClusterControllerManager(ZK_ADDR, clusterName, "controller");
     controller.syncStart();
 
     MockParticipantManager[] participants = new MockParticipantManager[n];
-    for (int i = 0; i < n; i++)
-    {
+    for (int i = 0; i < n; i++) {
       final String instanceName = "localhost_" + (12918 + i);
 
       participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
-      if (i == 0)
-      {
+      if (i == 0) {
         Map<String, Set<String>> errTransitionMap = new HashMap<String, Set<String>>();
         Set<String> partitions = new HashSet<String>();
         partitions.add("TestDB0_0");
@@ -169,11 +167,14 @@ public class TestStateModelLeak extends ZkUnitTestBase
     Map<String, Map<String, String>> errStates = new HashMap<String, Map<String, String>>();
     errStates.put("TestDB0", new HashMap<String, String>());
     errStates.get("TestDB0").put("TestDB0_0", "localhost_12918");
-    boolean result = ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR, clusterName, errStates));
+    boolean result =
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+            clusterName, errStates));
     Assert.assertTrue(result);
 
     // check state-models in state-machine
-    HelixStateMachineEngine stateMachine = (HelixStateMachineEngine) participants[0].getStateMachineEngine();
+    HelixStateMachineEngine stateMachine =
+        (HelixStateMachineEngine) participants[0].getStateMachineEngine();
     StateModelFactory<? extends StateModel> fty = stateMachine.getStateModelFactory("MasterSlave");
     Map<String, String> expectStateModelMap = new TreeMap<String, String>();
     expectStateModelMap.put("TestDB0_0", "ERROR");
@@ -186,17 +187,18 @@ public class TestStateModelLeak extends ZkUnitTestBase
     HelixAdmin admin = new ZKHelixAdmin(_gZkClient);
     admin.dropResource(clusterName, "TestDB0");
 
-    result = ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR, clusterName));
+    result =
+        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
+            clusterName));
     Assert.assertTrue(result);
 
     // check state models have been dropped also
-    Assert.assertTrue(fty.getPartitionSet().isEmpty(), "All state-models should be dropped, but was "
-    + fty.getPartitionSet());
+    Assert.assertTrue(fty.getPartitionSet().isEmpty(),
+        "All state-models should be dropped, but was " + fty.getPartitionSet());
 
     // cleanup
     controller.syncStop();
-    for (int i = 0; i < n; i++)
-    {
+    for (int i = 0; i < n; i++) {
       participants[i].syncStop();
     }
 
@@ -205,21 +207,19 @@ public class TestStateModelLeak extends ZkUnitTestBase
 
   /**
    * check state-model factory contains state-models same as in expect-state-model map
-   *
    * @param fty
    * @param expectStateModelMap
    */
-  static void checkStateModelMap(StateModelFactory<? extends StateModel> fty, Map<String, String> expectStateModelMap)
-  {
+  static void checkStateModelMap(StateModelFactory<? extends StateModel> fty,
+      Map<String, String> expectStateModelMap) {
     Assert.assertEquals(fty.getPartitionSet().size(), expectStateModelMap.size());
-    for (String partition : fty.getPartitionSet())
-    {
+    for (String partition : fty.getPartitionSet()) {
       StateModel stateModel = fty.getStateModel(partition);
       String actualState = stateModel.getCurrentState();
       String expectState = expectStateModelMap.get(partition);
       LOG.debug(partition + " actual state: " + actualState + ", expect state: " + expectState);
-      Assert.assertEquals(actualState, expectState, "partition: " + partition + " should be in state: " + expectState
-                          + " but was " + actualState);
+      Assert.assertEquals(actualState, expectState, "partition: " + partition
+          + " should be in state: " + expectState + " but was " + actualState);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/integration/manager/TestZkCallbackHandlerLeak.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/manager/TestZkCallbackHandlerLeak.java b/helix-core/src/test/java/org/apache/helix/integration/manager/TestZkCallbackHandlerLeak.java
index ade650f..59a3fd9 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/manager/TestZkCallbackHandlerLeak.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/manager/TestZkCallbackHandlerLeak.java
@@ -38,31 +38,27 @@ import org.apache.log4j.Logger;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-public class TestZkCallbackHandlerLeak extends ZkUnitTestBase
-{
+public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
   private static Logger LOG = Logger.getLogger(TestZkCallbackHandlerLeak.class);
 
   @Test
-  public void testCbHdlrLeakOnParticipantSessionExpiry() throws Exception
-  {
+  public void testCbHdlrLeakOnParticipantSessionExpiry() throws Exception {
     // Logger.getRootLogger().setLevel(Level.INFO);
     String className = TestHelper.getTestClassName();
     String methodName = TestHelper.getTestMethodName();
     String clusterName = className + "_" + methodName;
     final int n = 2;
 
-    System.out.println("START " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
     TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
-                            "localhost", // participant name prefix
-                            "TestDB", // resource name prefix
-                            1, // resources
-                            32, // partitions per resource
-                            n, // number of nodes
-                            2, // replicas
-                            "MasterSlave",
-                            true); // do rebalance
+        "localhost", // participant name prefix
+        "TestDB", // resource name prefix
+        1, // resources
+        32, // partitions per resource
+        n, // number of nodes
+        2, // replicas
+        "MasterSlave", true); // do rebalance
 
     // start controller
     final ClusterControllerManager controller =
@@ -71,27 +67,24 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase
 
     // start participants
     MockParticipantManager[] participants = new MockParticipantManager[n];
-    for (int i = 0; i < n; i++)
-    {
+    for (int i = 0; i < n; i++) {
       String instanceName = "localhost_" + (12918 + i);
 
-      participants[i] =
-          new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
       participants[i].syncStart();
     }
 
     boolean result =
-        ClusterStateVerifier.verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                                      clusterName));
+        ClusterStateVerifier
+            .verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
+                clusterName));
     Assert.assertTrue(result);
 
     // check controller zk-watchers
-    result = TestHelper.verify(new TestHelper.Verifier()
-    {
+    result = TestHelper.verify(new TestHelper.Verifier() {
 
       @Override
-      public boolean verify() throws Exception
-      {
+      public boolean verify() throws Exception {
         Map<String, Set<String>> watchers = ZkTestHelper.getListenersBySession(ZK_ADDR);
         LOG.debug("all watchers: " + watchers);
         Set<String> watchPaths = watchers.get("0x" + controller.getSessionId());
@@ -106,22 +99,18 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase
 
     // check participant zk-watchers
     final MockParticipantManager participantManagerToExpire = participants[0];
-    result = TestHelper.verify(new TestHelper.Verifier()
-    {
+    result = TestHelper.verify(new TestHelper.Verifier() {
 
       @Override
-      public boolean verify() throws Exception
-      {
+      public boolean verify() throws Exception {
         Map<String, Set<String>> watchers = ZkTestHelper.getListenersBySession(ZK_ADDR);
-        Set<String> watchPaths =
-            watchers.get("0x" + participantManagerToExpire.getSessionId());
+        Set<String> watchPaths = watchers.get("0x" + participantManagerToExpire.getSessionId());
         LOG.debug("participant watch paths: " + watchPaths);
 
         // participant should have 2 zk-watchers: 1 for MESSAGE and 1 for CONTROLLER
         return watchPaths.size() == 2;
       }
-    },
-                               500);
+    }, 500);
     Assert.assertTrue(result, "Participant should have 2 zk-watchers.");
 
     // check HelixManager#_handlers
@@ -129,12 +118,10 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase
     // printHandlers(participantManagerToExpire);
     int controllerHandlerNb = controller.getHandlers().size();
     int particHandlerNb = participantManagerToExpire.getHandlers().size();
-    Assert.assertEquals(controllerHandlerNb,
-                        (5 + 2 * n),
-                        "HelixController should have 9 (5+2n) callback handlers for 2 (n) participant");
-    Assert.assertEquals(particHandlerNb,
-                        2,
-                        "HelixParticipant should have 2 (msg+cur-state) callback handlers");
+    Assert.assertEquals(controllerHandlerNb, (5 + 2 * n),
+        "HelixController should have 9 (5+2n) callback handlers for 2 (n) participant");
+    Assert.assertEquals(particHandlerNb, 2,
+        "HelixParticipant should have 2 (msg+cur-state) callback handlers");
 
     // expire the session of participant
     LOG.debug("Expiring participant session...");
@@ -142,21 +129,19 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase
 
     ZkTestHelper.expireSession(participantManagerToExpire.getZkClient());
     String newSessionId = participantManagerToExpire.getSessionId();
-    LOG.debug("Expried participant session. oldSessionId: " + oldSessionId
-        + ", newSessionId: " + newSessionId);
+    LOG.debug("Expried participant session. oldSessionId: " + oldSessionId + ", newSessionId: "
+        + newSessionId);
 
     result =
-        ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                                   clusterName));
+        ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(
+            ZK_ADDR, clusterName));
     Assert.assertTrue(result);
 
     // check controller zk-watchers
-    result = TestHelper.verify(new TestHelper.Verifier()
-    {
+    result = TestHelper.verify(new TestHelper.Verifier() {
 
       @Override
-      public boolean verify() throws Exception
-      {
+      public boolean verify() throws Exception {
         Map<String, Set<String>> watchers = ZkTestHelper.getListenersBySession(ZK_ADDR);
         Set<String> watchPaths = watchers.get("0x" + controller.getSessionId());
         LOG.debug("controller watch paths after session expiry: " + watchPaths);
@@ -166,66 +151,54 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase
         return watchPaths.size() == (6 + 5 * n);
       }
     }, 500);
-    Assert.assertTrue(result,
-                      "Controller should have 6 + 5*n zk-watchers after session expiry.");
+    Assert.assertTrue(result, "Controller should have 6 + 5*n zk-watchers after session expiry.");
 
     // check participant zk-watchers
-    result = TestHelper.verify(new TestHelper.Verifier()
-    {
+    result = TestHelper.verify(new TestHelper.Verifier() {
 
       @Override
-      public boolean verify() throws Exception
-      {
+      public boolean verify() throws Exception {
         Map<String, Set<String>> watchers = ZkTestHelper.getListenersBySession(ZK_ADDR);
-        Set<String> watchPaths =
-            watchers.get("0x" + participantManagerToExpire.getSessionId());
+        Set<String> watchPaths = watchers.get("0x" + participantManagerToExpire.getSessionId());
         LOG.debug("participant watch paths after session expiry: " + watchPaths);
 
         // participant should have 2 zk-watchers: 1 for MESSAGE and 1 for CONTROLLER
         return watchPaths.size() == 2;
       }
-    },
-                               500);
-    Assert.assertTrue(result,
-                      "Participant should have 2 zk-watchers after session expiry.");
+    }, 500);
+    Assert.assertTrue(result, "Participant should have 2 zk-watchers after session expiry.");
 
     // check handlers
     // printHandlers(controllerManager);
     // printHandlers(participantManagerToExpire);
     int handlerNb = controller.getHandlers().size();
-    Assert.assertEquals(handlerNb,
-                        controllerHandlerNb,
-                        "controller callback handlers should not increase after participant session expiry");
+    Assert.assertEquals(handlerNb, controllerHandlerNb,
+        "controller callback handlers should not increase after participant session expiry");
     handlerNb = participantManagerToExpire.getHandlers().size();
-    Assert.assertEquals(handlerNb,
-                        particHandlerNb,
-                        "participant callback handlers should not increase after participant session expiry");
+    Assert.assertEquals(handlerNb, particHandlerNb,
+        "participant callback handlers should not increase after participant session expiry");
 
-    System.out.println("END " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis()));
   }
 
   @Test
-  public void testCbHdlrLeakOnControllerSessionExpiry() throws Exception
-  {
+  public void testCbHdlrLeakOnControllerSessionExpiry() throws Exception {
     // Logger.getRootLogger().setLevel(Level.INFO);
     String className = TestHelper.getTestClassName();
     String methodName = TestHelper.getTestMethodName();
     String clusterName = className + "_" + methodName;
     final int n = 2;
 
-    System.out.println("START " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
     TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
-                            "localhost", // participant name prefix
-                            "TestDB", // resource name prefix
-                            1, // resources
-                            32, // partitions per resource
-                            n, // number of nodes
-                            2, // replicas
-                            "MasterSlave",
-                            true); // do rebalance
+        "localhost", // participant name prefix
+        "TestDB", // resource name prefix
+        1, // resources
+        32, // partitions per resource
+        n, // number of nodes
+        2, // replicas
+        "MasterSlave", true); // do rebalance
 
     final ClusterControllerManager controller =
         new ClusterControllerManager(ZK_ADDR, clusterName, "controller");
@@ -233,28 +206,25 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase
 
     // start participants
     MockParticipantManager[] participants = new MockParticipantManager[n];
-    for (int i = 0; i < n; i++)
-    {
+    for (int i = 0; i < n; i++) {
       String instanceName = "localhost_" + (12918 + i);
 
-      participants[i] =
-          new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
+      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
       participants[i].syncStart();
     }
 
     boolean result =
-        ClusterStateVerifier.verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                                      clusterName));
+        ClusterStateVerifier
+            .verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
+                clusterName));
     Assert.assertTrue(result);
 
     // wait until we get all the listeners registered
     final MockParticipantManager participantManager = participants[0];
-    result = TestHelper.verify(new TestHelper.Verifier()
-    {
+    result = TestHelper.verify(new TestHelper.Verifier() {
 
       @Override
-      public boolean verify() throws Exception
-      {
+      public boolean verify() throws Exception {
         int controllerHandlerNb = controller.getHandlers().size();
         int particHandlerNb = participantManager.getHandlers().size();
         if (controllerHandlerNb == 9 && particHandlerNb == 2)
@@ -266,14 +236,12 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase
 
     int controllerHandlerNb = controller.getHandlers().size();
     int particHandlerNb = participantManager.getHandlers().size();
-    Assert.assertEquals(controllerHandlerNb,
-                        (5 + 2 * n),
-                        "HelixController should have 9 (5+2n) callback handlers for 2 participant, but was "
-                            + controllerHandlerNb + ", " + TestHelper.printHandlers(controller));
-    Assert.assertEquals(particHandlerNb,
-                        2,
-                        "HelixParticipant should have 2 (msg+cur-state) callback handlers, but was "
-                            + particHandlerNb + ", " + TestHelper.printHandlers(participantManager));
+    Assert.assertEquals(controllerHandlerNb, (5 + 2 * n),
+        "HelixController should have 9 (5+2n) callback handlers for 2 participant, but was "
+            + controllerHandlerNb + ", " + TestHelper.printHandlers(controller));
+    Assert.assertEquals(particHandlerNb, 2,
+        "HelixParticipant should have 2 (msg+cur-state) callback handlers, but was "
+            + particHandlerNb + ", " + TestHelper.printHandlers(participantManager));
 
     // expire controller
     LOG.debug("Expiring controller session...");
@@ -281,21 +249,19 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase
 
     ZkTestHelper.expireSession(controller.getZkClient());
     String newSessionId = controller.getSessionId();
-    LOG.debug("Expired controller session. oldSessionId: " + oldSessionId
-        + ", newSessionId: " + newSessionId);
+    LOG.debug("Expired controller session. oldSessionId: " + oldSessionId + ", newSessionId: "
+        + newSessionId);
 
     result =
-        ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                                   clusterName));
+        ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(
+            ZK_ADDR, clusterName));
     Assert.assertTrue(result);
 
     // check controller zk-watchers
-    result = TestHelper.verify(new TestHelper.Verifier()
-    {
+    result = TestHelper.verify(new TestHelper.Verifier() {
 
       @Override
-      public boolean verify() throws Exception
-      {
+      public boolean verify() throws Exception {
         Map<String, Set<String>> watchers = ZkTestHelper.getListenersBySession(ZK_ADDR);
         Set<String> watchPaths = watchers.get("0x" + controller.getSessionId());
         // System.out.println("controller watch paths after session expiry: " +
@@ -306,16 +272,13 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase
         return watchPaths.size() == (6 + 5 * n);
       }
     }, 500);
-    Assert.assertTrue(result,
-                      "Controller should have 6 + 5*n zk-watchers after session expiry.");
+    Assert.assertTrue(result, "Controller should have 6 + 5*n zk-watchers after session expiry.");
 
     // check participant zk-watchers
-    result = TestHelper.verify(new TestHelper.Verifier()
-    {
+    result = TestHelper.verify(new TestHelper.Verifier() {
 
       @Override
-      public boolean verify() throws Exception
-      {
+      public boolean verify() throws Exception {
         Map<String, Set<String>> watchers = ZkTestHelper.getListenersBySession(ZK_ADDR);
         Set<String> watchPaths = watchers.get("0x" + participantManager.getSessionId());
         LOG.debug("participant watch paths after session expiry: " + watchPaths);
@@ -324,67 +287,54 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase
         return watchPaths.size() == 2;
       }
     }, 500);
-    Assert.assertTrue(result,
-                      "Participant should have 2 zk-watchers after session expiry.");
+    Assert.assertTrue(result, "Participant should have 2 zk-watchers after session expiry.");
 
     // check HelixManager#_handlers
     // printHandlers(controllerManager);
     int handlerNb = controller.getHandlers().size();
-    Assert.assertEquals(handlerNb,
-                        controllerHandlerNb,
-                        "controller callback handlers should not increase after participant session expiry, but was "
-                            + TestHelper.printHandlers(controller));
+    Assert.assertEquals(handlerNb, controllerHandlerNb,
+        "controller callback handlers should not increase after participant session expiry, but was "
+            + TestHelper.printHandlers(controller));
     handlerNb = participantManager.getHandlers().size();
-    Assert.assertEquals(handlerNb,
-                        particHandlerNb,
-                        "participant callback handlers should not increase after participant session expiry, but was "
-                            + TestHelper.printHandlers(participantManager));
+    Assert.assertEquals(handlerNb, particHandlerNb,
+        "participant callback handlers should not increase after participant session expiry, but was "
+            + TestHelper.printHandlers(participantManager));
 
-    System.out.println("END " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis()));
   }
 
   @Test
-  public void testRemoveUserCbHdlrOnPathRemoval() throws Exception
-  {
+  public void testRemoveUserCbHdlrOnPathRemoval() throws Exception {
     String className = TestHelper.getTestClassName();
     String methodName = TestHelper.getTestMethodName();
     String clusterName = className + "_" + methodName;
     final int n = 3;
     final String zkAddr = ZK_ADDR;
-    System.out.println("START " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
     TestHelper.setupCluster(clusterName, zkAddr, 12918, "localhost", "TestDB", 1, // resource
-                            32, // partitions
-                            n, // nodes
-                            2, // replicas
-                            "MasterSlave",
-                            true);
+        32, // partitions
+        n, // nodes
+        2, // replicas
+        "MasterSlave", true);
 
     final ClusterControllerManager controller =
         new ClusterControllerManager(zkAddr, clusterName, "controller");
     controller.syncStart();
 
     MockParticipantManager[] participants = new MockParticipantManager[n];
-    for (int i = 0; i < n; i++)
-    {
+    for (int i = 0; i < n; i++) {
       String instanceName = "localhost_" + (12918 + i);
-      participants[i] =
-          new MockParticipantManager(zkAddr, clusterName, instanceName);
+      participants[i] = new MockParticipantManager(zkAddr, clusterName, instanceName);
       participants[i].syncStart();
 
       // register a controller listener on participant_0
-      if (i == 0)
-      {
+      if (i == 0) {
         MockParticipantManager manager = participants[0];
-        manager.addCurrentStateChangeListener(new CurrentStateChangeListener()
-        {
+        manager.addCurrentStateChangeListener(new CurrentStateChangeListener() {
           @Override
-          public void onStateChange(String instanceName,
-                                    List<CurrentState> statesInfo,
-                                    NotificationContext changeContext)
-          {
+          public void onStateChange(String instanceName, List<CurrentState> statesInfo,
+              NotificationContext changeContext) {
             // To change body of implemented methods use File | Settings | File Templates.
             // System.out.println(instanceName + " on current-state change, type: " +
             // changeContext.getType());
@@ -394,8 +344,9 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase
     }
 
     Boolean result =
-        ClusterStateVerifier.verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(zkAddr,
-                                                                                                      clusterName));
+        ClusterStateVerifier
+            .verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(zkAddr,
+                clusterName));
     Assert.assertTrue(result);
 
     MockParticipantManager participantToExpire = participants[0];
@@ -403,9 +354,8 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase
     PropertyKey.Builder keyBuilder = new PropertyKey.Builder(clusterName);
 
     // check manager#hanlders
-    Assert.assertEquals(participantToExpire.getHandlers().size(),
-                        3,
-                        "Should have 3 handlers: CURRENTSTATE/{sessionId}, CONTROLLER, and MESSAGES");
+    Assert.assertEquals(participantToExpire.getHandlers().size(), 3,
+        "Should have 3 handlers: CURRENTSTATE/{sessionId}, CONTROLLER, and MESSAGES");
 
     // check zkclient#listeners
     Map<String, Set<IZkDataListener>> dataListeners =
@@ -413,98 +363,91 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase
     Map<String, Set<IZkChildListener>> childListeners =
         ZkTestHelper.getZkChildListener(participantToExpire.getZkClient());
     // printZkListeners(participantToExpire.getZkClient());
-    Assert.assertEquals(dataListeners.size(),
-                        1,
-                        "Should have 1 path (CURRENTSTATE/{sessionId}/TestDB0) which has 1 data-listeners");
+    Assert.assertEquals(dataListeners.size(), 1,
+        "Should have 1 path (CURRENTSTATE/{sessionId}/TestDB0) which has 1 data-listeners");
     String path =
-        keyBuilder.currentState(participantToExpire.getInstanceName(),
-                                oldSessionId,
-                                "TestDB0").getPath();
-    Assert.assertEquals(dataListeners.get(path).size(),
-                        1,
-                        "Should have 1 data-listeners on path: " + path);
-    Assert.assertEquals(childListeners.size(),
-                        3,
-                        "Should have 3 paths (CURRENTSTATE/{sessionId}, CONTROLLER, and MESSAGES) each of which has 1 child-listener");
-    path =
-        keyBuilder.currentStates(participantToExpire.getInstanceName(), oldSessionId)
-                  .getPath();
-    Assert.assertEquals(childListeners.get(path).size(),
-                        1,
-                        "Should have 1 child-listener on path: " + path);
+        keyBuilder.currentState(participantToExpire.getInstanceName(), oldSessionId, "TestDB0")
+            .getPath();
+    Assert.assertEquals(dataListeners.get(path).size(), 1, "Should have 1 data-listeners on path: "
+        + path);
+    Assert
+        .assertEquals(
+            childListeners.size(),
+            3,
+            "Should have 3 paths (CURRENTSTATE/{sessionId}, CONTROLLER, and MESSAGES) each of which has 1 child-listener");
+    path = keyBuilder.currentStates(participantToExpire.getInstanceName(), oldSessionId).getPath();
+    Assert.assertEquals(childListeners.get(path).size(), 1,
+        "Should have 1 child-listener on path: " + path);
     path = keyBuilder.messages(participantToExpire.getInstanceName()).getPath();
-    Assert.assertEquals(childListeners.get(path).size(),
-                        1,
-                        "Should have 1 child-listener on path: " + path);
+    Assert.assertEquals(childListeners.get(path).size(), 1,
+        "Should have 1 child-listener on path: " + path);
     path = keyBuilder.controller().getPath();
-    Assert.assertEquals(childListeners.get(path).size(),
-                        1,
-                        "Should have 1 child-listener on path: " + path);
+    Assert.assertEquals(childListeners.get(path).size(), 1,
+        "Should have 1 child-listener on path: " + path);
 
     // check zookeeper#watches on client side
     Map<String, List<String>> watchPaths =
         ZkTestHelper.getZkWatch(participantToExpire.getZkClient());
     LOG.debug("localhost_12918 zk-client side watchPaths: " + watchPaths);
-    Assert.assertEquals(watchPaths.get("dataWatches").size(),
-                        4,
-                        "Should have 4 data-watches: CURRENTSTATE/{sessionId}, CURRENTSTATE/{sessionId}/TestDB, CONTROLLER, MESSAGES");
-    Assert.assertEquals(watchPaths.get("childWatches").size(),
-                        3,
-                        "Should have 3 child-watches: CONTROLLER, MESSAGES, and CURRENTSTATE/{sessionId}");
+    Assert
+        .assertEquals(
+            watchPaths.get("dataWatches").size(),
+            4,
+            "Should have 4 data-watches: CURRENTSTATE/{sessionId}, CURRENTSTATE/{sessionId}/TestDB, CONTROLLER, MESSAGES");
+    Assert.assertEquals(watchPaths.get("childWatches").size(), 3,
+        "Should have 3 child-watches: CONTROLLER, MESSAGES, and CURRENTSTATE/{sessionId}");
 
     // expire localhost_12918
     System.out.println("Expire participant: " + participantToExpire.getInstanceName()
         + ", session: " + participantToExpire.getSessionId());
     ZkTestHelper.expireSession(participantToExpire.getZkClient());
     String newSessionId = participantToExpire.getSessionId();
-    System.out.println(participantToExpire.getInstanceName() + " oldSessionId: "
-        + oldSessionId + ", newSessionId: " + newSessionId);
+    System.out.println(participantToExpire.getInstanceName() + " oldSessionId: " + oldSessionId
+        + ", newSessionId: " + newSessionId);
     result =
-        ClusterStateVerifier.verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(zkAddr,
-                                                                                                      clusterName));
+        ClusterStateVerifier
+            .verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(zkAddr,
+                clusterName));
     Assert.assertTrue(result);
 
     // check manager#hanlders
-    Assert.assertEquals(participantToExpire.getHandlers().size(),
-                        2,
-                        "Should have 2 handlers: CONTROLLER and MESSAGES. CURRENTSTATE/{sessionId} handler should be removed by CallbackHandler#handleChildChange()");
+    Assert
+        .assertEquals(
+            participantToExpire.getHandlers().size(),
+            2,
+            "Should have 2 handlers: CONTROLLER and MESSAGES. CURRENTSTATE/{sessionId} handler should be removed by CallbackHandler#handleChildChange()");
 
     // check zkclient#listeners
     dataListeners = ZkTestHelper.getZkDataListener(participantToExpire.getZkClient());
     childListeners = ZkTestHelper.getZkChildListener(participantToExpire.getZkClient());
     // printZkListeners(participantToExpire.getZkClient());
     Assert.assertTrue(dataListeners.isEmpty(), "Should have no data-listeners");
-    Assert.assertEquals(childListeners.size(),
-                        3,
-                        "Should have 3 paths (CURRENTSTATE/{oldSessionId}, CONTROLLER, and MESSAGES). "
-                            + "CONTROLLER and MESSAGE has 1 child-listener each. CURRENTSTATE/{oldSessionId} doesn't have listener (ZkClient doesn't remove empty childListener set. probably a ZkClient bug. see ZkClient#unsubscribeChildChange())");
-    path =
-        keyBuilder.currentStates(participantToExpire.getInstanceName(), oldSessionId)
-                  .getPath();
-    Assert.assertEquals(childListeners.get(path).size(),
-                        0,
-                        "Should have no child-listener on path: " + path);
+    Assert
+        .assertEquals(
+            childListeners.size(),
+            3,
+            "Should have 3 paths (CURRENTSTATE/{oldSessionId}, CONTROLLER, and MESSAGES). "
+                + "CONTROLLER and MESSAGE has 1 child-listener each. CURRENTSTATE/{oldSessionId} doesn't have listener (ZkClient doesn't remove empty childListener set. probably a ZkClient bug. see ZkClient#unsubscribeChildChange())");
+    path = keyBuilder.currentStates(participantToExpire.getInstanceName(), oldSessionId).getPath();
+    Assert.assertEquals(childListeners.get(path).size(), 0,
+        "Should have no child-listener on path: " + path);
     path = keyBuilder.messages(participantToExpire.getInstanceName()).getPath();
-    Assert.assertEquals(childListeners.get(path).size(),
-                        1,
-                        "Should have 1 child-listener on path: " + path);
+    Assert.assertEquals(childListeners.get(path).size(), 1,
+        "Should have 1 child-listener on path: " + path);
     path = keyBuilder.controller().getPath();
-    Assert.assertEquals(childListeners.get(path).size(),
-                        1,
-                        "Should have 1 child-listener on path: " + path);
+    Assert.assertEquals(childListeners.get(path).size(), 1,
+        "Should have 1 child-listener on path: " + path);
 
     // check zookeeper#watches on client side
     watchPaths = ZkTestHelper.getZkWatch(participantToExpire.getZkClient());
     LOG.debug("localhost_12918 zk-client side watchPaths: " + watchPaths);
-    Assert.assertEquals(watchPaths.get("dataWatches").size(),
-                        2,
-                        "Should have 2 data-watches: CONTROLLER and MESSAGES");
-    Assert.assertEquals(watchPaths.get("childWatches").size(),
-                        2,
-                        "Should have 2 child-watches: CONTROLLER and MESSAGES");
-    Assert.assertEquals(watchPaths.get("existWatches").size(),
-                        2,
-                        "Should have 2 exist-watches: CURRENTSTATE/{oldSessionId} and CURRENTSTATE/{oldSessionId}/TestDB0");
+    Assert.assertEquals(watchPaths.get("dataWatches").size(), 2,
+        "Should have 2 data-watches: CONTROLLER and MESSAGES");
+    Assert.assertEquals(watchPaths.get("childWatches").size(), 2,
+        "Should have 2 child-watches: CONTROLLER and MESSAGES");
+    Assert
+        .assertEquals(watchPaths.get("existWatches").size(), 2,
+            "Should have 2 exist-watches: CURRENTSTATE/{oldSessionId} and CURRENTSTATE/{oldSessionId}/TestDB0");
 
     // another session expiry on localhost_12918 should clear the two exist-watches on
     // CURRENTSTATE/{oldSessionId}
@@ -512,25 +455,25 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase
         + ", session: " + participantToExpire.getSessionId());
     ZkTestHelper.expireSession(participantToExpire.getZkClient());
     result =
-        ClusterStateVerifier.verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(zkAddr,
-                                                                                                      clusterName));
+        ClusterStateVerifier
+            .verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(zkAddr,
+                clusterName));
     Assert.assertTrue(result);
 
     // check zookeeper#watches on client side
     watchPaths = ZkTestHelper.getZkWatch(participantToExpire.getZkClient());
     LOG.debug("localhost_12918 zk-client side watchPaths: " + watchPaths);
-    Assert.assertEquals(watchPaths.get("dataWatches").size(),
-                        2,
-                        "Should have 2 data-watches: CONTROLLER and MESSAGES");
-    Assert.assertEquals(watchPaths.get("childWatches").size(),
-                        2,
-                        "Should have 2 child-watches: CONTROLLER and MESSAGES");
-    Assert.assertEquals(watchPaths.get("existWatches").size(),
-                        0,
-                        "Should have no exist-watches. exist-watches on CURRENTSTATE/{oldSessionId} and CURRENTSTATE/{oldSessionId}/TestDB0 should be cleared during handleNewSession");
+    Assert.assertEquals(watchPaths.get("dataWatches").size(), 2,
+        "Should have 2 data-watches: CONTROLLER and MESSAGES");
+    Assert.assertEquals(watchPaths.get("childWatches").size(), 2,
+        "Should have 2 child-watches: CONTROLLER and MESSAGES");
+    Assert
+        .assertEquals(
+            watchPaths.get("existWatches").size(),
+            0,
+            "Should have no exist-watches. exist-watches on CURRENTSTATE/{oldSessionId} and CURRENTSTATE/{oldSessionId}/TestDB0 should be cleared during handleNewSession");
 
     // Thread.sleep(1000);
-    System.out.println("END " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis()));
   }
 }


Mime
View raw message