@Test public void testListEventsErrCond() { List<EventRecorder> events = new ArrayList<>(); when(eventRepository.findAll()).thenReturn(events); MessageWrapper apiError = (MessageWrapper) eventController.listEvents().getBody(); assertEquals(HttpStatus.NOT_FOUND, apiError.getStatus()); assertEquals("No events found !!!", apiError.getStatusMessage()); }
@ApiOperation(value = "This API returns all Event Objects present in Elastic Search", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned all Event Objects"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No Event object found") }) @RequestMapping(value = "/api/events/", method = RequestMethod.GET, produces = "application/json") public ResponseEntity<Object> listEvents() { List<EventRecorder> events = Lists.newArrayList(eventService.findAll()); if (events.isEmpty()) { final String error = "No events found !!!"; final MessageWrapper apiError = new MessageWrapper(HttpStatus.NOT_FOUND, error, error); return new ResponseEntity<>(apiError, new HttpHeaders(), apiError.getStatus()); } return new ResponseEntity<>(events, HttpStatus.OK); }
EventRestController { @ApiOperation(value = "This API returns all Event Objects present in Elastic Search", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned all Event Objects"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No Event object found") }) @RequestMapping(value = "/api/events/", method = RequestMethod.GET, produces = "application/json") public ResponseEntity<Object> listEvents() { List<EventRecorder> events = Lists.newArrayList(eventService.findAll()); if (events.isEmpty()) { final String error = "No events found !!!"; final MessageWrapper apiError = new MessageWrapper(HttpStatus.NOT_FOUND, error, error); return new ResponseEntity<>(apiError, new HttpHeaders(), apiError.getStatus()); } return new ResponseEntity<>(events, HttpStatus.OK); } }
EventRestController { @ApiOperation(value = "This API returns all Event Objects present in Elastic Search", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned all Event Objects"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No Event object found") }) @RequestMapping(value = "/api/events/", method = RequestMethod.GET, produces = "application/json") public ResponseEntity<Object> listEvents() { List<EventRecorder> events = Lists.newArrayList(eventService.findAll()); if (events.isEmpty()) { final String error = "No events found !!!"; final MessageWrapper apiError = new MessageWrapper(HttpStatus.NOT_FOUND, error, error); return new ResponseEntity<>(apiError, new HttpHeaders(), apiError.getStatus()); } return new ResponseEntity<>(events, HttpStatus.OK); }  }
EventRestController { @ApiOperation(value = "This API returns all Event Objects present in Elastic Search", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned all Event Objects"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No Event object found") }) @RequestMapping(value = "/api/events/", method = RequestMethod.GET, produces = "application/json") public ResponseEntity<Object> listEvents() { List<EventRecorder> events = Lists.newArrayList(eventService.findAll()); if (events.isEmpty()) { final String error = "No events found !!!"; final MessageWrapper apiError = new MessageWrapper(HttpStatus.NOT_FOUND, error, error); return new ResponseEntity<>(apiError, new HttpHeaders(), apiError.getStatus()); } return new ResponseEntity<>(events, HttpStatus.OK); }  @ApiOperation(value = "This API returns all Event Objects present in Elastic Search", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned all Event Objects"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No Event object found") }) @RequestMapping(value = "/api/events/", method = RequestMethod.GET, produces = "application/json") ResponseEntity<Object> listEvents(); @ApiOperation(value = "This API returns list of all Event objects present in Elastic Search for given team", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned all Application Event for given team"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No Event object found for given team") }) @RequestMapping(value = "/api/events/team/", method = RequestMethod.GET, produces = "application/json") ResponseEntity<Object> listAllEvents(HttpServletRequest request); @ApiOperation(value = "This API returns single Event Objects present in Elastic Search for given Event ID", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned single Event Object for given Event ID"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No Event object found for given Event ID") }) @RequestMapping(value = "/api/events/{id}", method = RequestMethod.GET, produces = "application/json") ResponseEntity<Object> listEvent(HttpServletRequest request, @PathVariable("id") String id); @ApiOperation(value = "This API returns Event Status Objects present in Elastic Search for given Event ID", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned Event Status Object for given Event ID"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No Event Status object found for given Event ID") }) @RequestMapping(value = "/api/events/status/{id}", method = RequestMethod.GET, produces = "application/json") ResponseEntity<Object> getstatusupdateforevent(HttpServletRequest request, @PathVariable("id") String id); @ApiOperation(value = "This API returns count of Event objects available in Elastic Search for given team name", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned count of Event objects for given team name"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "The resource trying to reach is not found") }) @RequestMapping(value = "/api/events/count/", method = RequestMethod.GET, produces = "application/json") ResponseEntity<Object> countByTeamName(HttpServletRequest request); @ApiOperation(value = "This API returns Latest Events per Scenario present in Elastic Search for given App Name", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned Latest Events per Scenario for given App Name"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No Event object found for given App Name") }) @RequestMapping(value = "/api/events/latestevent/{applicationName}", method = RequestMethod.GET, produces = "application/json") ResponseEntity<Object> listLatestEventsByAppName(HttpServletRequest request,
			@PathVariable("applicationName") String applicationName); }
EventRestController { @ApiOperation(value = "This API returns all Event Objects present in Elastic Search", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned all Event Objects"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No Event object found") }) @RequestMapping(value = "/api/events/", method = RequestMethod.GET, produces = "application/json") public ResponseEntity<Object> listEvents() { List<EventRecorder> events = Lists.newArrayList(eventService.findAll()); if (events.isEmpty()) { final String error = "No events found !!!"; final MessageWrapper apiError = new MessageWrapper(HttpStatus.NOT_FOUND, error, error); return new ResponseEntity<>(apiError, new HttpHeaders(), apiError.getStatus()); } return new ResponseEntity<>(events, HttpStatus.OK); }  @ApiOperation(value = "This API returns all Event Objects present in Elastic Search", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned all Event Objects"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No Event object found") }) @RequestMapping(value = "/api/events/", method = RequestMethod.GET, produces = "application/json") ResponseEntity<Object> listEvents(); @ApiOperation(value = "This API returns list of all Event objects present in Elastic Search for given team", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned all Application Event for given team"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No Event object found for given team") }) @RequestMapping(value = "/api/events/team/", method = RequestMethod.GET, produces = "application/json") ResponseEntity<Object> listAllEvents(HttpServletRequest request); @ApiOperation(value = "This API returns single Event Objects present in Elastic Search for given Event ID", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned single Event Object for given Event ID"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No Event object found for given Event ID") }) @RequestMapping(value = "/api/events/{id}", method = RequestMethod.GET, produces = "application/json") ResponseEntity<Object> listEvent(HttpServletRequest request, @PathVariable("id") String id); @ApiOperation(value = "This API returns Event Status Objects present in Elastic Search for given Event ID", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned Event Status Object for given Event ID"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No Event Status object found for given Event ID") }) @RequestMapping(value = "/api/events/status/{id}", method = RequestMethod.GET, produces = "application/json") ResponseEntity<Object> getstatusupdateforevent(HttpServletRequest request, @PathVariable("id") String id); @ApiOperation(value = "This API returns count of Event objects available in Elastic Search for given team name", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned count of Event objects for given team name"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "The resource trying to reach is not found") }) @RequestMapping(value = "/api/events/count/", method = RequestMethod.GET, produces = "application/json") ResponseEntity<Object> countByTeamName(HttpServletRequest request); @ApiOperation(value = "This API returns Latest Events per Scenario present in Elastic Search for given App Name", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned Latest Events per Scenario for given App Name"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No Event object found for given App Name") }) @RequestMapping(value = "/api/events/latestevent/{applicationName}", method = RequestMethod.GET, produces = "application/json") ResponseEntity<Object> listLatestEventsByAppName(HttpServletRequest request,
			@PathVariable("applicationName") String applicationName);  }