@Test public void deleteCredentialShouldReturn401ErrorWhenUserNotFound() throws Exception { when(credentialsService.deleteCredential(credential)).thenReturn(new Credential()); mockMvc.perform(deleteSecretRequest) .andExpect(status().is4xxClientError()); }
@ResponseBody @DeleteMapping(value="/credentials/secret") public ResponseEntity deleteCredential(@RequestParam("account") String account, @RequestParam("region") String region, @RequestParam("application") String application, @RequestParam("environment") String environment, @RequestParam(value = "component", required = false) String component, @RequestParam("shortKey") String shortKey) { Credential credentialToDelete = new Credential(shortKey, null, account, region, application, environment, component, null, null); final Credential credentialSecret = credentialsService.deleteCredential(credentialToDelete); if (credentialSecret != null) return new ResponseEntity<>(credentialSecret, HttpStatus.ACCEPTED); return new ResponseEntity<>("Credential not deleted", HttpStatus.NOT_FOUND); }
FideliusController { @ResponseBody @DeleteMapping(value="/credentials/secret") public ResponseEntity deleteCredential(@RequestParam("account") String account, @RequestParam("region") String region, @RequestParam("application") String application, @RequestParam("environment") String environment, @RequestParam(value = "component", required = false) String component, @RequestParam("shortKey") String shortKey) { Credential credentialToDelete = new Credential(shortKey, null, account, region, application, environment, component, null, null); final Credential credentialSecret = credentialsService.deleteCredential(credentialToDelete); if (credentialSecret != null) return new ResponseEntity<>(credentialSecret, HttpStatus.ACCEPTED); return new ResponseEntity<>("Credential not deleted", HttpStatus.NOT_FOUND); } }
FideliusController { @ResponseBody @DeleteMapping(value="/credentials/secret") public ResponseEntity deleteCredential(@RequestParam("account") String account, @RequestParam("region") String region, @RequestParam("application") String application, @RequestParam("environment") String environment, @RequestParam(value = "component", required = false) String component, @RequestParam("shortKey") String shortKey) { Credential credentialToDelete = new Credential(shortKey, null, account, region, application, environment, component, null, null); final Credential credentialSecret = credentialsService.deleteCredential(credentialToDelete); if (credentialSecret != null) return new ResponseEntity<>(credentialSecret, HttpStatus.ACCEPTED); return new ResponseEntity<>("Credential not deleted", HttpStatus.NOT_FOUND); }  }
FideliusController { @ResponseBody @DeleteMapping(value="/credentials/secret") public ResponseEntity deleteCredential(@RequestParam("account") String account, @RequestParam("region") String region, @RequestParam("application") String application, @RequestParam("environment") String environment, @RequestParam(value = "component", required = false) String component, @RequestParam("shortKey") String shortKey) { Credential credentialToDelete = new Credential(shortKey, null, account, region, application, environment, component, null, null); final Credential credentialSecret = credentialsService.deleteCredential(credentialToDelete); if (credentialSecret != null) return new ResponseEntity<>(credentialSecret, HttpStatus.ACCEPTED); return new ResponseEntity<>("Credential not deleted", HttpStatus.NOT_FOUND); }  @RequestMapping(value = "/heartbeat", method = RequestMethod.GET) ResponseEntity heartbeatEndpoint(); @RequestMapping(value = "/credentials", method = RequestMethod.GET) ResponseEntity getCredentials(@RequestParam("account") String account,
                                                           @RequestParam("region") String region,
                                                           @RequestParam("application") String app); @ResponseBody @GetMapping(value="/credentials/{key:.+}/") ResponseEntity getCredential(@PathVariable("key") String longKey,
                                        @RequestParam("account") String account,
                                        @RequestParam("region") String region,
                                        @RequestParam("application") String application
    ); @RequestMapping(value = "/credentials/history", method = RequestMethod.GET) ResponseEntity getCredentialHistory(@RequestParam("account") String account,
                                                                   @RequestParam("region") String region,
                                                                   @RequestParam("application") String app,
                                                                   @RequestParam("environment") String environment,
                                                                   @RequestParam(value = "component", required = false) String component,
                                                                   @RequestParam("shortKey") String key); @ResponseBody @GetMapping(value="/credentials/secret") ResponseEntity getSecret(@RequestParam("account") String account,
                                      @RequestParam("region") String region,
                                      @RequestParam("application") String application,
                                      @RequestParam("environment") String environment,
                                      @RequestParam(value = "component", required = false) String component,
                                      @RequestParam("shortKey") String shortKey); @ResponseBody @PostMapping(value="/credentials/secret") ResponseEntity createCredential(@Valid @RequestBody Credential credential); @ResponseBody @PutMapping(value="/credentials/secret") ResponseEntity updateCredential(@Valid @RequestBody Credential credential); @ResponseBody @DeleteMapping(value="/credentials/secret") ResponseEntity deleteCredential(@RequestParam("account") String account,
                                                       @RequestParam("region") String region,
                                                       @RequestParam("application") String application,
                                                       @RequestParam("environment") String environment,
                                                       @RequestParam(value = "component", required = false) String component,
                                                       @RequestParam("shortKey") String shortKey); @ResponseBody @GetMapping(value="/validActiveDirectoryRegularExpression") ResponseEntity activeDirectory(); @ResponseBody @GetMapping(value="/accounts") ResponseEntity getAccounts(); }
FideliusController { @ResponseBody @DeleteMapping(value="/credentials/secret") public ResponseEntity deleteCredential(@RequestParam("account") String account, @RequestParam("region") String region, @RequestParam("application") String application, @RequestParam("environment") String environment, @RequestParam(value = "component", required = false) String component, @RequestParam("shortKey") String shortKey) { Credential credentialToDelete = new Credential(shortKey, null, account, region, application, environment, component, null, null); final Credential credentialSecret = credentialsService.deleteCredential(credentialToDelete); if (credentialSecret != null) return new ResponseEntity<>(credentialSecret, HttpStatus.ACCEPTED); return new ResponseEntity<>("Credential not deleted", HttpStatus.NOT_FOUND); }  @RequestMapping(value = "/heartbeat", method = RequestMethod.GET) ResponseEntity heartbeatEndpoint(); @RequestMapping(value = "/credentials", method = RequestMethod.GET) ResponseEntity getCredentials(@RequestParam("account") String account,
                                                           @RequestParam("region") String region,
                                                           @RequestParam("application") String app); @ResponseBody @GetMapping(value="/credentials/{key:.+}/") ResponseEntity getCredential(@PathVariable("key") String longKey,
                                        @RequestParam("account") String account,
                                        @RequestParam("region") String region,
                                        @RequestParam("application") String application
    ); @RequestMapping(value = "/credentials/history", method = RequestMethod.GET) ResponseEntity getCredentialHistory(@RequestParam("account") String account,
                                                                   @RequestParam("region") String region,
                                                                   @RequestParam("application") String app,
                                                                   @RequestParam("environment") String environment,
                                                                   @RequestParam(value = "component", required = false) String component,
                                                                   @RequestParam("shortKey") String key); @ResponseBody @GetMapping(value="/credentials/secret") ResponseEntity getSecret(@RequestParam("account") String account,
                                      @RequestParam("region") String region,
                                      @RequestParam("application") String application,
                                      @RequestParam("environment") String environment,
                                      @RequestParam(value = "component", required = false) String component,
                                      @RequestParam("shortKey") String shortKey); @ResponseBody @PostMapping(value="/credentials/secret") ResponseEntity createCredential(@Valid @RequestBody Credential credential); @ResponseBody @PutMapping(value="/credentials/secret") ResponseEntity updateCredential(@Valid @RequestBody Credential credential); @ResponseBody @DeleteMapping(value="/credentials/secret") ResponseEntity deleteCredential(@RequestParam("account") String account,
                                                       @RequestParam("region") String region,
                                                       @RequestParam("application") String application,
                                                       @RequestParam("environment") String environment,
                                                       @RequestParam(value = "component", required = false) String component,
                                                       @RequestParam("shortKey") String shortKey); @ResponseBody @GetMapping(value="/validActiveDirectoryRegularExpression") ResponseEntity activeDirectory(); @ResponseBody @GetMapping(value="/accounts") ResponseEntity getAccounts();  }