helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zzh...@apache.org
Subject [22/51] [partial] [HELIX-198] Unify helix code style, rb=13710
Date Wed, 21 Aug 2013 20:43:35 GMT
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/util/StatusUpdateUtil.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/util/StatusUpdateUtil.java b/helix-core/src/main/java/org/apache/helix/util/StatusUpdateUtil.java
index eed4909..02c39d1 100644
--- a/helix-core/src/main/java/org/apache/helix/util/StatusUpdateUtil.java
+++ b/helix-core/src/main/java/org/apache/helix/util/StatusUpdateUtil.java
@@ -44,27 +44,21 @@ import org.apache.helix.model.StatusUpdate;
 import org.apache.helix.model.Message.MessageType;
 import org.apache.log4j.Logger;
 
-
 /**
  * Util class to create statusUpdates ZK records and error ZK records. These message
  * records are for diagnostics only, and they are stored on the "StatusUpdates" and
  * "errors" ZNodes in the zookeeper instances.
- * 
- * 
- * */
-public class StatusUpdateUtil
-{
+ */
+public class StatusUpdateUtil {
   static Logger _logger = Logger.getLogger(StatusUpdateUtil.class);
 
-  public static class Transition implements Comparable<Transition>
-  {
+  public static class Transition implements Comparable<Transition> {
     private final String _msgID;
-    private final long   _timeStamp;
+    private final long _timeStamp;
     private final String _from;
     private final String _to;
 
-    public Transition(String msgID, long timeStamp, String from, String to)
-    {
+    public Transition(String msgID, long timeStamp, String from, String to) {
       this._msgID = msgID;
       this._timeStamp = timeStamp;
       this._from = from;
@@ -72,8 +66,7 @@ public class StatusUpdateUtil
     }
 
     @Override
-    public int compareTo(Transition t)
-    {
+    public int compareTo(Transition t) {
       if (_timeStamp < t._timeStamp)
         return -1;
       else if (_timeStamp > t._timeStamp)
@@ -82,55 +75,48 @@ public class StatusUpdateUtil
         return 0;
     }
 
-    public boolean equals(Transition t)
-    {
+    public boolean equals(Transition t) {
       return (_timeStamp == t._timeStamp && _from.equals(t._from) && _to.equals(t._to));
     }
 
-    public String getFromState()
-    {
+    public String getFromState() {
       return _from;
     }
 
-    public String getToState()
-    {
+    public String getToState() {
       return _to;
     }
 
-    public String getMsgID()
-    {
+    public String getMsgID() {
       return _msgID;
     }
 
     @Override
-    public String toString()
-    {
+    public String toString() {
       return _msgID + ":" + _timeStamp + ":" + _from + "->" + _to;
     }
   }
 
-  public static enum TaskStatus
-  {
-    UNKNOWN, NEW, SCHEDULED, INVOKING, COMPLETED, FAILED
+  public static enum TaskStatus {
+    UNKNOWN,
+    NEW,
+    SCHEDULED,
+    INVOKING,
+    COMPLETED,
+    FAILED
   }
 
-  public static class StatusUpdateContents
-  {
-    private final List<Transition>        _transitions;
+  public static class StatusUpdateContents {
+    private final List<Transition> _transitions;
     private final Map<String, TaskStatus> _taskMessages;
 
-    private StatusUpdateContents(List<Transition> transitions,
-                                 Map<String, TaskStatus> taskMessages)
-    {
+    private StatusUpdateContents(List<Transition> transitions, Map<String, TaskStatus> taskMessages) {
       this._transitions = transitions;
       this._taskMessages = taskMessages;
     }
 
     public static StatusUpdateContents getStatusUpdateContents(HelixDataAccessor accessor,
-                                                               String instance,
-                                                               String resourceGroup,
-                                                               String partition)
-    {
+        String instance, String resourceGroup, String partition) {
       return getStatusUpdateContents(accessor, instance, resourceGroup, null, partition);
     }
 
@@ -140,57 +126,41 @@ public class StatusUpdateUtil
     // But such a map is very similar to what exists in ZNRecord
     // passing null for sessionID results in searching across all sessions
     public static StatusUpdateContents getStatusUpdateContents(HelixDataAccessor accessor,
-                                                               String instance,
-                                                               String resourceGroup,
-                                                               String sessionID,
-                                                               String partition)
-    {
+        String instance, String resourceGroup, String sessionID, String partition) {
       Builder keyBuilder = accessor.keyBuilder();
 
       List<ZNRecord> instances =
           HelixProperty.convertToList(accessor.getChildValues(keyBuilder.instanceConfigs()));
       List<ZNRecord> partitionRecords = new ArrayList<ZNRecord>();
-      for (ZNRecord znRecord : instances)
-      {
+      for (ZNRecord znRecord : instances) {
         String instanceName = znRecord.getId();
-        if (!instanceName.equals(instance))
-        {
+        if (!instanceName.equals(instance)) {
           continue;
         }
 
         List<String> sessions = accessor.getChildNames(keyBuilder.sessions(instanceName));
-        for (String session : sessions)
-        {
-          if (sessionID != null && !session.equals(sessionID))
-          {
+        for (String session : sessions) {
+          if (sessionID != null && !session.equals(sessionID)) {
             continue;
           }
 
           List<String> resourceGroups =
-              accessor.getChildNames(keyBuilder.stateTransitionStatus(instanceName,
-                                                                      session));
-          for (String resourceGroupName : resourceGroups)
-          {
-            if (!resourceGroupName.equals(resourceGroup))
-            {
+              accessor.getChildNames(keyBuilder.stateTransitionStatus(instanceName, session));
+          for (String resourceGroupName : resourceGroups) {
+            if (!resourceGroupName.equals(resourceGroup)) {
               continue;
             }
 
             List<String> partitionStrings =
-                accessor.getChildNames(keyBuilder.stateTransitionStatus(instanceName,
-                                                                        session,
-                                                                        resourceGroupName));
+                accessor.getChildNames(keyBuilder.stateTransitionStatus(instanceName, session,
+                    resourceGroupName));
 
-            for (String partitionString : partitionStrings)
-            {
+            for (String partitionString : partitionStrings) {
               ZNRecord partitionRecord =
-                  accessor.getProperty(keyBuilder.stateTransitionStatus(instanceName,
-                                                                        session,
-                                                                        resourceGroupName,
-                                                                        partitionString))
-                          .getRecord();
-              if (!partitionString.equals(partition))
-              {
+                  accessor.getProperty(
+                      keyBuilder.stateTransitionStatus(instanceName, session, resourceGroupName,
+                          partitionString)).getRecord();
+              if (!partitionString.equals(partition)) {
                 continue;
               }
               partitionRecords.add(partitionRecord);
@@ -200,45 +170,34 @@ public class StatusUpdateUtil
       }
 
       return new StatusUpdateContents(getSortedTransitions(partitionRecords),
-                                      getTaskMessages(partitionRecords));
+          getTaskMessages(partitionRecords));
     }
 
-    public List<Transition> getTransitions()
-    {
+    public List<Transition> getTransitions() {
       return _transitions;
     }
 
-    public Map<String, TaskStatus> getTaskMessages()
-    {
+    public Map<String, TaskStatus> getTaskMessages() {
       return _taskMessages;
     }
 
     // input: List<ZNRecord> corresponding to (instance, database,
     // partition) tuples across all sessions
     // return list of transitions sorted from earliest to latest
-    private static List<Transition> getSortedTransitions(List<ZNRecord> partitionRecords)
-    {
+    private static List<Transition> getSortedTransitions(List<ZNRecord> partitionRecords) {
       List<Transition> transitions = new ArrayList<Transition>();
-      for (ZNRecord partition : partitionRecords)
-      {
+      for (ZNRecord partition : partitionRecords) {
         Map<String, Map<String, String>> mapFields = partition.getMapFields();
-        for (String key : mapFields.keySet())
-        {
-          if (key.startsWith("MESSAGE"))
-          {
+        for (String key : mapFields.keySet()) {
+          if (key.startsWith("MESSAGE")) {
             Map<String, String> m = mapFields.get(key);
             long createTimeStamp = 0;
-            try
-            {
+            try {
               createTimeStamp = Long.parseLong(m.get("CREATE_TIMESTAMP"));
+            } catch (Exception e) {
             }
-            catch (Exception e)
-            {
-            }
-            transitions.add(new Transition(m.get("MSG_ID"),
-                                           createTimeStamp,
-                                           m.get("FROM_STATE"),
-                                           m.get("TO_STATE")));
+            transitions.add(new Transition(m.get("MSG_ID"), createTimeStamp, m.get("FROM_STATE"), m
+                .get("TO_STATE")));
           }
         }
       }
@@ -246,18 +205,14 @@ public class StatusUpdateUtil
       return transitions;
     }
 
-    private static Map<String, TaskStatus> getTaskMessages(List<ZNRecord> partitionRecords)
-    {
+    private static Map<String, TaskStatus> getTaskMessages(List<ZNRecord> partitionRecords) {
       Map<String, TaskStatus> taskMessages = new HashMap<String, TaskStatus>();
-      for (ZNRecord partition : partitionRecords)
-      {
+      for (ZNRecord partition : partitionRecords) {
         Map<String, Map<String, String>> mapFields = partition.getMapFields();
         // iterate over the task status updates in the order they occurred
         // so that the last status can be recorded
-        for (String key : mapFields.keySet())
-        {
-          if (key.contains("STATE_TRANSITION"))
-          {
+        for (String key : mapFields.keySet()) {
+          if (key.contains("STATE_TRANSITION")) {
             Map<String, String> m = mapFields.get(key);
             String id = m.get("MSG_ID");
             String statusString = m.get("AdditionalInfo");
@@ -277,18 +232,17 @@ public class StatusUpdateUtil
     }
   }
 
-  public enum Level
-  {
-    HELIX_ERROR, HELIX_WARNING, HELIX_INFO
+  public enum Level {
+    HELIX_ERROR,
+    HELIX_WARNING,
+    HELIX_INFO
   }
 
   /**
    * Creates an empty ZNRecord as the statusUpdate/error record
-   * 
    * @param id
    */
-  public ZNRecord createEmptyStatusUpdateRecord(String id)
-  {
+  public ZNRecord createEmptyStatusUpdateRecord(String id) {
     return new ZNRecord(id);
   }
 
@@ -297,23 +251,19 @@ public class StatusUpdateUtil
    * simple fields) into the ZNRecord mapFields. In this way, the message update can be
    * merged with the previous status update record in the zookeeper. See ZNRecord.merge()
    * for more details.
-   * */
-  ZNRecord createMessageLogRecord(Message message)
-  {
+   */
+  ZNRecord createMessageLogRecord(Message message) {
     ZNRecord result = new ZNRecord(getStatusUpdateRecordName(message));
     String mapFieldKey = "MESSAGE " + message.getMsgId();
     result.setMapField(mapFieldKey, new TreeMap<String, String>());
 
     // Store all the simple fields of the message in the new ZNRecord's map
     // field.
-    for (String simpleFieldKey : message.getRecord().getSimpleFields().keySet())
-    {
+    for (String simpleFieldKey : message.getRecord().getSimpleFields().keySet()) {
       result.getMapField(mapFieldKey).put(simpleFieldKey,
-                                          message.getRecord()
-                                                 .getSimpleField(simpleFieldKey));
+          message.getRecord().getSimpleField(simpleFieldKey));
     }
-    if (message.getResultMap() != null)
-    {
+    if (message.getResultMap() != null) {
       result.setMapField("MessageResult", message.getResultMap());
     }
     return result;
@@ -323,7 +273,6 @@ public class StatusUpdateUtil
 
   /**
    * Create a statusupdate that is related to a cluster manager message.
-   * 
    * @param message
    *          the related cluster manager message
    * @param level
@@ -333,11 +282,8 @@ public class StatusUpdateUtil
    * @param additional
    *          info the additional debug information
    */
-  public ZNRecord createMessageStatusUpdateRecord(Message message,
-                                                  Level level,
-                                                  Class classInfo,
-                                                  String additionalInfo)
-  {
+  public ZNRecord createMessageStatusUpdateRecord(Message message, Level level, Class classInfo,
+      String additionalInfo) {
     ZNRecord result = createEmptyStatusUpdateRecord(getStatusUpdateRecordName(message));
     Map<String, String> contentMap = new TreeMap<String, String>();
 
@@ -349,24 +295,18 @@ public class StatusUpdateUtil
     DateFormat formatter = new SimpleDateFormat("yyyyMMdd-HHmmss.SSSSSS");
     String time = formatter.format(new Date());
 
-    String id =
-        String.format("%4s %26s ", level.toString(), time)
-            + getRecordIdForMessage(message);
+    String id = String.format("%4s %26s ", level.toString(), time) + getRecordIdForMessage(message);
 
     result.setMapField(id, contentMap);
 
     return result;
   }
 
-  String getRecordIdForMessage(Message message)
-  {
-    if (message.getMsgType().equals(MessageType.STATE_TRANSITION))
-    {
-      return message.getPartitionName() + " Trans:" + message.getFromState().charAt(0)
-          + "->" + message.getToState().charAt(0) + "  " + UUID.randomUUID().toString();
-    }
-    else
-    {
+  String getRecordIdForMessage(Message message) {
+    if (message.getMsgType().equals(MessageType.STATE_TRANSITION)) {
+      return message.getPartitionName() + " Trans:" + message.getFromState().charAt(0) + "->"
+          + message.getToState().charAt(0) + "  " + UUID.randomUUID().toString();
+    } else {
       return message.getMsgType() + " " + UUID.randomUUID().toString();
     }
   }
@@ -374,7 +314,6 @@ public class StatusUpdateUtil
   /**
    * Create a statusupdate that is related to a cluster manager message, then record it to
    * the zookeeper store.
-   * 
    * @param message
    *          the related cluster manager message
    * @param level
@@ -386,76 +325,42 @@ public class StatusUpdateUtil
    * @param accessor
    *          the zookeeper data accessor that writes the status update to zookeeper
    */
-  public void logMessageStatusUpdateRecord(Message message,
-                                           Level level,
-                                           Class classInfo,
-                                           String additionalInfo,
-                                           HelixDataAccessor accessor)
-  {
-    try
-    {
-      ZNRecord record =
-          createMessageStatusUpdateRecord(message, level, classInfo, additionalInfo);
+  public void logMessageStatusUpdateRecord(Message message, Level level, Class classInfo,
+      String additionalInfo, HelixDataAccessor accessor) {
+    try {
+      ZNRecord record = createMessageStatusUpdateRecord(message, level, classInfo, additionalInfo);
       publishStatusUpdateRecord(record, message, level, accessor);
-    }
-    catch (Exception e)
-    {
+    } catch (Exception e) {
       _logger.error("Exception while logging status update", e);
     }
   }
 
-  public void logError(Message message,
-                       Class classInfo,
-                       String additionalInfo,
-                       HelixDataAccessor accessor)
-  {
-    logMessageStatusUpdateRecord(message,
-                                 Level.HELIX_ERROR,
-                                 classInfo,
-                                 additionalInfo,
-                                 accessor);
+  public void logError(Message message, Class classInfo, String additionalInfo,
+      HelixDataAccessor accessor) {
+    logMessageStatusUpdateRecord(message, Level.HELIX_ERROR, classInfo, additionalInfo, accessor);
   }
 
-  public void logError(Message message,
-                       Class classInfo,
-                       Exception e,
-                       String additionalInfo,
-                       HelixDataAccessor accessor)
-  {
+  public void logError(Message message, Class classInfo, Exception e, String additionalInfo,
+      HelixDataAccessor accessor) {
     StringWriter sw = new StringWriter();
     PrintWriter pw = new PrintWriter(sw);
     e.printStackTrace(pw);
-    logMessageStatusUpdateRecord(message, Level.HELIX_ERROR, classInfo, additionalInfo
-        + sw.toString(), accessor);
+    logMessageStatusUpdateRecord(message, Level.HELIX_ERROR, classInfo,
+        additionalInfo + sw.toString(), accessor);
   }
 
-  public void logInfo(Message message,
-                      Class classInfo,
-                      String additionalInfo,
-                      HelixDataAccessor accessor)
-  {
-    logMessageStatusUpdateRecord(message,
-                                 Level.HELIX_INFO,
-                                 classInfo,
-                                 additionalInfo,
-                                 accessor);
+  public void logInfo(Message message, Class classInfo, String additionalInfo,
+      HelixDataAccessor accessor) {
+    logMessageStatusUpdateRecord(message, Level.HELIX_INFO, classInfo, additionalInfo, accessor);
   }
 
-  public void logWarning(Message message,
-                         Class classInfo,
-                         String additionalInfo,
-                         HelixDataAccessor accessor)
-  {
-    logMessageStatusUpdateRecord(message,
-                                 Level.HELIX_WARNING,
-                                 classInfo,
-                                 additionalInfo,
-                                 accessor);
+  public void logWarning(Message message, Class classInfo, String additionalInfo,
+      HelixDataAccessor accessor) {
+    logMessageStatusUpdateRecord(message, Level.HELIX_WARNING, classInfo, additionalInfo, accessor);
   }
 
   /**
    * Write a status update record to zookeeper to the zookeeper store.
-   * 
    * @param record
    *          the status update record
    * @param message
@@ -465,91 +370,72 @@ public class StatusUpdateUtil
    * @param accessor
    *          the zookeeper data accessor that writes the status update to zookeeper
    */
-  void publishStatusUpdateRecord(ZNRecord record,
-                                 Message message,
-                                 Level level,
-                                 HelixDataAccessor accessor)
-  {
+  void publishStatusUpdateRecord(ZNRecord record, Message message, Level level,
+      HelixDataAccessor accessor) {
     String instanceName = message.getTgtName();
     String statusUpdateSubPath = getStatusUpdateSubPath(message);
     String statusUpdateKey = getStatusUpdateKey(message);
     String sessionId = message.getExecutionSessionId();
-    if (sessionId == null)
-    {
+    if (sessionId == null) {
       sessionId = message.getTgtSessionId();
     }
-    if (sessionId == null)
-    {
+    if (sessionId == null) {
       sessionId = "*";
     }
 
     Builder keyBuilder = accessor.keyBuilder();
-    if (!_recordedMessages.containsKey(message.getMsgId()))
-    {
+    if (!_recordedMessages.containsKey(message.getMsgId())) {
       // TODO instanceName of a controller might be any string
-      if (instanceName.equalsIgnoreCase("Controller"))
-      {
-        accessor.updateProperty(keyBuilder.controllerTaskStatus(statusUpdateSubPath,
-                                                                statusUpdateKey),
-                                new StatusUpdate(createMessageLogRecord(message)));
+      if (instanceName.equalsIgnoreCase("Controller")) {
+        accessor.updateProperty(
+            keyBuilder.controllerTaskStatus(statusUpdateSubPath, statusUpdateKey),
+            new StatusUpdate(createMessageLogRecord(message)));
+
+      } else {
 
-      }
-      else
-      {
-        
         PropertyKey propertyKey =
-            keyBuilder.stateTransitionStatus(instanceName,
-                                             sessionId,
-                                             statusUpdateSubPath,
-                                             statusUpdateKey);
+            keyBuilder.stateTransitionStatus(instanceName, sessionId, statusUpdateSubPath,
+                statusUpdateKey);
 
         ZNRecord statusUpdateRecord = createMessageLogRecord(message);
 
-        // For now write participant StatusUpdates to log4j. 
+        // For now write participant StatusUpdates to log4j.
         // we are using restlet as another data channel to report to controller.
-        if(_logger.isTraceEnabled()){
-           _logger.trace("StatusUpdate path:" + propertyKey.getPath() + ", updates:"
+        if (_logger.isTraceEnabled()) {
+          _logger.trace("StatusUpdate path:" + propertyKey.getPath() + ", updates:"
               + statusUpdateRecord);
         }
         accessor.updateProperty(propertyKey, new StatusUpdate(statusUpdateRecord));
-        
+
       }
       _recordedMessages.put(message.getMsgId(), message.getMsgId());
     }
 
-    if (instanceName.equalsIgnoreCase("Controller"))
-    {
-      accessor.updateProperty(keyBuilder.controllerTaskStatus(statusUpdateSubPath,
-                                                              statusUpdateKey),
-                              new StatusUpdate(record));
-    }
-    else
-    {
-      
+    if (instanceName.equalsIgnoreCase("Controller")) {
+      accessor.updateProperty(
+          keyBuilder.controllerTaskStatus(statusUpdateSubPath, statusUpdateKey), new StatusUpdate(
+              record));
+    } else {
+
       PropertyKey propertyKey =
-          keyBuilder.stateTransitionStatus(instanceName,
-                                           sessionId,
-                                           statusUpdateSubPath,
-                                           statusUpdateKey);
-      // For now write participant StatusUpdates to log4j. 
+          keyBuilder.stateTransitionStatus(instanceName, sessionId, statusUpdateSubPath,
+              statusUpdateKey);
+      // For now write participant StatusUpdates to log4j.
       // we are using restlet as another data channel to report to controller.
-      if(_logger.isTraceEnabled()){
+      if (_logger.isTraceEnabled()) {
         _logger.trace("StatusUpdate path:" + propertyKey.getPath() + ", updates:" + record);
       }
       accessor.updateProperty(propertyKey, new StatusUpdate(record));
     }
 
     // If the error level is ERROR, also write the record to "ERROR" ZNode
-    if (Level.HELIX_ERROR == level)
-    {
+    if (Level.HELIX_ERROR == level) {
       publishErrorRecord(record, message, accessor);
     }
   }
 
-  private String getStatusUpdateKey(Message message)
-  {
-    if (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.toString()))
-    {
+  private String getStatusUpdateKey(Message message) {
+    if (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.toString())) {
       return message.getPartitionName();
     }
     return message.getMsgId();
@@ -557,24 +443,17 @@ public class StatusUpdateUtil
 
   /**
    * Generate the sub-path under STATUSUPDATE or ERROR path for a status update
-   * 
    */
-  String getStatusUpdateSubPath(Message message)
-  {
-    if (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.toString()))
-    {
+  String getStatusUpdateSubPath(Message message) {
+    if (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.toString())) {
       return message.getResourceName();
-    }
-    else
-    {
+    } else {
       return message.getMsgType();
     }
   }
 
-  String getStatusUpdateRecordName(Message message)
-  {
-    if (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.toString()))
-    {
+  String getStatusUpdateRecordName(Message message) {
+    if (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.toString())) {
       return message.getTgtSessionId() + "__" + message.getResourceName();
     }
     return message.getMsgId();
@@ -582,7 +461,6 @@ public class StatusUpdateUtil
 
   /**
    * Write an error record to zookeeper to the zookeeper store.
-   * 
    * @param record
    *          the status update record
    * @param message
@@ -590,46 +468,36 @@ public class StatusUpdateUtil
    * @param accessor
    *          the zookeeper data accessor that writes the status update to zookeeper
    */
-  void publishErrorRecord(ZNRecord record, Message message, HelixDataAccessor accessor)
-  {
+  void publishErrorRecord(ZNRecord record, Message message, HelixDataAccessor accessor) {
     String instanceName = message.getTgtName();
     String statusUpdateSubPath = getStatusUpdateSubPath(message);
     String statusUpdateKey = getStatusUpdateKey(message);
     String sessionId = message.getExecutionSessionId();
-    if (sessionId == null)
-    {
+    if (sessionId == null) {
       sessionId = message.getTgtSessionId();
     }
-    if (sessionId == null)
-    {
+    if (sessionId == null) {
       sessionId = "*";
     }
 
     Builder keyBuilder = accessor.keyBuilder();
 
     // TODO remove the hard code: "controller"
-    if (instanceName.equalsIgnoreCase("controller"))
-    {
+    if (instanceName.equalsIgnoreCase("controller")) {
       // TODO need to fix: ERRORS_CONTROLLER doesn't have a form of
       // ../{sessionId}/{subPath}
       // accessor.setProperty(PropertyType.ERRORS_CONTROLLER, record,
       // statusUpdateSubPath);
-      accessor.setProperty(keyBuilder.controllerTaskError(statusUpdateSubPath),
-                           new Error(record));
-    }
-    else
-    {
+      accessor.setProperty(keyBuilder.controllerTaskError(statusUpdateSubPath), new Error(record));
+    } else {
       // accessor.updateProperty(PropertyType.ERRORS,
       // record,
       // instanceName,
       // sessionId,
       // statusUpdateSubPath,
       // statusUpdateKey);
-      accessor.updateProperty(keyBuilder.stateTransitionError(instanceName,
-                                                              sessionId,
-                                                              statusUpdateSubPath,
-                                                              statusUpdateKey),
-                              new Error(record));
+      accessor.updateProperty(keyBuilder.stateTransitionError(instanceName, sessionId,
+          statusUpdateSubPath, statusUpdateKey), new Error(record));
 
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/util/StringTemplate.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/util/StringTemplate.java b/helix-core/src/main/java/org/apache/helix/util/StringTemplate.java
index 828d54d..ee77a05 100644
--- a/helix-core/src/main/java/org/apache/helix/util/StringTemplate.java
+++ b/helix-core/src/main/java/org/apache/helix/util/StringTemplate.java
@@ -27,56 +27,47 @@ import java.util.regex.Pattern;
 
 import org.apache.log4j.Logger;
 
-public class StringTemplate
-{
+public class StringTemplate {
   private static Logger LOG = Logger.getLogger(StringTemplate.class);
 
   Map<Enum, Map<Integer, String>> templateMap = new HashMap<Enum, Map<Integer, String>>();
   static Pattern pattern = Pattern.compile("(\\{.+?\\})");
 
-  public void addEntry(Enum type, int numKeys, String template)
-  {
-    if (!templateMap.containsKey(type))
-    {
+  public void addEntry(Enum type, int numKeys, String template) {
+    if (!templateMap.containsKey(type)) {
       templateMap.put(type, new HashMap<Integer, String>());
     }
-    LOG.trace("Add template for type: " + type.name() + ", arguments: " + numKeys
-        + ", template: " + template);
+    LOG.trace("Add template for type: " + type.name() + ", arguments: " + numKeys + ", template: "
+        + template);
     templateMap.get(type).put(numKeys, template);
   }
 
-  public String instantiate(Enum type, String... keys)
-  {
-    if (keys == null)
-    {
+  public String instantiate(Enum type, String... keys) {
+    if (keys == null) {
       keys = new String[] {};
     }
 
     String template = null;
-    if (templateMap.containsKey(type))
-    {
+    if (templateMap.containsKey(type)) {
       template = templateMap.get(type).get(keys.length);
     }
 
     String result = null;
 
-    if (template != null)
-    {
+    if (template != null) {
       result = template;
       Matcher matcher = pattern.matcher(template);
       int count = 0;
-      while (matcher.find())
-      {
+      while (matcher.find()) {
         String var = matcher.group();
         result = result.replace(var, keys[count]);
         count++;
       }
     }
 
-    if (result == null || result.indexOf('{') > -1 || result.indexOf('}') > -1)
-    {
-      String errMsg = "Unable to instantiate template: " + template
-          + " using keys: " + Arrays.toString(keys);
+    if (result == null || result.indexOf('{') > -1 || result.indexOf('}') > -1) {
+      String errMsg =
+          "Unable to instantiate template: " + template + " using keys: " + Arrays.toString(keys);
       LOG.error(errMsg);
       throw new IllegalArgumentException(errMsg);
     }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/util/ZKClientPool.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/util/ZKClientPool.java b/helix-core/src/main/java/org/apache/helix/util/ZKClientPool.java
index f4ee80a..0c45020 100644
--- a/helix-core/src/main/java/org/apache/helix/util/ZKClientPool.java
+++ b/helix-core/src/main/java/org/apache/helix/util/ZKClientPool.java
@@ -27,41 +27,33 @@ import org.apache.helix.manager.zk.ZNRecordSerializer;
 import org.apache.helix.manager.zk.ZkClient;
 import org.apache.zookeeper.ZooKeeper.States;
 
-
-public class ZKClientPool
-{
+public class ZKClientPool {
   static final Map<String, ZkClient> _zkClientMap = new ConcurrentHashMap<String, ZkClient>();
   static final int DEFAULT_SESSION_TIMEOUT = 30 * 1000;
 
-  public static ZkClient getZkClient(String zkServer)
-  {
+  public static ZkClient getZkClient(String zkServer) {
     // happy path that we cache the zkclient and it's still connected
-    if (_zkClientMap.containsKey(zkServer))
-    {
+    if (_zkClientMap.containsKey(zkServer)) {
       ZkClient zkClient = _zkClientMap.get(zkServer);
-      if (zkClient.getConnection().getZookeeperState() == States.CONNECTED)
-      {
+      if (zkClient.getConnection().getZookeeperState() == States.CONNECTED) {
         return zkClient;
       }
     }
 
-    synchronized (_zkClientMap)
-    {
+    synchronized (_zkClientMap) {
       // if we cache a stale zkclient, purge it
-      if (_zkClientMap.containsKey(zkServer))
-      {
+      if (_zkClientMap.containsKey(zkServer)) {
         ZkClient zkClient = _zkClientMap.get(zkServer);
-        if (zkClient.getConnection().getZookeeperState() != States.CONNECTED)
-        {
+        if (zkClient.getConnection().getZookeeperState() != States.CONNECTED) {
           _zkClientMap.remove(zkServer);
         }
       }
 
       // get a new zkclient
-      if (!_zkClientMap.containsKey(zkServer))
-      {
-        ZkClient zkClient = new ZkClient(zkServer, DEFAULT_SESSION_TIMEOUT, 
-            ZkClient.DEFAULT_CONNECTION_TIMEOUT, new ZNRecordSerializer());
+      if (!_zkClientMap.containsKey(zkServer)) {
+        ZkClient zkClient =
+            new ZkClient(zkServer, DEFAULT_SESSION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT,
+                new ZNRecordSerializer());
 
         _zkClientMap.put(zkServer, zkClient);
       }
@@ -69,71 +61,64 @@ public class ZKClientPool
     }
   }
 
-  public static void reset()
-  {
+  public static void reset() {
     _zkClientMap.clear();
   }
-  
-  public static void main(String[] args) throws InterruptedException
-  {
-    Thread /*_dataSampleThread = new Thread(new Runnable()
-    {
+
+  public static void main(String[] args) throws InterruptedException {
+    Thread /*
+            * _dataSampleThread = new Thread(new Runnable()
+            * {
+            * @Override
+            * public void run()
+            * {
+            * int i = 0;
+            * while(!Thread.currentThread().isInterrupted())
+            * {
+            * try
+            * {
+            * // if the queue is empty, sleep 100 ms and try again
+            * Thread.sleep(1000);
+            * System.out.println(i++ + "...");
+            * throw new RuntimeException("" + i);
+            * }
+            * catch (InterruptedException e)
+            * {
+            * System.out.println("Collector thread interrupted" + e);
+            * return;
+            * }
+            * catch(Throwable th)
+            * {
+            * System.out.println("Collector thread exception/ error" + th);
+            * }
+            * }
+            * }
+            * });
+            * _dataSampleThread.start();
+            * Thread.sleep(10000);
+            * _dataSampleThread.interrupt();
+            */
+    _dataSampleThread = new Thread(new Runnable() {
       @Override
-      public void run()
-      {
+      public void run() {
         int i = 0;
-        while(!Thread.currentThread().isInterrupted())
-        {
-          try
-          {
-            // if the queue is empty, sleep 100 ms and try again
+        while (!Thread.currentThread().isInterrupted()) {
+
+          // if the queue is empty, sleep 100 ms and try again
+          try {
             Thread.sleep(1000);
-            System.out.println(i++ + "...");
-            throw new RuntimeException("" + i);
-          }
-          catch (InterruptedException e)
-          {
-            System.out.println("Collector thread interrupted" + e);
-            return;
+          } catch (InterruptedException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
           }
-          catch(Throwable th)
-          {
-            System.out.println("Collector thread exception/ error" + th);
-          }
-        }
-      }
-    });
-    _dataSampleThread.start();
-    
-    Thread.sleep(10000);
-    _dataSampleThread.interrupt();
-    */
-    _dataSampleThread = new Thread(new Runnable()
-    {
-      @Override
-      public void run()
-      {
-        int i = 0;
-        while(!Thread.currentThread().isInterrupted())
-        {
-          
-            // if the queue is empty, sleep 100 ms and try again
-            try
-            {
-              Thread.sleep(1000);
-            } catch (InterruptedException e)
-            {
-              // TODO Auto-generated catch block
-              e.printStackTrace();
-            }
-            System.out.println(i++ + "...");
-            throw new Error("" + i);
-          
+          System.out.println(i++ + "...");
+          throw new Error("" + i);
+
         }
       }
     });
     _dataSampleThread.start();
-    
+
     Thread.sleep(10000);
     _dataSampleThread.interrupt();
   }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/util/ZNRecordUtil.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/util/ZNRecordUtil.java b/helix-core/src/main/java/org/apache/helix/util/ZNRecordUtil.java
index e22886f..80b5c54 100644
--- a/helix-core/src/main/java/org/apache/helix/util/ZNRecordUtil.java
+++ b/helix-core/src/main/java/org/apache/helix/util/ZNRecordUtil.java
@@ -28,35 +28,26 @@ import java.util.Map;
 import org.apache.helix.ZNRecord;
 import org.apache.log4j.Logger;
 
-
 //TODO find a proper place for these methods
-public final class ZNRecordUtil
-{
+public final class ZNRecordUtil {
   private static final Logger logger = Logger.getLogger(ZNRecordUtil.class.getName());
 
-  private ZNRecordUtil()
-  {
+  private ZNRecordUtil() {
   }
 
-  public static ZNRecord find(String id, List<ZNRecord> list)
-  {
-    for (ZNRecord record : list)
-    {
-      if (record.getId() != null && record.getId().equals(id))
-      {
+  public static ZNRecord find(String id, List<ZNRecord> list) {
+    for (ZNRecord record : list) {
+      if (record.getId() != null && record.getId().equals(id)) {
         return record;
       }
     }
     return null;
   }
 
-  public static Map<String, ZNRecord> convertListToMap(List<ZNRecord> recordList)
-  {
+  public static Map<String, ZNRecord> convertListToMap(List<ZNRecord> recordList) {
     Map<String, ZNRecord> recordMap = new HashMap<String, ZNRecord>();
-    for (ZNRecord record : recordList)
-    {
-      if (record.getId() != null)
-      {
+    for (ZNRecord record : recordList) {
+      if (record.getId() != null) {
         recordMap.put(record.getId(), record);
       }
     }
@@ -64,25 +55,21 @@ public final class ZNRecordUtil
   }
 
   public static <T extends Object> List<T> convertListToTypedList(List<ZNRecord> recordList,
-                                                                  Class<T> clazz)
-  {
+      Class<T> clazz) {
     List<T> list = new ArrayList<T>();
-    for (ZNRecord record : recordList)
-    {
-      if (record.getId() == null)
-      {
+    for (ZNRecord record : recordList) {
+      if (record.getId() == null) {
         logger.error("Invalid record: Id missing in " + record);
         continue;
       }
-      try
-      {
+      try {
 
-        Constructor<T> constructor = clazz.getConstructor(new Class[] { ZNRecord.class });
+        Constructor<T> constructor = clazz.getConstructor(new Class[] {
+          ZNRecord.class
+        });
         T instance = constructor.newInstance(record);
         list.add(instance);
-      }
-      catch (Exception e)
-      {
+      } catch (Exception e) {
         logger.error("Error creating an Object of type:" + clazz.getCanonicalName(), e);
       }
     }
@@ -90,36 +77,30 @@ public final class ZNRecordUtil
   }
 
   public static <T extends Object> Map<String, T> convertListToTypedMap(List<ZNRecord> recordList,
-                                                                        Class<T> clazz)
-  {
+      Class<T> clazz) {
     Map<String, T> map = new HashMap<String, T>();
-    for (ZNRecord record : recordList)
-    {
-      if (record.getId() == null)
-      {
+    for (ZNRecord record : recordList) {
+      if (record.getId() == null) {
         logger.error("Invalid record: Id missing in " + record);
         continue;
       }
-      try
-      {
+      try {
 
-        Constructor<T> constructor = clazz.getConstructor(new Class[] { ZNRecord.class });
+        Constructor<T> constructor = clazz.getConstructor(new Class[] {
+          ZNRecord.class
+        });
         T instance = constructor.newInstance(record);
         map.put(record.getId(), instance);
-      }
-      catch (Exception e)
-      {
+      } catch (Exception e) {
         logger.error("Error creating an Object of type:" + clazz.getCanonicalName(), e);
       }
     }
     return map;
   }
 
-  public static <T extends Object> List<T> convertMapToList(Map<String, T> map)
-  {
+  public static <T extends Object> List<T> convertMapToList(Map<String, T> map) {
     List<T> list = new ArrayList<T>();
-    for (T t : map.values())
-    {
+    for (T t : map.values()) {
       list.add(t);
     }
     return list;

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/DummyProcessThread.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/DummyProcessThread.java b/helix-core/src/test/java/org/apache/helix/DummyProcessThread.java
index df22ff1..f51aa1d 100644
--- a/helix-core/src/test/java/org/apache/helix/DummyProcessThread.java
+++ b/helix-core/src/test/java/org/apache/helix/DummyProcessThread.java
@@ -25,52 +25,44 @@ import org.apache.helix.mock.participant.DummyProcess.DummyStateModelFactory;
 import org.apache.helix.participant.StateMachineEngine;
 import org.apache.log4j.Logger;
 
-
-public class DummyProcessThread implements Runnable
-{
+public class DummyProcessThread implements Runnable {
   private static final Logger LOG = Logger.getLogger(DummyProcessThread.class);
 
   HelixManager _manager;
   String _instanceName;
 
-  public DummyProcessThread(HelixManager manager, String instanceName)
-  {
+  public DummyProcessThread(HelixManager manager, String instanceName) {
     _manager = manager;
     _instanceName = instanceName;
   }
 
   @Override
-  public void run()
-  {
-    try
-    {
+  public void run() {
+    try {
       DummyStateModelFactory stateModelFactory = new DummyStateModelFactory(0);
-//      StateMachineEngine genericStateMachineHandler =
-//          new StateMachineEngine();
+      // StateMachineEngine genericStateMachineHandler =
+      // new StateMachineEngine();
       StateMachineEngine stateMach = _manager.getStateMachineEngine();
       stateMach.registerStateModelFactory("MasterSlave", stateModelFactory);
 
-      DummyLeaderStandbyStateModelFactory stateModelFactory1 = new DummyLeaderStandbyStateModelFactory(10);
-      DummyOnlineOfflineStateModelFactory stateModelFactory2 = new DummyOnlineOfflineStateModelFactory(10);
+      DummyLeaderStandbyStateModelFactory stateModelFactory1 =
+          new DummyLeaderStandbyStateModelFactory(10);
+      DummyOnlineOfflineStateModelFactory stateModelFactory2 =
+          new DummyOnlineOfflineStateModelFactory(10);
       stateMach.registerStateModelFactory("LeaderStandby", stateModelFactory1);
       stateMach.registerStateModelFactory("OnlineOffline", stateModelFactory2);
-//      _manager.getMessagingService()
-//              .registerMessageHandlerFactory(MessageType.STATE_TRANSITION.toString(),
-//                                             genericStateMachineHandler);
+      // _manager.getMessagingService()
+      // .registerMessageHandlerFactory(MessageType.STATE_TRANSITION.toString(),
+      // genericStateMachineHandler);
 
       _manager.connect();
       Thread.currentThread().join();
-    }
-    catch (InterruptedException e)
-    {
+    } catch (InterruptedException e) {
       String msg =
-          "participant:" + _instanceName + ", " + Thread.currentThread().getName()
-              + " interrupted";
+          "participant:" + _instanceName + ", " + Thread.currentThread().getName() + " interrupted";
       LOG.info(msg);
       // System.err.println(msg);
-    }
-    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/Mocks.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/Mocks.java b/helix-core/src/test/java/org/apache/helix/Mocks.java
index d688561..7bafe1b 100644
--- a/helix-core/src/test/java/org/apache/helix/Mocks.java
+++ b/helix-core/src/test/java/org/apache/helix/Mocks.java
@@ -48,760 +48,721 @@ import org.apache.helix.store.zk.ZkHelixPropertyStore;
 import org.apache.zookeeper.data.Stat;
 import org.omg.CORBA._PolicyStub;
 
-
 public class Mocks {
-	public static class MockBaseDataAccessor implements BaseDataAccessor<ZNRecord> {
-		Map<String, ZNRecord> map = new HashMap<String, ZNRecord>();
-
-		@Override
-		public boolean create(String path, ZNRecord record, int options) {
-			// TODO Auto-generated method stub
-			return false;
-		}
-
-		@Override
-		public boolean set(String path, ZNRecord record, int options) {
-			System.err.println("Store.write()" + System.currentTimeMillis());
-			map.put(path, record);
-			try {
-				Thread.sleep(50);
-			} catch (InterruptedException e) {
-				e.printStackTrace();
-			}
-			return true;
-		}
-
-		@Override
-		public boolean update(String path, DataUpdater<ZNRecord> updater,
-				int options) {
-			// TODO Auto-generated method stub
-			return false;
-		}
-
-		@Override
-		public boolean remove(String path, int options) {
-			// TODO Auto-generated method stub
-			return false;
-		}
-
-		@Override
-		public boolean[] createChildren(List<String> paths,
-				List<ZNRecord> records, int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public boolean[] setChildren(List<String> paths,
-				List<ZNRecord> records, int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public boolean[] updateChildren(List<String> paths,
-				List<DataUpdater<ZNRecord>> updaters, int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public boolean[] remove(List<String> paths, int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public ZNRecord get(String path, Stat stat, int options) {
-		    return map.get(path);
-		}
-
-		@Override
-		public List<ZNRecord> get(List<String> paths, List<Stat> stats,
-				int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public List<ZNRecord> getChildren(String parentPath, List<Stat> stats,
-				int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public List<String> getChildNames(String parentPath, int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public boolean exists(String path, int options) {
-			// TODO Auto-generated method stub
-			return false;
-		}
-
-		@Override
-		public boolean[] exists(List<String> paths, int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public Stat[] getStats(List<String> paths, int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public Stat getStat(String path, int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-    @Override
-    public void subscribeDataChanges(String path, IZkDataListener listener)
-    {
+  public static class MockBaseDataAccessor implements BaseDataAccessor<ZNRecord> {
+    Map<String, ZNRecord> map = new HashMap<String, ZNRecord>();
+
+    @Override
+    public boolean create(String path, ZNRecord record, int options) {
       // TODO Auto-generated method stub
-      
+      return false;
     }
 
     @Override
-    public void unsubscribeDataChanges(String path, IZkDataListener listener)
-    {
+    public boolean set(String path, ZNRecord record, int options) {
+      System.err.println("Store.write()" + System.currentTimeMillis());
+      map.put(path, record);
+      try {
+        Thread.sleep(50);
+      } catch (InterruptedException e) {
+        e.printStackTrace();
+      }
+      return true;
+    }
+
+    @Override
+    public boolean update(String path, DataUpdater<ZNRecord> updater, int options) {
       // TODO Auto-generated method stub
-      
+      return false;
     }
 
     @Override
-    public List<String> subscribeChildChanges(String path, IZkChildListener listener)
-    {
+    public boolean remove(String path, int options) {
+      // TODO Auto-generated method stub
+      return false;
+    }
+
+    @Override
+    public boolean[] createChildren(List<String> paths, List<ZNRecord> records, int options) {
       // TODO Auto-generated method stub
       return null;
     }
 
     @Override
-    public void unsubscribeChildChanges(String path, IZkChildListener listener)
-    {
+    public boolean[] setChildren(List<String> paths, List<ZNRecord> records, int options) {
       // TODO Auto-generated method stub
-      
+      return null;
     }
 
     @Override
-    public void reset()
-    {
+    public boolean[] updateChildren(List<String> paths, List<DataUpdater<ZNRecord>> updaters,
+        int options) {
       // TODO Auto-generated method stub
-      
+      return null;
     }
 
     @Override
-    public boolean set(String path, ZNRecord record, int options, int expectVersion)
-    {
+    public boolean[] remove(List<String> paths, int options) {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public ZNRecord get(String path, Stat stat, int options) {
+      return map.get(path);
+    }
+
+    @Override
+    public List<ZNRecord> get(List<String> paths, List<Stat> stats, int options) {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public List<ZNRecord> getChildren(String parentPath, List<Stat> stats, int options) {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public List<String> getChildNames(String parentPath, int options) {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public boolean exists(String path, int options) {
       // TODO Auto-generated method stub
       return false;
     }
 
-//		@Override
-//		public boolean subscribe(String path, IZkListener listener) {
-//			// TODO Auto-generated method stub
-//			return false;
-//		}
-//
-//		@Override
-//		public boolean unsubscribe(String path, IZkListener listener) {
-//			// TODO Auto-generated method stub
-//			return false;
-//		}
-
-	}
-
-	public static class MockStateModel extends StateModel {
-		boolean stateModelInvoked = false;
-
-		public void onBecomeMasterFromSlave(Message msg,
-				NotificationContext context) {
-			stateModelInvoked = true;
-		}
-
-		public void onBecomeSlaveFromOffline(Message msg,
-				NotificationContext context) {
-			stateModelInvoked = true;
-		}
-	}
-
-	@StateModelInfo(states = "{'OFFLINE','SLAVE','MASTER'}", initialState = "OFFINE")
-	public static class MockStateModelAnnotated extends StateModel {
-		boolean stateModelInvoked = false;
-
-		@Transition(from = "SLAVE", to = "MASTER")
-		public void slaveToMaster(Message msg, NotificationContext context) {
-			stateModelInvoked = true;
-		}
-
-		@Transition(from = "OFFLINE", to = "SLAVE")
-		public void offlineToSlave(Message msg, NotificationContext context) {
-			stateModelInvoked = true;
-		}
-	}
-
-	public static class MockHelixTaskExecutor extends HelixTaskExecutor {
-		boolean completionInvoked = false;
-
-		@Override
-		public void finishTask(MessageTask task) {
-			System.out.println("Mocks.MockCMTaskExecutor.finishTask()");
-			completionInvoked = true;
-		}
-
-
-		public boolean isDone(String taskId) {
-			Future<HelixTaskResult> future = _taskMap.get(taskId).getFuture();
-			if (future != null) {
-				return future.isDone();
-			}
-			return false;
-		}
-	}
-
-	public static class MockManager implements HelixManager {
-		MockAccessor accessor;
-
-		private final String _clusterName;
-		private final String _sessionId;
-		String _instanceName;
-		ClusterMessagingService _msgSvc;
-		private String _version;
-		
-		HelixManagerProperties _properties = new HelixManagerProperties();
-
-		public MockManager() {
-			this("testCluster-" + Math.random() * 10000 % 999);
-		}
-
-		public MockManager(String clusterName) {
-			_clusterName = clusterName;
-			accessor = new MockAccessor(clusterName);
-			_sessionId = UUID.randomUUID().toString();
-			_instanceName = "testInstanceName";
-			_msgSvc = new MockClusterMessagingService();
-		}
-
-		@Override
-		public void disconnect() {
-
-		}
-
-		@Override
-		public void addIdealStateChangeListener(
-				IdealStateChangeListener listener) throws Exception {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public void addLiveInstanceChangeListener(
-				LiveInstanceChangeListener listener) {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public void addConfigChangeListener(ConfigChangeListener listener) {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public void addMessageListener(MessageListener listener,
-				String instanceName) {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public void addCurrentStateChangeListener(
-				CurrentStateChangeListener listener, String instanceName,
-				String sessionId) {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public void addExternalViewChangeListener(
-				ExternalViewChangeListener listener) {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public String getClusterName() {
-			return _clusterName;
-		}
-
-		@Override
-		public String getInstanceName() {
-			return _instanceName;
-		}
-
-		@Override
-		public void connect() {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public String getSessionId() {
-			return _sessionId;
-		}
-
-		@Override
-		public boolean isConnected() {
-			// TODO Auto-generated method stub
-			return false;
-		}
-
-		@Override
-		public long getLastNotificationTime() {
-			// TODO Auto-generated method stub
-			return 0;
-		}
-
-		@Override
-		public void addControllerListener(ControllerChangeListener listener) {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public boolean removeListener(PropertyKey key, Object listener) {
-			// TODO Auto-generated method stub
-			return false;
-		}
-
-		@Override
-		public HelixAdmin getClusterManagmentTool() {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public ClusterMessagingService getMessagingService() {
-			// TODO Auto-generated method stub
-			return _msgSvc;
-		}
-
-		@Override
-		public ParticipantHealthReportCollector getHealthReportCollector() {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public InstanceType getInstanceType() {
-			return InstanceType.PARTICIPANT;
-		}
-
-		@Override
-		public String getVersion() {
-			return _version;
-		}
-
-		public void setVersion(String version) {
-		  _properties.getProperties().put("clustermanager.version", version);
-			_version = version;
-			
-		}
-
-		@Override
-		public void addHealthStateChangeListener(
-				HealthStateChangeListener listener, String instanceName)
-				throws Exception {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public StateMachineEngine getStateMachineEngine() {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public boolean isLeader() {
-			// TODO Auto-generated method stub
-			return false;
-		}
-
-		@Override
-		public ConfigAccessor getConfigAccessor() {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public void startTimerTasks() {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public void stopTimerTasks() {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public HelixDataAccessor getHelixDataAccessor() {
-			return accessor;
-		}
-
-		@Override
-		public void addPreConnectCallback(PreConnectCallback callback) {
-			// TODO Auto-generated method stub
-
-		}
-
-    @Override
-    public ZkHelixPropertyStore<ZNRecord> getHelixPropertyStore()
-    {
+    @Override
+    public boolean[] exists(List<String> paths, int options) {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public Stat[] getStats(List<String> paths, int options) {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public Stat getStat(String path, int options) {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public void subscribeDataChanges(String path, IZkDataListener listener) {
+      // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void unsubscribeDataChanges(String path, IZkDataListener listener) {
+      // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public List<String> subscribeChildChanges(String path, IZkChildListener listener) {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public void unsubscribeChildChanges(String path, IZkChildListener listener) {
+      // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void reset() {
+      // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public boolean set(String path, ZNRecord record, int options, int expectVersion) {
+      // TODO Auto-generated method stub
+      return false;
+    }
+
+    // @Override
+    // public boolean subscribe(String path, IZkListener listener) {
+    // // TODO Auto-generated method stub
+    // return false;
+    // }
+    //
+    // @Override
+    // public boolean unsubscribe(String path, IZkListener listener) {
+    // // TODO Auto-generated method stub
+    // return false;
+    // }
+
+  }
+
+  public static class MockStateModel extends StateModel {
+    boolean stateModelInvoked = false;
+
+    public void onBecomeMasterFromSlave(Message msg, NotificationContext context) {
+      stateModelInvoked = true;
+    }
+
+    public void onBecomeSlaveFromOffline(Message msg, NotificationContext context) {
+      stateModelInvoked = true;
+    }
+  }
+
+  @StateModelInfo(states = "{'OFFLINE','SLAVE','MASTER'}", initialState = "OFFINE")
+  public static class MockStateModelAnnotated extends StateModel {
+    boolean stateModelInvoked = false;
+
+    @Transition(from = "SLAVE", to = "MASTER")
+    public void slaveToMaster(Message msg, NotificationContext context) {
+      stateModelInvoked = true;
+    }
+
+    @Transition(from = "OFFLINE", to = "SLAVE")
+    public void offlineToSlave(Message msg, NotificationContext context) {
+      stateModelInvoked = true;
+    }
+  }
+
+  public static class MockHelixTaskExecutor extends HelixTaskExecutor {
+    boolean completionInvoked = false;
+
+    @Override
+    public void finishTask(MessageTask task) {
+      System.out.println("Mocks.MockCMTaskExecutor.finishTask()");
+      completionInvoked = true;
+    }
+
+    public boolean isDone(String taskId) {
+      Future<HelixTaskResult> future = _taskMap.get(taskId).getFuture();
+      if (future != null) {
+        return future.isDone();
+      }
+      return false;
+    }
+  }
+
+  public static class MockManager implements HelixManager {
+    MockAccessor accessor;
+
+    private final String _clusterName;
+    private final String _sessionId;
+    String _instanceName;
+    ClusterMessagingService _msgSvc;
+    private String _version;
+
+    HelixManagerProperties _properties = new HelixManagerProperties();
+
+    public MockManager() {
+      this("testCluster-" + Math.random() * 10000 % 999);
+    }
+
+    public MockManager(String clusterName) {
+      _clusterName = clusterName;
+      accessor = new MockAccessor(clusterName);
+      _sessionId = UUID.randomUUID().toString();
+      _instanceName = "testInstanceName";
+      _msgSvc = new MockClusterMessagingService();
+    }
+
+    @Override
+    public void disconnect() {
+
+    }
+
+    @Override
+    public void addIdealStateChangeListener(IdealStateChangeListener listener) throws Exception {
+      // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void addLiveInstanceChangeListener(LiveInstanceChangeListener listener) {
+      // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void addConfigChangeListener(ConfigChangeListener listener) {
+      // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void addMessageListener(MessageListener listener, String instanceName) {
+      // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void addCurrentStateChangeListener(CurrentStateChangeListener listener,
+        String instanceName, String sessionId) {
+      // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void addExternalViewChangeListener(ExternalViewChangeListener listener) {
+      // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public String getClusterName() {
+      return _clusterName;
+    }
+
+    @Override
+    public String getInstanceName() {
+      return _instanceName;
+    }
+
+    @Override
+    public void connect() {
+      // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public String getSessionId() {
+      return _sessionId;
+    }
+
+    @Override
+    public boolean isConnected() {
+      // TODO Auto-generated method stub
+      return false;
+    }
+
+    @Override
+    public long getLastNotificationTime() {
+      // TODO Auto-generated method stub
+      return 0;
+    }
+
+    @Override
+    public void addControllerListener(ControllerChangeListener listener) {
+      // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public boolean removeListener(PropertyKey key, Object listener) {
+      // TODO Auto-generated method stub
+      return false;
+    }
+
+    @Override
+    public HelixAdmin getClusterManagmentTool() {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public ClusterMessagingService getMessagingService() {
+      // TODO Auto-generated method stub
+      return _msgSvc;
+    }
+
+    @Override
+    public ParticipantHealthReportCollector getHealthReportCollector() {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public InstanceType getInstanceType() {
+      return InstanceType.PARTICIPANT;
+    }
+
+    @Override
+    public String getVersion() {
+      return _version;
+    }
+
+    public void setVersion(String version) {
+      _properties.getProperties().put("clustermanager.version", version);
+      _version = version;
+
+    }
+
+    @Override
+    public void addHealthStateChangeListener(HealthStateChangeListener listener, String instanceName)
+        throws Exception {
+      // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public StateMachineEngine getStateMachineEngine() {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public boolean isLeader() {
+      // TODO Auto-generated method stub
+      return false;
+    }
+
+    @Override
+    public ConfigAccessor getConfigAccessor() {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public void startTimerTasks() {
+      // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void stopTimerTasks() {
+      // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public HelixDataAccessor getHelixDataAccessor() {
+      return accessor;
+    }
+
+    @Override
+    public void addPreConnectCallback(PreConnectCallback callback) {
+      // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public ZkHelixPropertyStore<ZNRecord> getHelixPropertyStore() {
       // TODO Auto-generated method stub
       return null;
     }
-    
+
     @Override
     public void addInstanceConfigChangeListener(InstanceConfigChangeListener listener)
-            throws Exception {
-	    // TODO Auto-generated method stub
+        throws Exception {
+      // TODO Auto-generated method stub
 
     }
 
-	@Override
+    @Override
     public void addConfigChangeListener(ScopedConfigChangeListener listener,
-            ConfigScopeProperty scope) throws Exception {
-	    // TODO Auto-generated method stub
+        ConfigScopeProperty scope) throws Exception {
+      // TODO Auto-generated method stub
 
     }
 
-  @Override
-  public void setLiveInstanceInfoProvider(
-      LiveInstanceInfoProvider liveInstanceInfoProvider)
+    @Override
+    public void setLiveInstanceInfoProvider(LiveInstanceInfoProvider liveInstanceInfoProvider) {
+      // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public HelixManagerProperties getProperties() {
+      // TODO Auto-generated method stub
+      return _properties;
+    }
+
+  }
+
+  public static class MockAccessor implements HelixDataAccessor // DataAccessor
   {
-    // TODO Auto-generated method stub
-    
+    private final String _clusterName;
+    Map<String, ZNRecord> data = new HashMap<String, ZNRecord>();
+    private final Builder _propertyKeyBuilder;
+
+    public MockAccessor() {
+      this("testCluster-" + Math.random() * 10000 % 999);
+    }
+
+    public MockAccessor(String clusterName) {
+      _clusterName = clusterName;
+      _propertyKeyBuilder = new PropertyKey.Builder(_clusterName);
+    }
+
+    Map<String, ZNRecord> map = new HashMap<String, ZNRecord>();
+
+    @Override
+    // public boolean setProperty(PropertyType type, HelixProperty value,
+    // String... keys)
+    public boolean setProperty(PropertyKey key, HelixProperty value) {
+      // return setProperty(type, value.getRecord(), keys);
+      String path = key.getPath();
+      data.put(path, value.getRecord());
+      return true;
+    }
+
+    // @Override
+    // public boolean setProperty(PropertyType type, ZNRecord value,
+    // String... keys)
+    // {
+    // String path = PropertyPathConfig.getPath(type, _clusterName, keys);
+    // data.put(path, value);
+    // return true;
+    // }
+
+    // @Override
+    // public boolean updateProperty(PropertyType type, HelixProperty value,
+    // String... keys)
+    // {
+    // return updateProperty(type, value.getRecord(), keys);
+    // }
+
+    @Override
+    public <T extends HelixProperty> boolean updateProperty(PropertyKey key, T value) {
+      // String path = PropertyPathConfig.getPath(type, _clusterName,
+      // keys);
+      String path = key.getPath();
+      PropertyType type = key.getType();
+      if (type.updateOnlyOnExists) {
+        if (data.containsKey(path)) {
+          if (type.mergeOnUpdate) {
+            ZNRecord znRecord = new ZNRecord(data.get(path));
+            znRecord.merge(value.getRecord());
+            data.put(path, znRecord);
+          } else {
+            data.put(path, value.getRecord());
+          }
+        }
+      } else {
+        if (type.mergeOnUpdate) {
+          if (data.containsKey(path)) {
+            ZNRecord znRecord = new ZNRecord(data.get(path));
+            znRecord.merge(value.getRecord());
+            data.put(path, znRecord);
+          } else {
+            data.put(path, value.getRecord());
+          }
+        } else {
+          data.put(path, value.getRecord());
+        }
+      }
+
+      return true;
+    }
+
+    // @Override
+    // public <T extends HelixProperty> T getProperty(Class<T> clazz,
+    // PropertyType type,
+    // String... keys)
+    // {
+    // ZNRecord record = getProperty(type, keys);
+    // if (record == null)
+    // {
+    // return null;
+    // }
+    // return HelixProperty.convertToTypedInstance(clazz, record);
+    // }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public <T extends HelixProperty> T getProperty(PropertyKey key)
+    // public ZNRecord getProperty(PropertyType type, String... keys)
+    {
+      // String path = PropertyPathConfig.getPath(type, _clusterName,
+      // keys);
+      String path = key.getPath();
+      return (T) HelixProperty.convertToTypedInstance(key.getTypeClass(), data.get(path));
+    }
+
+    @Override
+    public boolean removeProperty(PropertyKey key)
+    // public boolean removeProperty(PropertyType type, String... keys)
+    {
+      String path = key.getPath(); // PropertyPathConfig.getPath(type,
+      // _clusterName, keys);
+      data.remove(path);
+      return true;
+    }
+
+    @Override
+    public List<String> getChildNames(PropertyKey propertyKey)
+    // public List<String> getChildNames(PropertyType type, String... keys)
+    {
+      List<String> child = new ArrayList<String>();
+      String path = propertyKey.getPath(); // PropertyPathConfig.getPath(type,
+      // _clusterName, keys);
+      for (String key : data.keySet()) {
+        if (key.startsWith(path)) {
+          String[] keySplit = key.split("\\/");
+          String[] pathSplit = path.split("\\/");
+          if (keySplit.length > pathSplit.length) {
+            child.add(keySplit[pathSplit.length + 1]);
+          }
+        }
+      }
+      return child;
+    }
+
+    // @Override
+    // public <T extends HelixProperty> List<T> getChildValues(Class<T>
+    // clazz, PropertyType type,
+    // String... keys)
+    // {
+    // List<ZNRecord> list = getChildValues(type, keys);
+    // return HelixProperty.convertToTypedList(clazz, list);
+    // }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public <T extends HelixProperty> List<T> getChildValues(PropertyKey propertyKey)
+    // public List<ZNRecord> getChildValues(PropertyType type, String...
+    // keys)
+    {
+      List<ZNRecord> childs = new ArrayList<ZNRecord>();
+      String path = propertyKey.getPath(); // PropertyPathConfig.getPath(type,
+      // _clusterName, keys);
+      for (String key : data.keySet()) {
+        if (key.startsWith(path)) {
+          String[] keySplit = key.split("\\/");
+          String[] pathSplit = path.split("\\/");
+          if (keySplit.length - pathSplit.length == 1) {
+            ZNRecord record = data.get(key);
+            if (record != null) {
+              childs.add(record);
+            }
+          } else {
+            System.out.println("keySplit:" + Arrays.toString(keySplit));
+            System.out.println("pathSplit:" + Arrays.toString(pathSplit));
+          }
+        }
+      }
+      return (List<T>) HelixProperty.convertToTypedList(propertyKey.getTypeClass(), childs);
+    }
+
+    @Override
+    public <T extends HelixProperty> Map<String, T> getChildValuesMap(PropertyKey key)
+    // public <T extends HelixProperty> Map<String, T>
+    // getChildValuesMap(Class<T> clazz,
+    // PropertyType type, String... keys)
+    {
+      List<T> list = getChildValues(key);
+      return HelixProperty.convertListToMap(list);
+    }
+
+    @Override
+    public <T extends HelixProperty> boolean createProperty(PropertyKey key, T value) {
+      // TODO Auto-generated method stub
+      return false;
+    }
+
+    @Override
+    public <T extends HelixProperty> boolean[] createChildren(List<PropertyKey> keys,
+        List<T> children) {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public <T extends HelixProperty> boolean[] setChildren(List<PropertyKey> keys, List<T> children) {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public Builder keyBuilder() {
+      return _propertyKeyBuilder;
+    }
+
+    @Override
+    public BaseDataAccessor getBaseDataAccessor() {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public <T extends HelixProperty> boolean[] updateChildren(List<String> paths,
+        List<DataUpdater<ZNRecord>> updaters, int options) {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public <T extends HelixProperty> List<T> getProperty(List<PropertyKey> keys) {
+      List<T> list = new ArrayList<T>();
+      for (PropertyKey key : keys) {
+        @SuppressWarnings("unchecked")
+        T t = (T) getProperty(key);
+        list.add(t);
+      }
+      return list;
+    }
   }
 
-  @Override
-  public HelixManagerProperties getProperties() {
-    // TODO Auto-generated method stub
-    return _properties;
+  public static class MockHealthReportProvider extends HealthReportProvider {
+
+    @Override
+    public Map<String, String> getRecentHealthReport() {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public void resetStats() {
+      // TODO Auto-generated method stub
+
+    }
+
   }
 
-	}
-
-	public static class MockAccessor implements HelixDataAccessor // DataAccessor
-	{
-		private final String _clusterName;
-		Map<String, ZNRecord> data = new HashMap<String, ZNRecord>();
-		private final Builder _propertyKeyBuilder;
-
-		public MockAccessor() {
-			this("testCluster-" + Math.random() * 10000 % 999);
-		}
-
-		public MockAccessor(String clusterName) {
-			_clusterName = clusterName;
-			_propertyKeyBuilder = new PropertyKey.Builder(_clusterName);
-		}
-
-		Map<String, ZNRecord> map = new HashMap<String, ZNRecord>();
-
-		@Override
-		// public boolean setProperty(PropertyType type, HelixProperty value,
-		// String... keys)
-		public boolean setProperty(PropertyKey key, HelixProperty value) {
-			// return setProperty(type, value.getRecord(), keys);
-			String path = key.getPath();
-			data.put(path, value.getRecord());
-			return true;
-		}
-
-		// @Override
-		// public boolean setProperty(PropertyType type, ZNRecord value,
-		// String... keys)
-		// {
-		// String path = PropertyPathConfig.getPath(type, _clusterName, keys);
-		// data.put(path, value);
-		// return true;
-		// }
-
-		// @Override
-		// public boolean updateProperty(PropertyType type, HelixProperty value,
-		// String... keys)
-		// {
-		// return updateProperty(type, value.getRecord(), keys);
-		// }
-
-		@Override
-		public <T extends HelixProperty> boolean updateProperty(
-				PropertyKey key, T value) {
-			// String path = PropertyPathConfig.getPath(type, _clusterName,
-			// keys);
-			String path = key.getPath();
-			PropertyType type = key.getType();
-			if (type.updateOnlyOnExists) {
-				if (data.containsKey(path)) {
-					if (type.mergeOnUpdate) {
-						ZNRecord znRecord = new ZNRecord(data.get(path));
-						znRecord.merge(value.getRecord());
-						data.put(path, znRecord);
-					} else {
-						data.put(path, value.getRecord());
-					}
-				}
-			} else {
-				if (type.mergeOnUpdate) {
-					if (data.containsKey(path)) {
-						ZNRecord znRecord = new ZNRecord(data.get(path));
-						znRecord.merge(value.getRecord());
-						data.put(path, znRecord);
-					} else {
-						data.put(path, value.getRecord());
-					}
-				} else {
-					data.put(path, value.getRecord());
-				}
-			}
-
-			return true;
-		}
-
-		// @Override
-		// public <T extends HelixProperty> T getProperty(Class<T> clazz,
-		// PropertyType type,
-		// String... keys)
-		// {
-		// ZNRecord record = getProperty(type, keys);
-		// if (record == null)
-		// {
-		// return null;
-		// }
-		// return HelixProperty.convertToTypedInstance(clazz, record);
-		// }
-
-		@SuppressWarnings("unchecked")
-		@Override
-		public <T extends HelixProperty> T getProperty(PropertyKey key)
-		// public ZNRecord getProperty(PropertyType type, String... keys)
-		{
-			// String path = PropertyPathConfig.getPath(type, _clusterName,
-			// keys);
-			String path = key.getPath();
-			return (T) HelixProperty.convertToTypedInstance(key.getTypeClass(),
-					data.get(path));
-		}
-
-		@Override
-		public boolean removeProperty(PropertyKey key)
-		// public boolean removeProperty(PropertyType type, String... keys)
-		{
-			String path = key.getPath(); // PropertyPathConfig.getPath(type,
-											// _clusterName, keys);
-			data.remove(path);
-			return true;
-		}
-
-		@Override
-		public List<String> getChildNames(PropertyKey propertyKey)
-		// public List<String> getChildNames(PropertyType type, String... keys)
-		{
-			List<String> child = new ArrayList<String>();
-			String path = propertyKey.getPath(); // PropertyPathConfig.getPath(type,
-													// _clusterName, keys);
-			for (String key : data.keySet()) {
-				if (key.startsWith(path)) {
-					String[] keySplit = key.split("\\/");
-					String[] pathSplit = path.split("\\/");
-					if (keySplit.length > pathSplit.length) {
-						child.add(keySplit[pathSplit.length + 1]);
-					}
-				}
-			}
-			return child;
-		}
-
-		// @Override
-		// public <T extends HelixProperty> List<T> getChildValues(Class<T>
-		// clazz, PropertyType type,
-		// String... keys)
-		// {
-		// List<ZNRecord> list = getChildValues(type, keys);
-		// return HelixProperty.convertToTypedList(clazz, list);
-		// }
-
-		@SuppressWarnings("unchecked")
-		@Override
-		public <T extends HelixProperty> List<T> getChildValues(
-				PropertyKey propertyKey)
-		// public List<ZNRecord> getChildValues(PropertyType type, String...
-		// keys)
-		{
-			List<ZNRecord> childs = new ArrayList<ZNRecord>();
-			String path = propertyKey.getPath(); // PropertyPathConfig.getPath(type,
-													// _clusterName, keys);
-			for (String key : data.keySet()) {
-				if (key.startsWith(path)) {
-					String[] keySplit = key.split("\\/");
-					String[] pathSplit = path.split("\\/");
-					if (keySplit.length - pathSplit.length == 1) {
-						ZNRecord record = data.get(key);
-						if (record != null) {
-							childs.add(record);
-						}
-					} else {
-						System.out.println("keySplit:"
-								+ Arrays.toString(keySplit));
-						System.out.println("pathSplit:"
-								+ Arrays.toString(pathSplit));
-					}
-				}
-			}
-			return (List<T>) HelixProperty.convertToTypedList(
-					propertyKey.getTypeClass(), childs);
-		}
-
-		@Override
-		public <T extends HelixProperty> Map<String, T> getChildValuesMap(
-				PropertyKey key)
-		// public <T extends HelixProperty> Map<String, T>
-		// getChildValuesMap(Class<T> clazz,
-		// PropertyType type, String... keys)
-		{
-			List<T> list = getChildValues(key);
-			return HelixProperty.convertListToMap(list);
-		}
-
-		@Override
-		public <T extends HelixProperty> boolean createProperty(
-				PropertyKey key, T value) {
-			// TODO Auto-generated method stub
-			return false;
-		}
-
-		@Override
-		public <T extends HelixProperty> boolean[] createChildren(
-				List<PropertyKey> keys, List<T> children) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public <T extends HelixProperty> boolean[] setChildren(
-				List<PropertyKey> keys, List<T> children) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public Builder keyBuilder() {
-			return _propertyKeyBuilder;
-		}
-
-		@Override
-		public BaseDataAccessor getBaseDataAccessor() {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public <T extends HelixProperty> boolean[] updateChildren(
-				List<String> paths, List<DataUpdater<ZNRecord>> updaters,
-				int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-		
-	    @Override
-	    public <T extends HelixProperty> List<T> getProperty(List<PropertyKey> keys)
-	    {
-	      List<T> list = new ArrayList<T>();
-	      for (PropertyKey key : keys)
-	      {
-	        @SuppressWarnings("unchecked")
-	        T t = (T)getProperty(key);
-	        list.add(t);
-	      }
-	      return list;
-	    }
-	}
-
-	public static class MockHealthReportProvider extends HealthReportProvider {
-
-		@Override
-		public Map<String, String> getRecentHealthReport() {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public void resetStats() {
-			// TODO Auto-generated method stub
-
-		}
-
-	}
-
-	public static class MockClusterMessagingService implements
-			ClusterMessagingService {
-
-		@Override
-		public int send(Criteria recipientCriteria, Message message) {
-			// TODO Auto-generated method stub
-			return 0;
-		}
-
-		@Override
-		public int send(Criteria receipientCriteria, Message message,
-				AsyncCallback callbackOnReply, int timeOut) {
-			// TODO Auto-generated method stub
-			return 0;
-		}
-
-		@Override
-		public int sendAndWait(Criteria receipientCriteria, Message message,
-				AsyncCallback callbackOnReply, int timeOut) {
-			// TODO Auto-generated method stub
-			return 0;
-		}
-
-		@Override
-		public void registerMessageHandlerFactory(String type,
-				MessageHandlerFactory factory) {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public int send(Criteria receipientCriteria, Message message,
-				AsyncCallback callbackOnReply, int timeOut, int retryCount) {
-			// TODO Auto-generated method stub
-			return 0;
-		}
-
-		@Override
-		public int sendAndWait(Criteria receipientCriteria, Message message,
-				AsyncCallback callbackOnReply, int timeOut, int retryCount) {
-			// TODO Auto-generated method stub
-			return 0;
-		}
-
-    @Override
-    public Map<InstanceType, List<Message>> generateMessage(
-        Criteria recipientCriteria, Message messageTemplate)
-    {
+  public static class MockClusterMessagingService implements ClusterMessagingService {
+
+    @Override
+    public int send(Criteria recipientCriteria, Message message) {
+      // TODO Auto-generated method stub
+      return 0;
+    }
+
+    @Override
+    public int send(Criteria receipientCriteria, Message message, AsyncCallback callbackOnReply,
+        int timeOut) {
+      // TODO Auto-generated method stub
+      return 0;
+    }
+
+    @Override
+    public int sendAndWait(Criteria receipientCriteria, Message message,
+        AsyncCallback callbackOnReply, int timeOut) {
+      // TODO Auto-generated method stub
+      return 0;
+    }
+
+    @Override
+    public void registerMessageHandlerFactory(String type, MessageHandlerFactory factory) {
+      // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public int send(Criteria receipientCriteria, Message message, AsyncCallback callbackOnReply,
+        int timeOut, int retryCount) {
+      // TODO Auto-generated method stub
+      return 0;
+    }
+
+    @Override
+    public int sendAndWait(Criteria receipientCriteria, Message message,
+        AsyncCallback callbackOnReply, int timeOut, int retryCount) {
+      // TODO Auto-generated method stub
+      return 0;
+    }
+
+    @Override
+    public Map<InstanceType, List<Message>> generateMessage(Criteria recipientCriteria,
+        Message messageTemplate) {
       // TODO Auto-generated method stub
       return null;
     }
 
-	}
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/test/java/org/apache/helix/ScriptTestHelper.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/ScriptTestHelper.java b/helix-core/src/test/java/org/apache/helix/ScriptTestHelper.java
index 80e0d89..26a8735 100644
--- a/helix-core/src/test/java/org/apache/helix/ScriptTestHelper.java
+++ b/helix-core/src/test/java/org/apache/helix/ScriptTestHelper.java
@@ -26,8 +26,7 @@ import java.util.concurrent.TimeoutException;
 import org.apache.log4j.Logger;
 import org.testng.Assert;
 
-public class ScriptTestHelper
-{
+public class ScriptTestHelper {
   private static final Logger LOG = Logger.getLogger(ScriptTestHelper.class);
 
   public static final String INTEGRATION_SCRIPT_DIR = "src/main/scripts/integration-test/script";
@@ -35,49 +34,44 @@ public class ScriptTestHelper
   public static final String INTEGRATION_LOG_DIR = "src/main/scripts/integration-test/var/log";
 
   public static final long EXEC_TIMEOUT = 1200;
-  
-  public static String getPrefix()
-  {
+
+  public static String getPrefix() {
     StringBuilder prefixBuilder = new StringBuilder("");
     String prefix = "";
     String filepath = INTEGRATION_SCRIPT_DIR;
     File integrationScriptDir = new File(filepath);
 
-    while (!integrationScriptDir.exists())
-    {
+    while (!integrationScriptDir.exists()) {
       prefixBuilder.append("../");
       prefix = prefixBuilder.toString();
 
       integrationScriptDir = new File(prefix + filepath);
 
       // Give up
-      if (prefix.length() > 30)
-      {
+      if (prefix.length() > 30) {
         return "";
       }
     }
     return new File(prefix).getAbsolutePath() + "/";
   }
-  
-  public static ExternalCommand runCommandLineTest(String testName, String... arguments) throws IOException, InterruptedException,
-  TimeoutException
-  {
-    ExternalCommand cmd = ExternalCommand.executeWithTimeout(new File(getPrefix() + INTEGRATION_TEST_DIR),
-                                             testName, EXEC_TIMEOUT, arguments);
+
+  public static ExternalCommand runCommandLineTest(String testName, String... arguments)
+      throws IOException, InterruptedException, TimeoutException {
+    ExternalCommand cmd =
+        ExternalCommand.executeWithTimeout(new File(getPrefix() + INTEGRATION_TEST_DIR), testName,
+            EXEC_TIMEOUT, arguments);
     int exitValue = cmd.exitValue();
     String output = cmd.getStringOutput("UTF8");
 
-    if (0 == exitValue)
-    {
-      LOG.info("Test " + testName + " has run. ExitCode=" + exitValue + ". Command output: " + output);
-    }
-    else
-    {
-      LOG.warn("Test " + testName + " is FAILING. ExitCode=" + exitValue + ". Command output: " + output);
+    if (0 == exitValue) {
+      LOG.info("Test " + testName + " has run. ExitCode=" + exitValue + ". Command output: "
+          + output);
+    } else {
+      LOG.warn("Test " + testName + " is FAILING. ExitCode=" + exitValue + ". Command output: "
+          + output);
       Assert.fail(output);
-//      return cmd;
+      // return cmd;
     }
     return cmd;
   }
 }
-


Mime
View raw message