/** * Sets the status on an individual notification configuration and saves to xml. * * @param name * The name of the notification. * @param status * The status (either "on" or "off"). * @throws java.io.IOException if any. * @throws java.lang.ClassNotFoundException if any. */ public synchronized void updateStatus(final String name, final String status) throws IOException, ClassNotFoundException { if ("on".equals(status) || "off".equals(status)) { Notification notice = getNotification(name); notice.setStatus(status); saveCurrent(); } else throw new IllegalArgumentException("Status must be on|off, not " + status); }
/** * <p>removeNotification</p> * * @param name a {@link java.lang.String} object. * @throws java.io.IOException if any. * @throws java.lang.ClassNotFoundException if any. */ public synchronized void removeNotification(final String name) throws IOException, ClassNotFoundException { m_notifications.removeNotification(getNotification(name)); saveCurrent(); }
notification = getNotification(rs.getObject("notifConfigName").toString()); } catch (IOException e) {
/** * Handles adding a new Notification. * * @param notice * The Notification to add. * @throws java.io.IOException if any. * @throws java.lang.ClassNotFoundException if any. */ public synchronized void addNotification(final Notification notice) throws IOException, ClassNotFoundException { // remove any existing notice with the same name m_notifications.removeNotification(getNotification(notice.getName())); m_notifications.addNotification(notice); saveCurrent(); }
@Before @Override public void setUp() throws Exception { super.setUp(); m_notif = m_notificationManager.getNotification("nodeDown"); MockNode node = m_network.getNode(1); Event nodeDownEvent = node.createDownEvent(); m_params = m_eventProcessor.buildParameterMap(m_notif, nodeDownEvent, 1); m_commands = new String[]{ "email" }; }
@Test public void testFormattedNotificationsXml() throws Exception { MockUtil.println("################# Running Test ################"); MockLogAppender.setupLogging(); MockNotifdConfigManager notifdConfig = new MockNotifdConfigManager(ConfigurationTestUtils.getConfigForResourceWithReplacements(this, "notifd-configuration.xml")); NotificationManager manager = new MockNotificationManager(notifdConfig, null, ConfigurationTestUtils.getConfigForResourceWithReplacements(this, "notifications-config-test.xml")); Notification n = manager.getNotification("crazyTestNotification"); assertTrue(n.getTextMessage().contains("\n")); } }
Notification notice = getNotification(oldName); if (notice != null) { notice.setWriteable(newNotice.getWriteable());