@Test @WithMockUser public void getCredential() throws Exception { Credential fakeData = new Credential("testKey", "APP.dev.TestComponent.testKey", "dev", null,"APP", "dev", "TestComponent", "Jon Snow", "2018-04-04T12:51:37.803Z"); when(credentialsService.getCredential(any(), any(), any(), any())).thenReturn(fakeData); mockMvc.perform(getCredentialRequest) .andExpect(status().isOk()) .andExpect(jsonPath("shortKey", is("testKey"))) .andExpect(jsonPath("longKey", is("APP.dev.TestComponent.testKey"))) .andExpect(jsonPath("account", is("dev"))) .andExpect(jsonPath("environment", is("dev"))) .andExpect(jsonPath("component", is("TestComponent"))) .andExpect(jsonPath("lastUpdatedBy", is("Jon Snow"))) .andExpect(jsonPath("lastUpdatedDate", is("2018-04-04T12:51:37.803Z"))); }
@ResponseBody @GetMapping(value="/credentials/{key:.+}/") public ResponseEntity getCredential(@PathVariable("key") String longKey, @RequestParam("account") String account, @RequestParam("region") String region, @RequestParam("application") String application ){ final Credential credential = credentialsService.getCredential(account, region, application, longKey); if (credential != null) return new ResponseEntity<>(credential, HttpStatus.OK); return new ResponseEntity<>("Credential not found", HttpStatus.NOT_FOUND); }
FideliusController { @ResponseBody @GetMapping(value="/credentials/{key:.+}/") public ResponseEntity getCredential(@PathVariable("key") String longKey, @RequestParam("account") String account, @RequestParam("region") String region, @RequestParam("application") String application ){ final Credential credential = credentialsService.getCredential(account, region, application, longKey); if (credential != null) return new ResponseEntity<>(credential, HttpStatus.OK); return new ResponseEntity<>("Credential not found", HttpStatus.NOT_FOUND); } }
FideliusController { @ResponseBody @GetMapping(value="/credentials/{key:.+}/") public ResponseEntity getCredential(@PathVariable("key") String longKey, @RequestParam("account") String account, @RequestParam("region") String region, @RequestParam("application") String application ){ final Credential credential = credentialsService.getCredential(account, region, application, longKey); if (credential != null) return new ResponseEntity<>(credential, HttpStatus.OK); return new ResponseEntity<>("Credential not found", HttpStatus.NOT_FOUND); }  }
FideliusController { @ResponseBody @GetMapping(value="/credentials/{key:.+}/") public ResponseEntity getCredential(@PathVariable("key") String longKey, @RequestParam("account") String account, @RequestParam("region") String region, @RequestParam("application") String application ){ final Credential credential = credentialsService.getCredential(account, region, application, longKey); if (credential != null) return new ResponseEntity<>(credential, HttpStatus.OK); return new ResponseEntity<>("Credential not found", 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 @GetMapping(value="/credentials/{key:.+}/") public ResponseEntity getCredential(@PathVariable("key") String longKey, @RequestParam("account") String account, @RequestParam("region") String region, @RequestParam("application") String application ){ final Credential credential = credentialsService.getCredential(account, region, application, longKey); if (credential != null) return new ResponseEntity<>(credential, HttpStatus.OK); return new ResponseEntity<>("Credential not found", 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();  }