helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zzh...@apache.org
Subject [02/51] [partial] [HELIX-198] Unify helix code style, rb=13710
Date Wed, 21 Aug 2013 20:43:15 GMT
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/model/TestConstraint.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/model/TestConstraint.java b/helix-core/src/test/java/org/apache/helix/model/TestConstraint.java
index bddc519..f11af7f 100644
--- a/helix-core/src/test/java/org/apache/helix/model/TestConstraint.java
+++ b/helix-core/src/test/java/org/apache/helix/model/TestConstraint.java
@@ -40,17 +40,13 @@ import org.apache.log4j.Logger;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-
-public class TestConstraint extends ZkUnitTestBase
-{
+public class TestConstraint extends ZkUnitTestBase {
   private static Logger LOG = Logger.getLogger(TestConstraint.class);
 
   @Test
-  public void testMsgConstraint()
-  {
+  public void testMsgConstraint() {
     String className = getShortClassName();
-    System.out.println("START testMsgConstraint() at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("START testMsgConstraint() at " + new Date(System.currentTimeMillis()));
 
     String clusterName = "CLUSTER_" + className + "_msg";
     TestHelper.setupEmptyCluster(_gZkClient, clusterName);
@@ -116,25 +112,20 @@ public class TestConstraint extends ZkUnitTestBase
     Builder keyBuilder = accessor.keyBuilder();
 
     accessor.setProperty(keyBuilder.constraint(ConstraintType.MESSAGE_CONSTRAINT.toString()),
-                         new ClusterConstraints(record));
+        new ClusterConstraints(record));
 
     record =
         accessor.getProperty(keyBuilder.constraint(ConstraintType.MESSAGE_CONSTRAINT.toString()))
-                .getRecord();
+            .getRecord();
     ClusterConstraints constraint = new ClusterConstraints(record);
     // System.out.println("constraint: " + constraint);
 
     // message1
     Message msg1 =
-        createMessage(MessageType.STATE_TRANSITION,
-                      "msgId-001",
-                      "OFFLINE",
-                      "SLAVE",
-                      "TestDB",
-                      "localhost_12918");
-
-    Map<ConstraintAttribute, String> msgAttr =
-        ClusterConstraints.toConstraintAttributes(msg1);
+        createMessage(MessageType.STATE_TRANSITION, "msgId-001", "OFFLINE", "SLAVE", "TestDB",
+            "localhost_12918");
+
+    Map<ConstraintAttribute, String> msgAttr = ClusterConstraints.toConstraintAttributes(msg1);
     Set<ConstraintItem> matches = constraint.match(msgAttr);
     System.out.println(msg1 + " matches(" + matches.size() + "): " + matches);
     Assert.assertEquals(matches.size(), 5);
@@ -146,12 +137,8 @@ public class TestConstraint extends ZkUnitTestBase
 
     // message2
     Message msg2 =
-        createMessage(MessageType.STATE_TRANSITION,
-                      "msgId-002",
-                      "OFFLINE",
-                      "SLAVE",
-                      "TestDB",
-                      "localhost_12919");
+        createMessage(MessageType.STATE_TRANSITION, "msgId-002", "OFFLINE", "SLAVE", "TestDB",
+            "localhost_12919");
 
     msgAttr = ClusterConstraints.toConstraintAttributes(msg2);
     matches = constraint.match(msgAttr);
@@ -163,16 +150,13 @@ public class TestConstraint extends ZkUnitTestBase
     Assert.assertTrue(contains(matches, constraint3));
     Assert.assertTrue(contains(matches, constraint4));
 
-    System.out.println("END testMsgConstraint() at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("END testMsgConstraint() at " + new Date(System.currentTimeMillis()));
   }
 
   @Test
-  public void testStateConstraint()
-  {
+  public void testStateConstraint() {
     String className = getShortClassName();
-    System.out.println("START testStateConstraint() at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("START testStateConstraint() at " + new Date(System.currentTimeMillis()));
 
     String clusterName = "CLUSTER_" + className + "_state";
     TestHelper.setupEmptyCluster(_gZkClient, clusterName);
@@ -206,17 +190,16 @@ public class TestConstraint extends ZkUnitTestBase
     Builder keyBuilder = accessor.keyBuilder();
 
     accessor.setProperty(keyBuilder.constraint(ConstraintType.STATE_CONSTRAINT.toString()),
-                         new ClusterConstraints(record));
+        new ClusterConstraints(record));
 
     record =
         accessor.getProperty(keyBuilder.constraint(ConstraintType.STATE_CONSTRAINT.toString()))
-                .getRecord();
+            .getRecord();
     ClusterConstraints constraint = new ClusterConstraints(record);
     // System.out.println("constraint: " + constraint);
 
     // state1: hit rule2
-    Map<ConstraintAttribute, String> stateAttr1 =
-        new HashMap<ConstraintAttribute, String>();
+    Map<ConstraintAttribute, String> stateAttr1 = new HashMap<ConstraintAttribute, String>();
     stateAttr1.put(ConstraintAttribute.STATE, "MASTER");
     stateAttr1.put(ConstraintAttribute.RESOURCE, "TestDB");
 
@@ -234,8 +217,7 @@ public class TestConstraint extends ZkUnitTestBase
     // Assert.assertTrue(contains(matches, constraint1));
 
     // state2: not hit any rules
-    Map<ConstraintAttribute, String> stateAttr2 =
-        new HashMap<ConstraintAttribute, String>();
+    Map<ConstraintAttribute, String> stateAttr2 = new HashMap<ConstraintAttribute, String>();
     stateAttr2.put(ConstraintAttribute.STATE, "MASTER");
     stateAttr2.put(ConstraintAttribute.RESOURCE, "MyDB");
 
@@ -251,16 +233,12 @@ public class TestConstraint extends ZkUnitTestBase
     // Assert.assertTrue(contains(matches, constraint0));
     // Assert.assertTrue(contains(matches, constraint2));
 
-    System.out.println("END testStateConstraint() at "
-        + new Date(System.currentTimeMillis()));
+    System.out.println("END testStateConstraint() at " + new Date(System.currentTimeMillis()));
   }
 
-  private boolean contains(Set<ConstraintItem> constraints, ConstraintItem constraint)
-  {
-    for (ConstraintItem item : constraints)
-    {
-      if (item.toString().equals(constraint.toString()))
-      {
+  private boolean contains(Set<ConstraintItem> constraints, ConstraintItem constraint) {
+    for (ConstraintItem item : constraints) {
+      if (item.toString().equals(constraint.toString())) {
         return true;
       }
     }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/model/TestIdealState.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/model/TestIdealState.java b/helix-core/src/test/java/org/apache/helix/model/TestIdealState.java
index 120ab94..e30aff8 100644
--- a/helix-core/src/test/java/org/apache/helix/model/TestIdealState.java
+++ b/helix-core/src/test/java/org/apache/helix/model/TestIdealState.java
@@ -28,17 +28,13 @@ import org.testng.Assert;
 import org.testng.annotations.Test;
 
 @SuppressWarnings("deprecation")
-public class TestIdealState
-{
+public class TestIdealState {
   @Test
-  public void testGetInstanceSet()
-  {
+  public void testGetInstanceSet() {
     String className = TestHelper.getTestClassName();
     String methodName = TestHelper.getTestMethodName();
     String testName = className + "_" + methodName;
-    System.out.println("START " + testName + " at "
-        + new Date(System.currentTimeMillis()));
-
+    System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis()));
 
     IdealState idealState = new IdealState("idealState");
     idealState.getRecord().setListField("TestDB_0", Arrays.asList("node_1", "node_2"));
@@ -50,27 +46,26 @@ public class TestIdealState
     // test SEMI_AUTO mode
     idealState.setRebalanceMode(RebalanceMode.SEMI_AUTO);
     Set<String> instances = idealState.getInstanceSet("TestDB_0");
-//    System.out.println("instances: " + instances);
+    // System.out.println("instances: " + instances);
     Assert.assertEquals(instances.size(), 2, "Should contain node_1 and node_2");
     Assert.assertTrue(instances.contains("node_1"), "Should contain node_1 and node_2");
     Assert.assertTrue(instances.contains("node_2"), "Should contain node_1 and node_2");
 
     instances = idealState.getInstanceSet("TestDB_nonExist_auto");
     Assert.assertEquals(instances, Collections.emptySet(), "Should get empty set");
-    
+
     // test CUSTOMIZED mode
     idealState.setRebalanceMode(RebalanceMode.CUSTOMIZED);
     instances = idealState.getInstanceSet("TestDB_1");
-//    System.out.println("instances: " + instances);
+    // System.out.println("instances: " + instances);
     Assert.assertEquals(instances.size(), 2, "Should contain node_3 and node_4");
     Assert.assertTrue(instances.contains("node_3"), "Should contain node_3 and node_4");
     Assert.assertTrue(instances.contains("node_4"), "Should contain node_3 and node_4");
 
     instances = idealState.getInstanceSet("TestDB_nonExist_custom");
     Assert.assertEquals(instances, Collections.emptySet(), "Should get empty set");
-    
-    System.out.println("END " + testName + " at "
-        + new Date(System.currentTimeMillis()));
+
+    System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis()));
   }
 
   @Test
@@ -85,11 +80,13 @@ public class TestIdealState
     List<String> preferenceList = new ArrayList<String>();
     preferenceList.add("node_0");
     idealState.getRecord().setListField("test-db_0", preferenceList);
-    Assert.assertFalse(idealState.isValid(), "should fail since replicas not equals to preference-list size");
+    Assert.assertFalse(idealState.isValid(),
+        "should fail since replicas not equals to preference-list size");
 
     preferenceList.add("node_1");
     idealState.getRecord().setListField("test-db_0", preferenceList);
-    Assert.assertTrue(idealState.isValid(), "should pass since replicas equals to preference-list size");
+    Assert.assertTrue(idealState.isValid(),
+        "should pass since replicas equals to preference-list size");
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/model/TestInstanceConfig.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/model/TestInstanceConfig.java b/helix-core/src/test/java/org/apache/helix/model/TestInstanceConfig.java
index df99134..69a3d9f 100644
--- a/helix-core/src/test/java/org/apache/helix/model/TestInstanceConfig.java
+++ b/helix-core/src/test/java/org/apache/helix/model/TestInstanceConfig.java
@@ -30,9 +30,10 @@ import org.testng.annotations.Test;
  * To change this template use File | Settings | File Templates.
  */
 public class TestInstanceConfig {
-    @Test
-    public void testNotCheckingHostPortExistence() {
-        InstanceConfig config = new InstanceConfig("node_0");
-        Assert.assertTrue(config.isValid(), "HELIX-65: should not check host/port existence for instance-config");
-    }
+  @Test
+  public void testNotCheckingHostPortExistence() {
+    InstanceConfig config = new InstanceConfig("node_0");
+    Assert.assertTrue(config.isValid(),
+        "HELIX-65: should not check host/port existence for instance-config");
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/model/builder/TestIdealStateBuilder.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/model/builder/TestIdealStateBuilder.java b/helix-core/src/test/java/org/apache/helix/model/builder/TestIdealStateBuilder.java
index 1b5ba63..6eddcf5 100644
--- a/helix-core/src/test/java/org/apache/helix/model/builder/TestIdealStateBuilder.java
+++ b/helix-core/src/test/java/org/apache/helix/model/builder/TestIdealStateBuilder.java
@@ -24,70 +24,60 @@ import org.testng.Assert;
 import org.testng.annotations.Test;
 
 public class TestIdealStateBuilder {
-    @Test
-    public void testAutoISBuilder() {
-        AutoModeISBuilder builder = new AutoModeISBuilder("test-db");
-        builder.setStateModel("MasterSlave")
-               .setNumPartitions(2)
-               .setNumReplica(2);
-        builder.assignPreferenceList("test-db_0", "node_0", "node_1")
-               .assignPreferenceList("test-db_1", "node_1", "node_0");
+  @Test
+  public void testAutoISBuilder() {
+    AutoModeISBuilder builder = new AutoModeISBuilder("test-db");
+    builder.setStateModel("MasterSlave").setNumPartitions(2).setNumReplica(2);
+    builder.assignPreferenceList("test-db_0", "node_0", "node_1").assignPreferenceList("test-db_1",
+        "node_1", "node_0");
 
-        IdealState idealState = null;
-        try {
-            idealState = builder.build();
-        } catch (Exception e) {
-            Assert.fail("fail to build an auto mode ideal-state.", e);
-        }
-//        System.out.println("ideal-state: " + idealState);
-        Assert.assertEquals(idealState.getRebalanceMode(),
-            IdealState.RebalanceMode.SEMI_AUTO,
-            "rebalancer mode should be semi-auto");
+    IdealState idealState = null;
+    try {
+      idealState = builder.build();
+    } catch (Exception e) {
+      Assert.fail("fail to build an auto mode ideal-state.", e);
     }
+    // System.out.println("ideal-state: " + idealState);
+    Assert.assertEquals(idealState.getRebalanceMode(), IdealState.RebalanceMode.SEMI_AUTO,
+        "rebalancer mode should be semi-auto");
+  }
 
-    @Test
-    public void testAutoRebalanceISModeBuilder() {
-        AutoRebalanceModeISBuilder builder = new AutoRebalanceModeISBuilder("test-db");
-        builder.setStateModel("MasterSlave")
-                .setNumPartitions(2)
-                .setNumReplica(2);
-        builder.add("test-db_0")
-                .add("test-db_1");
-
-        IdealState idealState = null;
-        try {
-            idealState = builder.build();
-        } catch (Exception e) {
-            Assert.fail("fail to build an auto-rebalance mode ideal-state.", e);
-        }
-//        System.out.println("ideal-state: " + idealState);
-        Assert.assertEquals(idealState.getRebalanceMode(),
-            IdealState.RebalanceMode.FULL_AUTO,
-            "rebalancer mode should be auto");
+  @Test
+  public void testAutoRebalanceISModeBuilder() {
+    AutoRebalanceModeISBuilder builder = new AutoRebalanceModeISBuilder("test-db");
+    builder.setStateModel("MasterSlave").setNumPartitions(2).setNumReplica(2);
+    builder.add("test-db_0").add("test-db_1");
 
+    IdealState idealState = null;
+    try {
+      idealState = builder.build();
+    } catch (Exception e) {
+      Assert.fail("fail to build an auto-rebalance mode ideal-state.", e);
     }
+    // System.out.println("ideal-state: " + idealState);
+    Assert.assertEquals(idealState.getRebalanceMode(), IdealState.RebalanceMode.FULL_AUTO,
+        "rebalancer mode should be auto");
 
-    @Test
-    public void testCustomModeISBuilder() {
-        CustomModeISBuilder builder = new CustomModeISBuilder("test-db");
-        builder.setStateModel("MasterSlave")
-                .setNumPartitions(2)
-                .setNumReplica(2);
-        builder.assignInstanceAndState("test-db_0", "node_0", "MASTER")
-                .assignInstanceAndState("test-db_0", "node_1", "SLAVE")
-                .assignInstanceAndState("test-db_1", "node_0", "SLAVE")
-                .assignInstanceAndState("test-db_1", "node_1", "MASTER");
+  }
 
-        IdealState idealState = null;
-        try {
-            idealState = builder.build();
-        } catch (Exception e) {
-            Assert.fail("fail to build a custom mode ideal-state.", e);
-        }
-//        System.out.println("ideal-state: " + idealState);
-        Assert.assertEquals(idealState.getRebalanceMode(),
-            IdealState.RebalanceMode.CUSTOMIZED,
-            "rebalancer mode should be customized");
+  @Test
+  public void testCustomModeISBuilder() {
+    CustomModeISBuilder builder = new CustomModeISBuilder("test-db");
+    builder.setStateModel("MasterSlave").setNumPartitions(2).setNumReplica(2);
+    builder.assignInstanceAndState("test-db_0", "node_0", "MASTER")
+        .assignInstanceAndState("test-db_0", "node_1", "SLAVE")
+        .assignInstanceAndState("test-db_1", "node_0", "SLAVE")
+        .assignInstanceAndState("test-db_1", "node_1", "MASTER");
 
+    IdealState idealState = null;
+    try {
+      idealState = builder.build();
+    } catch (Exception e) {
+      Assert.fail("fail to build a custom mode ideal-state.", e);
     }
+    // System.out.println("ideal-state: " + idealState);
+    Assert.assertEquals(idealState.getRebalanceMode(), IdealState.RebalanceMode.CUSTOMIZED,
+        "rebalancer mode should be customized");
+
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/monitoring/TestParticipantMonitor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/monitoring/TestParticipantMonitor.java b/helix-core/src/test/java/org/apache/helix/monitoring/TestParticipantMonitor.java
index 645dfb7..74b1a89 100644
--- a/helix-core/src/test/java/org/apache/helix/monitoring/TestParticipantMonitor.java
+++ b/helix-core/src/test/java/org/apache/helix/monitoring/TestParticipantMonitor.java
@@ -41,101 +41,90 @@ import org.apache.log4j.Logger;
 import org.testng.AssertJUnit;
 import org.testng.annotations.Test;
 
-
-public class TestParticipantMonitor
-{
+public class TestParticipantMonitor {
   static Logger _logger = Logger.getLogger(TestParticipantMonitor.class);
 
-  class ParticipantMonitorListener extends ClusterMBeanObserver
-  {
+  class ParticipantMonitorListener extends ClusterMBeanObserver {
     Map<String, Map<String, Object>> _beanValueMap = new HashMap<String, Map<String, Object>>();
 
-    public ParticipantMonitorListener(String domain)
-        throws InstanceNotFoundException, IOException,
-        MalformedObjectNameException, NullPointerException
-    {
+    public ParticipantMonitorListener(String domain) throws InstanceNotFoundException, IOException,
+        MalformedObjectNameException, NullPointerException {
       super(domain);
       init();
     }
 
-    void init()
-    {
-      try
-      {
-        Set<ObjectInstance> existingInstances = _server.queryMBeans(new ObjectName(_domain+":Cluster=cluster,*"), null);
-        for(ObjectInstance instance : existingInstances)
-        {
+    void init() {
+      try {
+        Set<ObjectInstance> existingInstances =
+            _server.queryMBeans(new ObjectName(_domain + ":Cluster=cluster,*"), null);
+        for (ObjectInstance instance : existingInstances) {
           String mbeanName = instance.getObjectName().toString();
           // System.out.println("mbeanName: " + mbeanName);
           addMBean(instance.getObjectName());
         }
-      }
-      catch (Exception e)
-      {
+      } catch (Exception e) {
         _logger.warn("fail to get all existing mbeans in " + _domain, e);
       }
     }
 
     @Override
     public void onMBeanRegistered(MBeanServerConnection server,
-        MBeanServerNotification mbsNotification)
-    {
+        MBeanServerNotification mbsNotification) {
       addMBean(mbsNotification.getMBeanName());
     }
 
-    void addMBean(ObjectName beanName)
-    {
-      try
-      {
+    void addMBean(ObjectName beanName) {
+      try {
         MBeanInfo info = _server.getMBeanInfo(beanName);
         MBeanAttributeInfo[] infos = info.getAttributes();
         _beanValueMap.put(beanName.toString(), new HashMap<String, Object>());
-        for(MBeanAttributeInfo infoItem : infos)
-        {
+        for (MBeanAttributeInfo infoItem : infos) {
           Object val = _server.getAttribute(beanName, infoItem.getName());
-          // System.out.println("         " + infoItem.getName() + " : " + _server.getAttribute(beanName, infoItem.getName()) + " type : " + infoItem.getType());
+          // System.out.println("         " + infoItem.getName() + " : " +
+          // _server.getAttribute(beanName, infoItem.getName()) + " type : " + infoItem.getType());
           _beanValueMap.get(beanName.toString()).put(infoItem.getName(), val);
         }
-      }
-      catch (Exception e)
-      {
-        _logger.error("Error getting bean info, domain="+_domain, e);
+      } catch (Exception e) {
+        _logger.error("Error getting bean info, domain=" + _domain, e);
       }
     }
 
     @Override
     public void onMBeanUnRegistered(MBeanServerConnection server,
-        MBeanServerNotification mbsNotification)
-    {
+        MBeanServerNotification mbsNotification) {
 
     }
   }
-  @Test(groups={ "unitTest" })
-  public void TestReportData() throws InstanceNotFoundException, MalformedObjectNameException, NullPointerException, IOException, InterruptedException
-  {
-  	System.out.println("START TestParticipantMonitor");
+
+  @Test(groups = {
+    "unitTest"
+  })
+  public void TestReportData() throws InstanceNotFoundException, MalformedObjectNameException,
+      NullPointerException, IOException, InterruptedException {
+    System.out.println("START TestParticipantMonitor");
     ParticipantMonitor monitor = new ParticipantMonitor();
 
     int monitorNum = 0;
 
-    StateTransitionContext cxt = new StateTransitionContext("cluster", "instance", "db_1","a-b");
-    StateTransitionDataPoint data = new StateTransitionDataPoint(1000,1000,true);
+    StateTransitionContext cxt = new StateTransitionContext("cluster", "instance", "db_1", "a-b");
+    StateTransitionDataPoint data = new StateTransitionDataPoint(1000, 1000, true);
     monitor.reportTransitionStat(cxt, data);
 
-    data = new StateTransitionDataPoint(1000,1200,true);
+    data = new StateTransitionDataPoint(1000, 1200, true);
     monitor.reportTransitionStat(cxt, data);
 
-    ParticipantMonitorListener monitorListener = new ParticipantMonitorListener("CLMParticipantReport");
+    ParticipantMonitorListener monitorListener =
+        new ParticipantMonitorListener("CLMParticipantReport");
     Thread.sleep(1000);
     AssertJUnit.assertTrue(monitorListener._beanValueMap.size() == monitorNum + 1);
 
-    data = new StateTransitionDataPoint(1000,500,true);
+    data = new StateTransitionDataPoint(1000, 500, true);
     monitor.reportTransitionStat(cxt, data);
     Thread.sleep(1000);
     AssertJUnit.assertTrue(monitorListener._beanValueMap.size() == monitorNum + 1);
 
-    data = new StateTransitionDataPoint(1000,500,true);
-    StateTransitionContext cxt2 = new StateTransitionContext("cluster", "instance", "db_2","a-b");
+    data = new StateTransitionDataPoint(1000, 500, true);
+    StateTransitionContext cxt2 = new StateTransitionContext("cluster", "instance", "db_2", "a-b");
     monitor.reportTransitionStat(cxt2, data);
     monitor.reportTransitionStat(cxt2, data);
     Thread.sleep(1000);
@@ -143,14 +132,16 @@ public class TestParticipantMonitor
 
     AssertJUnit.assertFalse(cxt.equals(cxt2));
     AssertJUnit.assertFalse(cxt.equals(new Object()));
-    AssertJUnit.assertTrue(cxt.equals(new StateTransitionContext("cluster", "instance", "db_1","a-b")));
+    AssertJUnit.assertTrue(cxt.equals(new StateTransitionContext("cluster", "instance", "db_1",
+        "a-b")));
 
     cxt2.getInstanceName();
 
-    ParticipantMonitorListener monitorListener2 = new ParticipantMonitorListener("CLMParticipantReport");
+    ParticipantMonitorListener monitorListener2 =
+        new ParticipantMonitorListener("CLMParticipantReport");
 
     Thread.sleep(1000);
-    AssertJUnit.assertEquals(monitorListener2._beanValueMap.size() , monitorNum + 2);
+    AssertJUnit.assertEquals(monitorListener2._beanValueMap.size(), monitorNum + 2);
 
     monitorListener2.disconnect();
     monitorListener.disconnect();

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/monitoring/TestStatCollector.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/monitoring/TestStatCollector.java b/helix-core/src/test/java/org/apache/helix/monitoring/TestStatCollector.java
index 660003d..c35c961 100644
--- a/helix-core/src/test/java/org/apache/helix/monitoring/TestStatCollector.java
+++ b/helix-core/src/test/java/org/apache/helix/monitoring/TestStatCollector.java
@@ -22,34 +22,32 @@ package org.apache.helix.monitoring;
 import org.testng.AssertJUnit;
 import org.testng.annotations.Test;
 
-
-public class TestStatCollector
-{
-  @Test(groups={ "unitTest" })
-  public void TestCollectData()
-  {
+public class TestStatCollector {
+  @Test(groups = {
+    "unitTest"
+  })
+  public void TestCollectData() {
     StatCollector collector = new StatCollector();
-    
+
     int nPoints = 100;
-    for (int i = 0; i< nPoints; i++)
-    {
-      collector.addData(i*1000);
+    for (int i = 0; i < nPoints; i++) {
+      collector.addData(i * 1000);
     }
     AssertJUnit.assertEquals(collector.getNumDataPoints(), nPoints);
-    AssertJUnit.assertEquals((long)collector.getMax(), 99000);
-    AssertJUnit.assertEquals((long)collector.getTotalSum(), 4950000);
-    AssertJUnit.assertEquals((long)collector.getPercentile(40), 39400);
-    AssertJUnit.assertEquals((long)collector.getMean(), 49500);
-    AssertJUnit.assertEquals((long)collector.getMin(), 0);
-    
+    AssertJUnit.assertEquals((long) collector.getMax(), 99000);
+    AssertJUnit.assertEquals((long) collector.getTotalSum(), 4950000);
+    AssertJUnit.assertEquals((long) collector.getPercentile(40), 39400);
+    AssertJUnit.assertEquals((long) collector.getMean(), 49500);
+    AssertJUnit.assertEquals((long) collector.getMin(), 0);
+
     collector.reset();
-    
+
     AssertJUnit.assertEquals(collector.getNumDataPoints(), 0);
-    AssertJUnit.assertEquals((long)collector.getMax(), 0);
-    AssertJUnit.assertEquals((long)collector.getTotalSum(), 0);
-    AssertJUnit.assertEquals((long)collector.getPercentile(40), 0);
-    AssertJUnit.assertEquals((long)collector.getMean(), 0);
-    AssertJUnit.assertEquals((long)collector.getMin(), 0);
-    
+    AssertJUnit.assertEquals((long) collector.getMax(), 0);
+    AssertJUnit.assertEquals((long) collector.getTotalSum(), 0);
+    AssertJUnit.assertEquals((long) collector.getPercentile(40), 0);
+    AssertJUnit.assertEquals((long) collector.getMean(), 0);
+    AssertJUnit.assertEquals((long) collector.getMin(), 0);
+
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterAlertItemMBeanCollection.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterAlertItemMBeanCollection.java b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterAlertItemMBeanCollection.java
index 09f6699..e383291 100644
--- a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterAlertItemMBeanCollection.java
+++ b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterAlertItemMBeanCollection.java
@@ -43,221 +43,248 @@ import org.codehaus.jackson.type.TypeReference;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-
-public class TestClusterAlertItemMBeanCollection
-{
+public class TestClusterAlertItemMBeanCollection {
   private static final Logger _logger = Logger.getLogger(TestClusterAlertItemMBeanCollection.class);
 
   @Test
-  public void TestAlertReportingHistory() throws InstanceNotFoundException, MalformedObjectNameException, NullPointerException, IOException, IntrospectionException, AttributeNotFoundException, ReflectionException, MBeanException
-  {
+  public void TestAlertReportingHistory() throws InstanceNotFoundException,
+      MalformedObjectNameException, NullPointerException, IOException, IntrospectionException,
+      AttributeNotFoundException, ReflectionException, MBeanException {
     ClusterAlertMBeanCollection beanCollection = new ClusterAlertMBeanCollection();
-    
+
     String clusterName = "TestCluster";
-    String originAlert1 = "EXP(decay(1.0)(esv4-app7*.RestQueryStats@DBName=BizProfile.MinServerLatency))CMP(GREATER)CON(10)";
+    String originAlert1 =
+        "EXP(decay(1.0)(esv4-app7*.RestQueryStats@DBName=BizProfile.MinServerLatency))CMP(GREATER)CON(10)";
     Map<String, AlertValueAndStatus> alertResultMap1 = new HashMap<String, AlertValueAndStatus>();
     int nAlerts1 = 5;
-    
-    String originAlert2 = "EXP(decay(1.0)(esv4-app9*.RestQueryStats@DBName=BizProfile.MaxServerLatency))CMP(GREATER)CON(10)";
+
+    String originAlert2 =
+        "EXP(decay(1.0)(esv4-app9*.RestQueryStats@DBName=BizProfile.MaxServerLatency))CMP(GREATER)CON(10)";
     Map<String, AlertValueAndStatus> alertResultMap2 = new HashMap<String, AlertValueAndStatus>();
     int nAlerts2 = 3;
-    
-    TestClusterMBeanObserver jmxMBeanObserver = new TestClusterMBeanObserver(ClusterAlertMBeanCollection.DOMAIN_ALERT);
-    
-    for(int i = 0; i < nAlerts1; i++)
-    {
-      String alertName = "esv4-app7" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
+
+    TestClusterMBeanObserver jmxMBeanObserver =
+        new TestClusterMBeanObserver(ClusterAlertMBeanCollection.DOMAIN_ALERT);
+
+    for (int i = 0; i < nAlerts1; i++) {
+      String alertName =
+          "esv4-app7" + i
+              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
       Tuple<String> value = new Tuple<String>();
       value.add("22" + i);
-      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value , true);
+      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
       alertResultMap1.put(alertName, valueAndStatus);
     }
-    
-    for(int i = 0; i < nAlerts2; i++)
-    {
-      String alertName = "esv4-app9" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
+
+    for (int i = 0; i < nAlerts2; i++) {
+      String alertName =
+          "esv4-app9" + i
+              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
       Tuple<String> value = new Tuple<String>();
       value.add("22" + i);
-      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value , true);
+      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
       alertResultMap1.put(alertName, valueAndStatus);
     }
-    
+
     beanCollection.setAlerts(originAlert1, alertResultMap1, clusterName);
     beanCollection.setAlerts(originAlert2, alertResultMap2, clusterName);
-    
+
     beanCollection.refreshAlertDelta(clusterName);
     String summaryKey = ClusterAlertMBeanCollection.ALERT_SUMMARY + "_" + clusterName;
     jmxMBeanObserver.refresh();
-    
+
     // Get the history list
     String beanName = "HelixAlerts:alert=" + summaryKey;
     Map<String, Object> beanValueMap = jmxMBeanObserver._beanValueMap.get(beanName);
     String history1 = (String) (beanValueMap.get("AlertFiredHistory"));
-    
+
     StringReader sr = new StringReader(history1);
     ObjectMapper mapper = new ObjectMapper();
 
     // check the history
-   
+
     Map<String, String> delta = beanCollection.getRecentAlertDelta();
     Assert.assertEquals(delta.size(), nAlerts1 + nAlerts2);
-    for(int i = 0; i < nAlerts1; i++)
-    {
-      String alertBeanName = "(esv4-app7" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName#BizProfile.MinServerLatency)GREATER(10)";
+    for (int i = 0; i < nAlerts1; i++) {
+      String alertBeanName =
+          "(esv4-app7"
+              + i
+              + ".stg.linkedin.com_12918.RestQueryStats@DBName#BizProfile.MinServerLatency)GREATER(10)";
       Assert.assertTrue(delta.get(alertBeanName).equals("ON"));
     }
-    
-    for(int i = 0; i < nAlerts2; i++)
-    {
-      String alertBeanName = "(esv4-app9" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName#BizProfile.MaxServerLatency)GREATER(10)";
+
+    for (int i = 0; i < nAlerts2; i++) {
+      String alertBeanName =
+          "(esv4-app9"
+              + i
+              + ".stg.linkedin.com_12918.RestQueryStats@DBName#BizProfile.MaxServerLatency)GREATER(10)";
       Assert.assertTrue(delta.get(alertBeanName).equals("ON"));
     }
-    
+
     alertResultMap1 = new HashMap<String, AlertValueAndStatus>();
-    for(int i = 0; i < 3; i++)
-    {
-      String alertName = "esv4-app7" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
+    for (int i = 0; i < 3; i++) {
+      String alertName =
+          "esv4-app7" + i
+              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
       Tuple<String> value = new Tuple<String>();
       value.add("22" + i);
-      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value , true);
+      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
       alertResultMap1.put(alertName, valueAndStatus);
     }
-    
-    for(int i = 3; i < 5; i++)
-    {
-      String alertName = "esv4-app7" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
+
+    for (int i = 3; i < 5; i++) {
+      String alertName =
+          "esv4-app7" + i
+              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
       Tuple<String> value = new Tuple<String>();
       value.add("22" + i);
-      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value , false);
+      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, false);
       alertResultMap1.put(alertName, valueAndStatus);
     }
-    
-    for(int i = 7; i < 9; i++)
-    {
-      String alertName = "esv4-app7" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
+
+    for (int i = 7; i < 9; i++) {
+      String alertName =
+          "esv4-app7" + i
+              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
       Tuple<String> value = new Tuple<String>();
       value.add("22" + i);
-      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value , true);
+      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
       alertResultMap1.put(alertName, valueAndStatus);
     }
-    
-    for(int i = 0; i < 2; i++)
-    {
-      String alertName = "esv4-app9" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
+
+    for (int i = 0; i < 2; i++) {
+      String alertName =
+          "esv4-app9" + i
+              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
       Tuple<String> value = new Tuple<String>();
       value.add("22" + i);
-      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value , false);
+      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, false);
       alertResultMap1.put(alertName, valueAndStatus);
     }
-    
-    for(int i = 2; i < 3; i++)
-    {
-      String alertName = "esv4-app9" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
+
+    for (int i = 2; i < 3; i++) {
+      String alertName =
+          "esv4-app9" + i
+              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
       Tuple<String> value = new Tuple<String>();
       value.add("22" + i);
-      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value , true);
+      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
       alertResultMap1.put(alertName, valueAndStatus);
     }
-    for(int i = 7; i < 9; i++)
-    {
-      String alertName = "esv4-app9" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
+    for (int i = 7; i < 9; i++) {
+      String alertName =
+          "esv4-app9" + i
+              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
       Tuple<String> value = new Tuple<String>();
       value.add("22" + i);
-      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value , true);
+      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
       alertResultMap1.put(alertName, valueAndStatus);
     }
-    
+
     beanCollection.setAlerts(originAlert1, alertResultMap1, clusterName);
     beanCollection.refreshAlertDelta(clusterName);
     jmxMBeanObserver.refresh();
 
     beanValueMap = jmxMBeanObserver._beanValueMap.get(beanName);
     history1 = (String) (beanValueMap.get("AlertFiredHistory"));
-    
+
     sr = new StringReader(history1);
     mapper = new ObjectMapper();
 
     // check the history
     delta = beanCollection.getRecentAlertDelta();
-    Assert.assertEquals(delta.size(),  8);
-    for(int i = 3; i < 5; i++)
-    {
-      String alertBeanName = "(esv4-app7" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName#BizProfile.MinServerLatency)GREATER(10)";
+    Assert.assertEquals(delta.size(), 8);
+    for (int i = 3; i < 5; i++) {
+      String alertBeanName =
+          "(esv4-app7"
+              + i
+              + ".stg.linkedin.com_12918.RestQueryStats@DBName#BizProfile.MinServerLatency)GREATER(10)";
       Assert.assertTrue(delta.get(alertBeanName).equals("OFF"));
     }
-    for(int i = 7; i < 9; i++)
-    {
-      String alertBeanName = "(esv4-app7" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName#BizProfile.MinServerLatency)GREATER(10)";
+    for (int i = 7; i < 9; i++) {
+      String alertBeanName =
+          "(esv4-app7"
+              + i
+              + ".stg.linkedin.com_12918.RestQueryStats@DBName#BizProfile.MinServerLatency)GREATER(10)";
       Assert.assertTrue(delta.get(alertBeanName).equals("ON"));
     }
-    
-    for(int i = 0; i < 2; i++)
-    {
-      String alertBeanName = "(esv4-app9" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName#BizProfile.MaxServerLatency)GREATER(10)";
+
+    for (int i = 0; i < 2; i++) {
+      String alertBeanName =
+          "(esv4-app9"
+              + i
+              + ".stg.linkedin.com_12918.RestQueryStats@DBName#BizProfile.MaxServerLatency)GREATER(10)";
       Assert.assertTrue(delta.get(alertBeanName).equals("OFF"));
     }
-    for(int i = 7; i < 9; i++)
-    {
-      String alertBeanName = "(esv4-app9" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName#BizProfile.MaxServerLatency)GREATER(10)";
+    for (int i = 7; i < 9; i++) {
+      String alertBeanName =
+          "(esv4-app9"
+              + i
+              + ".stg.linkedin.com_12918.RestQueryStats@DBName#BizProfile.MaxServerLatency)GREATER(10)";
       Assert.assertTrue(delta.get(alertBeanName).equals("ON"));
     }
   }
+
   @Test
-  public void TestAlertRefresh() throws InstanceNotFoundException, MalformedObjectNameException, NullPointerException, IOException, IntrospectionException, AttributeNotFoundException, ReflectionException, MBeanException, InterruptedException
-  {
+  public void TestAlertRefresh() throws InstanceNotFoundException, MalformedObjectNameException,
+      NullPointerException, IOException, IntrospectionException, AttributeNotFoundException,
+      ReflectionException, MBeanException, InterruptedException {
     ClusterAlertMBeanCollection beanCollection = new ClusterAlertMBeanCollection();
-    
+
     String clusterName = "TestCluster";
-    String originAlert1 = "EXP(decay(1.0)(esv4-app7*.RestQueryStats@DBName=BizProfile.MinServerLatency))CMP(GREATER)CON(10)";
+    String originAlert1 =
+        "EXP(decay(1.0)(esv4-app7*.RestQueryStats@DBName=BizProfile.MinServerLatency))CMP(GREATER)CON(10)";
     Map<String, AlertValueAndStatus> alertResultMap1 = new HashMap<String, AlertValueAndStatus>();
     int nAlerts1 = 5;
-    
-    String originAlert2 = "EXP(decay(1.0)(esv4-app9*.RestQueryStats@DBName=BizProfile.MaxServerLatency))CMP(GREATER)CON(10)";
+
+    String originAlert2 =
+        "EXP(decay(1.0)(esv4-app9*.RestQueryStats@DBName=BizProfile.MaxServerLatency))CMP(GREATER)CON(10)";
     Map<String, AlertValueAndStatus> alertResultMap2 = new HashMap<String, AlertValueAndStatus>();
     int nAlerts2 = 3;
-    
-    TestClusterMBeanObserver jmxMBeanObserver = new TestClusterMBeanObserver(ClusterAlertMBeanCollection.DOMAIN_ALERT);
-    
-    for(int i = 0; i < nAlerts1; i++)
-    {
-      String alertName = "esv4-app7" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
+
+    TestClusterMBeanObserver jmxMBeanObserver =
+        new TestClusterMBeanObserver(ClusterAlertMBeanCollection.DOMAIN_ALERT);
+
+    for (int i = 0; i < nAlerts1; i++) {
+      String alertName =
+          "esv4-app7" + i
+              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
       Tuple<String> value = new Tuple<String>();
       value.add("22" + i);
-      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value , true);
+      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
       alertResultMap1.put(alertName, valueAndStatus);
     }
-    
-    for(int i = 0; i < nAlerts2; i++)
-    {
-      String alertName = "esv4-app9" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
+
+    for (int i = 0; i < nAlerts2; i++) {
+      String alertName =
+          "esv4-app9" + i
+              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
       Tuple<String> value = new Tuple<String>();
       value.add("22" + i);
-      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value , true);
+      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
       alertResultMap2.put(alertName, valueAndStatus);
     }
-    
+
     beanCollection.setAlerts(originAlert1, alertResultMap1, clusterName);
     beanCollection.setAlerts(originAlert2, alertResultMap2, clusterName);
-    
+
     beanCollection.refreshAlertDelta(clusterName);
     String summaryKey = ClusterAlertMBeanCollection.ALERT_SUMMARY + "_" + clusterName;
     jmxMBeanObserver.refresh();
-    
+
     Assert.assertEquals(jmxMBeanObserver._beanValueMap.size(), nAlerts2 + nAlerts1 + 1);
-    
+
     Thread.sleep(300);
-    
+
     beanCollection.setAlerts(originAlert1, alertResultMap1, clusterName);
     beanCollection.checkMBeanFreshness(200);
-    
-    for(int i = 0; i < 20; i++)
-    {
+
+    for (int i = 0; i < 20; i++) {
       Thread.sleep(500);
-      
+
       jmxMBeanObserver.refresh();
-      
-      if(jmxMBeanObserver._beanValueMap.size() == nAlerts1 + 1)
-      {
+
+      if (jmxMBeanObserver._beanValueMap.size() == nAlerts1 + 1) {
         break;
       }
     }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterStatusMonitor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterStatusMonitor.java b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterStatusMonitor.java
index 68cbaac..711aff2 100644
--- a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterStatusMonitor.java
+++ b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterStatusMonitor.java
@@ -33,10 +33,7 @@ import org.apache.helix.model.LiveInstance.LiveInstanceProperty;
 import org.apache.helix.tools.DefaultIdealStateCalculator;
 import org.testng.annotations.Test;
 
-
-
-public class TestClusterStatusMonitor
-{
+public class TestClusterStatusMonitor {
   List<String> _instances;
   List<ZNRecord> _liveInstances;
   String _db = "DB";
@@ -45,54 +42,48 @@ public class TestClusterStatusMonitor
   int _partitions = 50;
   ZNRecord _externalView, _externalView2;
 
-  class MockDataAccessor extends Mocks.MockAccessor
-  {
-    public MockDataAccessor()
-    {
+  class MockDataAccessor extends Mocks.MockAccessor {
+    public MockDataAccessor() {
       _instances = new ArrayList<String>();
-      for(int i = 0;i < 5; i++)
-      {
-        String instance = "localhost_"+(12918+i);
+      for (int i = 0; i < 5; i++) {
+        String instance = "localhost_" + (12918 + i);
         _instances.add(instance);
       }
-      ZNRecord externalView = DefaultIdealStateCalculator.calculateIdealState(
-          _instances, _partitions, _replicas, _db, "MASTER", "SLAVE");
+      ZNRecord externalView =
+          DefaultIdealStateCalculator.calculateIdealState(_instances, _partitions, _replicas, _db,
+              "MASTER", "SLAVE");
 
-      ZNRecord externalView2 = DefaultIdealStateCalculator.calculateIdealState(
-          _instances, 80, 2, _db2, "MASTER", "SLAVE");
+      ZNRecord externalView2 =
+          DefaultIdealStateCalculator.calculateIdealState(_instances, 80, 2, _db2, "MASTER",
+              "SLAVE");
 
     }
-    public ZNRecord getProperty(PropertyType type, String resource)
-    {
-      if(type == PropertyType.IDEALSTATES || type == PropertyType.EXTERNALVIEW)
-      {
-        if(resource.equals(_db))
-        {
+
+    public ZNRecord getProperty(PropertyType type, String resource) {
+      if (type == PropertyType.IDEALSTATES || type == PropertyType.EXTERNALVIEW) {
+        if (resource.equals(_db)) {
           return _externalView;
-        }
-        else if(resource.equals(_db2))
-        {
+        } else if (resource.equals(_db2)) {
           return _externalView2;
         }
       }
       return null;
     }
   }
-  class MockHelixManager extends Mocks.MockManager
-  {
+
+  class MockHelixManager extends Mocks.MockManager {
     MockDataAccessor _accessor = new MockDataAccessor();
 
     @Override
-		public HelixDataAccessor getHelixDataAccessor()
-    {
+    public HelixDataAccessor getHelixDataAccessor() {
       return _accessor;
     }
 
   }
+
   @Test()
-  public void TestReportData()
-  {
-  	System.out.println("START TestClusterStatusMonitor at" + new Date(System.currentTimeMillis()));
+  public void TestReportData() {
+    System.out.println("START TestClusterStatusMonitor at" + new Date(System.currentTimeMillis()));
     List<String> _instances;
     List<ZNRecord> _liveInstances = new ArrayList<ZNRecord>();
     String _db = "DB";
@@ -100,20 +91,21 @@ public class TestClusterStatusMonitor
     int _partitions = 50;
 
     _instances = new ArrayList<String>();
-    for(int i = 0;i < 5; i++)
-    {
-      String instance = "localhost_"+(12918+i);
+    for (int i = 0; i < 5; i++) {
+      String instance = "localhost_" + (12918 + i);
       _instances.add(instance);
       ZNRecord metaData = new ZNRecord(instance);
-      metaData.setSimpleField(LiveInstanceProperty.SESSION_ID.toString(),
-          UUID.randomUUID().toString());
+      metaData.setSimpleField(LiveInstanceProperty.SESSION_ID.toString(), UUID.randomUUID()
+          .toString());
       _liveInstances.add(metaData);
     }
-    ZNRecord externalView = DefaultIdealStateCalculator.calculateIdealState(
-        _instances, _partitions, _replicas, _db, "MASTER", "SLAVE");
+    ZNRecord externalView =
+        DefaultIdealStateCalculator.calculateIdealState(_instances, _partitions, _replicas, _db,
+            "MASTER", "SLAVE");
 
-    ZNRecord externalView2 = DefaultIdealStateCalculator.calculateIdealState(
-        _instances, 80, 2, "TestDB", "MASTER", "SLAVE");
+    ZNRecord externalView2 =
+        DefaultIdealStateCalculator.calculateIdealState(_instances, 80, 2, "TestDB", "MASTER",
+            "SLAVE");
 
     List<ZNRecord> externalViews = new ArrayList<ZNRecord>();
     externalViews.add(externalView);

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestResourceMonitor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestResourceMonitor.java b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestResourceMonitor.java
index 9d50d51..d631dd2 100644
--- a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestResourceMonitor.java
+++ b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestResourceMonitor.java
@@ -39,32 +39,24 @@ import org.apache.helix.tools.DefaultIdealStateCalculator;
 import org.testng.AssertJUnit;
 import org.testng.annotations.Test;
 
-
-public class TestResourceMonitor
-{
+public class TestResourceMonitor {
   String _clusterName = "Test-cluster";
   String _dbName = "TestDB";
   int _replicas = 3;
   int _partitions = 50;
 
-  class MockHelixManager extends Mocks.MockManager
-  {
-    class MockDataAccessor extends Mocks.MockAccessor
-    {
+  class MockHelixManager extends Mocks.MockManager {
+    class MockDataAccessor extends Mocks.MockAccessor {
       @Override
-      public <T extends HelixProperty> List<T>  getChildValues(PropertyKey key)
-      {
+      public <T extends HelixProperty> List<T> getChildValues(PropertyKey key) {
         List<T> result = new ArrayList<T>();
         PropertyType type = key.getType();
         Class<? extends HelixProperty> clazz = key.getTypeClass();
-        if (type == PropertyType.EXTERNALVIEW)
-        {
+        if (type == PropertyType.EXTERNALVIEW) {
           HelixProperty typedInstance = HelixProperty.convertToTypedInstance(clazz, _externalView);
           result.add((T) typedInstance);
           return result;
-        }
-        else if (type == PropertyType.LIVEINSTANCES)
-        {
+        } else if (type == PropertyType.LIVEINSTANCES) {
           return (List<T>) HelixProperty.convertToTypedList(clazz, _liveInstances);
         }
 
@@ -72,15 +64,11 @@ public class TestResourceMonitor
       }
 
       @Override
-      public  <T extends HelixProperty> T  getProperty(PropertyKey key)
-      {
+      public <T extends HelixProperty> T getProperty(PropertyKey key) {
         PropertyType type = key.getType();
-        if (type == PropertyType.EXTERNALVIEW)
-        {
+        if (type == PropertyType.EXTERNALVIEW) {
           return (T) new ExternalView(_externalView);
-        }
-        else if (type == PropertyType.IDEALSTATES)
-        {
+        } else if (type == PropertyType.IDEALSTATES) {
           return (T) new IdealState(_idealState);
         }
         return null;
@@ -94,46 +82,38 @@ public class TestResourceMonitor
     List<ZNRecord> _liveInstances;
     String _db = "DB";
 
-    public MockHelixManager()
-    {
+    public MockHelixManager() {
       _liveInstances = new ArrayList<ZNRecord>();
       _instances = new ArrayList<String>();
-      for(int i = 0;i<5; i++)
-      {
-        String instance = "localhost_"+(12918+i);
+      for (int i = 0; i < 5; i++) {
+        String instance = "localhost_" + (12918 + i);
         _instances.add(instance);
         ZNRecord metaData = new ZNRecord(instance);
-        metaData.setSimpleField(LiveInstanceProperty.SESSION_ID.toString(),
-            UUID.randomUUID().toString());
+        metaData.setSimpleField(LiveInstanceProperty.SESSION_ID.toString(), UUID.randomUUID()
+            .toString());
 
       }
-      _idealState= DefaultIdealStateCalculator.calculateIdealState(_instances,
-                                                                          _partitions,
-                                                                          _replicas,
-                                                                          _dbName,
-                                                                          "MASTER",
-                                                                          "SLAVE");
+      _idealState =
+          DefaultIdealStateCalculator.calculateIdealState(_instances, _partitions, _replicas,
+              _dbName, "MASTER", "SLAVE");
       _externalView = new ZNRecord(_idealState);
     }
 
     @Override
-    public HelixDataAccessor getHelixDataAccessor()
-    {
+    public HelixDataAccessor getHelixDataAccessor() {
       return _accessor;
     }
 
   }
 
   @Test()
-  public void TestReportData()
-  {
+  public void TestReportData() {
     MockHelixManager manager = new MockHelixManager();
     ResourceMonitor monitor = new ResourceMonitor(_clusterName, _dbName);
 
     HelixDataAccessor helixDataAccessor = manager.getHelixDataAccessor();
     Builder keyBuilder = helixDataAccessor.keyBuilder();
-    ExternalView externalView = 
-        helixDataAccessor.getProperty(keyBuilder.externalView(_dbName));
+    ExternalView externalView = helixDataAccessor.getProperty(keyBuilder.externalView(_dbName));
     IdealState idealState = helixDataAccessor.getProperty(keyBuilder.idealStates(_dbName));
 
     monitor.updateExternalView(externalView, idealState);
@@ -145,8 +125,7 @@ public class TestResourceMonitor
     monitor.getBeanName();
 
     int n = 4;
-    for (int i = 0; i < n; i++)
-    {
+    for (int i = 0; i < n; i++) {
       Map<String, String> map = externalView.getStateMap(_dbName + "_" + 3 * i);
       String key = map.keySet().toArray()[0].toString();
       map.put(key, "ERROR");
@@ -160,14 +139,12 @@ public class TestResourceMonitor
     AssertJUnit.assertEquals(monitor.getPartitionGauge(), _partitions);
 
     n = 5;
-    for (int i = 0; i < n; i++)
-    {
+    for (int i = 0; i < n; i++) {
       externalView.getRecord().getMapFields().remove(_dbName + "_" + 4 * i);
     }
 
     monitor.updateExternalView(externalView, idealState);
-    AssertJUnit.assertEquals(monitor.getDifferenceWithIdealStateGauge(), n
-        * (_replicas + 1));
+    AssertJUnit.assertEquals(monitor.getDifferenceWithIdealStateGauge(), n * (_replicas + 1));
     AssertJUnit.assertEquals(monitor.getErrorPartitionGauge(), 3);
     AssertJUnit.assertEquals(monitor.getExternalViewPartitionGauge(), _partitions - n);
     AssertJUnit.assertEquals(monitor.getPartitionGauge(), _partitions);

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/participant/MockZKHelixManager.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/participant/MockZKHelixManager.java b/helix-core/src/test/java/org/apache/helix/participant/MockZKHelixManager.java
index 8fedf01..6de77b2 100644
--- a/helix-core/src/test/java/org/apache/helix/participant/MockZKHelixManager.java
+++ b/helix-core/src/test/java/org/apache/helix/participant/MockZKHelixManager.java
@@ -49,19 +49,14 @@ import org.apache.helix.manager.zk.ZkClient;
 import org.apache.helix.model.HelixConfigScope.ConfigScopeProperty;
 import org.apache.helix.store.zk.ZkHelixPropertyStore;
 
-
-public class MockZKHelixManager implements HelixManager
-{
+public class MockZKHelixManager implements HelixManager {
   private final ZKHelixDataAccessor _accessor;
-  private final String              _instanceName;
-  private final String              _clusterName;
-  private final InstanceType        _type;
-
-  public MockZKHelixManager(String clusterName,
-                            String instanceName,
-                            InstanceType type,
-                            ZkClient zkClient)
-  {
+  private final String _instanceName;
+  private final String _clusterName;
+  private final InstanceType _type;
+
+  public MockZKHelixManager(String clusterName, String instanceName, InstanceType type,
+      ZkClient zkClient) {
     _instanceName = instanceName;
     _clusterName = clusterName;
     _type = type;
@@ -69,226 +64,195 @@ public class MockZKHelixManager implements HelixManager
   }
 
   @Override
-  public void connect() throws Exception
-  {
+  public void connect() throws Exception {
     // TODO Auto-generated method stub
 
   }
 
   @Override
-  public boolean isConnected()
-  {
+  public boolean isConnected() {
     // TODO Auto-generated method stub
     return false;
   }
 
   @Override
-  public void disconnect()
-  {
+  public void disconnect() {
     // TODO Auto-generated method stub
 
   }
 
   @Override
-  public void addIdealStateChangeListener(IdealStateChangeListener listener) throws Exception
-  {
+  public void addIdealStateChangeListener(IdealStateChangeListener listener) throws Exception {
     // TODO Auto-generated method stub
 
   }
 
   @Override
-  public void addLiveInstanceChangeListener(LiveInstanceChangeListener listener) throws Exception
-  {
+  public void addLiveInstanceChangeListener(LiveInstanceChangeListener listener) throws Exception {
     // TODO Auto-generated method stub
 
   }
 
   @Override
-  public void addConfigChangeListener(ConfigChangeListener listener) throws Exception
-  {
+  public void addConfigChangeListener(ConfigChangeListener listener) throws Exception {
     // TODO Auto-generated method stub
 
   }
 
   @Override
-  public void addMessageListener(MessageListener listener, String instanceName) throws Exception
-  {
+  public void addMessageListener(MessageListener listener, String instanceName) throws Exception {
     // TODO Auto-generated method stub
 
   }
 
   @Override
   public void addCurrentStateChangeListener(CurrentStateChangeListener listener,
-                                            String instanceName,
-                                            String sessionId) throws Exception
-  {
+      String instanceName, String sessionId) throws Exception {
     // TODO Auto-generated method stub
 
   }
 
   @Override
-  public void addExternalViewChangeListener(ExternalViewChangeListener listener) throws Exception
-  {
+  public void addExternalViewChangeListener(ExternalViewChangeListener listener) throws Exception {
     // TODO Auto-generated method stub
 
   }
 
   @Override
-  public boolean removeListener(PropertyKey key, Object listener)
-  {
+  public boolean removeListener(PropertyKey key, Object listener) {
     // TODO Auto-generated method stub
     return false;
   }
 
   @Override
-  public HelixDataAccessor getHelixDataAccessor()
-  {
+  public HelixDataAccessor getHelixDataAccessor() {
     return _accessor;
   }
 
   @Override
-  public String getClusterName()
-  {
+  public String getClusterName() {
     return _clusterName;
   }
 
   @Override
-  public String getInstanceName()
-  {
+  public String getInstanceName() {
     return _instanceName;
   }
 
   @Override
-  public String getSessionId()
-  {
+  public String getSessionId() {
     // TODO Auto-generated method stub
     return UUID.randomUUID().toString();
   }
 
   @Override
-  public long getLastNotificationTime()
-  {
+  public long getLastNotificationTime() {
     // TODO Auto-generated method stub
     return 0;
   }
 
   @Override
-  public void addControllerListener(ControllerChangeListener listener)
-  {
+  public void addControllerListener(ControllerChangeListener listener) {
     // TODO Auto-generated method stub
 
   }
 
   @Override
-  public HelixAdmin getClusterManagmentTool()
-  {
+  public HelixAdmin getClusterManagmentTool() {
     // TODO Auto-generated method stub
     return null;
   }
 
   @Override
-  public ClusterMessagingService getMessagingService()
-  {
+  public ClusterMessagingService getMessagingService() {
     // TODO Auto-generated method stub
     return null;
   }
 
   @Override
-  public ParticipantHealthReportCollector getHealthReportCollector()
-  {
+  public ParticipantHealthReportCollector getHealthReportCollector() {
     // TODO Auto-generated method stub
     return null;
   }
 
   @Override
-  public InstanceType getInstanceType()
-  {
+  public InstanceType getInstanceType() {
     return _type;
   }
 
   @Override
-  public void addHealthStateChangeListener(HealthStateChangeListener listener,
-                                           String instanceName) throws Exception
-  {
+  public void addHealthStateChangeListener(HealthStateChangeListener listener, String instanceName)
+      throws Exception {
     // TODO Auto-generated method stub
 
   }
 
   @Override
-  public String getVersion()
-  {
+  public String getVersion() {
     // TODO Auto-generated method stub
     return UUID.randomUUID().toString();
   }
 
   @Override
-  public StateMachineEngine getStateMachineEngine()
-  {
+  public StateMachineEngine getStateMachineEngine() {
     // TODO Auto-generated method stub
     return null;
   }
 
   @Override
-  public boolean isLeader()
-  {
+  public boolean isLeader() {
     // TODO Auto-generated method stub
     return false;
   }
 
   @Override
-  public ConfigAccessor getConfigAccessor()
-  {
+  public ConfigAccessor getConfigAccessor() {
     // TODO Auto-generated method stub
     return null;
   }
 
   @Override
-  public void startTimerTasks()
-  {
+  public void startTimerTasks() {
     // TODO Auto-generated method stub
 
   }
 
   @Override
-  public void stopTimerTasks()
-  {
+  public void stopTimerTasks() {
     // TODO Auto-generated method stub
 
   }
 
   @Override
-  public void addPreConnectCallback(PreConnectCallback callback)
-  {
+  public void addPreConnectCallback(PreConnectCallback callback) {
     // TODO Auto-generated method stub
-    
+
   }
 
   @Override
-  public ZkHelixPropertyStore<ZNRecord> getHelixPropertyStore()
-  {
+  public ZkHelixPropertyStore<ZNRecord> getHelixPropertyStore() {
     // TODO Auto-generated method stub
     return null;
   }
-  
+
   @Override
-  public void addInstanceConfigChangeListener(InstanceConfigChangeListener listener) throws Exception {
-  	// TODO Auto-generated method stub
+  public void addInstanceConfigChangeListener(InstanceConfigChangeListener listener)
+      throws Exception {
+    // TODO Auto-generated method stub
 
   }
 
   @Override
   public void addConfigChangeListener(ScopedConfigChangeListener listener, ConfigScopeProperty scope)
-          throws Exception {
-  	// TODO Auto-generated method stub
+      throws Exception {
+    // TODO Auto-generated method stub
 
   }
 
   @Override
-  public void setLiveInstanceInfoProvider(
-      LiveInstanceInfoProvider liveInstanceInfoProvider)
-  {
+  public void setLiveInstanceInfoProvider(LiveInstanceInfoProvider liveInstanceInfoProvider) {
     // TODO Auto-generated method stub
-    
+
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerElection.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerElection.java b/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerElection.java
index 622cbaa..fc80d2a 100644
--- a/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerElection.java
+++ b/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerElection.java
@@ -38,54 +38,50 @@ import org.apache.log4j.Logger;
 import org.testng.AssertJUnit;
 import org.testng.annotations.Test;
 
-
-public class TestDistControllerElection extends ZkUnitTestBase
-{
+public class TestDistControllerElection extends ZkUnitTestBase {
   private static Logger LOG = Logger.getLogger(TestDistControllerElection.class);
 
   @Test()
-  public void testController() throws Exception
-  {
+  public void testController() throws Exception {
     System.out.println("START TestDistControllerElection at "
         + new Date(System.currentTimeMillis()));
     String className = getShortClassName();
 
     final String clusterName = CLUSTER_PREFIX + "_" + className + "_" + "testController";
     String path = "/" + clusterName;
-    if (_gZkClient.exists(path))
-    {
+    if (_gZkClient.exists(path)) {
       _gZkClient.deleteRecursive(path);
     }
-   
-    ZKHelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor(_gZkClient));
+
+    ZKHelixDataAccessor accessor =
+        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor(_gZkClient));
     Builder keyBuilder = accessor.keyBuilder();
 
     TestHelper.setupEmptyCluster(_gZkClient, clusterName);
 
     final String controllerName = "controller_0";
-    HelixManager manager = new MockZKHelixManager(clusterName, controllerName,
-                               InstanceType.CONTROLLER,
-                               _gZkClient);
+    HelixManager manager =
+        new MockZKHelixManager(clusterName, controllerName, InstanceType.CONTROLLER, _gZkClient);
 
     DistClusterControllerElection election = new DistClusterControllerElection(ZK_ADDR);
     NotificationContext context = new NotificationContext(manager);
     context.setType(NotificationContext.Type.INIT);
     election.onControllerChange(context);
 
-//    path = PropertyPathConfig.getPath(PropertyType.LEADER, clusterName);
-//    ZNRecord leaderRecord = _gZkClient.<ZNRecord> readData(path);
+    // path = PropertyPathConfig.getPath(PropertyType.LEADER, clusterName);
+    // ZNRecord leaderRecord = _gZkClient.<ZNRecord> readData(path);
     LiveInstance liveInstance = accessor.getProperty(keyBuilder.controllerLeader());
     AssertJUnit.assertEquals(controllerName, liveInstance.getInstanceName());
     // AssertJUnit.assertNotNull(election.getController());
     // AssertJUnit.assertNull(election.getLeader());
 
-    manager = new MockZKHelixManager(clusterName, "controller_1", InstanceType.CONTROLLER,
-                               _gZkClient);
+    manager =
+        new MockZKHelixManager(clusterName, "controller_1", InstanceType.CONTROLLER, _gZkClient);
     election = new DistClusterControllerElection(ZK_ADDR);
     context = new NotificationContext(manager);
     context.setType(NotificationContext.Type.INIT);
     election.onControllerChange(context);
-//    leaderRecord = _gZkClient.<ZNRecord> readData(path);
+    // leaderRecord = _gZkClient.<ZNRecord> readData(path);
     liveInstance = accessor.getProperty(keyBuilder.controllerLeader());
     AssertJUnit.assertEquals(controllerName, liveInstance.getInstanceName());
     // AssertJUnit.assertNull(election.getController());
@@ -95,28 +91,27 @@ public class TestDistControllerElection extends ZkUnitTestBase
   }
 
   @Test()
-  public void testControllerParticipant() throws Exception
-  {
+  public void testControllerParticipant() throws Exception {
     String className = getShortClassName();
     LOG.info("RUN " + className + " at " + new Date(System.currentTimeMillis()));
 
-    final String clusterName = CONTROLLER_CLUSTER_PREFIX + "_" + className + "_"
-        + "testControllerParticipant";
+    final String clusterName =
+        CONTROLLER_CLUSTER_PREFIX + "_" + className + "_" + "testControllerParticipant";
     String path = "/" + clusterName;
-    if (_gZkClient.exists(path))
-    {
+    if (_gZkClient.exists(path)) {
       _gZkClient.deleteRecursive(path);
     }
-    
-    ZKHelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor(_gZkClient));
+
+    ZKHelixDataAccessor accessor =
+        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor(_gZkClient));
     Builder keyBuilder = accessor.keyBuilder();
 
     TestHelper.setupEmptyCluster(_gZkClient, clusterName);
 
     final String controllerName = "controller_0";
-    HelixManager manager = new MockZKHelixManager(clusterName, controllerName,
-                               InstanceType.CONTROLLER_PARTICIPANT,
-                               _gZkClient);
+    HelixManager manager =
+        new MockZKHelixManager(clusterName, controllerName, InstanceType.CONTROLLER_PARTICIPANT,
+            _gZkClient);
 
     DistClusterControllerElection election = new DistClusterControllerElection(ZK_ADDR);
     NotificationContext context = new NotificationContext(manager);
@@ -126,15 +121,15 @@ public class TestDistControllerElection extends ZkUnitTestBase
     LiveInstance liveInstance = accessor.getProperty(keyBuilder.controllerLeader());
     AssertJUnit.assertEquals(controllerName, liveInstance.getInstanceName());
 
-//    path = PropertyPathConfig.getPath(PropertyType.LEADER, clusterName);
-//    ZNRecord leaderRecord = _gZkClient.<ZNRecord> readData(path);
-//    AssertJUnit.assertEquals(controllerName, leaderRecord.getSimpleField("LEADER"));
+    // path = PropertyPathConfig.getPath(PropertyType.LEADER, clusterName);
+    // ZNRecord leaderRecord = _gZkClient.<ZNRecord> readData(path);
+    // AssertJUnit.assertEquals(controllerName, leaderRecord.getSimpleField("LEADER"));
     // AssertJUnit.assertNotNull(election.getController());
     // AssertJUnit.assertNotNull(election.getLeader());
 
-    manager = new MockZKHelixManager(clusterName, "controller_1",
-                               InstanceType.CONTROLLER_PARTICIPANT,
-                               _gZkClient);
+    manager =
+        new MockZKHelixManager(clusterName, "controller_1", InstanceType.CONTROLLER_PARTICIPANT,
+            _gZkClient);
     election = new DistClusterControllerElection(ZK_ADDR);
     context = new NotificationContext(manager);
     context.setType(NotificationContext.Type.CALLBACK);
@@ -143,8 +138,8 @@ public class TestDistControllerElection extends ZkUnitTestBase
     liveInstance = accessor.getProperty(keyBuilder.controllerLeader());
     AssertJUnit.assertEquals(controllerName, liveInstance.getInstanceName());
 
-//    leaderRecord = _gZkClient.<ZNRecord> readData(path);
-//    AssertJUnit.assertEquals(controllerName, leaderRecord.getSimpleField("LEADER"));
+    // leaderRecord = _gZkClient.<ZNRecord> readData(path);
+    // AssertJUnit.assertEquals(controllerName, leaderRecord.getSimpleField("LEADER"));
     // AssertJUnit.assertNull(election.getController());
     // AssertJUnit.assertNull(election.getLeader());
 
@@ -152,23 +147,20 @@ public class TestDistControllerElection extends ZkUnitTestBase
   }
 
   @Test()
-  public void testParticipant() throws Exception
-  {
+  public void testParticipant() throws Exception {
     String className = getShortClassName();
     LOG.info("RUN " + className + " at " + new Date(System.currentTimeMillis()));
 
     final String clusterName = CLUSTER_PREFIX + "_" + className + "_" + "testParticipant";
     String path = "/" + clusterName;
-    if (_gZkClient.exists(path))
-    {
+    if (_gZkClient.exists(path)) {
       _gZkClient.deleteRecursive(path);
     }
     TestHelper.setupEmptyCluster(_gZkClient, clusterName);
 
     final String controllerName = "participant_0";
-    HelixManager manager = new MockZKHelixManager(clusterName, controllerName,
-                               InstanceType.PARTICIPANT,
-                               _gZkClient);
+    HelixManager manager =
+        new MockZKHelixManager(clusterName, controllerName, InstanceType.PARTICIPANT, _gZkClient);
 
     DistClusterControllerElection election = new DistClusterControllerElection(ZK_ADDR);
     NotificationContext context = new NotificationContext(manager);

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerStateModel.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerStateModel.java b/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerStateModel.java
index c48f59a..ae700a4 100644
--- a/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerStateModel.java
+++ b/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerStateModel.java
@@ -28,41 +28,32 @@ import org.apache.helix.participant.DistClusterControllerStateModel;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-
-public class TestDistControllerStateModel extends ZkUnitTestBase
-{
+public class TestDistControllerStateModel extends ZkUnitTestBase {
   final String clusterName = CLUSTER_PREFIX + "_" + getShortClassName();
   DistClusterControllerStateModel stateModel = null;
 
   @BeforeMethod()
-  public void beforeMethod()
-  {
+  public void beforeMethod() {
     stateModel = new DistClusterControllerStateModel(ZK_ADDR);
-    if (_gZkClient.exists("/" + clusterName))
-    {
+    if (_gZkClient.exists("/" + clusterName)) {
       _gZkClient.deleteRecursive("/" + clusterName);
     }
     TestHelper.setupEmptyCluster(_gZkClient, clusterName);
   }
 
   @Test()
-  public void testOnBecomeStandbyFromOffline()
-  {
+  public void testOnBecomeStandbyFromOffline() {
     stateModel.onBecomeStandbyFromOffline(null, null);
   }
 
   @Test()
-  public void testOnBecomeLeaderFromStandby()
-  {
+  public void testOnBecomeLeaderFromStandby() {
     Message message = new Message(MessageType.STATE_TRANSITION, "0");
     message.setPartitionName(clusterName);
     message.setTgtName("controller_0");
-    try
-    {
+    try {
       stateModel.onBecomeLeaderFromStandby(message, new NotificationContext(null));
-    }
-    catch (Exception e)
-    {
+    } catch (Exception e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
@@ -70,8 +61,7 @@ public class TestDistControllerStateModel extends ZkUnitTestBase
   }
 
   @Test()
-  public void testOnBecomeStandbyFromLeader()
-  {
+  public void testOnBecomeStandbyFromLeader() {
     Message message = new Message(MessageType.STATE_TRANSITION, "0");
     message.setPartitionName(clusterName);
     message.setTgtName("controller_0");
@@ -79,8 +69,7 @@ public class TestDistControllerStateModel extends ZkUnitTestBase
   }
 
   @Test()
-  public void testOnBecomeOfflineFromStandby()
-  {
+  public void testOnBecomeOfflineFromStandby() {
     Message message = new Message(MessageType.STATE_TRANSITION, "0");
     message.setPartitionName(clusterName);
     message.setTgtName("controller_0");
@@ -89,29 +78,23 @@ public class TestDistControllerStateModel extends ZkUnitTestBase
   }
 
   @Test()
-  public void testOnBecomeDroppedFromOffline()
-  {
+  public void testOnBecomeDroppedFromOffline() {
     stateModel.onBecomeDroppedFromOffline(null, null);
   }
 
   @Test()
-  public void testOnBecomeOfflineFromDropped()
-  {
+  public void testOnBecomeOfflineFromDropped() {
     stateModel.onBecomeOfflineFromDropped(null, null);
   }
 
   @Test()
-  public void testRollbackOnError()
-  {
+  public void testRollbackOnError() {
     Message message = new Message(MessageType.STATE_TRANSITION, "0");
     message.setPartitionName(clusterName);
     message.setTgtName("controller_0");
-    try
-    {
+    try {
       stateModel.onBecomeLeaderFromStandby(message, new NotificationContext(null));
-    }
-    catch (Exception e)
-    {
+    } catch (Exception e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
@@ -119,17 +102,13 @@ public class TestDistControllerStateModel extends ZkUnitTestBase
   }
 
   @Test()
-  public void testReset()
-  {
+  public void testReset() {
     Message message = new Message(MessageType.STATE_TRANSITION, "0");
     message.setPartitionName(clusterName);
     message.setTgtName("controller_0");
-    try
-    {
+    try {
       stateModel.onBecomeLeaderFromStandby(message, new NotificationContext(null));
-    }
-    catch (Exception e)
-    {
+    } catch (Exception e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerStateModelFactory.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerStateModelFactory.java b/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerStateModelFactory.java
index 0a52fd9..dae58b3 100644
--- a/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerStateModelFactory.java
+++ b/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerStateModelFactory.java
@@ -25,15 +25,15 @@ import org.apache.helix.participant.DistClusterControllerStateModelFactory;
 import org.testng.annotations.Test;
 import org.testng.annotations.Test;
 
-
-public class TestDistControllerStateModelFactory
-{
+public class TestDistControllerStateModelFactory {
   final String zkAddr = ZkUnitTestBase.ZK_ADDR;
-      
-  @Test(groups = { "unitTest" })
-  public void testDistControllerStateModelFactory()
-  {
-    DistClusterControllerStateModelFactory factory = new DistClusterControllerStateModelFactory(zkAddr);
+
+  @Test(groups = {
+    "unitTest"
+  })
+  public void testDistControllerStateModelFactory() {
+    DistClusterControllerStateModelFactory factory =
+        new DistClusterControllerStateModelFactory(zkAddr);
     DistClusterControllerStateModel stateModel = factory.createNewStateModel("key");
     stateModel.onBecomeStandbyFromOffline(null, null);
   }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/participant/statemachine/TestStateModelParser.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/participant/statemachine/TestStateModelParser.java b/helix-core/src/test/java/org/apache/helix/participant/statemachine/TestStateModelParser.java
index 8cbab46..7c128fb 100644
--- a/helix-core/src/test/java/org/apache/helix/participant/statemachine/TestStateModelParser.java
+++ b/helix-core/src/test/java/org/apache/helix/participant/statemachine/TestStateModelParser.java
@@ -31,7 +31,9 @@ public class TestStateModelParser {
 
   private static Logger LOG = Logger.getLogger(TestStateModelParser.class);
 
-  @StateModelInfo(initialState = "OFFLINE", states = { "MASTER", "SLAVE", "ERROR" })
+  @StateModelInfo(initialState = "OFFLINE", states = {
+      "MASTER", "SLAVE", "ERROR"
+  })
   class StateModelUsingAnnotation extends StateModel {
     @Transition(to = "SLAVE", from = "OFFLINE")
     public void onBecomeSlaveFromOffline(Message message, NotificationContext context) {
@@ -46,7 +48,9 @@ public class TestStateModelParser {
 
   }
 
-  @StateModelInfo(initialState = "OFFLINE", states = { "MASTER", "SLAVE", "ERROR" })
+  @StateModelInfo(initialState = "OFFLINE", states = {
+      "MASTER", "SLAVE", "ERROR"
+  })
   class DerivedStateModelUsingAnnotation extends StateModelUsingAnnotation {
     @Transition(to = "SLAVE", from = "OFFLINE")
     public void derivedOnBecomeSlaveFromOffline(Message message, NotificationContext context) {
@@ -54,8 +58,7 @@ public class TestStateModelParser {
     }
   }
 
-  class StateModelUsingNameConvention extends StateModel
-  {
+  class StateModelUsingNameConvention extends StateModel {
     // empty state model
   }
 
@@ -64,10 +67,11 @@ public class TestStateModelParser {
     StateModelParser parser = new StateModelParser();
     StateModelUsingAnnotation testModel = new StateModelUsingAnnotation();
 
-    Method method = parser.getMethodForTransitionUsingAnnotation(testModel.getClass(),
-        "offline",
-        "slave",
-        new Class[] { Message.class, NotificationContext.class});
+    Method method =
+        parser.getMethodForTransitionUsingAnnotation(testModel.getClass(), "offline", "slave",
+            new Class[] {
+                Message.class, NotificationContext.class
+            });
 
     // System.out.println("method-name: " + method.getName());
     Assert.assertNotNull(method);
@@ -79,20 +83,21 @@ public class TestStateModelParser {
     StateModelParser parser = new StateModelParser();
     DerivedStateModelUsingAnnotation testModel = new DerivedStateModelUsingAnnotation();
 
-    Method method = parser.getMethodForTransitionUsingAnnotation(testModel.getClass(),
-        "offline",
-        "slave",
-        new Class[] { Message.class, NotificationContext.class});
+    Method method =
+        parser.getMethodForTransitionUsingAnnotation(testModel.getClass(), "offline", "slave",
+            new Class[] {
+                Message.class, NotificationContext.class
+            });
 
     // System.out.println("method-name: " + method.getName());
     Assert.assertNotNull(method);
     Assert.assertEquals(method.getName(), "derivedOnBecomeSlaveFromOffline");
 
-
-    method = parser.getMethodForTransitionUsingAnnotation(testModel.getClass(),
-        "error",
-        "dropped",
-        new Class[] { Message.class, NotificationContext.class});
+    method =
+        parser.getMethodForTransitionUsingAnnotation(testModel.getClass(), "error", "dropped",
+            new Class[] {
+                Message.class, NotificationContext.class
+            });
 
     // System.out.println("method: " + method);
     Assert.assertNotNull(method);
@@ -100,17 +105,15 @@ public class TestStateModelParser {
 
   }
 
-
   @Test
-  public void testUsingNameConvention()
-  {
+  public void testUsingNameConvention() {
     StateModelParser parser = new StateModelParser();
     StateModelUsingNameConvention testModel = new StateModelUsingNameConvention();
 
-    Method method = parser.getMethodForTransition(testModel.getClass(),
-                                                 "error",
-                                                 "dropped",
-                                                 new Class[] { Message.class, NotificationContext.class});
+    Method method =
+        parser.getMethodForTransition(testModel.getClass(), "error", "dropped", new Class[] {
+            Message.class, NotificationContext.class
+        });
     Assert.assertNotNull(method);
     Assert.assertEquals(method.getName(), "onBecomeDroppedFromError");
 

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/store/TestJsonComparator.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/store/TestJsonComparator.java b/helix-core/src/test/java/org/apache/helix/store/TestJsonComparator.java
index eb12d9e..e31fa77 100644
--- a/helix-core/src/test/java/org/apache/helix/store/TestJsonComparator.java
+++ b/helix-core/src/test/java/org/apache/helix/store/TestJsonComparator.java
@@ -26,16 +26,16 @@ import org.apache.helix.store.PropertyJsonComparator;
 import org.testng.AssertJUnit;
 import org.testng.annotations.Test;
 
-
-public class TestJsonComparator
-{
-  @Test (groups = {"unitTest"})
-  public void testJsonComparator()
-  {
+public class TestJsonComparator {
+  @Test(groups = {
+    "unitTest"
+  })
+  public void testJsonComparator() {
     System.out.println("START TestJsonComparator at " + new Date(System.currentTimeMillis()));
 
     ZNRecord record = new ZNRecord("id1");
-    PropertyJsonComparator<ZNRecord> comparator = new PropertyJsonComparator<ZNRecord>(ZNRecord.class);
+    PropertyJsonComparator<ZNRecord> comparator =
+        new PropertyJsonComparator<ZNRecord>(ZNRecord.class);
     AssertJUnit.assertTrue(comparator.compare(null, null) == 0);
     AssertJUnit.assertTrue(comparator.compare(null, record) == -1);
     AssertJUnit.assertTrue(comparator.compare(record, null) == 1);

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/store/TestPropertyStat.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/store/TestPropertyStat.java b/helix-core/src/test/java/org/apache/helix/store/TestPropertyStat.java
index 095ec38..a27d02c 100644
--- a/helix-core/src/test/java/org/apache/helix/store/TestPropertyStat.java
+++ b/helix-core/src/test/java/org/apache/helix/store/TestPropertyStat.java
@@ -22,12 +22,11 @@ package org.apache.helix.store;
 import org.testng.AssertJUnit;
 import org.testng.annotations.Test;
 
-
-public class TestPropertyStat
-{
-  @Test (groups = {"unitTest"})
-  public void testPropertyStat()
-  {
+public class TestPropertyStat {
+  @Test(groups = {
+    "unitTest"
+  })
+  public void testPropertyStat() {
     PropertyStat stat = new PropertyStat(0, 0);
     AssertJUnit.assertEquals(0, stat.getLastModifiedTime());
     AssertJUnit.assertEquals(0, stat.getVersion());

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/store/TestPropertyStoreException.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/store/TestPropertyStoreException.java b/helix-core/src/test/java/org/apache/helix/store/TestPropertyStoreException.java
index 805a964..dfe4737 100644
--- a/helix-core/src/test/java/org/apache/helix/store/TestPropertyStoreException.java
+++ b/helix-core/src/test/java/org/apache/helix/store/TestPropertyStoreException.java
@@ -22,15 +22,14 @@ package org.apache.helix.store;
 import org.testng.AssertJUnit;
 import org.testng.annotations.Test;
 
-
-public class TestPropertyStoreException
-{
-  @Test (groups = {"unitTest"})
-  public void testPropertyStoreException()
-  {
+public class TestPropertyStoreException {
+  @Test(groups = {
+    "unitTest"
+  })
+  public void testPropertyStoreException() {
     PropertyStoreException exception = new PropertyStoreException("msg");
     AssertJUnit.assertEquals(exception.getMessage(), "msg");
-    
+
     exception = new PropertyStoreException();
     AssertJUnit.assertNull(exception.getMessage());
   }


Mime
View raw message