helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ka...@apache.org
Subject [04/17] [HELIX-395] Remove old Helix alert/stat modules
Date Fri, 11 Jul 2014 19:57:59 GMT
http://git-wip-us.apache.org/repos/asf/helix/blob/38b43965/helix-core/src/test/java/org/apache/helix/healthcheck/TestSimpleAlert.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/healthcheck/TestSimpleAlert.java b/helix-core/src/test/java/org/apache/helix/healthcheck/TestSimpleAlert.java
deleted file mode 100644
index 44937fe..0000000
--- a/helix-core/src/test/java/org/apache/helix/healthcheck/TestSimpleAlert.java
+++ /dev/null
@@ -1,200 +0,0 @@
-package org.apache.helix.healthcheck;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.Date;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.helix.HelixDataAccessor;
-import org.apache.helix.HelixManager;
-import org.apache.helix.NotificationContext;
-import org.apache.helix.PropertyKey.Builder;
-import org.apache.helix.TestHelper;
-import org.apache.helix.ZNRecord;
-import org.apache.helix.alerts.AlertValueAndStatus;
-import org.apache.helix.api.State;
-import org.apache.helix.healthcheck.ParticipantHealthReportCollectorImpl;
-import org.apache.helix.integration.ZkIntegrationTestBase;
-import org.apache.helix.integration.manager.ClusterControllerManager;
-import org.apache.helix.integration.manager.MockParticipantManager;
-import org.apache.helix.manager.zk.ZKHelixDataAccessor;
-import org.apache.helix.manager.zk.ZkBaseDataAccessor;
-import org.apache.helix.mock.participant.MockEspressoHealthReportProvider;
-import org.apache.helix.mock.participant.MockTransition;
-import org.apache.helix.model.Message;
-import org.apache.helix.tools.ClusterSetup;
-import org.apache.helix.tools.ClusterStateVerifier;
-import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class TestSimpleAlert extends ZkIntegrationTestBase {
-  protected ClusterSetup _setupTool = null;
-  protected final String _alertStr =
-      "EXP(decay(1.0)(localhost_12918.RestQueryStats@DBName=TestDB0.latency))CMP(GREATER)CON(10)";
-  protected final String _alertStatusStr = _alertStr; // +" : (*)";
-  protected final String _dbName = "TestDB0";
-
-  @BeforeClass()
-  public void beforeClass() throws Exception {
-    _setupTool = new ClusterSetup(_gZkClient);
-  }
-
-  @AfterClass
-  public void afterClass() {
-  }
-
-  public class SimpleAlertTransition extends MockTransition {
-    int _alertValue;
-
-    public SimpleAlertTransition(int value) {
-      _alertValue = value;
-    }
-
-    @Override
-    public void doTransition(Message message, NotificationContext context) {
-      HelixManager manager = context.getManager();
-      HelixDataAccessor accessor = manager.getHelixDataAccessor();
-      State fromState = message.getTypedFromState();
-      State toState = message.getTypedToState();
-      String instance = message.getTgtName();
-
-      if (fromState.toString().equalsIgnoreCase("SLAVE")
-          && toState.toString().equalsIgnoreCase("MASTER")) {
-
-        // add a stat and report to ZK
-        // perhaps should keep reporter per instance...
-        ParticipantHealthReportCollectorImpl reporter =
-            new ParticipantHealthReportCollectorImpl(manager, instance);
-        MockEspressoHealthReportProvider provider = new MockEspressoHealthReportProvider();
-        reporter.addHealthReportProvider(provider);
-        String statName = "latency";
-        provider.setStat(_dbName, statName, "" + (0.1 + _alertValue));
-        reporter.transmitHealthReports();
-
-        /*
-         * for (int i = 0; i < 5; i++)
-         * {
-         * accessor.setProperty(PropertyType.HEALTHREPORT,
-         * new ZNRecord("mockAlerts" + i),
-         * instance,
-         * "mockAlerts");
-         * try
-         * {
-         * Thread.sleep(1000);
-         * }
-         * catch (InterruptedException e)
-         * {
-         * // TODO Auto-generated catch block
-         * e.printStackTrace();
-         * }
-         * }
-         */
-      }
-    }
-
-  }
-
-  @Test()
-  public void testSimpleAlert() throws Exception {
-    String clusterName = getShortClassName();
-    MockParticipantManager[] participants = new MockParticipantManager[5];
-
-    System.out.println("START TestSimpleAlert at " + new Date(System.currentTimeMillis()));
-
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant start port
-        "localhost", // participant name prefix
-        "TestDB", // resource name prefix
-        1, // resources
-        10, // partitions per resource
-        5, // number of nodes //change back to 5!!!
-        3, // replicas //change back to 3!!!
-        "MasterSlave", true); // do rebalance
-
-    // enableHealthCheck(clusterName);
-
-    ClusterControllerManager controller =
-        new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
-    controller.syncStart();
-    controller.startTimerTasks();
-
-    _setupTool.getClusterManagementTool().addAlert(clusterName, _alertStr);
-    // start participants
-    for (int i = 0; i < 5; i++) // !!!change back to 5
-    {
-      String instanceName = "localhost_" + (12918 + i);
-
-      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
-      participants[i].setTransition(new SimpleAlertTransition(15));
-      participants[i].syncStart();
-    }
-
-    boolean result =
-        ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(
-            ZK_ADDR, clusterName));
-    Assert.assertTrue(result);
-
-    // HealthAggregationTask is supposed to run by a timer every 30s
-    // To make sure HealthAggregationTask is run, we invoke it explicitly for this test
-    // new HealthStatsAggregator(cmResult._manager).aggregate();
-    new HealthStatsAggregator(controller).aggregate();
-    // sleep for a few seconds to give stats stage time to trigger
-    Thread.sleep(3000);
-
-    // other verifications go here
-    ZKHelixDataAccessor accessor =
-        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
-    Builder keyBuilder = accessor.keyBuilder();
-    // for (int i = 0; i < 1; i++) //change 1 back to 5
-    // {
-    // String instance = "localhost_" + (12918 + i);
-    String instance = "localhost_12918";
-    ZNRecord record = accessor.getProperty(keyBuilder.alertStatus()).getRecord();
-    Map<String, Map<String, String>> recMap = record.getMapFields();
-    Set<String> keySet = recMap.keySet();
-    Map<String, String> alertStatusMap = recMap.get(_alertStatusStr);
-    String val = alertStatusMap.get(AlertValueAndStatus.VALUE_NAME);
-    boolean fired = Boolean.parseBoolean(alertStatusMap.get(AlertValueAndStatus.FIRED_NAME));
-    Assert.assertEquals(Double.parseDouble(val), Double.parseDouble("15.1"));
-    Assert.assertTrue(fired);
-
-    // Verify Alert history from ZK
-    ZNRecord alertHistory = accessor.getProperty(keyBuilder.alertHistory()).getRecord();
-
-    String deltakey = (String) (alertHistory.getMapFields().keySet().toArray()[0]);
-    Map<String, String> delta = alertHistory.getMapField(deltakey);
-    Assert.assertTrue(delta.size() == 1);
-    Assert
-        .assertTrue(delta
-            .get(
-                "EXP(decay(1.0)(localhost_12918.RestQueryStats@DBName#TestDB0.latency))CMP(GREATER)CON(10)--(%)")
-            .equals("ON"));
-    // }
-
-    // clean up
-    controller.syncStop();
-    for (int i = 0; i < 5; i++) {
-      participants[i].syncStop();
-    }
-    System.out.println("END TestSimpleAlert at " + new Date(System.currentTimeMillis()));
-  }
-}

http://git-wip-us.apache.org/repos/asf/helix/blob/38b43965/helix-core/src/test/java/org/apache/helix/healthcheck/TestSimpleWildcardAlert.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/healthcheck/TestSimpleWildcardAlert.java b/helix-core/src/test/java/org/apache/helix/healthcheck/TestSimpleWildcardAlert.java
deleted file mode 100644
index 99c0608..0000000
--- a/helix-core/src/test/java/org/apache/helix/healthcheck/TestSimpleWildcardAlert.java
+++ /dev/null
@@ -1,246 +0,0 @@
-package org.apache.helix.healthcheck;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.Date;
-import java.util.Map;
-
-import org.apache.helix.HelixDataAccessor;
-import org.apache.helix.HelixManager;
-import org.apache.helix.NotificationContext;
-import org.apache.helix.PropertyKey.Builder;
-import org.apache.helix.TestHelper;
-import org.apache.helix.ZNRecord;
-import org.apache.helix.alerts.AlertValueAndStatus;
-import org.apache.helix.api.State;
-import org.apache.helix.healthcheck.ParticipantHealthReportCollectorImpl;
-import org.apache.helix.integration.ZkIntegrationTestBase;
-import org.apache.helix.integration.manager.ClusterControllerManager;
-import org.apache.helix.integration.manager.MockParticipantManager;
-import org.apache.helix.manager.zk.ZKHelixDataAccessor;
-import org.apache.helix.manager.zk.ZkBaseDataAccessor;
-import org.apache.helix.mock.participant.MockEspressoHealthReportProvider;
-import org.apache.helix.mock.participant.MockTransition;
-import org.apache.helix.model.Message;
-import org.apache.helix.tools.ClusterSetup;
-import org.apache.helix.tools.ClusterStateVerifier;
-import org.apache.log4j.Logger;
-import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class TestSimpleWildcardAlert extends ZkIntegrationTestBase {
-  private static Logger LOG = Logger.getLogger(TestSimpleWildcardAlert.class);
-
-  protected ClusterSetup _setupTool = null;
-  protected final String _alertStr =
-      "EXP(decay(1.0)(localhost_12918.RestQueryStats@DBName=TestDB0.latency))CMP(GREATER)CON(10)";
-  protected final String _alertStatusStr = _alertStr; // +" : (*)";
-  protected final String _dbName = "TestDB0";
-
-  @BeforeClass()
-  public void beforeClass() throws Exception {
-
-    _setupTool = new ClusterSetup(_gZkClient);
-  }
-
-  @AfterClass
-  public void afterClass() {
-  }
-
-  public class SimpleAlertTransition extends MockTransition {
-    int _alertValue;
-
-    public SimpleAlertTransition(int value) {
-      _alertValue = value;
-    }
-
-    @Override
-    public void doTransition(Message message, NotificationContext context) {
-      HelixManager manager = context.getManager();
-      HelixDataAccessor accessor = manager.getHelixDataAccessor();
-      State fromState = message.getTypedFromState();
-      State toState = message.getTypedToState();
-      String instance = message.getTgtName();
-
-      if (fromState.toString().equalsIgnoreCase("SLAVE")
-          && toState.toString().equalsIgnoreCase("MASTER")) {
-
-        // add a stat and report to ZK
-        // perhaps should keep reporter per instance...
-        ParticipantHealthReportCollectorImpl reporter =
-            new ParticipantHealthReportCollectorImpl(manager, instance);
-        MockEspressoHealthReportProvider provider = new MockEspressoHealthReportProvider();
-        reporter.addHealthReportProvider(provider);
-        String statName = "latency";
-        provider.setStat(_dbName, statName, "" + (0.1 + _alertValue));
-        reporter.transmitHealthReports();
-
-        /*
-         * for (int i = 0; i < 5; i++)
-         * {
-         * accessor.setProperty(PropertyType.HEALTHREPORT,
-         * new ZNRecord("mockAlerts" + i),
-         * instance,
-         * "mockAlerts");
-         * try
-         * {
-         * Thread.sleep(1000);
-         * }
-         * catch (InterruptedException e)
-         * {
-         * // TODO Auto-generated catch block
-         * e.printStackTrace();
-         * }
-         * }
-         */
-      }
-    }
-
-  }
-
-  @Test()
-  public void testSimpleWildcardAlert() throws Exception {
-    String clusterName = getShortClassName();
-    MockParticipantManager[] participants = new MockParticipantManager[5];
-
-    System.out.println("START testSimpleWildcardAlert at " + new Date(System.currentTimeMillis()));
-
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12944, // participant start port
-        "localhost", // participant name prefix
-        "TestDB", // resource name prefix
-        1, // resources
-        10, // partitions per resource
-        5, // number of nodes //change back to 5!!!
-        3, // replicas //change back to 3!!!
-        "MasterSlave", true); // do rebalance
-
-    // enableHealthCheck(clusterName);
-
-    ClusterControllerManager controller =
-        new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
-    controller.syncStart();
-    controller.stopTimerTasks();
-
-    String alertwildcard =
-        "EXP(decay(1.0)(localhost*.RestQueryStats@DBName=TestDB0.latency))CMP(GREATER)CON(10)";
-
-    _setupTool.getClusterManagementTool().addAlert(clusterName, alertwildcard);
-    // start participants
-    for (int i = 0; i < 5; i++) // !!!change back to 5
-    {
-      String instanceName = "localhost_" + (12944 + i);
-
-      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
-      participants[i].setTransition(new SimpleAlertTransition(i * 5));
-      participants[i].syncStart();
-    }
-
-    boolean result =
-        ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(
-            ZK_ADDR, clusterName));
-    Assert.assertTrue(result);
-
-    Thread.sleep(1000);
-    // HealthAggregationTask is supposed to run by a timer every 30s
-    // To make sure HealthAggregationTask is run, we invoke it explicitly for this test
-    new HealthStatsAggregator(controller).aggregate();
-    // sleep for a few seconds to give stats stage time to trigger
-    Thread.sleep(1000);
-
-    // other verifications go here
-    ZKHelixDataAccessor accessor =
-        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
-    Builder keyBuilder = accessor.keyBuilder();
-    ZNRecord record = accessor.getProperty(keyBuilder.alertStatus()).getRecord();
-    Map<String, Map<String, String>> recMap = record.getMapFields();
-    for (int i = 0; i < 2; i++) {
-      String alertString = "(localhost_" + (12944 + i) + ".RestQueryStats@DBName=TestDB0.latency)";
-      Map<String, String> alertStatusMap = recMap.get(alertwildcard + " : " + alertString);
-      String val = alertStatusMap.get(AlertValueAndStatus.VALUE_NAME);
-      boolean fired = Boolean.parseBoolean(alertStatusMap.get(AlertValueAndStatus.FIRED_NAME));
-      Assert.assertEquals(Double.parseDouble(val), (double) i * 5 + 0.1);
-      Assert.assertFalse(fired);
-    }
-    for (int i = 2; i < 5; i++) {
-      String alertString = "(localhost_" + (12944 + i) + ".RestQueryStats@DBName=TestDB0.latency)";
-      Map<String, String> alertStatusMap = recMap.get(alertwildcard + " : " + alertString);
-      String val = alertStatusMap.get(AlertValueAndStatus.VALUE_NAME);
-      boolean fired = Boolean.parseBoolean(alertStatusMap.get(AlertValueAndStatus.FIRED_NAME));
-      Assert.assertEquals(Double.parseDouble(val), (double) i * 5 + 0.1);
-      Assert.assertTrue(fired);
-    }
-    ZNRecord alertHistory = accessor.getProperty(keyBuilder.alertHistory()).getRecord();
-
-    String deltakey = (String) (alertHistory.getMapFields().keySet().toArray()[0]);
-    Map<String, String> delta = alertHistory.getMapField(deltakey);
-    Assert.assertEquals(delta.size(), 3);
-    for (int i = 2; i < 5; i++) {
-      String alertString =
-          "(localhost_" + (12944 + i) + ".RestQueryStats@DBName#TestDB0.latency)GREATER(10)";
-      Assert.assertTrue(delta.get(alertString).equals("ON"));
-    }
-
-    // Drop and add another alert
-    _setupTool.getClusterManagementTool().dropAlert(clusterName, alertwildcard);
-    alertwildcard =
-        "EXP(decay(1.0)(localhost*.RestQueryStats@DBName=TestDB0.latency))CMP(GREATER)CON(15)";
-    _setupTool.getClusterManagementTool().addAlert(clusterName, alertwildcard);
-    new HealthStatsAggregator(controller).aggregate();
-    Thread.sleep(1000);
-
-    record = accessor.getProperty(keyBuilder.alertStatus()).getRecord();
-    recMap = record.getMapFields();
-    for (int i = 0; i < 3; i++) {
-      String alertString = "(localhost_" + (12944 + i) + ".RestQueryStats@DBName=TestDB0.latency)";
-      Map<String, String> alertStatusMap = recMap.get(alertwildcard + " : " + alertString);
-      String val = alertStatusMap.get(AlertValueAndStatus.VALUE_NAME);
-      boolean fired = Boolean.parseBoolean(alertStatusMap.get(AlertValueAndStatus.FIRED_NAME));
-      Assert.assertEquals(Double.parseDouble(val), (double) i * 5 + 0.1);
-      Assert.assertFalse(fired);
-    }
-    for (int i = 3; i < 5; i++) {
-      String alertString = "(localhost_" + (12944 + i) + ".RestQueryStats@DBName=TestDB0.latency)";
-      Map<String, String> alertStatusMap = recMap.get(alertwildcard + " : " + alertString);
-      String val = alertStatusMap.get(AlertValueAndStatus.VALUE_NAME);
-      boolean fired = Boolean.parseBoolean(alertStatusMap.get(AlertValueAndStatus.FIRED_NAME));
-      Assert.assertEquals(Double.parseDouble(val), (double) i * 5 + 0.1);
-      Assert.assertTrue(fired);
-    }
-    alertHistory = accessor.getProperty(keyBuilder.alertHistory()).getRecord();
-
-    deltakey = (String) (alertHistory.getMapFields().keySet().toArray()[1]);
-    delta = alertHistory.getMapField(deltakey);
-    Assert.assertTrue(delta.size() == 2);
-    for (int i = 3; i < 5; i++) {
-      String alertString =
-          "(localhost_" + (12944 + i) + ".RestQueryStats@DBName#TestDB0.latency)GREATER(15)";
-      Assert.assertTrue(delta.get(alertString).equals("ON"));
-    }
-
-    // clean up
-    controller.syncStop();
-    for (int i = 0; i < 5; i++) {
-      participants[i].syncStop();
-    }
-    System.out.println("END testSimpleWildcardAlert at " + new Date(System.currentTimeMillis()));
-  }
-}

http://git-wip-us.apache.org/repos/asf/helix/blob/38b43965/helix-core/src/test/java/org/apache/helix/healthcheck/TestStalenessAlert.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/healthcheck/TestStalenessAlert.java b/helix-core/src/test/java/org/apache/helix/healthcheck/TestStalenessAlert.java
deleted file mode 100644
index 3227a65..0000000
--- a/helix-core/src/test/java/org/apache/helix/healthcheck/TestStalenessAlert.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package org.apache.helix.healthcheck;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.Date;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.helix.HelixDataAccessor;
-import org.apache.helix.HelixManager;
-import org.apache.helix.NotificationContext;
-import org.apache.helix.PropertyKey.Builder;
-import org.apache.helix.TestHelper;
-import org.apache.helix.ZNRecord;
-import org.apache.helix.alerts.AlertValueAndStatus;
-import org.apache.helix.api.State;
-import org.apache.helix.healthcheck.ParticipantHealthReportCollectorImpl;
-import org.apache.helix.integration.ZkIntegrationTestBase;
-import org.apache.helix.integration.manager.ClusterControllerManager;
-import org.apache.helix.integration.manager.MockParticipantManager;
-import org.apache.helix.manager.zk.ZKHelixDataAccessor;
-import org.apache.helix.manager.zk.ZkBaseDataAccessor;
-import org.apache.helix.mock.participant.MockEspressoHealthReportProvider;
-import org.apache.helix.mock.participant.MockTransition;
-import org.apache.helix.model.Message;
-import org.apache.helix.tools.ClusterSetup;
-import org.apache.helix.tools.ClusterStateVerifier;
-import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class TestStalenessAlert extends ZkIntegrationTestBase {
-  protected ClusterSetup _setupTool = null;
-  protected final String _alertStr = "EXP(decay(1)(localhost_*.reportingage))CMP(GREATER)CON(600)";
-  protected final String _alertStatusStr = _alertStr + " : (localhost_12918.reportingage)";
-  protected final String _dbName = "TestDB0";
-
-  @BeforeClass()
-  public void beforeClass() throws Exception {
-
-    _setupTool = new ClusterSetup(_gZkClient);
-  }
-
-  @AfterClass
-  public void afterClass() {
-  }
-
-  public class StalenessAlertTransition extends MockTransition {
-    @Override
-    public void doTransition(Message message, NotificationContext context) {
-      HelixManager manager = context.getManager();
-      HelixDataAccessor accessor = manager.getHelixDataAccessor();
-      State fromState = message.getTypedFromState();
-      State toState = message.getTypedToState();
-      String instance = message.getTgtName();
-
-      if (fromState.toString().equalsIgnoreCase("SLAVE")
-          && toState.toString().equalsIgnoreCase("MASTER")) {
-
-        // add a stat and report to ZK
-        // perhaps should keep reporter per instance...
-        ParticipantHealthReportCollectorImpl reporter =
-            new ParticipantHealthReportCollectorImpl(manager, instance);
-        MockEspressoHealthReportProvider provider = new MockEspressoHealthReportProvider();
-        reporter.addHealthReportProvider(provider);
-        String statName = "latency";
-        provider.setStat(_dbName, statName, "15");
-        reporter.transmitHealthReports();
-
-        /*
-         * for (int i = 0; i < 5; i++)
-         * {
-         * accessor.setProperty(PropertyType.HEALTHREPORT,
-         * new ZNRecord("mockAlerts" + i),
-         * instance,
-         * "mockAlerts");
-         * try
-         * {
-         * Thread.sleep(1000);
-         * }
-         * catch (InterruptedException e)
-         * {
-         * // TODO Auto-generated catch block
-         * e.printStackTrace();
-         * }
-         * }
-         */
-      }
-    }
-
-  }
-
-  @Test()
-  public void testStalenessAlert() throws Exception {
-    String clusterName = getShortClassName();
-    MockParticipantManager[] participants = new MockParticipantManager[5];
-
-    System.out.println("START TestStalenessAlert at " + new Date(System.currentTimeMillis()));
-
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant start port
-        "localhost", // participant name prefix
-        "TestDB", // resource name prefix
-        1, // resources
-        10, // partitions per resource
-        5, // number of nodes //change back to 5!!!
-        3, // replicas //change back to 3!!!
-        "MasterSlave", true); // do rebalance
-    // enableHealthCheck(clusterName);
-
-    _setupTool.getClusterManagementTool().addAlert(clusterName, _alertStr);
-
-    ClusterControllerManager controller =
-        new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
-    controller.syncStart();
-
-    // start participants
-    for (int i = 0; i < 5; i++) // !!!change back to 5
-    {
-      String instanceName = "localhost_" + (12918 + i);
-
-      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
-      participants[i].setTransition(new StalenessAlertTransition());
-      participants[i].syncStart();
-    }
-
-    boolean result =
-        ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(
-            ZK_ADDR, clusterName));
-    Assert.assertTrue(result);
-
-    // HealthAggregationTask is supposed to run by a timer every 30s
-    // To make sure HealthAggregationTask is run, we invoke it explicitly for this test
-    new HealthStatsAggregator(controller).aggregate();
-    // sleep for a few seconds to give stats stage time to trigger
-    Thread.sleep(3000);
-
-    // other verifications go here
-    ZKHelixDataAccessor accessor =
-        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
-    Builder keyBuilder = accessor.keyBuilder();
-    // for (int i = 0; i < 1; i++) //change 1 back to 5
-    // {
-    // String instance = "localhost_" + (12918 + i);
-    // String instance = "localhost_12918";
-    ZNRecord record = accessor.getProperty(keyBuilder.alertStatus()).getRecord();
-    Map<String, Map<String, String>> recMap = record.getMapFields();
-    Set<String> keySet = recMap.keySet();
-    Map<String, String> alertStatusMap = recMap.get(_alertStatusStr);
-    String val = alertStatusMap.get(AlertValueAndStatus.VALUE_NAME);
-    boolean fired = Boolean.parseBoolean(alertStatusMap.get(AlertValueAndStatus.FIRED_NAME));
-    // Assert.assertEquals(Double.parseDouble(val), Double.parseDouble("75.0"));
-    // Assert.assertFalse(fired);
-    // }
-
-    // clean up
-    controller.syncStop();
-    for (int i = 0; i < 5; i++) {
-      participants[i].syncStop();
-    }
-    System.out.println("END TestStalenessAlert at " + new Date(System.currentTimeMillis()));
-  }
-}

http://git-wip-us.apache.org/repos/asf/helix/blob/38b43965/helix-core/src/test/java/org/apache/helix/healthcheck/TestWildcardAlert.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/healthcheck/TestWildcardAlert.java b/helix-core/src/test/java/org/apache/helix/healthcheck/TestWildcardAlert.java
deleted file mode 100644
index 9677fcf..0000000
--- a/helix-core/src/test/java/org/apache/helix/healthcheck/TestWildcardAlert.java
+++ /dev/null
@@ -1,296 +0,0 @@
-package org.apache.helix.healthcheck;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.management.AttributeNotFoundException;
-import javax.management.InstanceNotFoundException;
-import javax.management.IntrospectionException;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanException;
-import javax.management.MBeanInfo;
-import javax.management.MBeanServerConnection;
-import javax.management.MBeanServerNotification;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.management.ReflectionException;
-
-import org.apache.helix.HelixDataAccessor;
-import org.apache.helix.HelixManager;
-import org.apache.helix.NotificationContext;
-import org.apache.helix.PropertyKey.Builder;
-import org.apache.helix.TestHelper;
-import org.apache.helix.ZNRecord;
-import org.apache.helix.alerts.AlertValueAndStatus;
-import org.apache.helix.api.State;
-import org.apache.helix.healthcheck.ParticipantHealthReportCollectorImpl;
-import org.apache.helix.integration.ZkIntegrationTestBase;
-import org.apache.helix.integration.manager.ClusterControllerManager;
-import org.apache.helix.integration.manager.MockParticipantManager;
-import org.apache.helix.manager.zk.ZKHelixDataAccessor;
-import org.apache.helix.manager.zk.ZkBaseDataAccessor;
-import org.apache.helix.mock.participant.MockEspressoHealthReportProvider;
-import org.apache.helix.mock.participant.MockTransition;
-import org.apache.helix.model.Message;
-import org.apache.helix.monitoring.mbeans.ClusterAlertMBeanCollection;
-import org.apache.helix.monitoring.mbeans.ClusterMBeanObserver;
-import org.apache.helix.tools.ClusterSetup;
-import org.apache.helix.tools.ClusterStateVerifier;
-import org.apache.log4j.Logger;
-import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class TestWildcardAlert extends ZkIntegrationTestBase {
-  public static class TestClusterMBeanObserver extends ClusterMBeanObserver {
-    public Map<String, Map<String, Object>> _beanValueMap =
-        new ConcurrentHashMap<String, Map<String, Object>>();
-
-    public TestClusterMBeanObserver(String domain) throws InstanceNotFoundException, IOException,
-        MalformedObjectNameException, NullPointerException {
-      super(domain);
-    }
-
-    @Override
-    public void onMBeanRegistered(MBeanServerConnection server,
-        MBeanServerNotification mbsNotification) {
-      try {
-        MBeanInfo info = _server.getMBeanInfo(mbsNotification.getMBeanName());
-        MBeanAttributeInfo[] infos = info.getAttributes();
-        _beanValueMap.put(mbsNotification.getMBeanName().toString(),
-            new ConcurrentHashMap<String, Object>());
-        for (MBeanAttributeInfo infoItem : infos) {
-          Object val = _server.getAttribute(mbsNotification.getMBeanName(), infoItem.getName());
-          System.out.println("         " + infoItem.getName() + " : "
-              + _server.getAttribute(mbsNotification.getMBeanName(), infoItem.getName())
-              + " type : " + infoItem.getType());
-          _beanValueMap.get(mbsNotification.getMBeanName().toString()).put(infoItem.getName(), val);
-        }
-      } catch (Exception e) {
-        _logger.error("Error getting bean info, domain=" + _domain, e);
-      }
-    }
-
-    @Override
-    public void onMBeanUnRegistered(MBeanServerConnection server,
-        MBeanServerNotification mbsNotification) {
-      _beanValueMap.remove(mbsNotification.getMBeanName().toString());
-    }
-
-    public void refresh() throws MalformedObjectNameException, NullPointerException,
-        InstanceNotFoundException, IntrospectionException, ReflectionException, IOException,
-        AttributeNotFoundException, MBeanException {
-      for (String beanName : _beanValueMap.keySet()) {
-        ObjectName objName = new ObjectName(beanName);
-        MBeanInfo info = _server.getMBeanInfo(objName);
-        MBeanAttributeInfo[] infos = info.getAttributes();
-        _beanValueMap.put(objName.toString(), new HashMap<String, Object>());
-        for (MBeanAttributeInfo infoItem : infos) {
-          Object val = _server.getAttribute(objName, infoItem.getName());
-          System.out
-              .println("         " + infoItem.getName() + " : "
-                  + _server.getAttribute(objName, infoItem.getName()) + " type : "
-                  + infoItem.getType());
-          _beanValueMap.get(objName.toString()).put(infoItem.getName(), val);
-        }
-      }
-    }
-
-  }
-
-  private static final Logger _logger = Logger.getLogger(TestWildcardAlert.class);
-  protected ClusterSetup _setupTool = null;
-  protected final String _alertStr =
-      "EXP(decay(1)(localhost_*.RestQueryStats@DBName=TestDB0.latency)|EXPAND|SUMEACH)CMP(GREATER)CON(10)";
-  protected final String _alertStatusStr = _alertStr; // +" : (*)";
-  protected final String _dbName = "TestDB0";
-
-  @BeforeClass()
-  public void beforeClass() throws Exception {
-
-    _setupTool = new ClusterSetup(_gZkClient);
-  }
-
-  @AfterClass
-  public void afterClass() {
-  }
-
-  public class WildcardAlertTransition extends MockTransition {
-    @Override
-    public void doTransition(Message message, NotificationContext context) {
-      HelixManager manager = context.getManager();
-      HelixDataAccessor accessor = manager.getHelixDataAccessor();
-      State fromState = message.getTypedFromState();
-      State toState = message.getTypedToState();
-      String instance = message.getTgtName();
-
-      if (fromState.toString().equalsIgnoreCase("SLAVE")
-          && toState.toString().equalsIgnoreCase("MASTER")) {
-        // add a stat and report to ZK
-        // perhaps should keep reporter per instance...
-        ParticipantHealthReportCollectorImpl reporter =
-            new ParticipantHealthReportCollectorImpl(manager, instance);
-        MockEspressoHealthReportProvider provider = new MockEspressoHealthReportProvider();
-        reporter.addHealthReportProvider(provider);
-        String statName = "latency";
-        // using constant as timestamp so that when each partition does this transition,
-        // they do not advance timestamp, and no stats double-counted
-        String timestamp = "12345";
-        provider.setStat(_dbName, statName, "15", timestamp);
-
-        // sleep for random time and see about errors.
-        /*
-         * Random r = new Random();
-         * int x = r.nextInt(30000);
-         * try {
-         * Thread.sleep(x);
-         * } catch (InterruptedException e) {
-         * // TODO Auto-generated catch block
-         * e.printStackTrace();
-         * }
-         */
-
-        reporter.transmitHealthReports();
-
-        /*
-         * for (int i = 0; i < 5; i++)
-         * {
-         * accessor.setProperty(PropertyType.HEALTHREPORT,
-         * new ZNRecord("mockAlerts" + i),
-         * instance,
-         * "mockAlerts");
-         * try
-         * {
-         * Thread.sleep(1000);
-         * }
-         * catch (InterruptedException e)
-         * {
-         * // TODO Auto-generated catch block
-         * e.printStackTrace();
-         * }
-         * }
-         */
-      }
-    }
-
-  }
-
-  @Test()
-  public void testWildcardAlert() throws Exception {
-    String clusterName = getShortClassName();
-    MockParticipantManager[] participants = new MockParticipantManager[5];
-
-    System.out.println("START TestWildcardAlert at " + new Date(System.currentTimeMillis()));
-
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant start
-                                                         // port
-        "localhost", // participant name prefix
-        "TestDB", // resource name prefix
-        1, // resources
-        10, // partitions per resource
-        5, // number of nodes //change back to 5!!!
-        3, // replicas //change back to 3!!!
-        "MasterSlave", true); // do rebalance
-
-    // enableHealthCheck(clusterName);
-
-    _setupTool.getClusterManagementTool().addAlert(clusterName, _alertStr);
-    // _setupTool.getClusterManagementTool().addAlert(clusterName, _alertStr2);
-
-    ClusterControllerManager controller =
-        new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
-    controller.syncStart();
-    // start participants
-    for (int i = 0; i < 5; i++) // !!!change back to 5
-    {
-      String instanceName = "localhost_" + (12918 + i);
-
-      participants[i] = new MockParticipantManager(ZK_ADDR, clusterName, instanceName);
-      participants[i].setTransition(new WildcardAlertTransition());
-      participants[i].syncStart();
-    }
-
-    TestClusterMBeanObserver jmxMBeanObserver =
-        new TestClusterMBeanObserver(ClusterAlertMBeanCollection.DOMAIN_ALERT);
-
-    boolean result =
-        ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(
-            ZK_ADDR, clusterName));
-    Assert.assertTrue(result);
-    Thread.sleep(3000);
-    // HealthAggregationTask is supposed to run by a timer every 30s
-    // To make sure HealthAggregationTask is run, we invoke it explicitly for this test
-    new HealthStatsAggregator(controller).aggregate();
-
-    // sleep for a few seconds to give stats stage time to trigger and for bean to trigger
-    Thread.sleep(3000);
-
-    ZKHelixDataAccessor accessor =
-        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
-    Builder keyBuilder = accessor.keyBuilder();
-
-    // for (int i = 0; i < 1; i++) //change 1 back to 5
-    // {
-    // String instance = "localhost_" + (12918 + i);
-    // String instance = "localhost_12918";
-    ZNRecord record = accessor.getProperty(keyBuilder.alertStatus()).getRecord();
-    Map<String, Map<String, String>> recMap = record.getMapFields();
-    Set<String> keySet = recMap.keySet();
-    Map<String, String> alertStatusMap = recMap.get(_alertStatusStr);
-    String val = alertStatusMap.get(AlertValueAndStatus.VALUE_NAME);
-    boolean fired = Boolean.parseBoolean(alertStatusMap.get(AlertValueAndStatus.FIRED_NAME));
-    Assert.assertEquals(Double.parseDouble(val), Double.parseDouble("75.0"));
-    Assert.assertTrue(fired);
-
-    // Make sure that the jmxObserver has received all the jmx bean value that is corresponding
-    // to the alerts.
-    jmxMBeanObserver.refresh();
-    Assert.assertTrue(jmxMBeanObserver._beanValueMap.size() >= 1);
-
-    String beanName =
-        "HelixAlerts:alert=EXP(decay(1)(localhost_%.RestQueryStats@DBName#TestDB0.latency)|EXPAND|SUMEACH)CMP(GREATER)CON(10)--(%)";
-    Assert.assertTrue(jmxMBeanObserver._beanValueMap.containsKey(beanName));
-
-    Map<String, Object> beanValueMap = jmxMBeanObserver._beanValueMap.get(beanName);
-    Assert.assertEquals(beanValueMap.size(), 4);
-    Assert.assertEquals((beanValueMap.get("AlertFired")), new Integer(1));
-    Assert.assertEquals((beanValueMap.get("AlertValue")), new Double(75.0));
-    Assert
-        .assertEquals(
-            (String) (beanValueMap.get("SensorName")),
-            "EXP(decay(1)(localhost_%.RestQueryStats@DBName#TestDB0.latency)|EXPAND|SUMEACH)CMP(GREATER)CON(10)--(%)");
-    // }
-
-    // clean up
-    controller.syncStop();
-    for (int i = 0; i < 5; i++) {
-      participants[i].syncStop();
-    }
-
-    System.out.println("END TestWildcardAlert at " + new Date(System.currentTimeMillis()));
-  }
-}

http://git-wip-us.apache.org/repos/asf/helix/blob/38b43965/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkClusterManager.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkClusterManager.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkClusterManager.java
index 83dc986..bcab38e 100644
--- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkClusterManager.java
+++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkClusterManager.java
@@ -106,7 +106,6 @@ public class TestZkClusterManager extends ZkUnitTestBase {
     AssertJUnit.assertEquals("node_1", record.getId());
 
     controller.getMessagingService();
-    controller.getHealthReportCollector();
     controller.getClusterManagmentTool();
 
     controller.handleNewSession();
@@ -247,8 +246,6 @@ public class TestZkClusterManager extends ZkUnitTestBase {
     AssertJUnit.assertTrue(admin.isConnected());
 
     HelixAdmin adminTool = admin.getClusterManagmentTool();
-    // ConfigScope scope = new ConfigScopeBuilder().forCluster(clusterName)
-    // .forResource("testResource").forPartition("testPartition").build();
     HelixConfigScope scope =
         new HelixConfigScopeBuilder(ConfigScopeProperty.PARTITION).forCluster(clusterName)
             .forResource("testResource").forPartition("testPartition").build();

http://git-wip-us.apache.org/repos/asf/helix/blob/38b43965/helix-core/src/test/java/org/apache/helix/mock/participant/MockEspressoHealthReportProvider.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/mock/participant/MockEspressoHealthReportProvider.java b/helix-core/src/test/java/org/apache/helix/mock/participant/MockEspressoHealthReportProvider.java
deleted file mode 100644
index 84ba081..0000000
--- a/helix-core/src/test/java/org/apache/helix/mock/participant/MockEspressoHealthReportProvider.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.apache.helix.mock.participant;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.helix.alerts.StatsHolder;
-import org.apache.helix.healthcheck.HealthReportProvider;
-
-public class MockEspressoHealthReportProvider extends HealthReportProvider {
-
-  private final String _reportName = "RestQueryStats";
-  private HashMap<String, Map<String, String>> _statMap;
-  private final String DB_NAME = "DBName";
-
-  public MockEspressoHealthReportProvider() {
-    super();
-    _statMap = new HashMap<String, Map<String, String>>();
-  }
-
-  public String buildMapKey(String dbName) {
-    return _reportName + "@" + DB_NAME + "=" + dbName;
-  }
-
-  public void setStat(String dbName, String statName, String statVal) {
-    String currTime = String.valueOf(System.currentTimeMillis());
-    setStat(dbName, statName, statVal, currTime);
-  }
-
-  /*
-   * This version takes a fixed timestamp to ease with testing
-   */
-  public void setStat(String dbName, String statName, String statVal, String timestamp) {
-    String key = buildMapKey(dbName);
-    Map<String, String> dbStatMap = _statMap.get(key);
-    if (dbStatMap == null) {
-      dbStatMap = new HashMap<String, String>();
-      _statMap.put(key, dbStatMap);
-    }
-    dbStatMap.put(statName, statVal);
-    dbStatMap.put(StatsHolder.TIMESTAMP_NAME, timestamp);
-  }
-
-  @Override
-  public Map<String, String> getRecentHealthReport() {
-    return null;
-  }
-
-  @Override
-  public Map<String, Map<String, String>> getRecentPartitionHealthReport() {
-    return _statMap;
-  }
-
-  @Override
-  public void resetStats() {
-    _statMap.clear();
-  }
-
-  public String getReportName() {
-    return _reportName;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/helix/blob/38b43965/helix-core/src/test/java/org/apache/helix/mock/participant/MockHealthReportParticipant.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/mock/participant/MockHealthReportParticipant.java b/helix-core/src/test/java/org/apache/helix/mock/participant/MockHealthReportParticipant.java
deleted file mode 100644
index 31811bb..0000000
--- a/helix-core/src/test/java/org/apache/helix/mock/participant/MockHealthReportParticipant.java
+++ /dev/null
@@ -1,248 +0,0 @@
-package org.apache.helix.mock.participant;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Random;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.GnuParser;
-import org.apache.commons.cli.HelpFormatter;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.commons.cli.Options;
-import org.apache.commons.cli.ParseException;
-import org.apache.helix.HelixManager;
-import org.apache.helix.healthcheck.HealthReportProvider;
-import org.apache.helix.integration.manager.MockParticipantManager;
-import org.apache.log4j.Logger;
-
-public class MockHealthReportParticipant {
-  private static final Logger LOG = Logger.getLogger(MockHealthReportParticipant.class);
-  public static final String zkServer = "zkSvr";
-  public static final String cluster = "cluster";
-  public static final String host = "host";
-  public static final String port = "port";
-  public static final String help = "help";
-
-  static class MockHealthReportProvider extends HealthReportProvider {
-    private final String _reportName = "MockRestQueryStats";
-    private final Map<String, Map<String, String>> _mockHealthReport;
-
-    public MockHealthReportProvider() {
-      _mockHealthReport = new HashMap<String, Map<String, String>>();
-
-      Map<String, String> reportMap = new HashMap<String, String>();
-      _mockHealthReport.put("MockRestQueryStats@DBName=BizProfile", reportMap);
-
-      reportMap.put("MeanMysqlLatency", "2.132700625");
-      reportMap.put("95PercentileLatencyLucene", "108.40825525");
-      reportMap.put("99PercentileLatencyMysql", "9.369827");
-      reportMap.put("99PercentileLatencyServer", "167.714208");
-      reportMap.put("95PercentileLatencyMysqlPool", "8.03621375");
-      reportMap.put("95PercentileLatencyServer", "164.68374265");
-      reportMap.put("MinLuceneLatency", "1.765908");
-      reportMap.put("MaxServerLatency", "167.714208");
-      reportMap.put("MeanLuceneLatency", "16.107599458333336");
-      reportMap.put("CollectorName", "RestQueryStats");
-      reportMap.put("MeanLucenePoolLatency", "8.120545333333332");
-      reportMap.put("99PercentileLatencyLucenePool", "65.930564");
-      reportMap.put("MinServerLatency", "0.425272");
-      reportMap.put("IndexStoreMismatchCount", "0");
-      reportMap.put("ErrorCount", "0");
-      reportMap.put("MeanMysqlPoolLatency", "1.0704102916666667");
-      reportMap.put("MinLucenePoolLatency", "0.008189");
-      reportMap.put("MinMysqlLatency", "0.709691");
-      reportMap.put("MaxMysqlPoolLatency", "8.606973");
-      reportMap.put("99PercentileLatencyMysqlPool", "8.606973");
-      reportMap.put("MinMysqlPoolLatency", "0.091883");
-      reportMap.put("MaxLucenePoolLatency", "65.930564");
-      reportMap.put("99PercentileLatencyLucene", "111.78799");
-      reportMap.put("MaxMysqlLatency", "9.369827");
-      reportMap.put("TimeStamp", "1332895048143");
-      reportMap.put("MeanConcurrencyLevel", "1.9");
-      reportMap.put("95PercentileLatencyMysql", "8.96594875");
-      reportMap.put("QueryStartCount", "0");
-      reportMap.put("95PercentileLatencyLucenePool", "63.518656500000006");
-      reportMap.put("MeanServerLatency", "39.5451532");
-      reportMap.put("MaxLuceneLatency", "111.78799");
-      reportMap.put("QuerySuccessCount", "0");
-    }
-
-    @Override
-    public Map<String, String> getRecentHealthReport() {
-      // TODO Auto-generated method stub
-      return null;
-    }
-
-    @Override
-    public void resetStats() {
-      // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public Map<String, Map<String, String>> getRecentPartitionHealthReport() {
-      // tweak: randomly change the last digit
-      for (String key1 : _mockHealthReport.keySet()) {
-        Map<String, String> reportMap = _mockHealthReport.get(key1);
-        for (String key2 : reportMap.keySet()) {
-          String value = reportMap.get(key2);
-          String lastDigit = "" + new Random().nextInt(10);
-          value = value.substring(0, value.length() - 1) + lastDigit;
-          reportMap.put(key2, value);
-        }
-      }
-
-      return _mockHealthReport;
-    }
-
-    @Override
-    public String getReportName() {
-      return _reportName;
-    }
-  }
-
-  static class MockHealthReportJob implements MockJobIntf {
-
-    @Override
-    public void doPreConnectJob(HelixManager manager) {
-      // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public void doPostConnectJob(HelixManager manager) {
-      // TODO Auto-generated method stub
-      manager.getHealthReportCollector().addHealthReportProvider(new MockHealthReportProvider());
-
-      // // set property store path for perf test
-      // final String setPath = "/TEST_PERF/set";
-      // final String updatePath = "/TEST_PERF/update";
-      // manager.getHelixPropertyStore().create(setPath, new ZNRecord(setPath),
-      // BaseDataAccessor.Option.PERSISTENT);
-      // manager.getHelixPropertyStore().set(updatePath, new ZNRecord(updatePath),
-      // BaseDataAccessor.Option.PERSISTENT);
-    }
-
-  }
-
-  // hack OptionBuilder is not thread safe
-  @SuppressWarnings("static-access")
-  synchronized private static Options constructCommandLineOptions() {
-    Option helpOption =
-        OptionBuilder.withLongOpt(help).withDescription("Prints command-line options info")
-            .create();
-
-    Option clusterOption =
-        OptionBuilder.withLongOpt(cluster).withDescription("Provide cluster name").create();
-    clusterOption.setArgs(1);
-    clusterOption.setRequired(true);
-    clusterOption.setArgName("Cluster name (Required)");
-
-    Option hostOption =
-        OptionBuilder.withLongOpt(host).withDescription("Provide host name").create();
-    hostOption.setArgs(1);
-    hostOption.setRequired(true);
-    hostOption.setArgName("Host name (Required)");
-
-    Option portOption =
-        OptionBuilder.withLongOpt(port).withDescription("Provide host port").create();
-    portOption.setArgs(1);
-    portOption.setRequired(true);
-    portOption.setArgName("Host port (Required)");
-
-    Option zkServerOption =
-        OptionBuilder.withLongOpt(zkServer).withDescription("Provide zookeeper address").create();
-    zkServerOption.setArgs(1);
-    zkServerOption.setRequired(true);
-    zkServerOption.setArgName("Zookeeper server address(Required)");
-
-    Options options = new Options();
-    options.addOption(helpOption);
-    options.addOption(clusterOption);
-    options.addOption(hostOption);
-    options.addOption(portOption);
-    options.addOption(zkServerOption);
-
-    return options;
-  }
-
-  public static void printUsage(Options cliOptions) {
-    HelpFormatter helpFormatter = new HelpFormatter();
-    helpFormatter.printHelp("java " + MockHealthReportParticipant.class.getName(), cliOptions);
-  }
-
-  public static CommandLine processCommandLineArgs(String[] cliArgs) throws Exception {
-    CommandLineParser cliParser = new GnuParser();
-    Options cliOptions = constructCommandLineOptions();
-
-    try {
-
-      return cliParser.parse(cliOptions, cliArgs);
-    } catch (ParseException pe) {
-      System.err.println("CommandLineClient: failed to parse command-line options: "
-          + pe.toString());
-      printUsage(cliOptions);
-      System.exit(1);
-    }
-    return null;
-  }
-
-  // NOT working for kill -9, working for kill -2/-15
-  static class MockHealthReportParticipantShutdownHook extends Thread {
-    final MockParticipantManager _participant;
-
-    MockHealthReportParticipantShutdownHook(MockParticipantManager participant) {
-      _participant = participant;
-    }
-
-    @Override
-    public void run() {
-      LOG.info("MockHealthReportParticipantShutdownHook invoked");
-      _participant.syncStop();
-    }
-  }
-
-  public static void main(String[] args) throws Exception {
-    CommandLine cmd = processCommandLineArgs(args);
-    String zkConnectStr = cmd.getOptionValue(zkServer);
-    String clusterName = cmd.getOptionValue(cluster);
-    String hostStr = cmd.getOptionValue(host);
-    String portStr = cmd.getOptionValue(port);
-
-    String instanceName = hostStr + "_" + portStr;
-
-    MockParticipantManager participant =
-        new MockParticipantManager(zkConnectStr, clusterName, instanceName);
-    // participant.setTransition(new StoreAccessDiffNodeTransition());
-    // participant.setTransition(new StoreAccessOneNodeTransition()));
-    // new MockHealthReportJob());
-    Runtime.getRuntime().addShutdownHook(new MockHealthReportParticipantShutdownHook(participant));
-
-    // Espresso_driver.py will consume this
-    System.out
-        .println("MockHealthReportParticipant process started, instanceName: " + instanceName);
-
-    participant.run();
-  }
-}

http://git-wip-us.apache.org/repos/asf/helix/blob/38b43965/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
deleted file mode 100644
index bb4f46d..0000000
--- a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterAlertItemMBeanCollection.java
+++ /dev/null
@@ -1,289 +0,0 @@
-package org.apache.helix.monitoring.mbeans;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.management.AttributeNotFoundException;
-import javax.management.InstanceNotFoundException;
-import javax.management.IntrospectionException;
-import javax.management.MBeanException;
-import javax.management.MalformedObjectNameException;
-import javax.management.ReflectionException;
-
-import org.apache.helix.alerts.AlertValueAndStatus;
-import org.apache.helix.alerts.Tuple;
-import org.apache.helix.healthcheck.TestWildcardAlert.TestClusterMBeanObserver;
-import org.apache.log4j.Logger;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-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 {
-    ClusterAlertMBeanCollection beanCollection = new ClusterAlertMBeanCollection();
-
-    String clusterName = "TestCluster";
-    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)";
-    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";
-      Tuple<String> value = new Tuple<String>();
-      value.add("22" + i);
-      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";
-      Tuple<String> value = new Tuple<String>();
-      value.add("22" + i);
-      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)";
-      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)";
-      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";
-      Tuple<String> value = new Tuple<String>();
-      value.add("22" + i);
-      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";
-      Tuple<String> value = new Tuple<String>();
-      value.add("22" + i);
-      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";
-      Tuple<String> value = new Tuple<String>();
-      value.add("22" + i);
-      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";
-      Tuple<String> value = new Tuple<String>();
-      value.add("22" + i);
-      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";
-      Tuple<String> value = new Tuple<String>();
-      value.add("22" + i);
-      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";
-      Tuple<String> value = new Tuple<String>();
-      value.add("22" + i);
-      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.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)";
-      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)";
-      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)";
-      Assert.assertTrue(delta.get(alertBeanName).equals("ON"));
-    }
-  }
-
-  @Test
-  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)";
-    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)";
-    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";
-      Tuple<String> value = new Tuple<String>();
-      value.add("22" + i);
-      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";
-      Tuple<String> value = new Tuple<String>();
-      value.add("22" + i);
-      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++) {
-      Thread.sleep(500);
-
-      jmxMBeanObserver.refresh();
-
-      if (jmxMBeanObserver._beanValueMap.size() == nAlerts1 + 1) {
-        break;
-      }
-    }
-    Assert.assertEquals(jmxMBeanObserver._beanValueMap.size(), nAlerts1 + 1);
-  }
-}

http://git-wip-us.apache.org/repos/asf/helix/blob/38b43965/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 7d252c5..11cdd34 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
@@ -27,7 +27,6 @@ import org.apache.helix.ConfigChangeListener;
 import org.apache.helix.ControllerChangeListener;
 import org.apache.helix.CurrentStateChangeListener;
 import org.apache.helix.ExternalViewChangeListener;
-import org.apache.helix.HealthStateChangeListener;
 import org.apache.helix.HelixAdmin;
 import org.apache.helix.HelixDataAccessor;
 import org.apache.helix.HelixManager;
@@ -42,7 +41,6 @@ import org.apache.helix.PreConnectCallback;
 import org.apache.helix.PropertyKey;
 import org.apache.helix.ScopedConfigChangeListener;
 import org.apache.helix.ZNRecord;
-import org.apache.helix.healthcheck.ParticipantHealthReportCollector;
 import org.apache.helix.manager.zk.ZKHelixDataAccessor;
 import org.apache.helix.manager.zk.ZkBaseDataAccessor;
 import org.apache.helix.manager.zk.ZkClient;
@@ -170,24 +168,11 @@ public class MockZKHelixManager implements HelixManager {
   }
 
   @Override
-  public ParticipantHealthReportCollector getHealthReportCollector() {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
   public InstanceType getInstanceType() {
     return _type;
   }
 
   @Override
-  public void addHealthStateChangeListener(HealthStateChangeListener listener, String instanceName)
-      throws Exception {
-    // TODO Auto-generated method stub
-
-  }
-
-  @Override
   public String getVersion() {
     // TODO Auto-generated method stub
     return UUID.randomUUID().toString();


Mime
View raw message