@Test(expected = NotFoundException.class) public void evictThrowsWhenClientIdNotFound() { doThrow(IllegalStateException.class).when(aclDAO).findAndEvictClient(60984, group.getId(), auditLog, "user",new HashMap<>()); resource.evictClient(user, new LongParam("60984"), new LongParam(Long.toString(group.getId()))); }
@Path("/clients/{clientId}/groups/{groupId}") @Timed @ExceptionMetered @DELETE public Response evictClient( @Auth User user, @PathParam("clientId") LongParam clientId, @PathParam("groupId") LongParam groupId) { logger.info("User {} evicting clientId {} from groupId {}.", user.getName(), clientId, groupId); try { aclDAO.findAndEvictClient(clientId.get(), groupId.get(), auditLog, user.getName(), new HashMap<>()); } catch (IllegalStateException e) { throw new NotFoundException(); } return Response.ok().build(); }
MembershipResource { @Path("/clients/{clientId}/groups/{groupId}") @Timed @ExceptionMetered @DELETE public Response evictClient( @Auth User user, @PathParam("clientId") LongParam clientId, @PathParam("groupId") LongParam groupId) { logger.info("User {} evicting clientId {} from groupId {}.", user.getName(), clientId, groupId); try { aclDAO.findAndEvictClient(clientId.get(), groupId.get(), auditLog, user.getName(), new HashMap<>()); } catch (IllegalStateException e) { throw new NotFoundException(); } return Response.ok().build(); } }
MembershipResource { @Path("/clients/{clientId}/groups/{groupId}") @Timed @ExceptionMetered @DELETE public Response evictClient( @Auth User user, @PathParam("clientId") LongParam clientId, @PathParam("groupId") LongParam groupId) { logger.info("User {} evicting clientId {} from groupId {}.", user.getName(), clientId, groupId); try { aclDAO.findAndEvictClient(clientId.get(), groupId.get(), auditLog, user.getName(), new HashMap<>()); } catch (IllegalStateException e) { throw new NotFoundException(); } return Response.ok().build(); } @Inject  MembershipResource(AclDAOFactory aclDAOFactory, AuditLog auditLog); @VisibleForTesting  MembershipResource(AclDAO aclDAO, AuditLog auditLog); }
MembershipResource { @Path("/clients/{clientId}/groups/{groupId}") @Timed @ExceptionMetered @DELETE public Response evictClient( @Auth User user, @PathParam("clientId") LongParam clientId, @PathParam("groupId") LongParam groupId) { logger.info("User {} evicting clientId {} from groupId {}.", user.getName(), clientId, groupId); try { aclDAO.findAndEvictClient(clientId.get(), groupId.get(), auditLog, user.getName(), new HashMap<>()); } catch (IllegalStateException e) { throw new NotFoundException(); } return Response.ok().build(); } @Inject  MembershipResource(AclDAOFactory aclDAOFactory, AuditLog auditLog); @VisibleForTesting  MembershipResource(AclDAO aclDAO, AuditLog auditLog); @Path("/secrets/{secretId}/groups/{groupId}") @Timed @ExceptionMetered @PUT Response allowAccess(
      @Auth User user,
      @PathParam("secretId") LongParam secretId,
      @PathParam("groupId") LongParam groupId); @Path("/secrets/{secretId}/groups/{groupId}") @Timed @ExceptionMetered @DELETE Response disallowAccess(
      @Auth User user,
      @PathParam("secretId") LongParam secretId,
      @PathParam("groupId") LongParam groupId); @Path("/clients/{clientId}/groups/{groupId}") @Timed @ExceptionMetered @PUT Response enrollClient(
    @Auth User user,
    @PathParam("clientId") LongParam clientId,
    @PathParam("groupId") LongParam groupId); @Path("/clients/{clientId}/groups/{groupId}") @Timed @ExceptionMetered @DELETE Response evictClient(
      @Auth User user,
      @PathParam("clientId") LongParam clientId,
      @PathParam("groupId") LongParam groupId); }
MembershipResource { @Path("/clients/{clientId}/groups/{groupId}") @Timed @ExceptionMetered @DELETE public Response evictClient( @Auth User user, @PathParam("clientId") LongParam clientId, @PathParam("groupId") LongParam groupId) { logger.info("User {} evicting clientId {} from groupId {}.", user.getName(), clientId, groupId); try { aclDAO.findAndEvictClient(clientId.get(), groupId.get(), auditLog, user.getName(), new HashMap<>()); } catch (IllegalStateException e) { throw new NotFoundException(); } return Response.ok().build(); } @Inject  MembershipResource(AclDAOFactory aclDAOFactory, AuditLog auditLog); @VisibleForTesting  MembershipResource(AclDAO aclDAO, AuditLog auditLog); @Path("/secrets/{secretId}/groups/{groupId}") @Timed @ExceptionMetered @PUT Response allowAccess(
      @Auth User user,
      @PathParam("secretId") LongParam secretId,
      @PathParam("groupId") LongParam groupId); @Path("/secrets/{secretId}/groups/{groupId}") @Timed @ExceptionMetered @DELETE Response disallowAccess(
      @Auth User user,
      @PathParam("secretId") LongParam secretId,
      @PathParam("groupId") LongParam groupId); @Path("/clients/{clientId}/groups/{groupId}") @Timed @ExceptionMetered @PUT Response enrollClient(
    @Auth User user,
    @PathParam("clientId") LongParam clientId,
    @PathParam("groupId") LongParam groupId); @Path("/clients/{clientId}/groups/{groupId}") @Timed @ExceptionMetered @DELETE Response evictClient(
      @Auth User user,
      @PathParam("clientId") LongParam clientId,
      @PathParam("groupId") LongParam groupId);  }