Search in sources :

Example 6 with UpdateField

use of org.opennms.netmgt.xml.event.UpdateField in project opennms by OpenNMS.

the class AlarmdIT method sendNodeDownEventChangeLogMsg.

private void sendNodeDownEventChangeLogMsg(String reductionKey, MockNode node, String logMsg) {
    EventBuilder event = MockEventUtil.createNodeDownEventBuilder("Test", node);
    if (reductionKey != null) {
        AlarmData data = new AlarmData();
        data.setAlarmType(1);
        data.setReductionKey(reductionKey);
        List<UpdateField> fields = new ArrayList<>();
        UpdateField field = new UpdateField();
        field.setFieldName("logMsg");
        field.setUpdateOnReduction(Boolean.TRUE);
        fields.add(field);
        data.setUpdateField(fields);
        event.setAlarmData(data);
    } else {
        event.setAlarmData(null);
    }
    event.setLogDest("logndisplay");
    event.setLogMessage(logMsg);
    m_eventdIpcMgr.sendNow(event.getEvent());
}
Also used : EventBuilder(org.opennms.netmgt.model.events.EventBuilder) UpdateField(org.opennms.netmgt.xml.event.UpdateField) ArrayList(java.util.ArrayList) AlarmData(org.opennms.netmgt.xml.event.AlarmData)

Aggregations

UpdateField (org.opennms.netmgt.xml.event.UpdateField)6 ArrayList (java.util.ArrayList)5 AlarmData (org.opennms.netmgt.xml.event.AlarmData)5 EventBuilder (org.opennms.netmgt.model.events.EventBuilder)3 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Before (org.junit.Before)1 Event (org.opennms.netmgt.xml.event.Event)1 Parm (org.opennms.netmgt.xml.event.Parm)1 Value (org.opennms.netmgt.xml.event.Value)1 Decode (org.opennms.netmgt.xml.eventconf.Decode)1 Parameter (org.opennms.netmgt.xml.eventconf.Parameter)1 Varbindsdecode (org.opennms.netmgt.xml.eventconf.Varbindsdecode)1