use of org.opennms.netmgt.alarmd.api.NorthboundAlarm in project opennms by OpenNMS.
the class NCSNorthbounderIT method alarm.
private NorthboundAlarm alarm(int alarmId) {
OnmsAlarm alarm = new OnmsAlarm();
alarm.setId(alarmId);
alarm.setUei("uei.opennms.org/test/httpNorthBounder");
alarm.setEventParms("componentType=Service(string,text);componentName=NAM" + alarmId + "(string,text);componentForeignSource=FS(string,text);componentForeignId=" + alarmId + "(string,text);cause=17(string,text)");
alarm.setAlarmType((alarmId + 1) % 2 + 1);
return new NorthboundAlarm(alarm);
}
use of org.opennms.netmgt.alarmd.api.NorthboundAlarm in project opennms by OpenNMS.
the class AbstractNorthbounderTest method testAlarmForwarding.
/**
* Test alarm forwarding.
*
* @throws InterruptedException the interrupted exception
*/
@Test
public void testAlarmForwarding() throws InterruptedException {
TestNorthbounder tnb = new TestNorthbounder();
tnb.setAccepting(true);
tnb.start();
NorthboundAlarm a = createNorthboundAlarm(1);
tnb.onAlarm(a);
tnb.waitForAcceptsToBeCalled(2000);
tnb.waitForForwardToBeCalled(2000);
assertNotNull(tnb.getAlarms());
assertTrue(tnb.getAlarms().contains(a));
}
use of org.opennms.netmgt.alarmd.api.NorthboundAlarm in project opennms by OpenNMS.
the class AlarmQueueTest method createAlarm.
/**
* Creates the alarm.
*
* @return the northbound alarm
*/
private NorthboundAlarm createAlarm() {
OnmsAlarm alarm = new OnmsAlarm();
alarm.setId(++alarmNumber);
alarm.setUei("uei.opennms.org/test/httpNorthBounder");
return new NorthboundAlarm(alarm);
}
use of org.opennms.netmgt.alarmd.api.NorthboundAlarm in project opennms by OpenNMS.
the class AbstractNorthbounderTest method createNorthboundAlarm.
/**
* Creates the northbound alarm.
*
* @param alarmid the alarmid
* @return the northbound alarm
*/
private NorthboundAlarm createNorthboundAlarm(int alarmid) {
OnmsAlarm alarm = new OnmsAlarm();
alarm.setId(alarmid);
alarm.setUei("uei.opennms.org/test/httpNorthBounder");
return new NorthboundAlarm(alarm);
}
use of org.opennms.netmgt.alarmd.api.NorthboundAlarm in project opennms by OpenNMS.
the class AbstractNorthbounderTest method testAlarmForwardingWithNagles.
/**
* Test alarm forwarding with nagles.
*
* @throws InterruptedException the interrupted exception
*/
@Test
public void testAlarmForwardingWithNagles() throws InterruptedException {
TestNorthbounder tnb = new TestNorthbounder();
tnb.setAccepting(true);
tnb.setNaglesDelay(500);
tnb.start();
NorthboundAlarm a1 = createNorthboundAlarm(1);
NorthboundAlarm a2 = createNorthboundAlarm(2);
NorthboundAlarm a3 = createNorthboundAlarm(3);
tnb.onAlarm(a1);
Thread.sleep(100);
tnb.onAlarm(a2);
Thread.sleep(100);
tnb.onAlarm(a3);
tnb.waitForAcceptsToBeCalled(2000);
tnb.waitForForwardToBeCalled(2000);
assertNotNull(tnb.getAlarms());
assertEquals(3, tnb.getAlarms().size());
assertTrue(tnb.getAlarms().contains(a1));
assertTrue(tnb.getAlarms().contains(a2));
assertTrue(tnb.getAlarms().contains(a3));
}
Aggregations