@Test public void testGetFlowHistoryIfRequestParamsPassed() throws Exception { List<FlowHistory> flowHistories = new ArrayList<FlowHistory>(); try { when(flowController.getFlowHistory(TestFlowMock.FLOW_ID, TestFlowMock.TIME_FROM, TestFlowMock.TIME_TO)) .thenReturn(flowHistories); mockMvc.perform(get("/api/flows/all/history/{flowId}", TestFlowMock.FLOW_ID) .param("timeFrom", TestFlowMock.TIME_TO) .param("timeTo", TestFlowMock.TIME_TO) .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()); assertTrue(true); } catch (Exception exception) { assertTrue(false); } }
@RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId, @RequestParam(name = "timeFrom", required = false) String timeFrom, @RequestParam(name = "timeTo", required = false) String timeTo) { return flowService.getFlowHistory(flowId, timeFrom, timeTo); }
FlowController extends BaseController { @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId, @RequestParam(name = "timeFrom", required = false) String timeFrom, @RequestParam(name = "timeTo", required = false) String timeTo) { return flowService.getFlowHistory(flowId, timeFrom, timeTo); } }
FlowController extends BaseController { @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId, @RequestParam(name = "timeFrom", required = false) String timeFrom, @RequestParam(name = "timeTo", required = false) String timeTo) { return flowService.getFlowHistory(flowId, timeFrom, timeTo); }  }
FlowController extends BaseController { @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId, @RequestParam(name = "timeFrom", required = false) String timeFrom, @RequestParam(name = "timeTo", required = false) String timeTo) { return flowService.getFlowHistory(flowId, timeFrom, timeTo); }  @RequestMapping(value = "/count", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ResponseBody Collection<FlowCount> getFlowCount(); @RequestMapping(value = "/list", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.MENU_FLOWS }) @ResponseBody List<FlowInfo> getFlows(
            @RequestParam(name = "status", required = false) List<String> statuses,
            @RequestParam(name = "controller", required = false) boolean controller); @RequestMapping(value = "/path/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ResponseBody FlowPayload getFlowPath(@PathVariable final String flowId); @RequestMapping(value = "/{flowId}/reroute", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ResponseBody FlowPath rerouteFlow(@PathVariable final String flowId); @RequestMapping(value = "/{flowId}/validate", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ResponseBody String validateFlow(@PathVariable final String flowId); @RequestMapping(value = "/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.MENU_FLOWS }) @ResponseBody FlowInfo getFlowById(@PathVariable final String flowId,
            @RequestParam(name = "controller", required = false) boolean controller); @RequestMapping(value = "/{flowId}/status", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ResponseBody FlowStatus getFlowStatusById(@PathVariable final String flowId); @RequestMapping(method = RequestMethod.PUT) @ResponseStatus(HttpStatus.CREATED) @Permissions(values = { IConstants.Permission.FW_FLOW_CREATE }) @ResponseBody Flow createFlow(@RequestBody final Flow flow); @RequestMapping(value = "/{flowId}", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.CREATED) @Permissions(values = { IConstants.Permission.FW_FLOW_UPDATE }) @ResponseBody Flow updateFlow(@PathVariable("flowId") final String flowId, @RequestBody final Flow flow); @RequestMapping(value = "/{flowId}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_DELETE }) @ResponseBody Flow deleteFlow(@RequestBody final UserInfo userInfo, @PathVariable("flowId") final String flowId); @RequestMapping(value = "/{flowId}/sync", method = RequestMethod.PATCH) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_RESYNC }) @ResponseBody String resyncFlow(@PathVariable final String flowId); @RequestMapping(value = "/status", method = { RequestMethod.GET }) Set<String> getAllStatus(); @Scheduled(fixedDelayString = "${status.cron.time}") void getAllStatusWithCron(); @RequestMapping(value = "/{flowId}/ping", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_PING }) @ResponseBody String flowPing(@PathVariable final String flowId, @RequestBody final Flow flow); @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId,
            @RequestParam(name = "timeFrom", required = false) String timeFrom,
            @RequestParam(name = "timeTo", required = false) String timeTo); @RequestMapping(value = "/connected/devices/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ResponseBody FlowConnectedDevice getFlowConnectedDevice(@PathVariable final String flowId,
            @RequestParam(name = "since", required = false) String timeLastSeen); }
FlowController extends BaseController { @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId, @RequestParam(name = "timeFrom", required = false) String timeFrom, @RequestParam(name = "timeTo", required = false) String timeTo) { return flowService.getFlowHistory(flowId, timeFrom, timeTo); }  @RequestMapping(value = "/count", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ResponseBody Collection<FlowCount> getFlowCount(); @RequestMapping(value = "/list", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.MENU_FLOWS }) @ResponseBody List<FlowInfo> getFlows(
            @RequestParam(name = "status", required = false) List<String> statuses,
            @RequestParam(name = "controller", required = false) boolean controller); @RequestMapping(value = "/path/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ResponseBody FlowPayload getFlowPath(@PathVariable final String flowId); @RequestMapping(value = "/{flowId}/reroute", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ResponseBody FlowPath rerouteFlow(@PathVariable final String flowId); @RequestMapping(value = "/{flowId}/validate", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ResponseBody String validateFlow(@PathVariable final String flowId); @RequestMapping(value = "/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.MENU_FLOWS }) @ResponseBody FlowInfo getFlowById(@PathVariable final String flowId,
            @RequestParam(name = "controller", required = false) boolean controller); @RequestMapping(value = "/{flowId}/status", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ResponseBody FlowStatus getFlowStatusById(@PathVariable final String flowId); @RequestMapping(method = RequestMethod.PUT) @ResponseStatus(HttpStatus.CREATED) @Permissions(values = { IConstants.Permission.FW_FLOW_CREATE }) @ResponseBody Flow createFlow(@RequestBody final Flow flow); @RequestMapping(value = "/{flowId}", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.CREATED) @Permissions(values = { IConstants.Permission.FW_FLOW_UPDATE }) @ResponseBody Flow updateFlow(@PathVariable("flowId") final String flowId, @RequestBody final Flow flow); @RequestMapping(value = "/{flowId}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_DELETE }) @ResponseBody Flow deleteFlow(@RequestBody final UserInfo userInfo, @PathVariable("flowId") final String flowId); @RequestMapping(value = "/{flowId}/sync", method = RequestMethod.PATCH) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_RESYNC }) @ResponseBody String resyncFlow(@PathVariable final String flowId); @RequestMapping(value = "/status", method = { RequestMethod.GET }) Set<String> getAllStatus(); @Scheduled(fixedDelayString = "${status.cron.time}") void getAllStatusWithCron(); @RequestMapping(value = "/{flowId}/ping", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_PING }) @ResponseBody String flowPing(@PathVariable final String flowId, @RequestBody final Flow flow); @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId,
            @RequestParam(name = "timeFrom", required = false) String timeFrom,
            @RequestParam(name = "timeTo", required = false) String timeTo); @RequestMapping(value = "/connected/devices/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ResponseBody FlowConnectedDevice getFlowConnectedDevice(@PathVariable final String flowId,
            @RequestParam(name = "since", required = false) String timeLastSeen);  }