use of org.opennms.netmgt.model.OnmsMonitoredServiceDetail 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.OnmsMonitoredServiceDetail 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());
}
}
use of org.opennms.netmgt.model.OnmsMonitoredServiceDetail in project opennms by OpenNMS.
the class IfServicesRestServiceIT method testGetById.
@Test
@JUnitTemporaryDatabase
public void testGetById() throws Exception {
OnmsMonitoredServiceDetail service = getXmlObject(JaxbUtils.getContextFor(OnmsMonitoredServiceDetail.class), "/ifservices/2", 200, OnmsMonitoredServiceDetail.class);
Assert.assertNotNull(service);
Assert.assertEquals("2", service.getId());
// verify that 404 is implemented correctly
sendRequest(GET, "/ifservices/-2", 404);
}
Aggregations