private void addMeasurementConfig(
      List<MeasurementConfigEntity> ents, AppdefEntityID id, String typeName) {
    MeasurementConfigEntity ent = new MeasurementConfigEntity();
    ConfigResponse response;
    byte[] config;

    try {
      response =
          configManager.getMergedConfigResponse(
              authzSubjectManager.getOverlordPojo(), ProductPlugin.TYPE_MEASUREMENT, id, true);

      // Only send the configuration to the agent if log or
      // config file tracking has been enabled.
      if (ConfigTrackPlugin.isEnabled(response, id.getType())
          || LogTrackPlugin.isEnabled(response, id.getType())) {

        config = response.encode();

        ent.setPluginName(id.getAppdefKey());
        ent.setPluginType(typeName);
        ent.setConfig(config);

        ents.add(ent);
      }

    } catch (Exception exc) {
      return; // Not a fatal condition
    }
  }
Ejemplo n.º 2
0
 public void setUp() throws Exception {
   super.setUp();
   this.alertConditionEvaluator = EasyMock.createMock(AlertConditionEvaluator.class);
   ConfigResponse measurementConfig = new ConfigResponse();
   measurementConfig.setValue(ConditionalTriggerInterface.CFG_ID, ALERT_DEFINITION_ID);
   RegisteredTriggerValue regTrigger = new RegisteredTriggerValue();
   regTrigger.setId(TRIGGER_ID);
   regTrigger.setConfig(measurementConfig.encode());
   trigger.init(regTrigger, alertConditionEvaluator);
 }