@Test public void testDeleteGroup() throws Exception { createGroup("deleteMe"); String xml = sendRequest(GET, "/groups", 200); assertTrue(xml.contains("deleteMe")); sendRequest(DELETE, "/groups/idontexist", 400); sendRequest(DELETE, "/groups/deleteMe", 200); sendRequest(GET, "/groups/deleteMe", 404); }
@DELETE @Path("{groupName}") public Response deleteGroup(@PathParam("groupName") final String groupName) { writeLock(); try { final OnmsGroup group = getOnmsGroup(groupName); log().debug("deleteGroup: deleting group " + group); m_groupManager.deleteGroup(groupName); return Response.ok().build(); } catch (final Throwable t) { throw getException(Status.BAD_REQUEST, t); } finally { writeUnlock(); } }
GroupRestService extends OnmsRestService { @DELETE @Path("{groupName}") public Response deleteGroup(@PathParam("groupName") final String groupName) { writeLock(); try { final OnmsGroup group = getOnmsGroup(groupName); log().debug("deleteGroup: deleting group " + group); m_groupManager.deleteGroup(groupName); return Response.ok().build(); } catch (final Throwable t) { throw getException(Status.BAD_REQUEST, t); } finally { writeUnlock(); } } }
GroupRestService extends OnmsRestService { @DELETE @Path("{groupName}") public Response deleteGroup(@PathParam("groupName") final String groupName) { writeLock(); try { final OnmsGroup group = getOnmsGroup(groupName); log().debug("deleteGroup: deleting group " + group); m_groupManager.deleteGroup(groupName); return Response.ok().build(); } catch (final Throwable t) { throw getException(Status.BAD_REQUEST, t); } finally { writeUnlock(); } }  }
GroupRestService extends OnmsRestService { @DELETE @Path("{groupName}") public Response deleteGroup(@PathParam("groupName") final String groupName) { writeLock(); try { final OnmsGroup group = getOnmsGroup(groupName); log().debug("deleteGroup: deleting group " + group); m_groupManager.deleteGroup(groupName); return Response.ok().build(); } catch (final Throwable t) { throw getException(Status.BAD_REQUEST, t); } finally { writeUnlock(); } }  @GET @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_ATOM_XML}) OnmsGroupList getGroups(); @GET @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_ATOM_XML}) @Path("{groupName}") OnmsGroup getGroup(@PathParam("groupName") final String groupName); @POST @Consumes(MediaType.APPLICATION_XML) Response addGroup(final OnmsGroup group); @PUT @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Path("{groupName}") Response updateGroup(@PathParam("groupName") final String groupName, final MultivaluedMapImpl params); @DELETE @Path("{groupName}") Response deleteGroup(@PathParam("groupName") final String groupName); @PUT @Path("{groupName}/users/{userName}") Response addUser(@PathParam("groupName") final String groupName, @PathParam("userName") final String userName); @DELETE @Path("{groupName}/users/{userName}") Response removeUser(@PathParam("groupName") final String groupName, @PathParam("userName") final String userName); }
GroupRestService extends OnmsRestService { @DELETE @Path("{groupName}") public Response deleteGroup(@PathParam("groupName") final String groupName) { writeLock(); try { final OnmsGroup group = getOnmsGroup(groupName); log().debug("deleteGroup: deleting group " + group); m_groupManager.deleteGroup(groupName); return Response.ok().build(); } catch (final Throwable t) { throw getException(Status.BAD_REQUEST, t); } finally { writeUnlock(); } }  @GET @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_ATOM_XML}) OnmsGroupList getGroups(); @GET @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_ATOM_XML}) @Path("{groupName}") OnmsGroup getGroup(@PathParam("groupName") final String groupName); @POST @Consumes(MediaType.APPLICATION_XML) Response addGroup(final OnmsGroup group); @PUT @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Path("{groupName}") Response updateGroup(@PathParam("groupName") final String groupName, final MultivaluedMapImpl params); @DELETE @Path("{groupName}") Response deleteGroup(@PathParam("groupName") final String groupName); @PUT @Path("{groupName}/users/{userName}") Response addUser(@PathParam("groupName") final String groupName, @PathParam("userName") final String userName); @DELETE @Path("{groupName}/users/{userName}") Response removeUser(@PathParam("groupName") final String groupName, @PathParam("userName") final String userName);  }