Search in sources :

Example 1 with LogDestType

use of org.opennms.netmgt.xml.eventconf.LogDestType in project opennms by OpenNMS.

the class EventConfDataTest method anticipateAndSend.

public void anticipateAndSend(String event, Event snmp) {
    /*
		if (event != null) {
			createEvent(event);
		}
         */
    org.opennms.netmgt.xml.eventconf.Event econf = eventConfDao.findByEvent(snmp);
    System.out.println("Eventconf: " + (econf == null ? null : new EventConfWrapper(econf)));
    if (event != null) {
        if (econf == null) {
            fail("Was expecting to match an eventconf with a UEI of \"" + event + "\", but no matching eventconf was found.");
        } else {
            if (!event.equals(econf.getUei())) {
                fail("Was expecting to match an eventconf with a UEI of \"" + event + "\", but received an eventconf with a UEI of \"" + econf.getUei() + "\"");
            }
        // everything's fine
        }
    } else {
        if (econf != null) {
            boolean complain = true;
            Logmsg logmsg = econf.getLogmsg();
            if (logmsg != null) {
                LogDestType dest = logmsg.getDest();
                if (LogDestType.DISCARDTRAPS.equals(dest)) {
                    complain = false;
                }
            }
            if (complain) {
                fail("Was not expecting an eventconf, but received an eventconf with " + "an UEI of \"" + econf.getUei() + "\"");
            }
        }
    // everything's fine
    }
    finishUp();
}
Also used : Logmsg(org.opennms.netmgt.xml.eventconf.Logmsg) LogDestType(org.opennms.netmgt.xml.eventconf.LogDestType)

Aggregations

LogDestType (org.opennms.netmgt.xml.eventconf.LogDestType)1 Logmsg (org.opennms.netmgt.xml.eventconf.Logmsg)1