Examples of alertHistory()


Examples of org.apache.helix.PropertyKey.Builder.alertHistory()

      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++) {
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.alertHistory()

      String date = dateFormat.format(new Date());

      HelixDataAccessor accessor = manager.getHelixDataAccessor();
      Builder keyBuilder = accessor.keyBuilder();

      HelixProperty property = accessor.getProperty(keyBuilder.alertHistory());
      ZNRecord alertFiredHistory;
      if (property == null) {
        alertFiredHistory = new ZNRecord(PropertyType.ALERT_HISTORY.toString());
      } else {
        alertFiredHistory = property.getRecord();
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.alertHistory()

        String firstKey = (String) (alertFiredHistory.getMapFields().keySet().toArray()[0]);
        alertFiredHistory.getMapFields().remove(firstKey);
      }
      alertFiredHistory.setMapField(date, delta);
      // manager.getDataAccessor().setProperty(PropertyType.ALERT_HISTORY, alertFiredHistory);
      accessor.setProperty(keyBuilder.alertHistory(), new AlertHistory(alertFiredHistory));
      _alertBeanCollection.setAlertHistory(alertFiredHistory);
    }
  }

  public ClusterAlertMBeanCollection getClusterAlertMBeanCollection() {
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.alertHistory()

    task.run();
    Thread.sleep(100);
    HelixDataAccessor helixDataAccessor = manager.getHelixDataAccessor();
    Builder keyBuilder = helixDataAccessor.keyBuilder();

    AlertHistory history = manager.getHelixDataAccessor().getProperty(keyBuilder.alertHistory());
    //
    Assert.assertEquals(history, null);
   
    properties.put("healthChange.enabled", "true");
    _setupTool.getClusterManagementTool().setConfig(scope, properties);
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.alertHistory()

    _setupTool.getClusterManagementTool().setConfig(scope, properties);
   
    task.run();
    Thread.sleep(100);
   
    history = manager.getHelixDataAccessor().getProperty(keyBuilder.alertHistory());
    //
    Assert.assertNotNull(history);
    Assert.assertEquals(history.getRecord().getMapFields().size(), 1);
  }
 
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.alertHistory()

    _setupTool.getClusterManagementTool().addAlert(CLUSTER_NAME, _alertStr2);

    int historySize = 0;
    HelixDataAccessor helixDataAccessor = manager.getHelixDataAccessor();
    Builder keyBuilder = helixDataAccessor.keyBuilder();
    HelixProperty property = helixDataAccessor.getProperty(keyBuilder.alertHistory());
    ZNRecord history = null;
    if(property != null)
    {
      history = property.getRecord();
      historySize = property.getRecord().getMapFields().size();
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.alertHistory()

    HealthStatsAggregationTask task = new HealthStatsAggregationTask(_startCMResultMap.get(controllerName)._manager);
    task.run();
    Thread.sleep(100);
   
   
    history = helixDataAccessor.getProperty(keyBuilder.alertHistory()).getRecord();
    //
    Assert.assertEquals(history.getMapFields().size(), 1 + historySize);
    TreeMap<String, Map<String, String>> recordMap = new TreeMap<String, Map<String, String>>();
    recordMap.putAll( history.getMapFields());
    Map<String, String> lastRecord = recordMap.firstEntry().getValue();
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.alertHistory()

    Assert.assertTrue(lastRecord.get("(localhost_12921.TestStat@DB#db1.TestMetric2)GREATER(100)").equals("ON"));
   
    setHealthData(metrics1, metrics2);
    task.run();
    Thread.sleep(100);
    history = helixDataAccessor.getProperty(keyBuilder.alertHistory()).getRecord();
    // no change
    Assert.assertEquals(history.getMapFields().size(), 1 + historySize);
    recordMap = new TreeMap<String, Map<String, String>>();
    recordMap.putAll( history.getMapFields());
    lastRecord = recordMap.firstEntry().getValue();
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.alertHistory()

    int [] metrics3 = {21, 44, 22, 14, 16};
    int [] metrics4 = {122, 115, 222, 41,16};
    setHealthData(metrics3, metrics4);
    task.run();
    Thread.sleep(100);
    history = helixDataAccessor.getProperty(keyBuilder.alertHistory()).getRecord();
    // new delta should be recorded
    Assert.assertEquals(history.getMapFields().size(), 2 + historySize);
    recordMap = new TreeMap<String, Map<String, String>>();
    recordMap.putAll( history.getMapFields());
    lastRecord = recordMap.lastEntry().getValue();
View Full Code Here

Examples of org.apache.helix.PropertyKey.Builder.alertHistory()

    task.run();
   
    for (int i = 0; i < 10; i++)
    {
        Thread.sleep(500);
        history = helixDataAccessor.getProperty(keyBuilder.alertHistory()).getRecord();
        recordMap = new TreeMap<String, Map<String, String>>();
        recordMap.putAll( history.getMapFields());
        lastRecord = recordMap.lastEntry().getValue();

        if (history.getMapFields().size() == 3 + historySize && lastRecord.size() == 6) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.