@Test @JUnitTemporaryDatabase // Relies on records created in @Before so we need a fresh database public void testInterfaceFilter() { InterfaceFilter filter = new InterfaceFilter("192.168.1.1"); OutageCriteria criteria = new OutageCriteria(filter); InterfaceFilter filter2 = new InterfaceFilter("192.168.2.1"); OutageCriteria criteria2 = new OutageCriteria(filter2); Outage[] outages = m_daoOutageRepo.getMatchingOutages(criteria); assertEquals(2, outages.length); outages = m_daoOutageRepo.getMatchingOutages(criteria2); assertEquals(1, outages.length); }
@Test @JUnitTemporaryDatabase // Relies on specific IDs so we need a fresh database public void testServiceFilter() { ServiceFilter filter = new ServiceFilter(2, null); OutageCriteria criteria = new OutageCriteria(filter); Outage[] outages = m_daoOutageRepo.getMatchingOutages(criteria); assertEquals(2, outages.length); }
@Test @JUnitTemporaryDatabase // Relies on records created in @Before so we need a fresh database public void testRecentOutagesFilter() { RecentOutagesFilter filter = new RecentOutagesFilter(); OutageCriteria criteria = new OutageCriteria(filter); Outage[] outages = m_daoOutageRepo.getMatchingOutages(criteria); assertEquals(3, outages.length); }
@Test @JUnitTemporaryDatabase // Relies on records created in @Before so we need a fresh database public void testLostServiceDateAfterFilter() { LostServiceDateAfterFilter filter = new LostServiceDateAfterFilter(yesterday()); OutageCriteria criteria = new OutageCriteria(filter); Outage[] outages = m_daoOutageRepo.getMatchingOutages(criteria); assertEquals(3, outages.length); }