Search in sources :

Example 6 with ApplicationDetails

use of org.opennms.features.poller.remote.gwt.client.ApplicationDetails in project opennms by OpenNMS.

the class LocationDataServiceIT method testApplicationDetailsTwoMonitorsOutageContainedInOther.

@Test
public void testApplicationDetailsTwoMonitorsOutageContainedInOther() throws Exception {
    // first, everything's up
    m_pollerBackEnd.reportResult(m_rduMonitor1.getId(), m_localhostHttpService.getId(), getAvailable(m_pollingStart));
    m_pollerBackEnd.reportResult(m_rduMonitor2.getId(), m_localhostHttpService.getId(), getAvailable(m_pollingStart));
    m_pollerBackEnd.reportResult(m_rduMonitor1.getId(), m_googleHttpService.getId(), getAvailable(m_pollingStart));
    m_pollerBackEnd.reportResult(m_rduMonitor2.getId(), m_googleHttpService.getId(), getAvailable(m_pollingStart));
    // bring one down for 12 hours
    m_pollerBackEnd.reportResult(m_rduMonitor1.getId(), m_googleHttpService.getId(), getDown(new Date(m_pollingStart.getTime() + (1000 * 60 * 60 * 6))));
    // and back up
    m_pollerBackEnd.reportResult(m_rduMonitor1.getId(), m_googleHttpService.getId(), getAvailable(new Date(m_pollingStart.getTime() + (1000 * 60 * 60 * 18))));
    // bring the other down for 4 hours, overlapping
    m_pollerBackEnd.reportResult(m_rduMonitor2.getId(), m_googleHttpService.getId(), getDown(new Date(m_pollingStart.getTime() + (1000 * 60 * 60 * 6))));
    // and back up
    m_pollerBackEnd.reportResult(m_rduMonitor2.getId(), m_googleHttpService.getId(), getAvailable(new Date(m_pollingStart.getTime() + (1000 * 60 * 60 * 10))));
    ApplicationDetails ad = m_locationDataService.getApplicationDetails("TestApp1");
    assertEquals("TestApp1", ad.getApplicationName());
    assertEquals(Double.valueOf(20D / 24D * 100), ad.getAvailability());
    assertEquals("currently available", StatusDetails.up(), ad.getStatusDetails());
}
Also used : ApplicationDetails(org.opennms.features.poller.remote.gwt.client.ApplicationDetails) Date(java.util.Date) Test(org.junit.Test)

Example 7 with ApplicationDetails

use of org.opennms.features.poller.remote.gwt.client.ApplicationDetails in project opennms by OpenNMS.

the class LocationDataServiceIT method testApplicationDetailsFullyAvailableOneMonitor.

@Test
public void testApplicationDetailsFullyAvailableOneMonitor() throws Exception {
    m_pollerBackEnd.reportResult(m_rduMonitor1.getId(), m_localhostHttpService.getId(), getAvailable(m_pollingStart));
    m_pollerBackEnd.reportResult(m_rduMonitor1.getId(), m_googleHttpService.getId(), getAvailable(m_pollingStart));
    ApplicationDetails ad = m_locationDataService.getApplicationDetails("TestApp1");
    assertEquals("TestApp1", ad.getApplicationName());
    assertEquals(Double.valueOf(100), ad.getAvailability());
    assertEquals(StatusDetails.up(), ad.getStatusDetails());
}
Also used : ApplicationDetails(org.opennms.features.poller.remote.gwt.client.ApplicationDetails) Test(org.junit.Test)

Aggregations

ApplicationDetails (org.opennms.features.poller.remote.gwt.client.ApplicationDetails)7 Test (org.junit.Test)6 Date (java.util.Date)5 ArrayList (java.util.ArrayList)1 ApplicationInfo (org.opennms.features.poller.remote.gwt.client.ApplicationInfo)1 GWTLocationMonitor (org.opennms.features.poller.remote.gwt.client.GWTLocationMonitor)1 GWTLocationSpecificStatus (org.opennms.features.poller.remote.gwt.client.GWTLocationSpecificStatus)1 OnmsLocationMonitor (org.opennms.netmgt.model.OnmsLocationMonitor)1 OnmsLocationSpecificStatus (org.opennms.netmgt.model.OnmsLocationSpecificStatus)1 OnmsMonitoredService (org.opennms.netmgt.model.OnmsMonitoredService)1 Transactional (org.springframework.transaction.annotation.Transactional)1