@Test public void testGetFailurePointsByName() { FailurePoint fp = createFailurePoint(FPNAME, TEAMNAME); when(failurePointRepository.findByName(fp.getName())).thenReturn(fp); FailurePoint failurePoint = (FailurePoint) failurePointController.getFailurePointsByName(fp.getName()) .getBody(); assertEquals(MonkeyType.CHAOS, failurePoint.getMonkeyType()); assertEquals(FPNAME, failurePoint.getName()); }
@ApiOperation(value = "This API returns single FailurePoint Object present in Elastic Search for given FailurePoint Name", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned FailurePoint Object for given FailurePoint Name"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No FailurePoint object found for given FailurePoint Name") }) @RequestMapping(value = "/api/failurepoints/name/{name}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getFailurePointsByName(@PathVariable("name") String name) { FailurePoint failurePoint = failurePointService.findByName(name); if (failurePoint == null) { final String error = " FailurePoint Not found for name " + name; logger.debug(error); final MessageWrapper apiError = new MessageWrapper(HttpStatus.NOT_FOUND, error, error); return new ResponseEntity<>(apiError, new HttpHeaders(), apiError.getStatus()); } return new ResponseEntity<>(failurePoint, HttpStatus.OK); }
FailurePointRestController { @ApiOperation(value = "This API returns single FailurePoint Object present in Elastic Search for given FailurePoint Name", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned FailurePoint Object for given FailurePoint Name"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No FailurePoint object found for given FailurePoint Name") }) @RequestMapping(value = "/api/failurepoints/name/{name}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getFailurePointsByName(@PathVariable("name") String name) { FailurePoint failurePoint = failurePointService.findByName(name); if (failurePoint == null) { final String error = " FailurePoint Not found for name " + name; logger.debug(error); final MessageWrapper apiError = new MessageWrapper(HttpStatus.NOT_FOUND, error, error); return new ResponseEntity<>(apiError, new HttpHeaders(), apiError.getStatus()); } return new ResponseEntity<>(failurePoint, HttpStatus.OK); } }
FailurePointRestController { @ApiOperation(value = "This API returns single FailurePoint Object present in Elastic Search for given FailurePoint Name", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned FailurePoint Object for given FailurePoint Name"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No FailurePoint object found for given FailurePoint Name") }) @RequestMapping(value = "/api/failurepoints/name/{name}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getFailurePointsByName(@PathVariable("name") String name) { FailurePoint failurePoint = failurePointService.findByName(name); if (failurePoint == null) { final String error = " FailurePoint Not found for name " + name; logger.debug(error); final MessageWrapper apiError = new MessageWrapper(HttpStatus.NOT_FOUND, error, error); return new ResponseEntity<>(apiError, new HttpHeaders(), apiError.getStatus()); } return new ResponseEntity<>(failurePoint, HttpStatus.OK); }  }
FailurePointRestController { @ApiOperation(value = "This API returns single FailurePoint Object present in Elastic Search for given FailurePoint Name", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned FailurePoint Object for given FailurePoint Name"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No FailurePoint object found for given FailurePoint Name") }) @RequestMapping(value = "/api/failurepoints/name/{name}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getFailurePointsByName(@PathVariable("name") String name) { FailurePoint failurePoint = failurePointService.findByName(name); if (failurePoint == null) { final String error = " FailurePoint Not found for name " + name; logger.debug(error); final MessageWrapper apiError = new MessageWrapper(HttpStatus.NOT_FOUND, error, error); return new ResponseEntity<>(apiError, new HttpHeaders(), apiError.getStatus()); } return new ResponseEntity<>(failurePoint, HttpStatus.OK); }  @ApiOperation(value = "This API returns all FailurePoint Objects present in Elastic Search", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned all FailurePoint Objects"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No FailurePoint object found") }) @RequestMapping(value = "/api/failurepoints/", method = RequestMethod.GET, produces = "application/json") ResponseEntity<Object> listAllFailurePoints(); @ApiOperation(value = "This API returns single FailurePoint Objects present in Elastic Search for given FailurePoint ID", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned single FailurePoint Object for given FailurePoint ID"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No FailurePoint object found for given FailurePoint ID") }) @RequestMapping(value = "/api/failurepoints/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getFailurePoint(@PathVariable("id") String id); @ApiOperation(value = "This API returns single FailurePoint Object present in Elastic Search for given FailurePoint Name", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned FailurePoint Object for given FailurePoint Name"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No FailurePoint object found for given FailurePoint Name") }) @RequestMapping(value = "/api/failurepoints/name/{name}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getFailurePointsByName(@PathVariable("name") String name); @ApiOperation(value = "This API returns FailurePoint Objects present in Elastic Search for given FailurePoint Category", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned FailurePoint Objects for given FailurePoint Category"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No FailurePoint object found for given FailurePoint Category") }) @RequestMapping(value = "/api/failurepoints/category/{category}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getFailurePointByCategory(@PathVariable("category") String category); @ApiOperation(value = "This API returns FailurePoint Objects present in Elastic Search for given FailurePoint role", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned FailurePoint Objects for given FailurePoint role"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No FailurePoint object found for given FailurePoint role") }) @RequestMapping(value = "/api/failurepoints/role/{role}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getFailurePointByRole(@PathVariable("role") String role); @ApiOperation(value = "This API inserts a FailurePoint Object into Elastic Search", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 201, message = "FailurePoint object successfully inserted into ES"), @ApiResponse(code = 401, message = "User is not authorized to perform Add operation"), @ApiResponse(code = 409, message = "FailurePoint with same name is already exist"), @ApiResponse(code = 404, message = "The resource trying to reach is not found"), @ApiResponse(code = 400, message = "Input Request object is not valid") }) @RequestMapping(value = "/api/failurepoint/", method = RequestMethod.POST, produces = "application/json") ResponseEntity<Object> addFailurePoint(@RequestBody FailurePoint failurePoint,
			UriComponentsBuilder ucBuilder); @ApiOperation(value = "This API do bulk insertion of an FailurePoint Objects into Elastic Search", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 201, message = "FailurePoint objects successfully inserted into ES"), @ApiResponse(code = 401, message = "User is not authorized to perform Add operation"), @ApiResponse(code = 409, message = "FailurePoint with same name is already exist"), @ApiResponse(code = 404, message = "The resource trying to reach is not found"), @ApiResponse(code = 400, message = "Input Request object is not valid") }) @RequestMapping(value = "/api/failurepoints/", method = RequestMethod.POST, produces = "application/json") ResponseEntity<Object> bulkaddFailurePoint(@RequestBody FailurePointAdapter failurePointadapter); @ApiOperation(value = "This API updates a FailurePoint Objects into Elastic Search for given FailurePoint ID", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "FailurePoint objects successfully updated into ES for given FailurePoint ID"), @ApiResponse(code = 401, message = "User is not authorized to perform Update operation "), @ApiResponse(code = 404, message = "FailurePoint object not found in ES for given FailurePoint ID"), @ApiResponse(code = 400, message = "Input Request object is not valid") }) @RequestMapping(value = "/api/failurepoints/{id}", method = RequestMethod.PUT, produces = "application/json") ResponseEntity<Object> updateFailurePoint(@PathVariable("id") String id,
			@RequestBody FailurePoint toModifyFailurePoint); @ApiOperation(value = "This API deletes a FailurePoint Objects from Elastic Search for given FailurePoint ID", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "FailurePoint object successfully deleted from ES for given FailurePoint ID"), @ApiResponse(code = 401, message = "User is not authorized to perform Delete operation"), @ApiResponse(code = 404, message = "FailurePoint object not found in ES for given FailurePoint ID"), @ApiResponse(code = 400, message = "Input Request object is not valid") }) @RequestMapping(value = "/api/failurepoints/{id}", method = RequestMethod.DELETE, produces = "application/json") ResponseEntity<Object> deleteFailurePoint(@PathVariable("id") String id); @ApiOperation(value = "This API deletes all FailurePoint Objects from Elastic Search", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "All FailurePoint object successfully deleted from ES"), @ApiResponse(code = 401, message = "User is not authorized to perform Delete operation"), @ApiResponse(code = 400, message = "Input Request object is not valid") }) @RequestMapping(value = "/api/failurepoints/", method = RequestMethod.DELETE, produces = "application/json") ResponseEntity<Object> deleteAllFailurePoints(); }
FailurePointRestController { @ApiOperation(value = "This API returns single FailurePoint Object present in Elastic Search for given FailurePoint Name", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned FailurePoint Object for given FailurePoint Name"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No FailurePoint object found for given FailurePoint Name") }) @RequestMapping(value = "/api/failurepoints/name/{name}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getFailurePointsByName(@PathVariable("name") String name) { FailurePoint failurePoint = failurePointService.findByName(name); if (failurePoint == null) { final String error = " FailurePoint Not found for name " + name; logger.debug(error); final MessageWrapper apiError = new MessageWrapper(HttpStatus.NOT_FOUND, error, error); return new ResponseEntity<>(apiError, new HttpHeaders(), apiError.getStatus()); } return new ResponseEntity<>(failurePoint, HttpStatus.OK); }  @ApiOperation(value = "This API returns all FailurePoint Objects present in Elastic Search", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned all FailurePoint Objects"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No FailurePoint object found") }) @RequestMapping(value = "/api/failurepoints/", method = RequestMethod.GET, produces = "application/json") ResponseEntity<Object> listAllFailurePoints(); @ApiOperation(value = "This API returns single FailurePoint Objects present in Elastic Search for given FailurePoint ID", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned single FailurePoint Object for given FailurePoint ID"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No FailurePoint object found for given FailurePoint ID") }) @RequestMapping(value = "/api/failurepoints/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getFailurePoint(@PathVariable("id") String id); @ApiOperation(value = "This API returns single FailurePoint Object present in Elastic Search for given FailurePoint Name", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned FailurePoint Object for given FailurePoint Name"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No FailurePoint object found for given FailurePoint Name") }) @RequestMapping(value = "/api/failurepoints/name/{name}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getFailurePointsByName(@PathVariable("name") String name); @ApiOperation(value = "This API returns FailurePoint Objects present in Elastic Search for given FailurePoint Category", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned FailurePoint Objects for given FailurePoint Category"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No FailurePoint object found for given FailurePoint Category") }) @RequestMapping(value = "/api/failurepoints/category/{category}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getFailurePointByCategory(@PathVariable("category") String category); @ApiOperation(value = "This API returns FailurePoint Objects present in Elastic Search for given FailurePoint role", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned FailurePoint Objects for given FailurePoint role"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No FailurePoint object found for given FailurePoint role") }) @RequestMapping(value = "/api/failurepoints/role/{role}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getFailurePointByRole(@PathVariable("role") String role); @ApiOperation(value = "This API inserts a FailurePoint Object into Elastic Search", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 201, message = "FailurePoint object successfully inserted into ES"), @ApiResponse(code = 401, message = "User is not authorized to perform Add operation"), @ApiResponse(code = 409, message = "FailurePoint with same name is already exist"), @ApiResponse(code = 404, message = "The resource trying to reach is not found"), @ApiResponse(code = 400, message = "Input Request object is not valid") }) @RequestMapping(value = "/api/failurepoint/", method = RequestMethod.POST, produces = "application/json") ResponseEntity<Object> addFailurePoint(@RequestBody FailurePoint failurePoint,
			UriComponentsBuilder ucBuilder); @ApiOperation(value = "This API do bulk insertion of an FailurePoint Objects into Elastic Search", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 201, message = "FailurePoint objects successfully inserted into ES"), @ApiResponse(code = 401, message = "User is not authorized to perform Add operation"), @ApiResponse(code = 409, message = "FailurePoint with same name is already exist"), @ApiResponse(code = 404, message = "The resource trying to reach is not found"), @ApiResponse(code = 400, message = "Input Request object is not valid") }) @RequestMapping(value = "/api/failurepoints/", method = RequestMethod.POST, produces = "application/json") ResponseEntity<Object> bulkaddFailurePoint(@RequestBody FailurePointAdapter failurePointadapter); @ApiOperation(value = "This API updates a FailurePoint Objects into Elastic Search for given FailurePoint ID", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "FailurePoint objects successfully updated into ES for given FailurePoint ID"), @ApiResponse(code = 401, message = "User is not authorized to perform Update operation "), @ApiResponse(code = 404, message = "FailurePoint object not found in ES for given FailurePoint ID"), @ApiResponse(code = 400, message = "Input Request object is not valid") }) @RequestMapping(value = "/api/failurepoints/{id}", method = RequestMethod.PUT, produces = "application/json") ResponseEntity<Object> updateFailurePoint(@PathVariable("id") String id,
			@RequestBody FailurePoint toModifyFailurePoint); @ApiOperation(value = "This API deletes a FailurePoint Objects from Elastic Search for given FailurePoint ID", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "FailurePoint object successfully deleted from ES for given FailurePoint ID"), @ApiResponse(code = 401, message = "User is not authorized to perform Delete operation"), @ApiResponse(code = 404, message = "FailurePoint object not found in ES for given FailurePoint ID"), @ApiResponse(code = 400, message = "Input Request object is not valid") }) @RequestMapping(value = "/api/failurepoints/{id}", method = RequestMethod.DELETE, produces = "application/json") ResponseEntity<Object> deleteFailurePoint(@PathVariable("id") String id); @ApiOperation(value = "This API deletes all FailurePoint Objects from Elastic Search", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "All FailurePoint object successfully deleted from ES"), @ApiResponse(code = 401, message = "User is not authorized to perform Delete operation"), @ApiResponse(code = 400, message = "Input Request object is not valid") }) @RequestMapping(value = "/api/failurepoints/", method = RequestMethod.DELETE, produces = "application/json") ResponseEntity<Object> deleteAllFailurePoints();  }