use of org.opennms.features.poller.remote.gwt.client.ApplicationDetails in project opennms by OpenNMS.
the class LocationDataServiceIT method testApplicationDetailsHalfAvailableOneMonitor.
@Test
public void testApplicationDetailsHalfAvailableOneMonitor() throws Exception {
// first, everything's up
m_pollerBackEnd.reportResult(m_rduMonitor1.getId(), m_localhostHttpService.getId(), getAvailable(m_pollingStart));
m_pollerBackEnd.reportResult(m_rduMonitor1.getId(), m_googleHttpService.getId(), getAvailable(m_pollingStart));
// bring it down for 12 hours
m_pollerBackEnd.reportResult(m_rduMonitor1.getId(), m_googleHttpService.getId(), getDown(new Date(m_pollingStart.getTime() + (1000 * 60 * 60 * 6))));
// bring it back up
m_pollerBackEnd.reportResult(m_rduMonitor1.getId(), m_googleHttpService.getId(), getAvailable(new Date(m_pollingStart.getTime() + (1000 * 60 * 60 * 18))));
ApplicationDetails ad = m_locationDataService.getApplicationDetails("TestApp1");
assertEquals("TestApp1", ad.getApplicationName());
assertEquals(Double.valueOf(50), ad.getAvailability());
assertEquals("currently available", StatusDetails.up(), ad.getStatusDetails());
}
use of org.opennms.features.poller.remote.gwt.client.ApplicationDetails in project opennms by OpenNMS.
the class LocationDataServiceIT method testApplicationDetailsTwoMonitorsMarginal.
@Test
public void testApplicationDetailsTwoMonitorsMarginal() 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))));
ApplicationDetails ad = m_locationDataService.getApplicationDetails("TestApp1");
assertEquals("TestApp1", ad.getApplicationName());
assertEquals(Double.valueOf(100), ad.getAvailability());
assertEquals("currently available", StatusDetails.up(), ad.getStatusDetails());
}
use of org.opennms.features.poller.remote.gwt.client.ApplicationDetails in project opennms by OpenNMS.
the class DefaultLocationDataService method getApplicationDetails.
/**
* <p>getApplicationDetails</p>
*
* @param app a {@link org.opennms.netmgt.model.OnmsApplication} object.
* @return a {@link org.opennms.features.poller.remote.gwt.client.ApplicationDetails} object.
*/
@Transactional
@Override
public ApplicationDetails getApplicationDetails(final OnmsApplication app) {
waitForGeocoding("getApplicationDetails");
final ApplicationInfo applicationInfo = getApplicationInfo(app, StatusDetails.unknown());
List<GWTLocationSpecificStatus> statuses = new ArrayList<GWTLocationSpecificStatus>();
final Date to = new Date();
final Date from = new Date(to.getTime() - AVAILABILITY_MS);
final Collection<OnmsMonitoredService> services = m_monitoredServiceDao.findByApplication(app);
final List<GWTLocationMonitor> monitors = new ArrayList<GWTLocationMonitor>();
for (final OnmsLocationMonitor monitor : m_locationDao.findByApplication(app)) {
monitors.add(transformLocationMonitor(monitor));
for (final OnmsLocationSpecificStatus locationSpecificStatus : m_locationDao.getStatusChangesForLocationBetween(from, to, monitor.getLocation())) {
if (services.contains(locationSpecificStatus.getMonitoredService())) {
statuses.add(transformLocationSpecificStatus(locationSpecificStatus));
}
}
}
ApplicationDetails details = new ApplicationDetails(applicationInfo, from, to, monitors, statuses);
LOG.warn("getApplicationDetails({}) returning {}", app.getName(), details);
return details;
}
use of org.opennms.features.poller.remote.gwt.client.ApplicationDetails in project opennms by OpenNMS.
the class LocationDataServiceIT method testApplicationDetailsTwoMonitorsOutagesOverlap.
@Test
public void testApplicationDetailsTwoMonitorsOutagesOverlap() 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 12 hours, overlapping by 8
m_pollerBackEnd.reportResult(m_rduMonitor2.getId(), m_googleHttpService.getId(), getDown(new Date(m_pollingStart.getTime() + (1000 * 60 * 60 * 10))));
// and back up
m_pollerBackEnd.reportResult(m_rduMonitor2.getId(), m_googleHttpService.getId(), getAvailable(new Date(m_pollingStart.getTime() + (1000 * 60 * 60 * 22))));
ApplicationDetails ad = m_locationDataService.getApplicationDetails("TestApp1");
assertEquals("TestApp1", ad.getApplicationName());
assertEquals(Double.valueOf(16D / 24D * 100), ad.getAvailability());
assertEquals("currently available", StatusDetails.up(), ad.getStatusDetails());
final String detailString = ad.getDetailsAsString();
System.err.println(detailString);
assertTrue(detailString.contains(""));
}
use of org.opennms.features.poller.remote.gwt.client.ApplicationDetails in project opennms by OpenNMS.
the class LocationDataServiceIT method testApplicationDetailsDownOneMonitor.
@Test
public void testApplicationDetailsDownOneMonitor() throws Exception {
m_pollerBackEnd.reportResult(m_rduMonitor1.getId(), m_localhostHttpService.getId(), getDown(m_pollingStart));
m_pollerBackEnd.reportResult(m_rduMonitor1.getId(), m_googleHttpService.getId(), getDown(m_pollingStart));
ApplicationDetails ad = m_locationDataService.getApplicationDetails("TestApp1");
assertEquals("TestApp1", ad.getApplicationName());
assertEquals(Double.valueOf(0), ad.getAvailability());
assertEquals("down for 24 hours", StatusDetails.down("foo"), ad.getStatusDetails());
}
Aggregations