@Test public void testDeleteOutage() throws Exception { sendRequest(DELETE, "/sched-outages/my-junit-test", 200); }
@DELETE @Path("{outageName}") public Response deleteOutage(@PathParam("outageName") String outageName) { writeLock(); try { log().debug("deleteOutage: deleting outage " + outageName); updateCollectd(ConfigAction.REMOVE_FROM_ALL, outageName, null); updatePollerd(ConfigAction.REMOVE_FROM_ALL, outageName, null); updateThreshd(ConfigAction.REMOVE_FROM_ALL, outageName, null); updateNotifd(ConfigAction.REMOVE, outageName); m_configFactory.removeOutage(outageName); m_configFactory.saveCurrent(); sendConfigChangedEvent(); return Response.ok().build(); } catch (Exception e) { throw getException(Status.BAD_REQUEST, "Can't delete the scheduled outage " + outageName + " because, " + e.getMessage()); } finally { writeUnlock(); } }
ScheduledOutagesRestService extends OnmsRestService { @DELETE @Path("{outageName}") public Response deleteOutage(@PathParam("outageName") String outageName) { writeLock(); try { log().debug("deleteOutage: deleting outage " + outageName); updateCollectd(ConfigAction.REMOVE_FROM_ALL, outageName, null); updatePollerd(ConfigAction.REMOVE_FROM_ALL, outageName, null); updateThreshd(ConfigAction.REMOVE_FROM_ALL, outageName, null); updateNotifd(ConfigAction.REMOVE, outageName); m_configFactory.removeOutage(outageName); m_configFactory.saveCurrent(); sendConfigChangedEvent(); return Response.ok().build(); } catch (Exception e) { throw getException(Status.BAD_REQUEST, "Can't delete the scheduled outage " + outageName + " because, " + e.getMessage()); } finally { writeUnlock(); } } }
ScheduledOutagesRestService extends OnmsRestService { @DELETE @Path("{outageName}") public Response deleteOutage(@PathParam("outageName") String outageName) { writeLock(); try { log().debug("deleteOutage: deleting outage " + outageName); updateCollectd(ConfigAction.REMOVE_FROM_ALL, outageName, null); updatePollerd(ConfigAction.REMOVE_FROM_ALL, outageName, null); updateThreshd(ConfigAction.REMOVE_FROM_ALL, outageName, null); updateNotifd(ConfigAction.REMOVE, outageName); m_configFactory.removeOutage(outageName); m_configFactory.saveCurrent(); sendConfigChangedEvent(); return Response.ok().build(); } catch (Exception e) { throw getException(Status.BAD_REQUEST, "Can't delete the scheduled outage " + outageName + " because, " + e.getMessage()); } finally { writeUnlock(); } }  }
ScheduledOutagesRestService extends OnmsRestService { @DELETE @Path("{outageName}") public Response deleteOutage(@PathParam("outageName") String outageName) { writeLock(); try { log().debug("deleteOutage: deleting outage " + outageName); updateCollectd(ConfigAction.REMOVE_FROM_ALL, outageName, null); updatePollerd(ConfigAction.REMOVE_FROM_ALL, outageName, null); updateThreshd(ConfigAction.REMOVE_FROM_ALL, outageName, null); updateNotifd(ConfigAction.REMOVE, outageName); m_configFactory.removeOutage(outageName); m_configFactory.saveCurrent(); sendConfigChangedEvent(); return Response.ok().build(); } catch (Exception e) { throw getException(Status.BAD_REQUEST, "Can't delete the scheduled outage " + outageName + " because, " + e.getMessage()); } finally { writeUnlock(); } }  @GET @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_ATOM_XML}) Outages getOutages(); @GET @Path("{outageName}") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_ATOM_XML}) Outage getOutage(@PathParam("outageName") String outageName); @POST @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) Response saveOrUpdateOutage(final Outage newOutage); @DELETE @Path("{outageName}") Response deleteOutage(@PathParam("outageName") String outageName); @PUT @Path("{outageName}/collectd/{packageName}") Response addOutageToCollector(@PathParam("outageName") String outageName, @PathParam("packageName") String packageName); @DELETE @Path("{outageName}/collectd/{packageName}") Response removeOutageFromCollector(@PathParam("outageName") String outageName, @PathParam("packageName") String packageName); @PUT @Path("{outageName}/pollerd/{packageName}") Response addOutageToPoller(@PathParam("outageName") String outageName, @PathParam("packageName") String packageName); @DELETE @Path("{outageName}/pollerd/{packageName}") Response removeOutageFromPoller(@PathParam("outageName") String outageName, @PathParam("packageName") String packageName); @PUT @Path("{outageName}/threshd/{packageName}") Response addOutageToThresholder(@PathParam("outageName") String outageName, @PathParam("packageName") String packageName); @DELETE @Path("{outageName}/threshd/{packageName}") Response removeOutageFromThresholder(@PathParam("outageName") String outageName, @PathParam("packageName") String packageName); @PUT @Path("{outageName}/notifd") Response addOutageToNotifications(@PathParam("outageName") String outageName); @DELETE @Path("{outageName}/notifd") Response removeOutageFromNotifications(@PathParam("outageName") String outageName); @GET @Path("{outageName}/nodeInOutage/{nodeId}") @Produces(MediaType.TEXT_PLAIN) String isNodeInOutage(@PathParam("outageName") String outageName, @PathParam("nodeId") Integer nodeId); @GET @Path("nodeInOutage/{nodeId}") @Produces(MediaType.TEXT_PLAIN) String isNodeInOutage(@PathParam("nodeId") Integer nodeId); @GET @Path("{outageName}/interfaceInOutage/{ipAddr}") @Produces(MediaType.TEXT_PLAIN) String isInterfaceInOutage(@PathParam("outageName") String outageName, @PathParam("ipAddr") String ipAddr); @GET @Path("interfaceInOutage/{ipAddr}") @Produces(MediaType.TEXT_PLAIN) String isInterfaceInOutage(@PathParam("ipAddr") String ipAddr); }
ScheduledOutagesRestService extends OnmsRestService { @DELETE @Path("{outageName}") public Response deleteOutage(@PathParam("outageName") String outageName) { writeLock(); try { log().debug("deleteOutage: deleting outage " + outageName); updateCollectd(ConfigAction.REMOVE_FROM_ALL, outageName, null); updatePollerd(ConfigAction.REMOVE_FROM_ALL, outageName, null); updateThreshd(ConfigAction.REMOVE_FROM_ALL, outageName, null); updateNotifd(ConfigAction.REMOVE, outageName); m_configFactory.removeOutage(outageName); m_configFactory.saveCurrent(); sendConfigChangedEvent(); return Response.ok().build(); } catch (Exception e) { throw getException(Status.BAD_REQUEST, "Can't delete the scheduled outage " + outageName + " because, " + e.getMessage()); } finally { writeUnlock(); } }  @GET @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_ATOM_XML}) Outages getOutages(); @GET @Path("{outageName}") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_ATOM_XML}) Outage getOutage(@PathParam("outageName") String outageName); @POST @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) Response saveOrUpdateOutage(final Outage newOutage); @DELETE @Path("{outageName}") Response deleteOutage(@PathParam("outageName") String outageName); @PUT @Path("{outageName}/collectd/{packageName}") Response addOutageToCollector(@PathParam("outageName") String outageName, @PathParam("packageName") String packageName); @DELETE @Path("{outageName}/collectd/{packageName}") Response removeOutageFromCollector(@PathParam("outageName") String outageName, @PathParam("packageName") String packageName); @PUT @Path("{outageName}/pollerd/{packageName}") Response addOutageToPoller(@PathParam("outageName") String outageName, @PathParam("packageName") String packageName); @DELETE @Path("{outageName}/pollerd/{packageName}") Response removeOutageFromPoller(@PathParam("outageName") String outageName, @PathParam("packageName") String packageName); @PUT @Path("{outageName}/threshd/{packageName}") Response addOutageToThresholder(@PathParam("outageName") String outageName, @PathParam("packageName") String packageName); @DELETE @Path("{outageName}/threshd/{packageName}") Response removeOutageFromThresholder(@PathParam("outageName") String outageName, @PathParam("packageName") String packageName); @PUT @Path("{outageName}/notifd") Response addOutageToNotifications(@PathParam("outageName") String outageName); @DELETE @Path("{outageName}/notifd") Response removeOutageFromNotifications(@PathParam("outageName") String outageName); @GET @Path("{outageName}/nodeInOutage/{nodeId}") @Produces(MediaType.TEXT_PLAIN) String isNodeInOutage(@PathParam("outageName") String outageName, @PathParam("nodeId") Integer nodeId); @GET @Path("nodeInOutage/{nodeId}") @Produces(MediaType.TEXT_PLAIN) String isNodeInOutage(@PathParam("nodeId") Integer nodeId); @GET @Path("{outageName}/interfaceInOutage/{ipAddr}") @Produces(MediaType.TEXT_PLAIN) String isInterfaceInOutage(@PathParam("outageName") String outageName, @PathParam("ipAddr") String ipAddr); @GET @Path("interfaceInOutage/{ipAddr}") @Produces(MediaType.TEXT_PLAIN) String isInterfaceInOutage(@PathParam("ipAddr") String ipAddr);  }