SDBControllerV2 { @ApiOperation(value = "${SafesController.getInfo.value}", notes = "${SafesController.getInfo.notes}") @GetMapping(value="/v2/sdb/folder/{path}",produces="application/json") public ResponseEntity<String> getInfo(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path){ return safesService.getInfo(token, path); }  @ApiOperation(value = "${SafesController.getFolders.value}", notes = "${SafesController.getFolders.notes}") @GetMapping(value="/v2/sdb/folder",produces="application/json") ResponseEntity<String> getFolders(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @ApiOperation(value = "${SafesController.getInfo.value}", notes = "${SafesController.getInfo.notes}") @GetMapping(value="/v2/sdb/folder/{path}",produces="application/json") ResponseEntity<String> getInfo(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @PostMapping(value="/v2/sdb/folder",produces="application/json") ResponseEntity<String> createfolder(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @DeleteMapping(value="/v2/sdb/delete",produces="application/json") ResponseEntity<String> deleteFolder(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @ApiOperation(value = "${SafesController.updateSafe.value}", notes = "${SafesController.updateSafe.notes}") @PutMapping(value="/v2/sdb",consumes="application/json",produces="application/json") ResponseEntity<String> updateSafe(@RequestHeader(value="vault-token" ) String token, @RequestBody Safe safe); @ApiOperation(value = "${SafesController.createSafe.value}", notes = "${SafesController.createSafe.notes}") @PostMapping(value="/v2/sdb", consumes="application/json",produces="application/json") ResponseEntity<String> createSafe(@RequestHeader(value="vault-token" ) String token, @RequestBody Safe safe); @ApiOperation(value = "${SafesController.deleteSafe.value}", notes = "${SafesController.deleteSafe.notes}") @DeleteMapping(value="/v2/sdb",produces="application/json") ResponseEntity<String> deleteSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody Safe safe); @ApiOperation(value = "${SafesController.getSafe.value}", notes = "${SafesController.getSafe.notes}") @GetMapping(value="/v2/sdb",produces="application/json") ResponseEntity<String> getSafe(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @ApiOperation(value = "${SafesController.addUserToSafe.value}", notes = "${SafesController.addUserToSafe.notes}") @PostMapping(value="/v2/sdb/user",consumes="application/json",produces="application/json") ResponseEntity<String> addUsertoSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody SafeUser safeUser); @ApiOperation(value = "${SafesController.removeUserFromSafe.value}", notes = "${SafesController.removeUserFromSafe.notes}") @DeleteMapping(value="/v2/sdb/user",consumes="application/json",produces="application/json") ResponseEntity<String> deleteUserFromSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody SafeUser safeUser); @ApiOperation(value = "${SafesController.addGroupToSafe.value}", notes = "${SafesController.addGroupToSafe.notes}") @PostMapping(value="/v2/sdb/group",consumes="application/json",produces="application/json") ResponseEntity<String> addGrouptoSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody SafeGroup safeGroup); @ApiOperation(value = "${SafesController.deleteGroupFromSafe.value}", notes = "${SafesController.deleteGroupFromSafe.notes}") @DeleteMapping (value="/v2/sdb/group",consumes="application/json",produces="application/json") ResponseEntity<String> deleteGroupFromSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody SafeGroup safeGroup); @ApiOperation(value = "${SafesController.addAWSRoleToSafe.value}", notes = "${SafesController.addAWSRoleToSafe.notes}") @PostMapping (value="/v2/sdb/role",consumes="application/json",produces="application/json") ResponseEntity<String> addAwsRoleToSafe(@RequestHeader(value="vault-token") String token, @RequestBody AWSRole awsRole); @ApiOperation(value = "${SafesController.deleteAWSRoleFromSafe.value}", notes = "${SafesController.deleteAWSRoleFromSafe.notes}") @DeleteMapping (value="/v2/sdb/role",consumes="application/json",produces="application/json") ResponseEntity<String> deleteAwsRoleFromSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody AWSRole awsRole); @ApiOperation(value = "${SafesController.deleteAWSPermissionFromSafe.value}", notes = "${SafesController.deleteAWSPermissionFromSafe.notes}") @PutMapping (value="/v2/sdb/role",consumes="application/json",produces="application/json") ResponseEntity<String> detachAwsRoleFromSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody AWSRole awsRole); @GetMapping(value="/v2/sdb/list",produces="application/json") ResponseEntity<String> getFoldersRecursively(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @PostMapping(value="/v2/sdb/createfolder",produces="application/json") ResponseEntity<String> createNestedfolder(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @PostMapping(value="/v2/sdb/approle",consumes="application/json",produces="application/json") ResponseEntity<String> associateApproletoSDB(@RequestHeader(value="vault-token") String token, @RequestBody SafeAppRoleAccess safeAppRoleAccess);  }
@Test public void test_getInfo() throws Exception { String responseJson = "{\"data\": { \"description\": \"My first safe\", \"name\": \"mysafe01\", \"owner\": \"youremail@yourcompany.com\", \"type\": \"\" }}"; ResponseEntity<String> responseEntityExpected = ResponseEntity.status(HttpStatus.OK).body(responseJson); when(safesService.getInfo("5PDrOhsy4ig8L3EpsJZSLAMg", "users")).thenReturn(responseEntityExpected); mockMvc.perform(MockMvcRequestBuilders.get("/v2/sdb/folder/users?path=users") .header("vault-token", "5PDrOhsy4ig8L3EpsJZSLAMg") .header("Content-Type", "application/json;charset=UTF-8")) .andExpect(status().isOk()) .andExpect(content().string(containsString(responseJson))); }