Search in sources :

Example 26 with JUnitTemporaryDatabase

use of org.opennms.core.test.db.annotations.JUnitTemporaryDatabase in project opennms by OpenNMS.

the class WebNotificationRepositoryFilterIT method testNodeFilter.

@Test
// Relies on specific IDs so we need a fresh database
@JUnitTemporaryDatabase
public void testNodeFilter() {
    NodeFilter filter = new NodeFilter(1);
    assert1Result(filter);
}
Also used : NodeFilter(org.opennms.web.notification.filter.NodeFilter) Test(org.junit.Test) JUnitTemporaryDatabase(org.opennms.core.test.db.annotations.JUnitTemporaryDatabase)

Example 27 with JUnitTemporaryDatabase

use of org.opennms.core.test.db.annotations.JUnitTemporaryDatabase in project opennms by OpenNMS.

the class WebNotificationRepositoryFilterIT method testNotificationIdListFilter.

@Test
// Relies on specific IDs so we need a fresh database
@JUnitTemporaryDatabase
public void testNotificationIdListFilter() {
    int[] ids = { 1 };
    NotificationIdListFilter filter = new NotificationIdListFilter(ids);
    assert1Result(filter);
}
Also used : NotificationIdListFilter(org.opennms.web.notification.filter.NotificationIdListFilter) Test(org.junit.Test) JUnitTemporaryDatabase(org.opennms.core.test.db.annotations.JUnitTemporaryDatabase)

Example 28 with JUnitTemporaryDatabase

use of org.opennms.core.test.db.annotations.JUnitTemporaryDatabase in project opennms by OpenNMS.

the class WebNotificationRepositoryFilterIT method testServiceFilter.

@Test
// Relies on specific IDs so we need a fresh database
@JUnitTemporaryDatabase
public void testServiceFilter() {
    Notification[] notifs = m_daoNotificationRepo.getMatchingNotifications(new NotificationCriteria());
    System.out.println(notifs[0].getServiceId());
    ServiceFilter filter = new ServiceFilter(1, null);
    assert1Result(filter);
}
Also used : ServiceFilter(org.opennms.web.notification.filter.ServiceFilter) NotificationCriteria(org.opennms.web.notification.filter.NotificationCriteria) Test(org.junit.Test) JUnitTemporaryDatabase(org.opennms.core.test.db.annotations.JUnitTemporaryDatabase)

Example 29 with JUnitTemporaryDatabase

use of org.opennms.core.test.db.annotations.JUnitTemporaryDatabase in project opennms by OpenNMS.

the class WebEventRepositoryFilterIT method testAcknowledgeByFilter.

@Test
// Relies on specific IDs so we need a fresh database
@JUnitTemporaryDatabase
public void testAcknowledgeByFilter() {
    AcknowledgedByFilter filter = new AcknowledgedByFilter("TestUser");
    EventCriteria criteria = new EventCriteria(filter);
    Event[] events = m_daoEventRepo.getMatchingEvents(criteria);
    assertEquals(0, events.length);
    m_daoEventRepo.acknowledgeMatchingEvents("TestUser", new Date(), new EventCriteria(new EventIdFilter(1)));
    events = m_daoEventRepo.getMatchingEvents(criteria);
    assertEquals(1, events.length);
    assertEquals("TestUser", events[0].getAcknowledgeUser());
    m_daoEventRepo.unacknowledgeAll();
}
Also used : OnmsEvent(org.opennms.netmgt.model.OnmsEvent) Event(org.opennms.web.event.Event) Date(java.util.Date) Test(org.junit.Test) JUnitTemporaryDatabase(org.opennms.core.test.db.annotations.JUnitTemporaryDatabase)

Example 30 with JUnitTemporaryDatabase

use of org.opennms.core.test.db.annotations.JUnitTemporaryDatabase in project opennms by OpenNMS.

the class WebEventRepositoryFilterIT method testAlarmIdFilter.

@Test
// Relies on specific IDs so we need a fresh database
@JUnitTemporaryDatabase
public void testAlarmIdFilter() {
    AlarmIdFilter filter = new AlarmIdFilter(1);
    Event[] events = getMatchingDaoEvents(filter);
    assertEquals(1, events.length);
}
Also used : OnmsEvent(org.opennms.netmgt.model.OnmsEvent) Event(org.opennms.web.event.Event) AlarmIdFilter(org.opennms.web.alarm.filter.AlarmIdFilter) Test(org.junit.Test) JUnitTemporaryDatabase(org.opennms.core.test.db.annotations.JUnitTemporaryDatabase)

Aggregations

JUnitTemporaryDatabase (org.opennms.core.test.db.annotations.JUnitTemporaryDatabase)109 Test (org.junit.Test)105 OnmsNode (org.opennms.netmgt.model.OnmsNode)21 Date (java.util.Date)20 JSONObject (org.json.JSONObject)18 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)18 OnmsAlarm (org.opennms.netmgt.model.OnmsAlarm)17 Transactional (org.springframework.transaction.annotation.Transactional)14 FileInputStream (java.io.FileInputStream)10 AlarmCriteria (org.opennms.web.alarm.filter.AlarmCriteria)10 OnmsEvent (org.opennms.netmgt.model.OnmsEvent)9 OnmsOutage (org.opennms.netmgt.model.OnmsOutage)8 EventBuilder (org.opennms.netmgt.model.events.EventBuilder)7 AlarmIdFilter (org.opennms.web.alarm.filter.AlarmIdFilter)7 HashMap (java.util.HashMap)6 OutageCriteria (org.opennms.web.outage.filter.OutageCriteria)6 Matcher (java.util.regex.Matcher)4 Pattern (java.util.regex.Pattern)4 JSONArray (org.json.JSONArray)4 AcknowledgedByFilter (org.opennms.web.alarm.filter.AcknowledgedByFilter)4