@Test public void testGetMetricValuesFailureWithException() throws Exception { given(service.getMetricValues(Matchers.anyString(), Matchers.anyInt(), Matchers.anyInt(), Matchers.anyLong())) .willThrow(new GriffinException.ServiceException( "Failed to get metric values", new IOException())); mvc.perform(get(URLHelper.API_VERSION_PATH + "/metrics/values") .param("metricName", "jobName") .param("size", "5")) .andExpect(status().isInternalServerError()); }
@RequestMapping(value = "/metrics/values", method = RequestMethod.GET) public List<MetricValue> getMetricValues(@RequestParam("metricName") String metricName, @RequestParam("size") int size, @RequestParam(value = "offset", defaultValue = "0") int offset, @RequestParam(value = "tmst", defaultValue = "0") long tmst) { return metricService.getMetricValues(metricName, offset, size, tmst); }
MetricController { @RequestMapping(value = "/metrics/values", method = RequestMethod.GET) public List<MetricValue> getMetricValues(@RequestParam("metricName") String metricName, @RequestParam("size") int size, @RequestParam(value = "offset", defaultValue = "0") int offset, @RequestParam(value = "tmst", defaultValue = "0") long tmst) { return metricService.getMetricValues(metricName, offset, size, tmst); } }
MetricController { @RequestMapping(value = "/metrics/values", method = RequestMethod.GET) public List<MetricValue> getMetricValues(@RequestParam("metricName") String metricName, @RequestParam("size") int size, @RequestParam(value = "offset", defaultValue = "0") int offset, @RequestParam(value = "tmst", defaultValue = "0") long tmst) { return metricService.getMetricValues(metricName, offset, size, tmst); }  }
MetricController { @RequestMapping(value = "/metrics/values", method = RequestMethod.GET) public List<MetricValue> getMetricValues(@RequestParam("metricName") String metricName, @RequestParam("size") int size, @RequestParam(value = "offset", defaultValue = "0") int offset, @RequestParam(value = "tmst", defaultValue = "0") long tmst) { return metricService.getMetricValues(metricName, offset, size, tmst); }  @RequestMapping(value = "/metrics", method = RequestMethod.GET) Map<String, List<Metric>> getAllMetrics(); @RequestMapping(value = "/metrics/values", method = RequestMethod.GET) List<MetricValue> getMetricValues(@RequestParam("metricName")
                                                 String metricName,
                                             @RequestParam("size") int size,
                                             @RequestParam(value = "offset",
                                                 defaultValue = "0")
                                                 int offset,
                                             @RequestParam(value = "tmst",
                                                 defaultValue = "0")
                                                 long tmst); @RequestMapping(value = "/metrics/values", method = RequestMethod.POST) ResponseEntity<?> addMetricValues(@RequestBody List<MetricValue>
                                                 values); @RequestMapping(value = "/metrics/values", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.NO_CONTENT) ResponseEntity<?> deleteMetricValues(@RequestParam("metricName")
                                                    String metricName); @RequestMapping(value = "/metrics/values/{instanceId}", method = RequestMethod.GET) MetricValue getMetric(@PathVariable("instanceId") Long id); }
MetricController { @RequestMapping(value = "/metrics/values", method = RequestMethod.GET) public List<MetricValue> getMetricValues(@RequestParam("metricName") String metricName, @RequestParam("size") int size, @RequestParam(value = "offset", defaultValue = "0") int offset, @RequestParam(value = "tmst", defaultValue = "0") long tmst) { return metricService.getMetricValues(metricName, offset, size, tmst); }  @RequestMapping(value = "/metrics", method = RequestMethod.GET) Map<String, List<Metric>> getAllMetrics(); @RequestMapping(value = "/metrics/values", method = RequestMethod.GET) List<MetricValue> getMetricValues(@RequestParam("metricName")
                                                 String metricName,
                                             @RequestParam("size") int size,
                                             @RequestParam(value = "offset",
                                                 defaultValue = "0")
                                                 int offset,
                                             @RequestParam(value = "tmst",
                                                 defaultValue = "0")
                                                 long tmst); @RequestMapping(value = "/metrics/values", method = RequestMethod.POST) ResponseEntity<?> addMetricValues(@RequestBody List<MetricValue>
                                                 values); @RequestMapping(value = "/metrics/values", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.NO_CONTENT) ResponseEntity<?> deleteMetricValues(@RequestParam("metricName")
                                                    String metricName); @RequestMapping(value = "/metrics/values/{instanceId}", method = RequestMethod.GET) MetricValue getMetric(@PathVariable("instanceId") Long id);  }