You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by zz...@apache.org on 2013/08/21 22:43:34 UTC

[21/51] [partial] [HELIX-198] Unify helix code style, rb=13710

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/TestConfigAccessor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestConfigAccessor.java b/helix-core/src/test/java/org/apache/helix/TestConfigAccessor.java
index e03620a..c8514ef 100644
--- a/helix-core/src/test/java/org/apache/helix/TestConfigAccessor.java
+++ b/helix-core/src/test/java/org/apache/helix/TestConfigAccessor.java
@@ -31,20 +31,16 @@ import org.apache.helix.model.builder.ConfigScopeBuilder;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-
-public class TestConfigAccessor extends ZkUnitTestBase
-{
+public class TestConfigAccessor extends ZkUnitTestBase {
   @Test
-  public void testBasic() throws Exception
-  {
-      String className = TestHelper.getTestClassName();
-      String methodName = TestHelper.getTestMethodName();
-      String clusterName = className + "_" + methodName;
+  public void testBasic() throws Exception {
+    String className = TestHelper.getTestClassName();
+    String methodName = TestHelper.getTestMethodName();
+    String clusterName = className + "_" + methodName;
 
-      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, "localhost", "TestDB", 1, 10, 5, 3,
+    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, "localhost", "TestDB", 1, 10, 5, 3,
         "MasterSlave", true);
 
     ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient);
@@ -59,22 +55,23 @@ public class TestConfigAccessor extends ZkUnitTestBase
     Assert.assertEquals(clusterConfigValue, "clusterConfigValue");
 
     // resource scope config
-    ConfigScope resourceScope = new ConfigScopeBuilder().forCluster(clusterName)
-        .forResource("testResource").build();
+    ConfigScope resourceScope =
+        new ConfigScopeBuilder().forCluster(clusterName).forResource("testResource").build();
     configAccessor.set(resourceScope, "resourceConfigKey", "resourceConfigValue");
     String resourceConfigValue = configAccessor.get(resourceScope, "resourceConfigKey");
     Assert.assertEquals(resourceConfigValue, "resourceConfigValue");
 
     // partition scope config
-    ConfigScope partitionScope = new ConfigScopeBuilder().forCluster(clusterName)
-        .forResource("testResource").forPartition("testPartition").build();
+    ConfigScope partitionScope =
+        new ConfigScopeBuilder().forCluster(clusterName).forResource("testResource")
+            .forPartition("testPartition").build();
     configAccessor.set(partitionScope, "partitionConfigKey", "partitionConfigValue");
     String partitionConfigValue = configAccessor.get(partitionScope, "partitionConfigKey");
     Assert.assertEquals(partitionConfigValue, "partitionConfigValue");
 
     // participant scope config
-    ConfigScope participantScope = new ConfigScopeBuilder().forCluster(clusterName)
-        .forParticipant("localhost_12918").build();
+    ConfigScope participantScope =
+        new ConfigScopeBuilder().forCluster(clusterName).forParticipant("localhost_12918").build();
     configAccessor.set(participantScope, "participantConfigKey", "participantConfigValue");
     String participantConfigValue = configAccessor.get(participantScope, "participantConfigKey");
     Assert.assertEquals(participantConfigValue, "participantConfigValue");
@@ -106,10 +103,13 @@ public class TestConfigAccessor extends ZkUnitTestBase
 
     keys = configAccessor.getKeys(ConfigScopeProperty.PARTICIPANT, clusterName, "localhost_12918");
     System.out.println((keys));
-    Assert.assertEquals(keys.size(), 4, "should be [HELIX_ENABLED, HELIX_HOST, HELIX_PORT, participantConfigKey]");
+    Assert.assertEquals(keys.size(), 4,
+        "should be [HELIX_ENABLED, HELIX_HOST, HELIX_PORT, participantConfigKey]");
     Assert.assertEquals(keys.get(3), "participantConfigKey");
 
-    keys = configAccessor.getKeys(ConfigScopeProperty.PARTITION, clusterName, "testResource", "testPartition");
+    keys =
+        configAccessor.getKeys(ConfigScopeProperty.PARTITION, clusterName, "testResource",
+            "testPartition");
     Assert.assertEquals(keys.size(), 1, "should be [partitionConfigKey]");
     Assert.assertEquals(keys.get(0), "partitionConfigKey");
 
@@ -125,79 +125,71 @@ public class TestConfigAccessor extends ZkUnitTestBase
     configAccessor.remove(partitionScope, "partitionConfigKey");
     partitionConfigValue = configAccessor.get(partitionScope, "partitionConfigKey");
     Assert.assertNull(partitionConfigValue, "Should be null since it's removed");
-    
+
     configAccessor.remove(participantScope, "participantConfigKey");
     participantConfigValue = configAccessor.get(partitionScope, "participantConfigKey");
     Assert.assertNull(participantConfigValue, "Should be null since it's removed");
-    
+
     // negative tests
-    try
-    {
+    try {
       new ConfigScopeBuilder().forPartition("testPartition").build();
       Assert.fail("Should fail since cluster name is not set");
-    } catch (Exception e)
-    {
+    } catch (Exception e) {
       // OK
     }
 
-    try
-    {
+    try {
       new ConfigScopeBuilder().forCluster("testCluster").forPartition("testPartition").build();
       Assert.fail("Should fail since resource name is not set");
-    } catch (Exception e)
-    {
+    } catch (Exception e) {
       // OK
     }
 
-    try
-    {
+    try {
       new ConfigScopeBuilder().forParticipant("testParticipant").build();
       Assert.fail("Should fail since cluster name is not set");
-    } catch (Exception e)
-    {
+    } catch (Exception e) {
       // OK
     }
 
-      System.out.println("END " + clusterName + " at "
-              + new Date(System.currentTimeMillis()));
+    System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
   }
 
-    // HELIX-25: set participant Config should check existence of instance
-    @Test
-    public void testSetNonexistentParticipantConfig() throws Exception
-    {
-        String className = TestHelper.getTestClassName();
-        String methodName = TestHelper.getTestMethodName();
-        String clusterName = className + "_" + methodName;
-
-        System.out.println("START " + clusterName + " at "
-                + new Date(System.currentTimeMillis()));
-
-        ZKHelixAdmin admin = new ZKHelixAdmin(_gZkClient);
-        admin.addCluster(clusterName, true);
-        ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient);
-        ConfigScope participantScope = new ConfigScopeBuilder().forCluster(clusterName)
-                .forParticipant("localhost_12918").build();
-
-        try {
-            configAccessor.set(participantScope, "participantConfigKey", "participantConfigValue");
-            Assert.fail("Except fail to set participant-config because participant: localhost_12918 is not added to cluster yet");
-        } catch (HelixException e) {
-            // OK
-        }
-        admin.addInstance(clusterName, new InstanceConfig("localhost_12918"));
-
-        try {
-            configAccessor.set(participantScope, "participantConfigKey", "participantConfigValue");
-        } catch (Exception e) {
-            Assert.fail("Except succeed to set participant-config because participant: localhost_12918 has been added to cluster");
-        }
-
-        String participantConfigValue = configAccessor.get(participantScope, "participantConfigKey");
-        Assert.assertEquals(participantConfigValue, "participantConfigValue");
-
-        System.out.println("END " + clusterName + " at "
-                + new Date(System.currentTimeMillis()));
+  // HELIX-25: set participant Config should check existence of instance
+  @Test
+  public void testSetNonexistentParticipantConfig() throws Exception {
+    String className = TestHelper.getTestClassName();
+    String methodName = TestHelper.getTestMethodName();
+    String clusterName = className + "_" + methodName;
+
+    System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
+
+    ZKHelixAdmin admin = new ZKHelixAdmin(_gZkClient);
+    admin.addCluster(clusterName, true);
+    ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient);
+    ConfigScope participantScope =
+        new ConfigScopeBuilder().forCluster(clusterName).forParticipant("localhost_12918").build();
+
+    try {
+      configAccessor.set(participantScope, "participantConfigKey", "participantConfigValue");
+      Assert
+          .fail("Except fail to set participant-config because participant: localhost_12918 is not added to cluster yet");
+    } catch (HelixException e) {
+      // OK
     }
+    admin.addInstance(clusterName, new InstanceConfig("localhost_12918"));
+
+    try {
+      configAccessor.set(participantScope, "participantConfigKey", "participantConfigValue");
+    } catch (Exception e) {
+      Assert
+          .fail("Except succeed to set participant-config because participant: localhost_12918 has been added to cluster");
+    }
+
+    String participantConfigValue = configAccessor.get(participantScope, "participantConfigKey");
+    Assert.assertEquals(participantConfigValue, "participantConfigValue");
+
+    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/TestEspressoStorageClusterIdealState.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestEspressoStorageClusterIdealState.java b/helix-core/src/test/java/org/apache/helix/TestEspressoStorageClusterIdealState.java
index 6634175..9b249ec 100644
--- a/helix-core/src/test/java/org/apache/helix/TestEspressoStorageClusterIdealState.java
+++ b/helix-core/src/test/java/org/apache/helix/TestEspressoStorageClusterIdealState.java
@@ -36,54 +36,49 @@ import org.testng.Assert;
 import org.testng.AssertJUnit;
 import org.testng.annotations.Test;
 
-
-
-public class TestEspressoStorageClusterIdealState
-{
-  @Test ()
-  public void testEspressoStorageClusterIdealState() throws Exception
-  {
+public class TestEspressoStorageClusterIdealState {
+  @Test()
+  public void testEspressoStorageClusterIdealState() throws Exception {
     List<String> instanceNames = new ArrayList<String>();
-    for(int i = 0;i < 5; i++)
-    {
+    for (int i = 0; i < 5; i++) {
       instanceNames.add("localhost:123" + i);
     }
     int partitions = 8, replicas = 0;
-    Map<String, Object> result0 = DefaultIdealStateCalculator.calculateInitialIdealState(instanceNames, partitions, replicas);
-    Verify(result0, partitions,replicas);
+    Map<String, Object> result0 =
+        DefaultIdealStateCalculator.calculateInitialIdealState(instanceNames, partitions, replicas);
+    Verify(result0, partitions, replicas);
 
     partitions = 8192;
     replicas = 3;
 
     instanceNames.clear();
-    for(int i = 0;i < 20; i++)
-    {
+    for (int i = 0; i < 20; i++) {
       instanceNames.add("localhost:123" + i);
     }
-    Map<String, Object> resultOriginal = DefaultIdealStateCalculator.calculateInitialIdealState(instanceNames, partitions, replicas);
+    Map<String, Object> resultOriginal =
+        DefaultIdealStateCalculator.calculateInitialIdealState(instanceNames, partitions, replicas);
 
-    Verify(resultOriginal, partitions,replicas);
+    Verify(resultOriginal, partitions, replicas);
     printStat(resultOriginal);
 
-    Map<String, Object> result1 = DefaultIdealStateCalculator.calculateInitialIdealState(instanceNames, partitions, replicas);
+    Map<String, Object> result1 =
+        DefaultIdealStateCalculator.calculateInitialIdealState(instanceNames, partitions, replicas);
 
     List<String> instanceNames2 = new ArrayList<String>();
-    for(int i = 30;i < 35; i++)
-    {
+    for (int i = 30; i < 35; i++) {
       instanceNames2.add("localhost:123" + i);
     }
 
     DefaultIdealStateCalculator.calculateNextIdealState(instanceNames2, result1);
 
     List<String> instanceNames3 = new ArrayList<String>();
-    for(int i = 35;i < 40; i++)
-    {
+    for (int i = 35; i < 40; i++) {
       instanceNames3.add("localhost:123" + i);
     }
 
     DefaultIdealStateCalculator.calculateNextIdealState(instanceNames3, result1);
     Double masterKeepRatio = 0.0, slaveKeepRatio = 0.0;
-    Verify(result1, partitions,replicas);
+    Verify(result1, partitions, replicas);
     double[] result = compareResult(resultOriginal, result1);
     masterKeepRatio = result[0];
     slaveKeepRatio = result[1];
@@ -91,34 +86,35 @@ public class TestEspressoStorageClusterIdealState
     Assert.assertTrue(0.66 < slaveKeepRatio && 0.67 > slaveKeepRatio);
 
   }
-  
+
   @Test
-  public void testRebalance2()
-  {
+  public void testRebalance2() {
     int partitions = 1256, replicas = 3;
     List<String> instanceNames = new ArrayList<String>();
-    
-    for(int i = 0;i < 10; i++)
-    {
+
+    for (int i = 0; i < 10; i++) {
       instanceNames.add("localhost:123" + i);
     }
-    
-    Map<String, Object> resultOriginal = DefaultIdealStateCalculator.calculateInitialIdealState(instanceNames, partitions, replicas);
-    
-    ZNRecord idealState1 = DefaultIdealStateCalculator.convertToZNRecord(resultOriginal, "TestDB", "MASTER", "SLAVE");
-    
-    Map<String, Object> result1 = RebalanceUtil.buildInternalIdealState(new IdealState(idealState1));
-    
+
+    Map<String, Object> resultOriginal =
+        DefaultIdealStateCalculator.calculateInitialIdealState(instanceNames, partitions, replicas);
+
+    ZNRecord idealState1 =
+        DefaultIdealStateCalculator.convertToZNRecord(resultOriginal, "TestDB", "MASTER", "SLAVE");
+
+    Map<String, Object> result1 =
+        RebalanceUtil.buildInternalIdealState(new IdealState(idealState1));
+
     List<String> instanceNames2 = new ArrayList<String>();
-    for(int i = 30;i < 35; i++)
-    {
+    for (int i = 30; i < 35; i++) {
       instanceNames2.add("localhost:123" + i);
     }
-    
-    Map<String, Object> result2 = DefaultIdealStateCalculator.calculateNextIdealState(instanceNames2, result1);
-    
-    Verify(resultOriginal, partitions,replicas);
-    Verify(result2, partitions,replicas);
+
+    Map<String, Object> result2 =
+        DefaultIdealStateCalculator.calculateNextIdealState(instanceNames2, result1);
+
+    Verify(resultOriginal, partitions, replicas);
+    Verify(result2, partitions, replicas);
     Double masterKeepRatio = 0.0, slaveKeepRatio = 0.0;
     double[] result = compareResult(resultOriginal, result2);
     masterKeepRatio = result[0];
@@ -127,91 +123,80 @@ public class TestEspressoStorageClusterIdealState
     Assert.assertTrue(0.66 < slaveKeepRatio && 0.67 > slaveKeepRatio);
   }
 
-  public static void Verify(Map<String, Object> result, int partitions, int replicas)
-  {
-    Map<String, List<Integer>> masterAssignmentMap = (Map<String, List<Integer>>) (result.get("MasterAssignmentMap"));
-    Map<String, Map<String, List<Integer>>> nodeSlaveAssignmentMap = (Map<String, Map<String, List<Integer>>>)(result.get("SlaveAssignmentMap"));
+  public static void Verify(Map<String, Object> result, int partitions, int replicas) {
+    Map<String, List<Integer>> masterAssignmentMap =
+        (Map<String, List<Integer>>) (result.get("MasterAssignmentMap"));
+    Map<String, Map<String, List<Integer>>> nodeSlaveAssignmentMap =
+        (Map<String, Map<String, List<Integer>>>) (result.get("SlaveAssignmentMap"));
 
-    AssertJUnit.assertTrue( partitions == (Integer)(result.get("partitions")));
+    AssertJUnit.assertTrue(partitions == (Integer) (result.get("partitions")));
 
     // Verify master partitions covers all master partitions on each node
     Map<Integer, Integer> masterCounterMap = new TreeMap<Integer, Integer>();
-    for(int i = 0;i<partitions; i++)
-    {
+    for (int i = 0; i < partitions; i++) {
       masterCounterMap.put(i, 0);
     }
 
     int minMasters = Integer.MAX_VALUE, maxMasters = Integer.MIN_VALUE;
-    for(String instanceName : masterAssignmentMap.keySet())
-    {
+    for (String instanceName : masterAssignmentMap.keySet()) {
       List<Integer> masterList = masterAssignmentMap.get(instanceName);
       // the assert needs to be changed when weighting is introduced
-      // AssertJUnit.assertTrue(masterList.size() == partitions /masterAssignmentMap.size() | masterList.size() == (partitions /masterAssignmentMap.size()+1) );
+      // AssertJUnit.assertTrue(masterList.size() == partitions /masterAssignmentMap.size() |
+      // masterList.size() == (partitions /masterAssignmentMap.size()+1) );
 
-      for(Integer x : masterList)
-      {
+      for (Integer x : masterList) {
         AssertJUnit.assertTrue(masterCounterMap.get(x) == 0);
-        masterCounterMap.put(x,1);
+        masterCounterMap.put(x, 1);
       }
-      if(minMasters > masterList.size())
-      {
+      if (minMasters > masterList.size()) {
         minMasters = masterList.size();
       }
-      if(maxMasters < masterList.size())
-      {
+      if (maxMasters < masterList.size()) {
         maxMasters = masterList.size();
       }
     }
     // Master partition should be evenly distributed most of the time
-    System.out.println("Masters: max: "+maxMasters+" Min:"+ minMasters);
+    System.out.println("Masters: max: " + maxMasters + " Min:" + minMasters);
     // Each master partition should occur only once
-    for(int i = 0;i < partitions; i++)
-    {
+    for (int i = 0; i < partitions; i++) {
       AssertJUnit.assertTrue(masterCounterMap.get(i) == 1);
     }
     AssertJUnit.assertTrue(masterCounterMap.size() == partitions);
 
     // for each node, verify the master partitions and the slave partition assignment map
-    if(replicas == 0)
-    {
+    if (replicas == 0) {
       AssertJUnit.assertTrue(nodeSlaveAssignmentMap.size() == 0);
       return;
     }
 
     AssertJUnit.assertTrue(masterAssignmentMap.size() == nodeSlaveAssignmentMap.size());
-    for(String instanceName: masterAssignmentMap.keySet())
-    {
+    for (String instanceName : masterAssignmentMap.keySet()) {
       AssertJUnit.assertTrue(nodeSlaveAssignmentMap.containsKey(instanceName));
 
       Map<String, List<Integer>> slaveAssignmentMap = nodeSlaveAssignmentMap.get(instanceName);
       Map<Integer, Integer> slaveCountMap = new TreeMap<Integer, Integer>();
       List<Integer> masterList = masterAssignmentMap.get(instanceName);
 
-      for(Integer masterPartitionId : masterList)
-      {
+      for (Integer masterPartitionId : masterList) {
         slaveCountMap.put(masterPartitionId, 0);
       }
       // Make sure that masterList are covered replica times by the slave assignment.
       int minSlaves = Integer.MAX_VALUE, maxSlaves = Integer.MIN_VALUE;
-      for(String hostInstance : slaveAssignmentMap.keySet())
-      {
+      for (String hostInstance : slaveAssignmentMap.keySet()) {
         List<Integer> slaveAssignment = slaveAssignmentMap.get(hostInstance);
         Set<Integer> occurenceSet = new HashSet<Integer>();
 
         // Each slave should occur only once in the list, since the list is per-node slaves
-        for(Integer slavePartition : slaveAssignment)
-        {
+        for (Integer slavePartition : slaveAssignment) {
           AssertJUnit.assertTrue(!occurenceSet.contains(slavePartition));
           occurenceSet.add(slavePartition);
 
           slaveCountMap.put(slavePartition, slaveCountMap.get(slavePartition) + 1);
         }
-        if(minSlaves > slaveAssignment.size())
-        {
+        if (minSlaves > slaveAssignment.size()) {
           minSlaves = slaveAssignment.size();
         }
-        if(maxSlaves < slaveAssignment.size())
-        {
+        if (maxSlaves < slaveAssignment.size()) {
           maxSlaves = slaveAssignment.size();
         }
       }
@@ -222,78 +207,71 @@ public class TestEspressoStorageClusterIdealState
       // for each node, the slave assignment map should cover the masters for exactly replica
       // times
       AssertJUnit.assertTrue(slaveCountMap.size() == masterList.size());
-      for(Integer masterPartitionId : masterList)
-      {
+      for (Integer masterPartitionId : masterList) {
         AssertJUnit.assertTrue(slaveCountMap.get(masterPartitionId) == replicas);
       }
     }
 
   }
 
-  public void printStat(Map<String, Object> result)
-  {
+  public void printStat(Map<String, Object> result) {
     // print out master distribution
 
     // print out slave distribution
 
   }
 
-  public static double [] compareResult(Map<String, Object> result1, Map<String, Object> result2)
-  {
-    double [] result = new double[2];
-    Map<String, List<Integer>> masterAssignmentMap1 = (Map<String, List<Integer>>) (result1.get("MasterAssignmentMap"));
-    Map<String, Map<String, List<Integer>>> nodeSlaveAssignmentMap1 = (Map<String, Map<String, List<Integer>>>)(result1.get("SlaveAssignmentMap"));
+  public static double[] compareResult(Map<String, Object> result1, Map<String, Object> result2) {
+    double[] result = new double[2];
+    Map<String, List<Integer>> masterAssignmentMap1 =
+        (Map<String, List<Integer>>) (result1.get("MasterAssignmentMap"));
+    Map<String, Map<String, List<Integer>>> nodeSlaveAssignmentMap1 =
+        (Map<String, Map<String, List<Integer>>>) (result1.get("SlaveAssignmentMap"));
 
-    Map<String, List<Integer>> masterAssignmentMap2 = (Map<String, List<Integer>>) (result2.get("MasterAssignmentMap"));
-    Map<String, Map<String, List<Integer>>> nodeSlaveAssignmentMap2 = (Map<String, Map<String, List<Integer>>>)(result2.get("SlaveAssignmentMap"));
+    Map<String, List<Integer>> masterAssignmentMap2 =
+        (Map<String, List<Integer>>) (result2.get("MasterAssignmentMap"));
+    Map<String, Map<String, List<Integer>>> nodeSlaveAssignmentMap2 =
+        (Map<String, Map<String, List<Integer>>>) (result2.get("SlaveAssignmentMap"));
 
     int commonMasters = 0;
     int commonSlaves = 0;
-    int partitions = (Integer)(result1.get("partitions"));
-    int replicas = (Integer)(result1.get("replicas"));
+    int partitions = (Integer) (result1.get("partitions"));
+    int replicas = (Integer) (result1.get("replicas"));
 
-    AssertJUnit.assertTrue((Integer)(result2.get("partitions")) == partitions);
-    AssertJUnit.assertTrue((Integer)(result2.get("replicas")) == replicas);
+    AssertJUnit.assertTrue((Integer) (result2.get("partitions")) == partitions);
+    AssertJUnit.assertTrue((Integer) (result2.get("replicas")) == replicas);
 
     // masterMap1 maps from partition id to the holder instance name
     Map<Integer, String> masterMap1 = new TreeMap<Integer, String>();
-    for(String instanceName : masterAssignmentMap1.keySet())
-    {
+    for (String instanceName : masterAssignmentMap1.keySet()) {
       List<Integer> masterList1 = masterAssignmentMap1.get(instanceName);
-      for(Integer partition : masterList1)
-      {
+      for (Integer partition : masterList1) {
         AssertJUnit.assertTrue(!masterMap1.containsKey(partition));
         masterMap1.put(partition, instanceName);
       }
     }
     // go through masterAssignmentMap2 and find out the common number
-    for(String instanceName : masterAssignmentMap2.keySet())
-    {
+    for (String instanceName : masterAssignmentMap2.keySet()) {
       List<Integer> masterList2 = masterAssignmentMap2.get(instanceName);
-      for(Integer partition : masterList2)
-      {
-        if(masterMap1.get(partition).equalsIgnoreCase(instanceName))
-        {
-          commonMasters ++;
+      for (Integer partition : masterList2) {
+        if (masterMap1.get(partition).equalsIgnoreCase(instanceName)) {
+          commonMasters++;
         }
       }
     }
-    
-    result[0] = 1.0*commonMasters/partitions;
-    System.out.println(commonMasters + " master partitions are kept, "+ (partitions - commonMasters) + " moved, keep ratio:" + 1.0*commonMasters/partitions);
-    
+
+    result[0] = 1.0 * commonMasters / partitions;
+    System.out.println(commonMasters + " master partitions are kept, "
+        + (partitions - commonMasters) + " moved, keep ratio:" + 1.0 * commonMasters / partitions);
+
     // maps from the partition id to the instance names that holds its slave partition
     Map<Integer, Set<String>> slaveMap1 = new TreeMap<Integer, Set<String>>();
-    for(String instanceName : nodeSlaveAssignmentMap1.keySet())
-    {
+    for (String instanceName : nodeSlaveAssignmentMap1.keySet()) {
       Map<String, List<Integer>> slaveAssignment1 = nodeSlaveAssignmentMap1.get(instanceName);
-      for(String slaveHostName : slaveAssignment1.keySet())
-      {
+      for (String slaveHostName : slaveAssignment1.keySet()) {
         List<Integer> slaveList = slaveAssignment1.get(slaveHostName);
-        for(Integer partition : slaveList)
-        {
-          if(!slaveMap1.containsKey(partition))
-          {
+        for (Integer partition : slaveList) {
+          if (!slaveMap1.containsKey(partition)) {
             slaveMap1.put(partition, new TreeSet<String>());
           }
           AssertJUnit.assertTrue(!slaveMap1.get(partition).contains(slaveHostName));
@@ -302,23 +280,21 @@ public class TestEspressoStorageClusterIdealState
       }
     }
 
-    for(String instanceName : nodeSlaveAssignmentMap2.keySet())
-    {
+    for (String instanceName : nodeSlaveAssignmentMap2.keySet()) {
       Map<String, List<Integer>> slaveAssignment2 = nodeSlaveAssignmentMap2.get(instanceName);
-      for(String slaveHostName : slaveAssignment2.keySet())
-      {
+      for (String slaveHostName : slaveAssignment2.keySet()) {
         List<Integer> slaveList = slaveAssignment2.get(slaveHostName);
-        for(Integer partition : slaveList)
-        {
-          if(slaveMap1.get(partition).contains(slaveHostName))
-          {
+        for (Integer partition : slaveList) {
+          if (slaveMap1.get(partition).contains(slaveHostName)) {
             commonSlaves++;
           }
         }
       }
     }
-    result[1] = 1.0*commonSlaves/partitions/replicas;
-    System.out.println(commonSlaves + " slave partitions are kept, " + (partitions * replicas - commonSlaves)+ " moved. keep ratio:"+1.0*commonSlaves/partitions/replicas);
+    result[1] = 1.0 * commonSlaves / partitions / replicas;
+    System.out.println(commonSlaves + " slave partitions are kept, "
+        + (partitions * replicas - commonSlaves) + " moved. keep ratio:" + 1.0 * commonSlaves
+        / partitions / replicas);
     return result;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/TestGetProperty.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestGetProperty.java b/helix-core/src/test/java/org/apache/helix/TestGetProperty.java
index c1fe91e..0418407 100644
--- a/helix-core/src/test/java/org/apache/helix/TestGetProperty.java
+++ b/helix-core/src/test/java/org/apache/helix/TestGetProperty.java
@@ -26,25 +26,21 @@ import java.util.Properties;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-public class TestGetProperty
-{
+public class TestGetProperty {
   @Test
-  public void testGetProperty()
-  {
+  public void testGetProperty() {
     String version;
     Properties props = new Properties();
 
-    try
-    {
-      InputStream stream = Thread.currentThread().getContextClassLoader()
-          .getResourceAsStream("cluster-manager-version.properties");
+    try {
+      InputStream stream =
+          Thread.currentThread().getContextClassLoader()
+              .getResourceAsStream("cluster-manager-version.properties");
       props.load(stream);
       version = props.getProperty("clustermanager.version");
       Assert.assertNotNull(version);
       System.out.println("cluster-manager-version:" + version);
-    }
-    catch (IOException e)
-    {
+    } catch (IOException e) {
       // e.printStackTrace();
       Assert.fail("could not open cluster-manager-version.properties. ", e);
     }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/TestGroupCommit.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestGroupCommit.java b/helix-core/src/test/java/org/apache/helix/TestGroupCommit.java
index a62fa3a..9e8f943 100644
--- a/helix-core/src/test/java/org/apache/helix/TestGroupCommit.java
+++ b/helix-core/src/test/java/org/apache/helix/TestGroupCommit.java
@@ -26,17 +26,13 @@ import org.apache.helix.BaseDataAccessor;
 import org.apache.helix.GroupCommit;
 import org.apache.helix.ZNRecord;
 
-
-public class TestGroupCommit
-{
+public class TestGroupCommit {
   // @Test
-  public void testGroupCommit() throws InterruptedException
-  {
+  public void testGroupCommit() throws InterruptedException {
     final BaseDataAccessor<ZNRecord> accessor = new Mocks.MockBaseDataAccessor();
     final GroupCommit commit = new GroupCommit();
     ExecutorService newFixedThreadPool = Executors.newFixedThreadPool(400);
-    for (int i = 0; i < 2400; i++)
-    {
+    for (int i = 0; i < 2400; i++) {
       Runnable runnable = new MyClass(accessor, commit, i);
       newFixedThreadPool.submit(runnable);
     }
@@ -47,22 +43,19 @@ public class TestGroupCommit
 
 }
 
-class MyClass implements Runnable
-{
+class MyClass implements Runnable {
   private final BaseDataAccessor<ZNRecord> store;
-  private final GroupCommit                commit;
-  private final int                        i;
+  private final GroupCommit commit;
+  private final int i;
 
-  public MyClass(BaseDataAccessor<ZNRecord> store, GroupCommit commit, int i)
-  {
+  public MyClass(BaseDataAccessor<ZNRecord> store, GroupCommit commit, int i) {
     this.store = store;
     this.commit = commit;
     this.i = i;
   }
 
   @Override
-  public void run()
-  {
+  public void run() {
     // System.out.println("START " + System.currentTimeMillis() + " --"
     // + Thread.currentThread().getId());
     ZNRecord znRecord = new ZNRecord("test");

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/TestHelixConfigAccessor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestHelixConfigAccessor.java b/helix-core/src/test/java/org/apache/helix/TestHelixConfigAccessor.java
index 3bbc4d3..337bcfe 100644
--- a/helix-core/src/test/java/org/apache/helix/TestHelixConfigAccessor.java
+++ b/helix-core/src/test/java/org/apache/helix/TestHelixConfigAccessor.java
@@ -31,7 +31,7 @@ import org.testng.Assert;
 import org.testng.annotations.Test;
 
 public class TestHelixConfigAccessor extends ZkUnitTestBase {
-  
+
   @Test
   public void testBasic() throws Exception {
     String className = TestHelper.getTestClassName();
@@ -40,22 +40,12 @@ public class TestHelixConfigAccessor extends ZkUnitTestBase {
 
     System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
 
-    TestHelper.setupCluster(clusterName, 
-                            ZK_ADDR, 
-                            12918, 
-                            "localhost", 
-                            "TestDB", 
-                            1, 
-                            10, 
-                            5, 
-                            3,
-                            "MasterSlave", 
-                            true);
+    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, "localhost", "TestDB", 1, 10, 5, 3,
+        "MasterSlave", true);
 
     ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient);
-    HelixConfigScope clusterScope = new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER)
-                                            .forCluster(clusterName)
-                                            .build();
+    HelixConfigScope clusterScope =
+        new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER).forCluster(clusterName).build();
 
     // cluster scope config
     String clusterConfigValue = configAccessor.get(clusterScope, "clusterConfigKey");
@@ -66,85 +56,78 @@ public class TestHelixConfigAccessor extends ZkUnitTestBase {
     Assert.assertEquals(clusterConfigValue, "clusterConfigValue");
 
     // resource scope config
-    HelixConfigScope resourceScope = new HelixConfigScopeBuilder(ConfigScopeProperty.RESOURCE)
-                                      .forCluster(clusterName)
-                                      .forResource("testResource")
-                                      .build();
+    HelixConfigScope resourceScope =
+        new HelixConfigScopeBuilder(ConfigScopeProperty.RESOURCE).forCluster(clusterName)
+            .forResource("testResource").build();
     configAccessor.set(resourceScope, "resourceConfigKey", "resourceConfigValue");
     String resourceConfigValue = configAccessor.get(resourceScope, "resourceConfigKey");
     Assert.assertEquals(resourceConfigValue, "resourceConfigValue");
 
     // partition scope config
-    HelixConfigScope partitionScope = new HelixConfigScopeBuilder(ConfigScopeProperty.PARTITION)
-                                        .forCluster(clusterName)
-                                        .forResource("testResource")
-                                        .forPartition("testPartition")
-                                        .build();
+    HelixConfigScope partitionScope =
+        new HelixConfigScopeBuilder(ConfigScopeProperty.PARTITION).forCluster(clusterName)
+            .forResource("testResource").forPartition("testPartition").build();
     configAccessor.set(partitionScope, "partitionConfigKey", "partitionConfigValue");
     String partitionConfigValue = configAccessor.get(partitionScope, "partitionConfigKey");
     Assert.assertEquals(partitionConfigValue, "partitionConfigValue");
 
     // participant scope config
-    HelixConfigScope participantScope = new HelixConfigScopeBuilder(ConfigScopeProperty.PARTICIPANT)
-                                          .forCluster(clusterName)
-                                          .forParticipant("localhost_12918")
-                                          .build();
+    HelixConfigScope participantScope =
+        new HelixConfigScopeBuilder(ConfigScopeProperty.PARTICIPANT).forCluster(clusterName)
+            .forParticipant("localhost_12918").build();
     configAccessor.set(participantScope, "participantConfigKey", "participantConfigValue");
     String participantConfigValue = configAccessor.get(participantScope, "participantConfigKey");
     Assert.assertEquals(participantConfigValue, "participantConfigValue");
 
     // test get-keys
-    List<String> keys = configAccessor.getKeys(new HelixConfigScopeBuilder(ConfigScopeProperty.RESOURCE)
-                                                  .forCluster(clusterName)
-                                                  .build());
+    List<String> keys =
+        configAccessor.getKeys(new HelixConfigScopeBuilder(ConfigScopeProperty.RESOURCE)
+            .forCluster(clusterName).build());
     Assert.assertEquals(keys.size(), 1, "should be [testResource]");
     Assert.assertEquals(keys.get(0), "testResource");
 
-//    keys = configAccessor.getKeys(new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER)
-//                                                  .forCluster(clusterName)
-//                                                  .build());
-//    Assert.assertEquals(keys.size(), 1, "should be [" + clusterName + "]");
-//    Assert.assertEquals(keys.get(0), clusterName);
+    // keys = configAccessor.getKeys(new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER)
+    // .forCluster(clusterName)
+    // .build());
+    // Assert.assertEquals(keys.size(), 1, "should be [" + clusterName + "]");
+    // Assert.assertEquals(keys.get(0), clusterName);
 
-    keys = configAccessor.getKeys(new HelixConfigScopeBuilder(ConfigScopeProperty.PARTICIPANT)
-                                    .forCluster(clusterName)
-                                    .build());
+    keys =
+        configAccessor.getKeys(new HelixConfigScopeBuilder(ConfigScopeProperty.PARTICIPANT)
+            .forCluster(clusterName).build());
     Assert.assertEquals(keys.size(), 5, "should be [localhost_12918~22] sorted");
     Assert.assertTrue(keys.contains("localhost_12918"));
     Assert.assertTrue(keys.contains("localhost_12922"));
 
-    keys = configAccessor.getKeys(new HelixConfigScopeBuilder(ConfigScopeProperty.PARTITION)
-                                      .forCluster(clusterName)
-                                      .forResource("testResource")
-                                      .build());
+    keys =
+        configAccessor.getKeys(new HelixConfigScopeBuilder(ConfigScopeProperty.PARTITION)
+            .forCluster(clusterName).forResource("testResource").build());
     Assert.assertEquals(keys.size(), 1, "should be [testPartition]");
     Assert.assertEquals(keys.get(0), "testPartition");
 
-    keys = configAccessor.getKeys(new HelixConfigScopeBuilder(ConfigScopeProperty.RESOURCE)
-                                      .forCluster(clusterName)
-                                      .forResource("testResource")
-                                      .build());
+    keys =
+        configAccessor.getKeys(new HelixConfigScopeBuilder(ConfigScopeProperty.RESOURCE)
+            .forCluster(clusterName).forResource("testResource").build());
     Assert.assertEquals(keys.size(), 1, "should be [resourceConfigKey]");
     Assert.assertTrue(keys.contains("resourceConfigKey"));
 
-    keys = configAccessor.getKeys(new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER)
-                                      .forCluster(clusterName)
-                                      .build());
+    keys =
+        configAccessor.getKeys(new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER).forCluster(
+            clusterName).build());
     Assert.assertEquals(keys.size(), 1, "should be [clusterConfigKey]");
     Assert.assertTrue(keys.contains("clusterConfigKey"));
 
-    keys = configAccessor.getKeys(new HelixConfigScopeBuilder(ConfigScopeProperty.PARTICIPANT)
-                                      .forCluster(clusterName)
-                                      .forParticipant("localhost_12918")
-                                      .build());
-    Assert.assertEquals(keys.size(), 4, "should be [HELIX_ENABLED, HELIX_PORT, HELIX_HOST, participantConfigKey]");
+    keys =
+        configAccessor.getKeys(new HelixConfigScopeBuilder(ConfigScopeProperty.PARTICIPANT)
+            .forCluster(clusterName).forParticipant("localhost_12918").build());
+    Assert.assertEquals(keys.size(), 4,
+        "should be [HELIX_ENABLED, HELIX_PORT, HELIX_HOST, participantConfigKey]");
     Assert.assertTrue(keys.contains("participantConfigKey"));
 
-    keys = configAccessor.getKeys(new HelixConfigScopeBuilder(ConfigScopeProperty.PARTITION)
-                                      .forCluster(clusterName)
-                                      .forResource("testResource")
-                                      .forPartition("testPartition")
-                                      .build());
+    keys =
+        configAccessor.getKeys(new HelixConfigScopeBuilder(ConfigScopeProperty.PARTITION)
+            .forCluster(clusterName).forResource("testResource").forPartition("testPartition")
+            .build());
     Assert.assertEquals(keys.size(), 1, "should be [partitionConfigKey]");
     Assert.assertEquals(keys.get(0), "partitionConfigKey");
 
@@ -160,43 +143,33 @@ public class TestHelixConfigAccessor extends ZkUnitTestBase {
     configAccessor.remove(partitionScope, "partitionConfigKey");
     partitionConfigValue = configAccessor.get(partitionScope, "partitionConfigKey");
     Assert.assertNull(partitionConfigValue, "Should be null since it's removed");
-    
+
     configAccessor.remove(participantScope, "participantConfigKey");
     participantConfigValue = configAccessor.get(partitionScope, "participantConfigKey");
     Assert.assertNull(participantConfigValue, "Should be null since it's removed");
-    
+
     // negative tests
-    try
-    {
-      new HelixConfigScopeBuilder(ConfigScopeProperty.PARTITION)
-        .forPartition("testPartition")
-        .build();
+    try {
+      new HelixConfigScopeBuilder(ConfigScopeProperty.PARTITION).forPartition("testPartition")
+          .build();
       Assert.fail("Should fail since cluster name is not set");
-    } catch (Exception e)
-    {
+    } catch (Exception e) {
       // OK
     }
-    
-    try
-    {
+
+    try {
       new HelixConfigScopeBuilder(ConfigScopeProperty.PARTICIPANT)
-        .forParticipant("testParticipant")
-        .build();
+          .forParticipant("testParticipant").build();
       Assert.fail("Should fail since cluster name is not set");
-    } catch (Exception e)
-    {
+    } catch (Exception e) {
       // OK
     }
-    
-    try
-    {
-      new HelixConfigScopeBuilder(ConfigScopeProperty.PARTITION)
-              .forCluster("testCluster")
-              .forPartition("testPartition")
-              .build();
+
+    try {
+      new HelixConfigScopeBuilder(ConfigScopeProperty.PARTITION).forCluster("testCluster")
+          .forPartition("testPartition").build();
       Assert.fail("Should fail since resource name is not set");
-    } catch (Exception e)
-    {
+    } catch (Exception e) {
       // OK
       // e.printStackTrace();
     }
@@ -205,41 +178,39 @@ public class TestHelixConfigAccessor extends ZkUnitTestBase {
 
   // HELIX-25: set participant Config should check existence of instance
   @Test
-  public void testSetNonexistentParticipantConfig() throws Exception
-  {
-      String className = TestHelper.getTestClassName();
-      String methodName = TestHelper.getTestMethodName();
-      String clusterName = className + "_" + methodName;
-
-      System.out.println("START " + clusterName + " at "
-              + new Date(System.currentTimeMillis()));
-
-      ZKHelixAdmin admin = new ZKHelixAdmin(_gZkClient);
-      admin.addCluster(clusterName, true);
-      ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient);
-      HelixConfigScope participantScope = new HelixConfigScopeBuilder(ConfigScopeProperty.PARTICIPANT)
-                                              .forCluster(clusterName)
-                                              .forParticipant("localhost_12918")
-                                              .build();
-
-      try {
-          configAccessor.set(participantScope, "participantConfigKey", "participantConfigValue");
-          Assert.fail("Except fail to set participant-config because participant: localhost_12918 is not added to cluster yet");
-      } catch (HelixException e) {
-          // OK
-      }
-      admin.addInstance(clusterName, new InstanceConfig("localhost_12918"));
-
-      try {
-          configAccessor.set(participantScope, "participantConfigKey", "participantConfigValue");
-      } catch (Exception e) {
-          Assert.fail("Except succeed to set participant-config because participant: localhost_12918 has been added to cluster");
-      }
-
-      String participantConfigValue = configAccessor.get(participantScope, "participantConfigKey");
-      Assert.assertEquals(participantConfigValue, "participantConfigValue");
-
-      System.out.println("END " + clusterName + " at "
-              + new Date(System.currentTimeMillis()));
+  public void testSetNonexistentParticipantConfig() throws Exception {
+    String className = TestHelper.getTestClassName();
+    String methodName = TestHelper.getTestMethodName();
+    String clusterName = className + "_" + methodName;
+
+    System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
+
+    ZKHelixAdmin admin = new ZKHelixAdmin(_gZkClient);
+    admin.addCluster(clusterName, true);
+    ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient);
+    HelixConfigScope participantScope =
+        new HelixConfigScopeBuilder(ConfigScopeProperty.PARTICIPANT).forCluster(clusterName)
+            .forParticipant("localhost_12918").build();
+
+    try {
+      configAccessor.set(participantScope, "participantConfigKey", "participantConfigValue");
+      Assert
+          .fail("Except fail to set participant-config because participant: localhost_12918 is not added to cluster yet");
+    } catch (HelixException e) {
+      // OK
+    }
+    admin.addInstance(clusterName, new InstanceConfig("localhost_12918"));
+
+    try {
+      configAccessor.set(participantScope, "participantConfigKey", "participantConfigValue");
+    } catch (Exception e) {
+      Assert
+          .fail("Except succeed to set participant-config because participant: localhost_12918 has been added to cluster");
+    }
+
+    String participantConfigValue = configAccessor.get(participantScope, "participantConfigKey");
+    Assert.assertEquals(participantConfigValue, "participantConfigValue");
+
+    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/TestHelixTaskExecutor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestHelixTaskExecutor.java b/helix-core/src/test/java/org/apache/helix/TestHelixTaskExecutor.java
index 711be81..4aa16eb 100644
--- a/helix-core/src/test/java/org/apache/helix/TestHelixTaskExecutor.java
+++ b/helix-core/src/test/java/org/apache/helix/TestHelixTaskExecutor.java
@@ -35,12 +35,10 @@ import org.apache.helix.tools.StateModelConfigGenerator;
 import org.testng.AssertJUnit;
 import org.testng.annotations.Test;
 
-public class TestHelixTaskExecutor
-{
+public class TestHelixTaskExecutor {
 
   @Test()
-  public void testCMTaskExecutor() throws Exception
-  {
+  public void testCMTaskExecutor() throws Exception {
     System.out.println("START TestCMTaskExecutor");
     String msgId = "TestMessageId";
     Message message = new Message(MessageType.TASK_REPLY, msgId);
@@ -64,32 +62,30 @@ public class TestHelixTaskExecutor
 
     MockHelixTaskExecutor executor = new MockHelixTaskExecutor();
     MockStateModel stateModel = new MockStateModel();
-    executor.registerMessageHandlerFactory(MessageType.TASK_REPLY.toString(), new AsyncCallbackService());
+    executor.registerMessageHandlerFactory(MessageType.TASK_REPLY.toString(),
+        new AsyncCallbackService());
 
     NotificationContext context = new NotificationContext(manager);
     CurrentState currentStateDelta = new CurrentState("TestDB");
     currentStateDelta.setState("TestDB_0", "OFFLINE");
 
-    StateModelFactory<MockStateModel> stateModelFactory = new StateModelFactory<MockStateModel>()
-    {
+    StateModelFactory<MockStateModel> stateModelFactory = new StateModelFactory<MockStateModel>() {
 
       @Override
-      public MockStateModel createNewStateModel(String partitionName)
-      {
+      public MockStateModel createNewStateModel(String partitionName) {
         // TODO Auto-generated method stub
         return new MockStateModel();
       }
 
     };
     HelixStateTransitionHandler handler =
-        new HelixStateTransitionHandler(stateModelFactory, stateModel, message, context, currentStateDelta);
+        new HelixStateTransitionHandler(stateModelFactory, stateModel, message, context,
+            currentStateDelta);
 
     HelixTask task = new HelixTask(message, context, handler, executor);
     executor.scheduleTask(task);
-    for (int i = 0; i < 10; i++)
-    {
-      if (!executor.isDone(task.getTaskId()))
-      {
+    for (int i = 0; i < 10; i++) {
+      if (!executor.isDone(task.getTaskId())) {
         Thread.sleep(500);
       }
     }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/TestHelixTaskHandler.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestHelixTaskHandler.java b/helix-core/src/test/java/org/apache/helix/TestHelixTaskHandler.java
index 064e04d..3c7f2af 100644
--- a/helix-core/src/test/java/org/apache/helix/TestHelixTaskHandler.java
+++ b/helix-core/src/test/java/org/apache/helix/TestHelixTaskHandler.java
@@ -40,11 +40,9 @@ import org.apache.helix.tools.StateModelConfigGenerator;
 import org.testng.AssertJUnit;
 import org.testng.annotations.Test;
 
-public class TestHelixTaskHandler
-{
+public class TestHelixTaskHandler {
   @Test()
-  public void testInvocation() throws Exception
-  {
+  public void testInvocation() throws Exception {
     HelixTaskExecutor executor = new HelixTaskExecutor();
     System.out.println("START TestCMTaskHandler.testInvocation()");
     Message message = new Message(MessageType.STATE_TRANSITION, "Some unique id");
@@ -78,13 +76,14 @@ public class TestHelixTaskHandler
     handler = new HelixTask(message, context, stHandler, executor);
     handler.call();
     AssertJUnit.assertTrue(stateModel.stateModelInvoked);
-    System.out.println("END TestCMTaskHandler.testInvocation() at " + new Date(System.currentTimeMillis()));
+    System.out.println("END TestCMTaskHandler.testInvocation() at "
+        + new Date(System.currentTimeMillis()));
   }
 
   @Test()
-  public void testInvocationAnnotated() throws Exception
-  {
-    System.out.println("START TestCMTaskHandler.testInvocationAnnotated() at " + new Date(System.currentTimeMillis()));
+  public void testInvocationAnnotated() throws Exception {
+    System.out.println("START TestCMTaskHandler.testInvocationAnnotated() at "
+        + new Date(System.currentTimeMillis()));
     HelixTaskExecutor executor = new HelixTaskExecutor();
     Message message = new Message(MessageType.STATE_TRANSITION, "Some unique id");
     message.setSrcName("cm-instance-0");
@@ -113,25 +112,26 @@ public class TestHelixTaskHandler
     CurrentState currentStateDelta = new CurrentState("TestDB");
     currentStateDelta.setState("TestDB_0", "OFFLINE");
 
-    StateModelFactory<MockStateModelAnnotated> stateModelFactory = new StateModelFactory<MockStateModelAnnotated>()
-    {
+    StateModelFactory<MockStateModelAnnotated> stateModelFactory =
+        new StateModelFactory<MockStateModelAnnotated>() {
 
-      @Override
-      public MockStateModelAnnotated createNewStateModel(String partitionName)
-      {
-        // TODO Auto-generated method stub
-        return new MockStateModelAnnotated();
-      }
+          @Override
+          public MockStateModelAnnotated createNewStateModel(String partitionName) {
+            // TODO Auto-generated method stub
+            return new MockStateModelAnnotated();
+          }
 
-    };
+        };
 
     HelixStateTransitionHandler stHandler =
-        new HelixStateTransitionHandler(stateModelFactory, stateModel, message, context, currentStateDelta);
+        new HelixStateTransitionHandler(stateModelFactory, stateModel, message, context,
+            currentStateDelta);
 
     HelixTask handler = new HelixTask(message, context, stHandler, executor);
     handler.call();
     AssertJUnit.assertTrue(stateModel.stateModelInvoked);
-    System.out.println("END TestCMTaskHandler.testInvocationAnnotated() at " + new Date(System.currentTimeMillis()));
+    System.out.println("END TestCMTaskHandler.testInvocationAnnotated() at "
+        + new Date(System.currentTimeMillis()));
   }
 
 }