use of org.opennms.netmgt.mock.MockNotification in project opennms by OpenNMS.
the class MockNotificationStrategy method send.
/* (non-Javadoc)
* @see org.opennms.netmgt.notifd.NotificationStrategy#send(java.util.List)
*/
@Override
public int send(List<Argument> arguments) {
MockUtil.println("Message sent with arguments:" + arguments);
MockNotification notification = new MockNotification();
Iterator<Argument> it = arguments.iterator();
while (it.hasNext()) {
Argument arg = it.next();
if (arg.getSwitch().equals(NotificationManager.PARAM_SUBJECT)) {
notification.setSubject(arg.getValue());
} else if (arg.getSwitch().equals(NotificationManager.PARAM_EMAIL)) {
notification.setEmail(arg.getValue());
} else if (arg.getSwitch().equals(NotificationManager.PARAM_TEXT_MSG)) {
notification.setTextMsg(arg.getValue());
}
}
notification.setExpectedTime(System.currentTimeMillis());
NotificationAnticipator anticipator = getAnticipator();
if (anticipator != null) {
anticipator.notificationReceived(notification);
} else {
throw new NullPointerException("anticipator is null");
}
return 0;
}
use of org.opennms.netmgt.mock.MockNotification in project opennms by OpenNMS.
the class NotificationsITCase method createMockNotification.
protected MockNotification createMockNotification(long expectedTime, String subject, String textMsg, String email) {
MockNotification notification;
notification = new MockNotification();
notification.setExpectedTime(expectedTime);
notification.setSubject(subject);
notification.setTextMsg(textMsg);
notification.setEmail(email);
return notification;
}
Aggregations