@Test public void testDeleteAccount() { }
@DELETE @Path("{userName}") @Consumes(MediaType.APPLICATION_JSON + ";charset=UTF-8") @Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8") public Response<AccountEntry> deleteAccount(Request<AccountEntry> request, @PathParam("userName") String userName) { Data<AccountEntry> data, returnData; boolean deleted = false; try { userName = validateUsername(userName); RequestValidator.validateRequest(request); data = request.getMessage().getData(); Collection<AccountEntry> accounts = data.getEntries(); if (accounts.size() != 1) { return Response.badRequest("Number of entries must be 1.", null); } deleted = userManager.disable(userName); } catch (AccessDeniedException ex) { return Response.badRequest(ex.getMessage(), ex); } catch (IllegalArgumentException e) { return Response.badRequest(e.getMessage(), e); } catch (Exception e) { return Response.serverError(e.getMessage(), e); } if (deleted) { return Response.ok(); } else { return Response.serverError("could not delete account.", null); } }
AuthenticationController { @DELETE @Path("{userName}") @Consumes(MediaType.APPLICATION_JSON + ";charset=UTF-8") @Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8") public Response<AccountEntry> deleteAccount(Request<AccountEntry> request, @PathParam("userName") String userName) { Data<AccountEntry> data, returnData; boolean deleted = false; try { userName = validateUsername(userName); RequestValidator.validateRequest(request); data = request.getMessage().getData(); Collection<AccountEntry> accounts = data.getEntries(); if (accounts.size() != 1) { return Response.badRequest("Number of entries must be 1.", null); } deleted = userManager.disable(userName); } catch (AccessDeniedException ex) { return Response.badRequest(ex.getMessage(), ex); } catch (IllegalArgumentException e) { return Response.badRequest(e.getMessage(), e); } catch (Exception e) { return Response.serverError(e.getMessage(), e); } if (deleted) { return Response.ok(); } else { return Response.serverError("could not delete account.", null); } } }
AuthenticationController { @DELETE @Path("{userName}") @Consumes(MediaType.APPLICATION_JSON + ";charset=UTF-8") @Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8") public Response<AccountEntry> deleteAccount(Request<AccountEntry> request, @PathParam("userName") String userName) { Data<AccountEntry> data, returnData; boolean deleted = false; try { userName = validateUsername(userName); RequestValidator.validateRequest(request); data = request.getMessage().getData(); Collection<AccountEntry> accounts = data.getEntries(); if (accounts.size() != 1) { return Response.badRequest("Number of entries must be 1.", null); } deleted = userManager.disable(userName); } catch (AccessDeniedException ex) { return Response.badRequest(ex.getMessage(), ex); } catch (IllegalArgumentException e) { return Response.badRequest(e.getMessage(), e); } catch (Exception e) { return Response.serverError(e.getMessage(), e); } if (deleted) { return Response.ok(); } else { return Response.serverError("could not delete account.", null); } }  }
AuthenticationController { @DELETE @Path("{userName}") @Consumes(MediaType.APPLICATION_JSON + ";charset=UTF-8") @Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8") public Response<AccountEntry> deleteAccount(Request<AccountEntry> request, @PathParam("userName") String userName) { Data<AccountEntry> data, returnData; boolean deleted = false; try { userName = validateUsername(userName); RequestValidator.validateRequest(request); data = request.getMessage().getData(); Collection<AccountEntry> accounts = data.getEntries(); if (accounts.size() != 1) { return Response.badRequest("Number of entries must be 1.", null); } deleted = userManager.disable(userName); } catch (AccessDeniedException ex) { return Response.badRequest(ex.getMessage(), ex); } catch (IllegalArgumentException e) { return Response.badRequest(e.getMessage(), e); } catch (Exception e) { return Response.serverError(e.getMessage(), e); } if (deleted) { return Response.ok(); } else { return Response.serverError("could not delete account.", null); } }  void setUserManager(UserManager userManager); void setAccessControlManager(AccessControlManager accessControlManager); @GET @Path("{userName}") @Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8") Response<AccountEntry> getUser(
               @PathParam("userName") String userName); @POST @Path("{userName}")// can be @me - then updating the current user @Consumes(MediaType.APPLICATION_JSON + ";charset=UTF-8") @Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8") Response<AccountEntry> updateUser(
               @PathParam("said") String said,
               @PathParam("userName") String userName,
               Request<AccountEntry> request); @DELETE @Path("{userName}") @Consumes(MediaType.APPLICATION_JSON + ";charset=UTF-8") @Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8") Response<AccountEntry> deleteAccount(Request<AccountEntry> request,
            @PathParam("userName") String userName); @GET @Path("/username") String getCurrentUserName(); @GET @Path("/role") String getCurrentRole(); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/credentials/{contact-said}") Response<AccountEntry> getCredentials(
            @PathParam("said") String saidLocal,
            @PathParam("contact-said") String saidRequester); @POST @Produces(MediaType.APPLICATION_JSON) @Path("/credentials/{contact-said}") Response<?> confirmCredentials(
            @PathParam("said") String saidLocal,
            @PathParam("contact-said") String saidRequester); }
AuthenticationController { @DELETE @Path("{userName}") @Consumes(MediaType.APPLICATION_JSON + ";charset=UTF-8") @Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8") public Response<AccountEntry> deleteAccount(Request<AccountEntry> request, @PathParam("userName") String userName) { Data<AccountEntry> data, returnData; boolean deleted = false; try { userName = validateUsername(userName); RequestValidator.validateRequest(request); data = request.getMessage().getData(); Collection<AccountEntry> accounts = data.getEntries(); if (accounts.size() != 1) { return Response.badRequest("Number of entries must be 1.", null); } deleted = userManager.disable(userName); } catch (AccessDeniedException ex) { return Response.badRequest(ex.getMessage(), ex); } catch (IllegalArgumentException e) { return Response.badRequest(e.getMessage(), e); } catch (Exception e) { return Response.serverError(e.getMessage(), e); } if (deleted) { return Response.ok(); } else { return Response.serverError("could not delete account.", null); } }  void setUserManager(UserManager userManager); void setAccessControlManager(AccessControlManager accessControlManager); @GET @Path("{userName}") @Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8") Response<AccountEntry> getUser(
               @PathParam("userName") String userName); @POST @Path("{userName}")// can be @me - then updating the current user @Consumes(MediaType.APPLICATION_JSON + ";charset=UTF-8") @Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8") Response<AccountEntry> updateUser(
               @PathParam("said") String said,
               @PathParam("userName") String userName,
               Request<AccountEntry> request); @DELETE @Path("{userName}") @Consumes(MediaType.APPLICATION_JSON + ";charset=UTF-8") @Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8") Response<AccountEntry> deleteAccount(Request<AccountEntry> request,
            @PathParam("userName") String userName); @GET @Path("/username") String getCurrentUserName(); @GET @Path("/role") String getCurrentRole(); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/credentials/{contact-said}") Response<AccountEntry> getCredentials(
            @PathParam("said") String saidLocal,
            @PathParam("contact-said") String saidRequester); @POST @Produces(MediaType.APPLICATION_JSON) @Path("/credentials/{contact-said}") Response<?> confirmCredentials(
            @PathParam("said") String saidLocal,
            @PathParam("contact-said") String saidRequester);  }