@Test public void testGetOutage() throws Exception { String url = "/sched-outages/my-junit-test"; Outage outage = getXmlObject(m_jaxbContext, url, 200, Outage.class); Assert.assertNotNull(outage); Assert.assertEquals("match-any", outage.getInterface(0).getAddress()); }
@GET @Path("{outageName}") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_ATOM_XML}) public Outage getOutage(@PathParam("outageName") String outageName) throws IllegalArgumentException { readLock(); try { Outage outage = m_configFactory.getOutage(outageName); if (outage == null) throw new IllegalArgumentException("Scheduled outage " + outageName + " does not exist."); return outage; } finally { readUnlock(); } }
ScheduledOutagesRestService extends OnmsRestService { @GET @Path("{outageName}") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_ATOM_XML}) public Outage getOutage(@PathParam("outageName") String outageName) throws IllegalArgumentException { readLock(); try { Outage outage = m_configFactory.getOutage(outageName); if (outage == null) throw new IllegalArgumentException("Scheduled outage " + outageName + " does not exist."); return outage; } finally { readUnlock(); } } }
ScheduledOutagesRestService extends OnmsRestService { @GET @Path("{outageName}") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_ATOM_XML}) public Outage getOutage(@PathParam("outageName") String outageName) throws IllegalArgumentException { readLock(); try { Outage outage = m_configFactory.getOutage(outageName); if (outage == null) throw new IllegalArgumentException("Scheduled outage " + outageName + " does not exist."); return outage; } finally { readUnlock(); } }  }
ScheduledOutagesRestService extends OnmsRestService { @GET @Path("{outageName}") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_ATOM_XML}) public Outage getOutage(@PathParam("outageName") String outageName) throws IllegalArgumentException { readLock(); try { Outage outage = m_configFactory.getOutage(outageName); if (outage == null) throw new IllegalArgumentException("Scheduled outage " + outageName + " does not exist."); return outage; } finally { readUnlock(); } }  @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 { @GET @Path("{outageName}") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_ATOM_XML}) public Outage getOutage(@PathParam("outageName") String outageName) throws IllegalArgumentException { readLock(); try { Outage outage = m_configFactory.getOutage(outageName); if (outage == null) throw new IllegalArgumentException("Scheduled outage " + outageName + " does not exist."); return outage; } finally { readUnlock(); } }  @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);  }