use of org.opennms.netmgt.model.OnmsMonitoredServiceDetailList in project opennms by OpenNMS.
the class IfServicesRestService method getServices.
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_ATOM_XML })
public OnmsMonitoredServiceDetailList getServices(@Context final UriInfo uriInfo) {
final Criteria c = getCriteria(uriInfo.getQueryParameters());
final OnmsMonitoredServiceDetailList servicesList = new OnmsMonitoredServiceDetailList();
final List<OnmsMonitoredService> services = m_serviceDao.findMatching(c);
for (OnmsMonitoredService svc : services) {
servicesList.add(new OnmsMonitoredServiceDetail(svc));
}
c.setLimit(null);
c.setOffset(null);
c.setOrders(new ArrayList<Order>());
servicesList.setTotalCount(m_serviceDao.countMatching(c));
return servicesList;
}
use of org.opennms.netmgt.model.OnmsMonitoredServiceDetailList in project opennms by OpenNMS.
the class IfServicesRestServiceIT method testGetServices.
@Test
@JUnitTemporaryDatabase
public void testGetServices() throws Exception {
String url = "/ifservices";
OnmsMonitoredServiceDetailList list = getXmlObject(JaxbUtils.getContextFor(OnmsMonitoredServiceDetailList.class), url, 200, OnmsMonitoredServiceDetailList.class);
for (OnmsMonitoredServiceDetail detail : list.getObjects()) {
assertFalse("F".equals(detail.getStatusCode()));
}
// Mark all services as forced unmanaged
sendPut(url, "status=F", 204);
// Verify that all statuses were updated
list = getXmlObject(JaxbUtils.getContextFor(OnmsMonitoredServiceDetailList.class), url, 200, OnmsMonitoredServiceDetailList.class);
for (OnmsMonitoredServiceDetail detail : list.getObjects()) {
assertEquals("F", detail.getStatusCode());
}
}
Aggregations