Package org.apache.helix.PropertyKey

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());
      }
View Full Code Here


        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

      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"));
View Full Code Here

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

      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

    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

    _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

    _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

    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

    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

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.