@Test public void Test5DeleteKey() throws Exception { Mockito.doNothing().when(keyMgr).deleteKey(provider, name); keyREST.deleteKey(name, provider, request); Mockito.verify(keyMgr).deleteKey(provider, name); }
@DELETE @Path("/key/{alias}") @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.DELETE_KEY + "\")") public void deleteKey(@PathParam("alias") String name, @QueryParam("provider") String provider, @Context HttpServletRequest request) { try{ if (name == null || name.isEmpty()) { throw restErrorUtil.createRESTException("Please provide a valid " + "alias.", MessageEnums.INVALID_INPUT_DATA); } keyMgr.deleteKey(provider, name); }catch(Exception e){ handleError(e); } }
XKeyREST { @DELETE @Path("/key/{alias}") @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.DELETE_KEY + "\")") public void deleteKey(@PathParam("alias") String name, @QueryParam("provider") String provider, @Context HttpServletRequest request) { try{ if (name == null || name.isEmpty()) { throw restErrorUtil.createRESTException("Please provide a valid " + "alias.", MessageEnums.INVALID_INPUT_DATA); } keyMgr.deleteKey(provider, name); }catch(Exception e){ handleError(e); } } }
XKeyREST { @DELETE @Path("/key/{alias}") @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.DELETE_KEY + "\")") public void deleteKey(@PathParam("alias") String name, @QueryParam("provider") String provider, @Context HttpServletRequest request) { try{ if (name == null || name.isEmpty()) { throw restErrorUtil.createRESTException("Please provide a valid " + "alias.", MessageEnums.INVALID_INPUT_DATA); } keyMgr.deleteKey(provider, name); }catch(Exception e){ handleError(e); } }  }
XKeyREST { @DELETE @Path("/key/{alias}") @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.DELETE_KEY + "\")") public void deleteKey(@PathParam("alias") String name, @QueryParam("provider") String provider, @Context HttpServletRequest request) { try{ if (name == null || name.isEmpty()) { throw restErrorUtil.createRESTException("Please provide a valid " + "alias.", MessageEnums.INVALID_INPUT_DATA); } keyMgr.deleteKey(provider, name); }catch(Exception e){ handleError(e); } }  @GET @Path("/keys") @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.SEARCH_KEYS + "\")") VXKmsKeyList searchKeys(@Context HttpServletRequest request, @QueryParam("provider") String provider); @PUT @Path("/key") @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.ROLLOVER_KEYS + "\")") VXKmsKey rolloverKey(@QueryParam("provider") String provider, VXKmsKey vXKey); @DELETE @Path("/key/{alias}") @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.DELETE_KEY + "\")") void deleteKey(@PathParam("alias") String name, @QueryParam("provider") String provider, @Context HttpServletRequest request); @POST @Path("/key") @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.CREATE_KEY + "\")") VXKmsKey createKey(@QueryParam("provider") String provider, VXKmsKey vXKey); @GET @Path("/key/{alias}") @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.GET_KEY + "\")") VXKmsKey getKey(@PathParam("alias") String name,@QueryParam("provider") String provider); }
XKeyREST { @DELETE @Path("/key/{alias}") @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.DELETE_KEY + "\")") public void deleteKey(@PathParam("alias") String name, @QueryParam("provider") String provider, @Context HttpServletRequest request) { try{ if (name == null || name.isEmpty()) { throw restErrorUtil.createRESTException("Please provide a valid " + "alias.", MessageEnums.INVALID_INPUT_DATA); } keyMgr.deleteKey(provider, name); }catch(Exception e){ handleError(e); } }  @GET @Path("/keys") @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.SEARCH_KEYS + "\")") VXKmsKeyList searchKeys(@Context HttpServletRequest request, @QueryParam("provider") String provider); @PUT @Path("/key") @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.ROLLOVER_KEYS + "\")") VXKmsKey rolloverKey(@QueryParam("provider") String provider, VXKmsKey vXKey); @DELETE @Path("/key/{alias}") @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.DELETE_KEY + "\")") void deleteKey(@PathParam("alias") String name, @QueryParam("provider") String provider, @Context HttpServletRequest request); @POST @Path("/key") @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.CREATE_KEY + "\")") VXKmsKey createKey(@QueryParam("provider") String provider, VXKmsKey vXKey); @GET @Path("/key/{alias}") @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.GET_KEY + "\")") VXKmsKey getKey(@PathParam("alias") String name,@QueryParam("provider") String provider);  }